[skip ci][内容]
1.调整部分代码
This commit is contained in:
parent
29b8076c75
commit
652759a9ae
3 changed files with 11 additions and 17 deletions
|
@ -74,16 +74,14 @@ func ApplyConfig(cfg *config.Config, force bool) {
|
|||
mux.Lock()
|
||||
defer mux.Unlock()
|
||||
|
||||
log.SetLevel(log.INFO)
|
||||
|
||||
updateUsers(cfg.Users)
|
||||
updateHosts(cfg.Hosts)
|
||||
updateGeneral(cfg.General, force)
|
||||
updateProxies(cfg.Proxies, cfg.Providers)
|
||||
updateRules(cfg.Rules, cfg.RuleProviders)
|
||||
updateIPTables(cfg.DNS, cfg.General, cfg.Tun)
|
||||
updateGeneral(cfg.General, force)
|
||||
updateDNS(cfg.DNS, cfg.Tun)
|
||||
updateTun(cfg.Tun)
|
||||
updateIPTables(cfg.DNS, cfg.General, cfg.Tun)
|
||||
updateExperimental(cfg)
|
||||
loadProvider(cfg.RuleProviders, cfg.Providers)
|
||||
updateProfile(cfg)
|
||||
|
@ -93,7 +91,7 @@ func ApplyConfig(cfg *config.Config, force bool) {
|
|||
|
||||
func GetGeneral() *config.General {
|
||||
ports := P.GetPorts()
|
||||
authenticator := []string{}
|
||||
var authenticator []string
|
||||
if auth := authStore.Authenticator(); auth != nil {
|
||||
authenticator = auth.Users()
|
||||
}
|
||||
|
@ -218,20 +216,21 @@ func updateTun(tun *config.Tun) {
|
|||
}
|
||||
|
||||
func updateGeneral(general *config.General, force bool) {
|
||||
log.SetLevel(general.LogLevel)
|
||||
tunnel.SetMode(general.Mode)
|
||||
resolver.DisableIPv6 = !general.IPv6
|
||||
|
||||
adapter.UnifiedDelay.Store(general.UnifiedDelay)
|
||||
|
||||
dialer.DefaultInterface.Store(general.Interface)
|
||||
|
||||
if dialer.DefaultInterface.Load() != "" {
|
||||
log.Infoln("Use interface name: %s", general.Interface)
|
||||
}
|
||||
|
||||
if general.RoutingMark > 0 || (general.RoutingMark == 0 && general.TProxyPort == 0) {
|
||||
dialer.DefaultRoutingMark.Store(int32(general.RoutingMark))
|
||||
if general.RoutingMark > 0 {
|
||||
log.Infoln("Use routing mark: %#x", general.RoutingMark)
|
||||
}
|
||||
dialer.DefaultRoutingMark.Store(int32(general.RoutingMark))
|
||||
if general.RoutingMark > 0 {
|
||||
log.Infoln("Use routing mark: %#x", general.RoutingMark)
|
||||
}
|
||||
|
||||
iface.FlushCache()
|
||||
|
|
|
@ -77,9 +77,6 @@ func NewTCPTracker(conn C.Conn, manager *Manager, metadata *C.Metadata, rule C.R
|
|||
if rule != nil {
|
||||
t.trackerInfo.Rule = rule.RuleType().String()
|
||||
t.trackerInfo.RulePayload = rule.Payload()
|
||||
//if rule.RuleType() == C.GEOSITE || rule.RuleType() == C.GEOIP {
|
||||
// t.trackerInfo.Rule = t.trackerInfo.Rule + " (" + rule.Payload() + ")"
|
||||
//}
|
||||
}
|
||||
|
||||
manager.Join(t)
|
||||
|
@ -137,9 +134,6 @@ func NewUDPTracker(conn C.PacketConn, manager *Manager, metadata *C.Metadata, ru
|
|||
if rule != nil {
|
||||
ut.trackerInfo.Rule = rule.RuleType().String()
|
||||
ut.trackerInfo.RulePayload = rule.Payload()
|
||||
//if rule.RuleType() == C.GEOSITE || rule.RuleType() == C.GEOIP {
|
||||
// ut.trackerInfo.Rule = ut.trackerInfo.Rule + " (" + rule.Payload() + ")"
|
||||
//}
|
||||
}
|
||||
|
||||
manager.Join(ut)
|
||||
|
|
|
@ -28,8 +28,9 @@ var (
|
|||
rules []C.Rule
|
||||
proxies = make(map[string]C.Proxy)
|
||||
providers map[string]provider.ProxyProvider
|
||||
configMux sync.RWMutex
|
||||
ruleProviders map[string]*provider.RuleProvider
|
||||
configMux sync.RWMutex
|
||||
|
||||
// Outbound Rule
|
||||
mode = Rule
|
||||
|
||||
|
|
Loading…
Reference in a new issue