mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-02-28 13:13:00 +00:00
Compare commits
1 commit
3936b1b4e5
...
8d36d5013b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8d36d5013b |
4 changed files with 2 additions and 11 deletions
5
main.go
5
main.go
|
|
@ -16,7 +16,6 @@ import (
|
|||
"github.com/mhsanaei/3x-ui/v2/logger"
|
||||
"github.com/mhsanaei/3x-ui/v2/sub"
|
||||
"github.com/mhsanaei/3x-ui/v2/util/crypto"
|
||||
"github.com/mhsanaei/3x-ui/v2/util/sys"
|
||||
"github.com/mhsanaei/3x-ui/v2/web"
|
||||
"github.com/mhsanaei/3x-ui/v2/web/global"
|
||||
"github.com/mhsanaei/3x-ui/v2/web/service"
|
||||
|
|
@ -71,7 +70,7 @@ func runWebServer() {
|
|||
|
||||
sigCh := make(chan os.Signal, 1)
|
||||
// Trap shutdown signals
|
||||
signal.Notify(sigCh, syscall.SIGHUP, syscall.SIGTERM, sys.SIGUSR1)
|
||||
signal.Notify(sigCh, syscall.SIGHUP, syscall.SIGTERM, syscall.SIGUSR1)
|
||||
for {
|
||||
sig := <-sigCh
|
||||
|
||||
|
|
@ -109,7 +108,7 @@ func runWebServer() {
|
|||
return
|
||||
}
|
||||
log.Println("Sub server restarted successfully.")
|
||||
case sys.SIGUSR1:
|
||||
case syscall.SIGUSR1:
|
||||
logger.Info("Received USR1 signal, restarting xray-core...")
|
||||
err := server.RestartXray()
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -7,14 +7,11 @@ 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 {
|
||||
|
|
|
|||
|
|
@ -12,11 +12,8 @@ import (
|
|||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
var SIGUSR1 = syscall.SIGUSR1
|
||||
|
||||
func getLinesNum(filename string) (int, error) {
|
||||
file, err := os.Open(filename)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -12,8 +12,6 @@ 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" {
|
||||
|
|
|
|||
Loading…
Reference in a new issue