mirror of
https://github.com/XTLS/Xray-core.git
synced 2026-09-15 22:10:26 +00:00
Fixes https://github.com/XTLS/Xray-core/pull/6673 --------- Co-authored-by: Kosta <makostadev@xyecoc.com>
36 lines
592 B
Go
36 lines
592 B
Go
package router
|
|
|
|
import (
|
|
sync "sync"
|
|
)
|
|
|
|
type overrideSettings struct {
|
|
target string
|
|
}
|
|
|
|
type override struct {
|
|
access sync.RWMutex
|
|
settings overrideSettings
|
|
}
|
|
|
|
// Get gets the override settings
|
|
func (o *override) Get() string {
|
|
o.access.RLock()
|
|
defer o.access.RUnlock()
|
|
return o.settings.target
|
|
}
|
|
|
|
// Put updates the override settings
|
|
func (o *override) Put(target string) {
|
|
o.access.Lock()
|
|
defer o.access.Unlock()
|
|
o.settings.target = target
|
|
}
|
|
|
|
// Clear clears the override settings
|
|
func (o *override) Clear() {
|
|
o.access.Lock()
|
|
defer o.access.Unlock()
|
|
o.settings.target = ""
|
|
}
|