diff --git a/custom/command_client.go b/custom/command_client.go index fbdc8e9..12466ed 100644 --- a/custom/command_client.go +++ b/custom/command_client.go @@ -20,6 +20,10 @@ func (cch *CommandClientHandler) Disconnected(message string) { fmt.Printf("disconnected: %s\n", message) } +func (cch *CommandClientHandler) ClearLog() { + fmt.Println("clear log") +} + func (cch *CommandClientHandler) WriteLog(message string) { fmt.Printf("new log: %s\n", message) } diff --git a/custom/service.go b/custom/service.go index b1e05bd..b677c98 100644 --- a/custom/service.go +++ b/custom/service.go @@ -3,6 +3,7 @@ package main import ( "context" "os" + runtimeDebug "runtime/debug" B "github.com/sagernet/sing-box" "github.com/sagernet/sing-box/common/urltest" @@ -30,6 +31,7 @@ func Setup(basePath string, workingPath string, tempPath string) { } func NewService(options option.Options) (*libbox.BoxService, error) { + runtimeDebug.FreeOSMemory() ctx, cancel := context.WithCancel(context.Background()) ctx = filemanager.WithDefault(ctx, sWorkingPath, sTempPath, sUserID, sGroupID) urlTestHistoryStorage := urltest.NewHistoryStorage() @@ -44,6 +46,7 @@ func NewService(options option.Options) (*libbox.BoxService, error) { cancel() return nil, E.Cause(err, "create service") } + runtimeDebug.FreeOSMemory() service := libbox.NewBoxService( ctx, cancel, diff --git a/go.mod b/go.mod index c72dce3..34b4e9b 100644 --- a/go.mod +++ b/go.mod @@ -52,9 +52,9 @@ require ( github.com/sagernet/bbolt v0.0.0-20231008142710-b2d6e2f20458 // indirect github.com/sagernet/cloudflare-tls v0.0.0-20230829051644-4a68352d0c4a // indirect github.com/sagernet/go-tun2socks v1.16.12-0.20220818015926-16cb67876a61 // indirect - github.com/sagernet/gvisor v0.0.0-20230930141345-5fef6f2e17ab // indirect + github.com/sagernet/gvisor v0.0.0-20230627031050-1ab0276e0dd2 // indirect github.com/sagernet/netlink v0.0.0-20220905062125-8043b4a9aa97 // indirect - github.com/sagernet/quic-go v0.0.0-20231001051131-0fc736a289bb // indirect + github.com/sagernet/quic-go v0.0.0-20230919101909-0cc6c5dcecee // indirect github.com/sagernet/reality v0.0.0-20230406110435-ee17307e7691 // indirect github.com/sagernet/sing-mux v0.1.3 // indirect github.com/sagernet/sing-quic v0.1.2 // indirect diff --git a/go.sum b/go.sum index 0ca962e..44408ad 100644 --- a/go.sum +++ b/go.sum @@ -107,12 +107,12 @@ github.com/sagernet/go-tun2socks v1.16.12-0.20220818015926-16cb67876a61 h1:5+m7c github.com/sagernet/go-tun2socks v1.16.12-0.20220818015926-16cb67876a61/go.mod h1:QUQ4RRHD6hGGHdFMEtR8T2P6GS6R3D/CXKdaYHKKXms= github.com/sagernet/gomobile v0.0.0-20230915142329-c6740b6d2950 h1:hUz/2mJLgi7l2H36JGpDY+jou9FmI6kAm0ZkU+xPpgE= github.com/sagernet/gomobile v0.0.0-20230915142329-c6740b6d2950/go.mod h1:5YE39YkJkCcMsfq1jMKkjsrM2GfBoF9JVWnvU89hmvU= -github.com/sagernet/gvisor v0.0.0-20230930141345-5fef6f2e17ab h1:u+xQoi/Yc6bNUvTfrDD6HhGRybn2lzrhf5vmS+wb4Ho= -github.com/sagernet/gvisor v0.0.0-20230930141345-5fef6f2e17ab/go.mod h1:3akUhSHSVtLuJaYcW5JPepUraBOW06Ibz2HKwaK5rOk= +github.com/sagernet/gvisor v0.0.0-20230627031050-1ab0276e0dd2 h1:dnkKrzapqtAwjTSWt6hdPrARORfoYvuUczynvRLrueo= +github.com/sagernet/gvisor v0.0.0-20230627031050-1ab0276e0dd2/go.mod h1:1JUiV7nGuf++YFm9eWZ8q2lrwHmhcUGzptMl/vL1+LA= github.com/sagernet/netlink v0.0.0-20220905062125-8043b4a9aa97 h1:iL5gZI3uFp0X6EslacyapiRz7LLSJyr4RajF/BhMVyE= github.com/sagernet/netlink v0.0.0-20220905062125-8043b4a9aa97/go.mod h1:xLnfdiJbSp8rNqYEdIW/6eDO4mVoogml14Bh2hSiFpM= -github.com/sagernet/quic-go v0.0.0-20231001051131-0fc736a289bb h1:jlrVCepGBoob4QsPChIbe1j0d/lZSJkyVj2ukX3D4PE= -github.com/sagernet/quic-go v0.0.0-20231001051131-0fc736a289bb/go.mod h1:uJGpmJCOcMQqMlHKc3P1Vz6uygmpz4bPeVIoOhdVQnM= +github.com/sagernet/quic-go v0.0.0-20230919101909-0cc6c5dcecee h1:ykuhl9jCS638N+jw1vC9AvT9bbQn6xRNScP2FWPV9dM= +github.com/sagernet/quic-go v0.0.0-20230919101909-0cc6c5dcecee/go.mod h1:0CfhWwZAeXGYM9+Nkkw1zcQtFHQC8KWjbpeDv7pu8iw= github.com/sagernet/reality v0.0.0-20230406110435-ee17307e7691 h1:5Th31OC6yj8byLGkEnIYp6grlXfo1QYUfiYFGjewIdc= github.com/sagernet/reality v0.0.0-20230406110435-ee17307e7691/go.mod h1:B8lp4WkQ1PwNnrVMM6KyuFR20pU8jYBD+A4EhJovEXU= github.com/sagernet/sing v0.0.0-20220817130738-ce854cda8522/go.mod h1:QVsS5L/ZA2Q5UhQwLrn0Trw+msNd/NPGEhBKR/ioWiY=