3x-ui/util/sys/sys_darwin.go
civisrom b7c471e8f2 new file: xray/log_writer.go
new file:   xray/process.go
	new file:   xray/traffic.go
2025-02-04 14:38:53 +03:00

24 lines
367 B
Go

//go:build darwin
// +build darwin
package sys
import (
"github.com/shirou/gopsutil/v4/net"
)
func GetTCPCount() (int, error) {
stats, err := net.Connections("tcp")
if err != nil {
return 0, err
}
return len(stats), nil
}
func GetUDPCount() (int, error) {
stats, err := net.Connections("udp")
if err != nil {
return 0, err
}
return len(stats), nil
}