3x-ui/util/sys/sys_windows.go

25 lines
369 B
Go
Raw Normal View History

2023-02-26 16:59:54 +03:00
//go:build windows
// +build windows
package sys
import (
"github.com/shirou/gopsutil/v3/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
}