diff --git a/tunnel/tunnel.go b/tunnel/tunnel.go index 53617d76..dbe48ee6 100644 --- a/tunnel/tunnel.go +++ b/tunnel/tunnel.go @@ -370,9 +370,6 @@ func match(metadata *C.Metadata) (C.Proxy, C.Rule, error) { resolved = true } - var processUid int32 - process := "" - processPath := "" foundProcess := false for _, rule := range rules { if !resolved && shouldResolveIP(rule, metadata) { @@ -392,19 +389,13 @@ func match(metadata *C.Metadata) (C.Proxy, C.Rule, error) { if err != nil { log.Debugln("[Process] find process %s: %v", metadata.String(), err) } else { - process = filepath.Base(path) - processPath = path - processUid = uid + metadata.Process = filepath.Base(path) + metadata.ProcessPath = path + metadata.Uid = &uid foundProcess = true } } - if foundProcess { - metadata.Uid = &processUid - metadata.Process = process - metadata.ProcessPath = processPath - } - if rule.Match(metadata) { adapter, ok := proxies[rule.Adapter()] if !ok { @@ -421,21 +412,6 @@ func match(metadata *C.Metadata) (C.Proxy, C.Rule, error) { continue } - extra := rule.RuleExtra() - if extra != nil { - if extra.NotMatchNetwork(metadata.NetWork) { - continue - } - - if extra.NotMatchSourceIP(metadata.SrcIP) { - continue - } - - if extra.NotMatchProcessName(metadata.Process) { - continue - } - } - return adapter, rule, nil } }