diff --git a/hub/executor/executor.go b/hub/executor/executor.go index 086bfc72..e261ef9e 100644 --- a/hub/executor/executor.go +++ b/hub/executor/executor.go @@ -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() diff --git a/tunnel/statistic/tracker.go b/tunnel/statistic/tracker.go index 9f231547..1f5f1f9c 100644 --- a/tunnel/statistic/tracker.go +++ b/tunnel/statistic/tracker.go @@ -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) diff --git a/tunnel/tunnel.go b/tunnel/tunnel.go index 643595df..ff303548 100644 --- a/tunnel/tunnel.go +++ b/tunnel/tunnel.go @@ -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