123456789101112131415161718192021222324 |
- //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
- }
|