fix process code

This commit is contained in:
MetaCubeX
2022-07-24 01:32:22 +08:00
parent dec32da262
commit 9be70f67ca
2 changed files with 11 additions and 32 deletions

View File

@ -15,7 +15,11 @@ const (
proccallnumpidinfo = 0x2
)
func findProcessName(network string, ip netip.Addr, port int) (string, error) {
func resolveSocketByNetlink(network string, ip netip.Addr, srcPort int) (int32, int32, error) {
return 0, 0, ErrPlatformNotSupport
}
func findProcessName(network string, ip netip.Addr, port int) (int32, string, error) {
var spath string
switch network {
case TCP:
@ -23,14 +27,14 @@ func findProcessName(network string, ip netip.Addr, port int) (string, error) {
case UDP:
spath = "net.inet.udp.pcblist_n"
default:
return "", ErrInvalidNetwork
return -1, "", ErrInvalidNetwork
}
isIPv4 := ip.Is4()
value, err := syscall.Sysctl(spath)
if err != nil {
return "", err
return -1, "", err
}
buf := []byte(value)