mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2024-12-22 15:47:59 +08:00
fix: find pkg not work
This commit is contained in:
parent
a883faae9d
commit
7d58238e06
@ -10,6 +10,5 @@ func FindPackageName(metadata *constant.Metadata) (string, error) {
|
||||
if resolver := DefaultPackageNameResolver; resolver != nil {
|
||||
return resolver(metadata)
|
||||
}
|
||||
|
||||
return "", ErrPlatformNotSupport
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user