sing-box/experimental/libbox/command_conntrack.go
2025-01-03 18:38:04 +08:00

27 lines
483 B
Go

package libbox
import (
"encoding/binary"
"net"
runtimeDebug "runtime/debug"
"time"
)
func (c *CommandClient) CloseConnections() error {
conn, err := c.directConnect()
if err != nil {
return err
}
defer conn.Close()
return binary.Write(conn, binary.BigEndian, uint8(CommandCloseConnections))
}
func (s *CommandServer) handleCloseConnections(conn net.Conn) error {
tracker.Close()
go func() {
time.Sleep(time.Second)
runtimeDebug.FreeOSMemory()
}()
return nil
}