test sing-box 1.3-b12

This commit is contained in:
arm64v8a
2023-05-13 12:35:17 +09:00
parent 0d8a934881
commit 4d3fa1daf8
5 changed files with 12 additions and 35 deletions

View File

@@ -19,6 +19,6 @@ func setupCore() {
// //
neko_log.SetupLog(50*1024, "./neko.log") neko_log.SetupLog(50*1024, "./neko.log")
neko_common.GetProxyHttpClient = func() *http.Client { neko_common.GetProxyHttpClient = func() *http.Client {
return boxapi.GetProxyHttpClient(instance) return boxapi.CreateProxyHttpClient(instance)
} }
} }

View File

@@ -54,11 +54,11 @@ require (
github.com/sagernet/netlink v0.0.0-20220905062125-8043b4a9aa97 // indirect github.com/sagernet/netlink v0.0.0-20220905062125-8043b4a9aa97 // indirect
github.com/sagernet/quic-go v0.0.0-20230202071646-a8c8afb18b32 // indirect github.com/sagernet/quic-go v0.0.0-20230202071646-a8c8afb18b32 // indirect
github.com/sagernet/reality v0.0.0-20230406110435-ee17307e7691 // indirect github.com/sagernet/reality v0.0.0-20230406110435-ee17307e7691 // indirect
github.com/sagernet/sing v0.2.5-0.20230509045155-f60c80c56f21 // indirect github.com/sagernet/sing v0.2.5-0.20230512033628-9be7806bab51 // indirect
github.com/sagernet/sing-dns v0.1.5-0.20230426113254-25d948c44223 // indirect github.com/sagernet/sing-dns v0.1.5-0.20230426113254-25d948c44223 // indirect
github.com/sagernet/sing-mux v0.0.0-20230425130511-b0a6ffd8406f // indirect github.com/sagernet/sing-mux v0.0.0-20230425130511-b0a6ffd8406f // indirect
github.com/sagernet/sing-shadowsocks v0.2.2-0.20230509053848-d83f8fe1194c // indirect github.com/sagernet/sing-shadowsocks v0.2.2-0.20230509053848-d83f8fe1194c // indirect
github.com/sagernet/sing-shadowsocks2 v0.0.0-20230510062121-18b8e5920cb2 // indirect github.com/sagernet/sing-shadowsocks2 v0.0.0-20230512030659-23bb92c1eb97 // indirect
github.com/sagernet/sing-shadowtls v0.1.2-0.20230417103049-4f682e05f19b // indirect github.com/sagernet/sing-shadowtls v0.1.2-0.20230417103049-4f682e05f19b // indirect
github.com/sagernet/sing-tun v0.1.5-0.20230509102026-91df97aee204 // indirect github.com/sagernet/sing-tun v0.1.5-0.20230509102026-91df97aee204 // indirect
github.com/sagernet/sing-vmess v0.1.5-0.20230417103030-8c3070ae3fb3 // indirect github.com/sagernet/sing-vmess v0.1.5-0.20230417103030-8c3070ae3fb3 // indirect

View File

@@ -135,16 +135,16 @@ github.com/sagernet/reality v0.0.0-20230406110435-ee17307e7691 h1:5Th31OC6yj8byL
github.com/sagernet/reality v0.0.0-20230406110435-ee17307e7691/go.mod h1:B8lp4WkQ1PwNnrVMM6KyuFR20pU8jYBD+A4EhJovEXU= 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= github.com/sagernet/sing v0.0.0-20220817130738-ce854cda8522/go.mod h1:QVsS5L/ZA2Q5UhQwLrn0Trw+msNd/NPGEhBKR/ioWiY=
github.com/sagernet/sing v0.1.8/go.mod h1:jt1w2u7lJQFFSGLiRrRIs5YWmx4kAPfWuOejuDW9qMk= github.com/sagernet/sing v0.1.8/go.mod h1:jt1w2u7lJQFFSGLiRrRIs5YWmx4kAPfWuOejuDW9qMk=
github.com/sagernet/sing v0.2.5-0.20230509045155-f60c80c56f21 h1:voT2nOCvukNfRLn9KxQYEYSu9/OZsCqEmD6tEFJAnBw= github.com/sagernet/sing v0.2.5-0.20230512033628-9be7806bab51 h1:ySJuouhl890pBZly51Hkb2mbDnz+qSQCLF5j+4IFHis=
github.com/sagernet/sing v0.2.5-0.20230509045155-f60c80c56f21/go.mod h1:Ta8nHnDLAwqySzKhGoKk4ZIB+vJ3GTKj7UPrWYvM+4w= github.com/sagernet/sing v0.2.5-0.20230512033628-9be7806bab51/go.mod h1:Ta8nHnDLAwqySzKhGoKk4ZIB+vJ3GTKj7UPrWYvM+4w=
github.com/sagernet/sing-dns v0.1.5-0.20230426113254-25d948c44223 h1:L4eMuM07iSHY3UCknFnuFuHoe5clZuF2Xnf2wwA6Lwc= github.com/sagernet/sing-dns v0.1.5-0.20230426113254-25d948c44223 h1:L4eMuM07iSHY3UCknFnuFuHoe5clZuF2Xnf2wwA6Lwc=
github.com/sagernet/sing-dns v0.1.5-0.20230426113254-25d948c44223/go.mod h1:ZKuuqgsHRxDahYrzgSgy4vIAGGuKPlIf4hLcNzYzLkY= github.com/sagernet/sing-dns v0.1.5-0.20230426113254-25d948c44223/go.mod h1:ZKuuqgsHRxDahYrzgSgy4vIAGGuKPlIf4hLcNzYzLkY=
github.com/sagernet/sing-mux v0.0.0-20230425130511-b0a6ffd8406f h1:iEpOTgBTjt0vZJVXMTqYq13XyIu/337TWbq6WZ3CMWc= github.com/sagernet/sing-mux v0.0.0-20230425130511-b0a6ffd8406f h1:iEpOTgBTjt0vZJVXMTqYq13XyIu/337TWbq6WZ3CMWc=
github.com/sagernet/sing-mux v0.0.0-20230425130511-b0a6ffd8406f/go.mod h1:pF+RnLvCAOhECrvauy6LYOpBakJ/vuaF1Wm4lPsWryI= github.com/sagernet/sing-mux v0.0.0-20230425130511-b0a6ffd8406f/go.mod h1:pF+RnLvCAOhECrvauy6LYOpBakJ/vuaF1Wm4lPsWryI=
github.com/sagernet/sing-shadowsocks v0.2.2-0.20230509053848-d83f8fe1194c h1:EiQ+i4gdPpSI8D2YUlOeBZA3R1ZGi0ShSLSXoSd/13A= github.com/sagernet/sing-shadowsocks v0.2.2-0.20230509053848-d83f8fe1194c h1:EiQ+i4gdPpSI8D2YUlOeBZA3R1ZGi0ShSLSXoSd/13A=
github.com/sagernet/sing-shadowsocks v0.2.2-0.20230509053848-d83f8fe1194c/go.mod h1:UJjvQGw0lyYaDGIDvUraL16fwaAEH1WFw1Y6sUcMPog= github.com/sagernet/sing-shadowsocks v0.2.2-0.20230509053848-d83f8fe1194c/go.mod h1:UJjvQGw0lyYaDGIDvUraL16fwaAEH1WFw1Y6sUcMPog=
github.com/sagernet/sing-shadowsocks2 v0.0.0-20230510062121-18b8e5920cb2 h1:ORW4JxNuKAEPtKSGRMS+Qj8tnKqn074FPupLLOrG/UI= github.com/sagernet/sing-shadowsocks2 v0.0.0-20230512030659-23bb92c1eb97 h1:Mc5dbIMFF3ph3JofkBv3loq1qdBLktER+LL0IpoLm5M=
github.com/sagernet/sing-shadowsocks2 v0.0.0-20230510062121-18b8e5920cb2/go.mod h1:i6Eoor37Cy4JKBcelMMFfUVBNjqRYuvcqOBjUI3Zw80= github.com/sagernet/sing-shadowsocks2 v0.0.0-20230512030659-23bb92c1eb97/go.mod h1:i6Eoor37Cy4JKBcelMMFfUVBNjqRYuvcqOBjUI3Zw80=
github.com/sagernet/sing-shadowtls v0.1.2-0.20230417103049-4f682e05f19b h1:ouW/6IDCrxkBe19YSbdCd7buHix7b+UZ6BM4Zz74XF4= github.com/sagernet/sing-shadowtls v0.1.2-0.20230417103049-4f682e05f19b h1:ouW/6IDCrxkBe19YSbdCd7buHix7b+UZ6BM4Zz74XF4=
github.com/sagernet/sing-shadowtls v0.1.2-0.20230417103049-4f682e05f19b/go.mod h1:oG8bPerYI6cZ74KquY3DvA7ynECyrILPBnce6wtBqeI= github.com/sagernet/sing-shadowtls v0.1.2-0.20230417103049-4f682e05f19b/go.mod h1:oG8bPerYI6cZ74KquY3DvA7ynECyrILPBnce6wtBqeI=
github.com/sagernet/sing-tun v0.1.5-0.20230509102026-91df97aee204 h1:V8eGGmvyjRtFDNmarASZGsTyyXz/gc/zStSxW/knc9E= github.com/sagernet/sing-tun v0.1.5-0.20230509102026-91df97aee204 h1:V8eGGmvyjRtFDNmarASZGsTyyXz/gc/zStSxW/knc9E=

View File

@@ -4,6 +4,7 @@ import (
"context" "context"
"errors" "errors"
"fmt" "fmt"
"time"
"grpc_server" "grpc_server"
"grpc_server/gen" "grpc_server/gen"
@@ -15,11 +16,7 @@ import (
"github.com/matsuridayo/sing-box-extra/boxbox" "github.com/matsuridayo/sing-box-extra/boxbox"
"github.com/matsuridayo/sing-box-extra/boxmain" "github.com/matsuridayo/sing-box-extra/boxmain"
"io"
"log" "log"
"reflect"
"time"
"unsafe"
"github.com/sagernet/sing-box/option" "github.com/sagernet/sing-box/option"
) )
@@ -52,12 +49,7 @@ func (s *server) Start(ctx context.Context, in *gen.LoadConfigReq) (out *gen.Err
if instance != nil { if instance != nil {
// Logger // Logger
logFactory_ := reflect.Indirect(reflect.ValueOf(instance)).FieldByName("logFactory") instance.SetLogWritter(neko_log.LogWriter)
logFactory_ = reflect.NewAt(logFactory_.Type(), unsafe.Pointer(logFactory_.UnsafeAddr())).Elem() // get unexported logFactory
logFactory_ = logFactory_.Elem().Elem() // get struct
writer_ := logFactory_.FieldByName("writer")
writer_ = reflect.NewAt(writer_.Type(), unsafe.Pointer(writer_.UnsafeAddr())).Elem() // get unexported io.Writer
writer_.Set(reflect.ValueOf(neko_log.LogWriter))
// V2ray Service // V2ray Service
if in.StatsOutbounds != nil { if in.StatsOutbounds != nil {
instance.Router().SetV2RayServer(boxapi.NewSbV2rayServer(option.V2RayStatsServiceOptions{ instance.Router().SetV2RayServer(boxapi.NewSbV2rayServer(option.V2RayStatsServiceOptions{
@@ -84,23 +76,8 @@ func (s *server) Stop(ctx context.Context, in *gen.EmptyReq) (out *gen.ErrorResp
return return
} }
t := time.NewTimer(time.Second * 2) instance.CloseWithTimeout(instance_cancel, time.Second*2, log.Println)
c := make(chan struct{}, 1)
go func(cancel context.CancelFunc, closer io.Closer) {
cancel()
closer.Close()
c <- struct{}{}
close(c)
}(instance_cancel, instance)
select {
case <-t.C:
log.Println("[Warning] sing-box close takes longer than expected.")
case <-c:
}
t.Stop()
instance = nil instance = nil
return return
@@ -135,7 +112,7 @@ func (s *server) Test(ctx context.Context, in *gen.TestReq) (out *gen.TestResp,
} }
} }
// Latency // Latency
out.Ms, err = speedtest.UrlTest(boxapi.GetProxyHttpClient(i), in.Url, in.Timeout) out.Ms, err = speedtest.UrlTest(boxapi.CreateProxyHttpClient(i), in.Url, in.Timeout)
} else if in.Mode == gen.TestMode_TcpPing { } else if in.Mode == gen.TestMode_TcpPing {
out.Ms, err = speedtest.TcpPing(in.Address, in.Timeout) out.Ms, err = speedtest.TcpPing(in.Address, in.Timeout)
} else { } else {

View File

@@ -1,5 +1,5 @@
if [ ! -z $ENV_NEKORAY ]; then if [ ! -z $ENV_NEKORAY ]; then
export COMMIT_SING_BOX_EXTRA="b80bbaf5c70acb992ba1c9a3d5e165992eefe131" export COMMIT_SING_BOX_EXTRA="d663cfa6b9f721d306ec3972460b61bb2c935685"
export COMMIT_MATSURI_V2RAY="8134d3cc23aa6b8e2a056887addf22d7d22bd969" export COMMIT_MATSURI_V2RAY="8134d3cc23aa6b8e2a056887addf22d7d22bd969"
fi fi