From 7d58238e0635541511448f753acc9a3c1fa1653a Mon Sep 17 00:00:00 2001 From: riolurs Date: Sun, 22 Oct 2023 22:42:10 +0800 Subject: [PATCH] fix: find pkg not work --- component/process/patch.go | 1 - tunnel/tunnel.go | 9 +++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/component/process/patch.go b/component/process/patch.go index c7b9ccf3..c468061f 100644 --- a/component/process/patch.go +++ b/component/process/patch.go @@ -10,6 +10,5 @@ func FindPackageName(metadata *constant.Metadata) (string, error) { if resolver := DefaultPackageNameResolver; resolver != nil { return resolver(metadata) } - return "", ErrPlatformNotSupport } diff --git a/tunnel/tunnel.go b/tunnel/tunnel.go index 5f14c096..bbcf203b 100644 --- a/tunnel/tunnel.go +++ b/tunnel/tunnel.go @@ -5,7 +5,6 @@ import ( "fmt" "net" "net/netip" - "path/filepath" "runtime" "sync" "time" @@ -621,16 +620,14 @@ func match(metadata *C.Metadata) (C.Proxy, C.Rule, error) { } if !findProcessMode.Off() && !processFound && (findProcessMode.Always() || rule.ShouldFindProcess()) { - uid, path, err := P.FindProcessName(metadata.NetWork.String(), metadata.SrcIP, int(metadata.SrcPort)) + pkg, err := P.FindPackageName(metadata) if err != nil { log.Debugln("[Process] find process %s: %v", metadata.String(), err) } else { - metadata.Process = filepath.Base(path) - metadata.ProcessPath = path - metadata.Uid = uid + metadata.Process = pkg processFound = true if procesCache != metadata.Process { - log.Debugln("[Process] %s from process %s", metadata.String(), path) + log.Debugln("[Process] %s from process %s", metadata.String(), metadata.Process) } procesCache = metadata.Process }