|
@@ -0,0 +1,24 @@
|
|
|
+//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
|
|
|
+}
|