fix windows build

This commit is contained in:
Alireza Ahmadi
2026-02-20 02:07:46 +01:00
parent 2b1d3e7347
commit 3ec5b3589f
4 changed files with 11 additions and 2 deletions

View File

@@ -7,11 +7,14 @@ import (
"encoding/binary"
"fmt"
"sync"
"syscall"
"github.com/shirou/gopsutil/v4/net"
"golang.org/x/sys/unix"
)
var SIGUSR1 = syscall.SIGUSR1
func GetTCPCount() (int, error) {
stats, err := net.Connections("tcp")
if err != nil {

View File

@@ -12,8 +12,11 @@ import (
"strconv"
"strings"
"sync"
"syscall"
)
var SIGUSR1 = syscall.SIGUSR1
func getLinesNum(filename string) (int, error) {
file, err := os.Open(filename)
if err != nil {

View File

@@ -12,6 +12,8 @@ import (
"github.com/shirou/gopsutil/v4/net"
)
var SIGUSR1 = syscall.Signal(0)
// GetConnectionCount returns the number of active connections for the specified protocol ("tcp" or "udp").
func GetConnectionCount(proto string) (int, error) {
if proto != "tcp" && proto != "udp" {