Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/MHSanaei/3x-ui.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/util/sys
diff options
context:
space:
mode:
authorMHSanaei <33454419+MHSanaei@users.noreply.github.com>2023-02-26 16:59:54 +0300
committerMHSanaei <33454419+MHSanaei@users.noreply.github.com>2023-02-26 16:59:54 +0300
commit23a2c545f7a237a7536da7d79b53dd3668939e1d (patch)
treef4f6337175b6b1f01d68c20c790b5f80bad57b61 /util/sys
parent3e938deaaecb53d523ad873bde9aff083cf1648c (diff)
tcp-udp count windows (debug)
Diffstat (limited to 'util/sys')
-rw-r--r--util/sys/sys_windows.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/util/sys/sys_windows.go b/util/sys/sys_windows.go
new file mode 100644
index 00000000..ef9cdf54
--- /dev/null
+++ b/util/sys/sys_windows.go
@@ -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
+}