feat: support uid rule

eg. UID,1000/5000-6000,Proxy
This commit is contained in:
adlyq
2022-04-22 16:27:51 +08:00
parent 0cb5270452
commit 3d6aea4c1e
6 changed files with 106 additions and 6 deletions

View File

@ -37,7 +37,6 @@ func findProcessName(network string, ip netip.Addr, srcPort int) (string, error)
if err != nil {
return "", err
}
return resolveProcessNameByProcSearch(inode, uid)
}
@ -108,7 +107,7 @@ func resolveSocketByNetlink(network string, ip netip.Addr, srcPort int) (int32,
return 0, 0, fmt.Errorf("netlink message: NLMSG_ERROR")
}
inode, uid := unpackSocketDiagResponse(&messages[0])
inode, uid := unpackSocketDiagResponse(&message)
if inode < 0 || uid < 0 {
return 0, 0, fmt.Errorf("invalid inode(%d) or uid(%d)", inode, uid)
}