From 652759a9aeabe3b76ec0c31abdd52e30465ab912 Mon Sep 17 00:00:00 2001 From: gVisor bot Date: Sun, 20 Mar 2022 02:39:48 +0800 Subject: [PATCH] =?UTF-8?q?[skip=20ci][=E5=86=85=E5=AE=B9]=201.=E8=B0=83?= =?UTF-8?q?=E6=95=B4=E9=83=A8=E5=88=86=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hub/executor/executor.go | 19 +++++++++---------- tunnel/statistic/tracker.go | 6 ------ tunnel/tunnel.go | 3 ++- 3 files changed, 11 insertions(+), 17 deletions(-) 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