diff --git a/box.go b/box.go index 8a84aae2..790649b3 100644 --- a/box.go +++ b/box.go @@ -44,7 +44,8 @@ func New(ctx context.Context, options option.Options) (*Box, error) { var observableLogFactory log.ObservableFactory var logFile *os.File if logOptions.Disabled { - logFactory = log.NewNOPFactory() + observableLogFactory = log.NewNOPFactory() + logFactory = observableLogFactory } else { var logWriter io.Writer switch logOptions.Output { diff --git a/experimental/clashapi/server.go b/experimental/clashapi/server.go index 46aec394..c333ae68 100644 --- a/experimental/clashapi/server.go +++ b/experimental/clashapi/server.go @@ -3,6 +3,7 @@ package clashapi import ( "bytes" "context" + "errors" "net" "net/http" "strings" @@ -85,7 +86,7 @@ func (s *Server) Start() error { s.logger.Info("restful api listening at ", listener.Addr()) go func() { err = s.httpServer.Serve(listener) - if err != nil && !E.IsClosed(err) { + if err != nil && !errors.Is(err, http.ErrServerClosed) { s.logger.Error("external controller serve error: ", err) } }() @@ -243,6 +244,13 @@ func getLogs(logFactory log.ObservableFactory) func(w http.ResponseWriter, r *ht return } + subscription, done, err := logFactory.Subscribe() + if err != nil { + render.Status(r, http.StatusNoContent) + return + } + defer logFactory.UnSubscribe(subscription) + var wsConn *websocket.Conn if websocket.IsWebSocketUpgrade(r) { var err error @@ -257,14 +265,6 @@ func getLogs(logFactory log.ObservableFactory) func(w http.ResponseWriter, r *ht render.Status(r, http.StatusOK) } - subscription, done, err := logFactory.Subscribe() - if err != nil { - log.Warn(err) - render.Status(r, http.StatusInternalServerError) - return - } - defer logFactory.UnSubscribe(subscription) - buf := &bytes.Buffer{} var logEntry log.Entry for { diff --git a/experimental/clashapi/trafficontroll/tracker.go b/experimental/clashapi/trafficontroll/tracker.go index 9676e128..25778c59 100644 --- a/experimental/clashapi/trafficontroll/tracker.go +++ b/experimental/clashapi/trafficontroll/tracker.go @@ -54,17 +54,17 @@ func (tt *tcpTracker) ID() string { func (tt *tcpTracker) Read(b []byte) (int, error) { n, err := tt.Conn.Read(b) - download := int64(n) - tt.manager.PushDownloaded(download) - tt.DownloadTotal.Add(download) + upload := int64(n) + tt.manager.PushUploaded(upload) + tt.UploadTotal.Add(upload) return n, err } func (tt *tcpTracker) Write(b []byte) (int, error) { n, err := tt.Conn.Write(b) - upload := int64(n) - tt.manager.PushUploaded(upload) - tt.UploadTotal.Add(upload) + download := int64(n) + tt.manager.PushDownloaded(download) + tt.DownloadTotal.Add(download) return n, err } @@ -112,21 +112,21 @@ func (ut *udpTracker) ID() string { func (ut *udpTracker) ReadPacket(buffer *buf.Buffer) (destination M.Socksaddr, err error) { destination, err = ut.PacketConn.ReadPacket(buffer) if err == nil { - download := int64(buffer.Len()) - ut.manager.PushDownloaded(download) - ut.DownloadTotal.Add(download) + upload := int64(buffer.Len()) + ut.manager.PushUploaded(upload) + ut.UploadTotal.Add(upload) } return } func (ut *udpTracker) WritePacket(buffer *buf.Buffer, destination M.Socksaddr) error { - upload := int64(buffer.Len()) + download := int64(buffer.Len()) err := ut.PacketConn.WritePacket(buffer, destination) if err != nil { return err } - ut.manager.PushUploaded(upload) - ut.UploadTotal.Add(upload) + ut.manager.PushDownloaded(download) + ut.DownloadTotal.Add(download) return nil } diff --git a/go.mod b/go.mod index 9398c276..c8876d35 100644 --- a/go.mod +++ b/go.mod @@ -11,10 +11,10 @@ require ( github.com/gorilla/websocket v1.5.0 github.com/logrusorgru/aurora v2.0.3+incompatible github.com/oschwald/maxminddb-golang v1.9.0 - github.com/sagernet/sing v0.0.0-20220718035659-3d74b823ed56 - github.com/sagernet/sing-dns v0.0.0-20220711062726-c64e938e4619 + github.com/sagernet/sing v0.0.0-20220720054545-2af19486bb1f + github.com/sagernet/sing-dns v0.0.0-20220720045209-c44590ebeb0f github.com/sagernet/sing-shadowsocks v0.0.0-20220717063942-45a2ad9cd41f - github.com/sagernet/sing-tun v0.0.0-20220717030718-f53aabff275f + github.com/sagernet/sing-tun v0.0.0-20220720051454-d35c334b46c9 github.com/sagernet/sing-vmess v0.0.0-20220718031323-07c377156e4a github.com/spf13/cobra v1.5.0 github.com/stretchr/testify v1.8.0 diff --git a/go.sum b/go.sum index 856940c6..1d4e68ab 100644 --- a/go.sum +++ b/go.sum @@ -35,14 +35,14 @@ github.com/oschwald/maxminddb-golang v1.9.0/go.mod h1:TK+s/Z2oZq0rSl4PSeAEoP0bgm github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/sagernet/sing v0.0.0-20220718035659-3d74b823ed56 h1:r6FHrtIE3dG9c6zl487QjxPFgADq/C0AiDwhpAZFKUw= -github.com/sagernet/sing v0.0.0-20220718035659-3d74b823ed56/go.mod h1:GbtQfZSpmtD3cXeD1qX2LCMwY8dH+bnnInDTqd92IsM= -github.com/sagernet/sing-dns v0.0.0-20220711062726-c64e938e4619 h1:oHbOmq1WS0XaZmXp6WpxzyB2xeyRIA1/L8EJKuNntfY= -github.com/sagernet/sing-dns v0.0.0-20220711062726-c64e938e4619/go.mod h1:y2fpvoxukw3G7eApIZwkcpcG/NE4AB8pCQI0Qd8rMqk= +github.com/sagernet/sing v0.0.0-20220720054545-2af19486bb1f h1:eMaEhzlP5jFCd6xvLkeb8vMayLSuAPy446QSCZgdSGg= +github.com/sagernet/sing v0.0.0-20220720054545-2af19486bb1f/go.mod h1:GbtQfZSpmtD3cXeD1qX2LCMwY8dH+bnnInDTqd92IsM= +github.com/sagernet/sing-dns v0.0.0-20220720045209-c44590ebeb0f h1:PCrkSLS+fQtBimPi/2WzjJqeTy0zJtBDaMLykyTAiwQ= +github.com/sagernet/sing-dns v0.0.0-20220720045209-c44590ebeb0f/go.mod h1:y2fpvoxukw3G7eApIZwkcpcG/NE4AB8pCQI0Qd8rMqk= github.com/sagernet/sing-shadowsocks v0.0.0-20220717063942-45a2ad9cd41f h1:F6yiuKbBoXgWiuoP7R0YA14pDEl3emxA1mL7M16Q7gc= github.com/sagernet/sing-shadowsocks v0.0.0-20220717063942-45a2ad9cd41f/go.mod h1:cDrLwa3zwY8AaW6a4sjipn4xgdIr3CT8TPqSW6iFOi0= -github.com/sagernet/sing-tun v0.0.0-20220717030718-f53aabff275f h1:o3YN4sFC7lQznAwutagPqBb23hal7MkgVq/VEvd7Vug= -github.com/sagernet/sing-tun v0.0.0-20220717030718-f53aabff275f/go.mod h1:p7QbUBs2ejf6UQsiHyy1xGAWOk9JWQjZTHy8pOmkWmo= +github.com/sagernet/sing-tun v0.0.0-20220720051454-d35c334b46c9 h1:kzEyWi2iJcq1oNeCCRrJ1Oh/ogbHR0CZRZ/HMxzy+mo= +github.com/sagernet/sing-tun v0.0.0-20220720051454-d35c334b46c9/go.mod h1:p7QbUBs2ejf6UQsiHyy1xGAWOk9JWQjZTHy8pOmkWmo= github.com/sagernet/sing-vmess v0.0.0-20220718031323-07c377156e4a h1:durFxTP1xsOMeDt8x0AV/9BXAPa8uMQRKzPaVkGSOS0= github.com/sagernet/sing-vmess v0.0.0-20220718031323-07c377156e4a/go.mod h1:VjqeHNWtDVoExWInXB7QsCeMp5RozlnJhMgfbW/n4I0= github.com/spf13/cobra v1.5.0 h1:X+jTBEBqF0bHN+9cSMgmfuvv2VHJ9ezmFNf9Y/XstYU= diff --git a/inbound/default.go b/inbound/default.go index 06808dfa..f8cf8363 100644 --- a/inbound/default.go +++ b/inbound/default.go @@ -324,7 +324,7 @@ func (a *myInboundAdapter) NewError(ctx context.Context, err error) { func NewError(logger log.ContextLogger, ctx context.Context, err error) { common.Close(err) - if E.IsClosed(err) || E.IsCanceled(err) { + if E.IsClosedOrCanceled(err) { logger.DebugContext(ctx, "connection closed") return } diff --git a/inbound/tun.go b/inbound/tun.go index 8a9942d6..acb57281 100644 --- a/inbound/tun.go +++ b/inbound/tun.go @@ -116,7 +116,11 @@ func (t *Tun) NewConnection(ctx context.Context, conn net.Conn, upstreamMetadata } t.logger.InfoContext(ctx, "inbound connection from ", metadata.Source) t.logger.InfoContext(ctx, "inbound connection to ", metadata.Destination) - return t.router.RouteConnection(ctx, conn, metadata) + err := t.router.RouteConnection(ctx, conn, metadata) + if err != nil { + t.NewError(ctx, err) + } + return err } func (t *Tun) NewPacketConnection(ctx context.Context, conn N.PacketConn, upstreamMetadata M.Metadata) error { @@ -137,7 +141,11 @@ func (t *Tun) NewPacketConnection(ctx context.Context, conn N.PacketConn, upstre } t.logger.InfoContext(ctx, "inbound packet connection from ", metadata.Source) t.logger.InfoContext(ctx, "inbound packet connection to ", metadata.Destination) - return t.router.RoutePacketConnection(ctx, conn, metadata) + err := t.router.RoutePacketConnection(ctx, conn, metadata) + if err != nil { + t.NewError(ctx, err) + } + return err } func (t *Tun) NewError(ctx context.Context, err error) { diff --git a/log/format.go b/log/format.go index 1c2420bd..ef69d821 100644 --- a/log/format.go +++ b/log/format.go @@ -75,7 +75,7 @@ func (f Formatter) Format(ctx context.Context, level Level, tag string, message default: message = levelString + "[" + xd(int(timestamp.Sub(f.BaseTime)/time.Second), 4) + "] " + message } - return message + return message + "\n" } func (f Formatter) FormatWithSimple(ctx context.Context, level Level, tag string, message string, timestamp time.Time) (string, string) { @@ -126,6 +126,8 @@ func (f Formatter) FormatWithSimple(ctx context.Context, level Level, tag string } else { message = F.ToString("[", id, "] ", message) } + messageSimple = F.ToString("[", id, "] ", messageSimple) + } switch { case f.DisableTimestamp: @@ -135,7 +137,7 @@ func (f Formatter) FormatWithSimple(ctx context.Context, level Level, tag string default: message = levelString + "[" + xd(int(timestamp.Sub(f.BaseTime)/time.Second), 4) + "] " + message } - return message, messageSimple + return message + "\n", messageSimple } func xd(value int, x int) string { diff --git a/log/nop.go b/log/nop.go index 3a39a315..a189e0fb 100644 --- a/log/nop.go +++ b/log/nop.go @@ -1,12 +1,17 @@ package log -import "context" +import ( + "context" + "os" -var _ Factory = (*nopFactory)(nil) + "github.com/sagernet/sing/common/observable" +) + +var _ ObservableFactory = (*nopFactory)(nil) type nopFactory struct{} -func NewNOPFactory() Factory { +func NewNOPFactory() ObservableFactory { return (*nopFactory)(nil) } @@ -66,3 +71,10 @@ func (f *nopFactory) FatalContext(ctx context.Context, args ...any) { func (f *nopFactory) PanicContext(ctx context.Context, args ...any) { } + +func (f *nopFactory) Subscribe() (subscription observable.Subscription[Entry], done <-chan struct{}, err error) { + return nil, nil, os.ErrInvalid +} + +func (f *nopFactory) UnSubscribe(subscription observable.Subscription[Entry]) { +} diff --git a/log/observable.go b/log/observable.go index f0379fd5..1a231521 100644 --- a/log/observable.go +++ b/log/observable.go @@ -71,7 +71,6 @@ func (l *observableLogger) Log(ctx context.Context, level Level, args []any) { panic(message) } l.writer.Write([]byte(message)) - l.writer.Write([]byte{'\n'}) if level == LevelFatal { os.Exit(1) } diff --git a/route/rule.go b/route/rule.go index 203c2567..55970b9c 100644 --- a/route/rule.go +++ b/route/rule.go @@ -92,7 +92,7 @@ func NewDefaultRule(router adapter.Router, logger log.ContextLogger, options opt rule.allItems = append(rule.allItems, item) } if len(options.Protocol) > 0 { - item := NewUserItem(options.Protocol) + item := NewProtocolItem(options.Protocol) rule.items = append(rule.items, item) rule.allItems = append(rule.allItems, item) } diff --git a/route/rule_dns.go b/route/rule_dns.go index 7cd22384..6a7e5f3d 100644 --- a/route/rule_dns.go +++ b/route/rule_dns.go @@ -76,7 +76,7 @@ func NewDefaultDNSRule(router adapter.Router, logger log.ContextLogger, options rule.allItems = append(rule.allItems, item) } if len(options.Protocol) > 0 { - item := NewUserItem(options.Protocol) + item := NewProtocolItem(options.Protocol) rule.items = append(rule.items, item) rule.allItems = append(rule.allItems, item) } diff --git a/test/go.mod b/test/go.mod index d56292e2..75d70029 100644 --- a/test/go.mod +++ b/test/go.mod @@ -10,7 +10,7 @@ require ( github.com/docker/docker v20.10.17+incompatible github.com/docker/go-connections v0.4.0 github.com/gofrs/uuid v4.2.0+incompatible - github.com/sagernet/sing v0.0.0-20220718035659-3d74b823ed56 + github.com/sagernet/sing v0.0.0-20220720054545-2af19486bb1f github.com/spyzhov/ajson v0.7.1 github.com/stretchr/testify v1.8.0 golang.org/x/net v0.0.0-20220708220712-1185a9018129 @@ -39,9 +39,9 @@ require ( github.com/oschwald/maxminddb-golang v1.9.0 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/sagernet/sing-dns v0.0.0-20220711062726-c64e938e4619 // indirect + github.com/sagernet/sing-dns v0.0.0-20220720045209-c44590ebeb0f // indirect github.com/sagernet/sing-shadowsocks v0.0.0-20220717063942-45a2ad9cd41f // indirect - github.com/sagernet/sing-tun v0.0.0-20220717030718-f53aabff275f // indirect + github.com/sagernet/sing-tun v0.0.0-20220720051454-d35c334b46c9 // indirect github.com/sagernet/sing-vmess v0.0.0-20220718031323-07c377156e4a // indirect github.com/sirupsen/logrus v1.8.1 // indirect github.com/vishvananda/netlink v1.1.0 // indirect diff --git a/test/go.sum b/test/go.sum index dbfe2620..06a87cc1 100644 --- a/test/go.sum +++ b/test/go.sum @@ -62,14 +62,14 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/sagernet/sing v0.0.0-20220718035659-3d74b823ed56 h1:r6FHrtIE3dG9c6zl487QjxPFgADq/C0AiDwhpAZFKUw= -github.com/sagernet/sing v0.0.0-20220718035659-3d74b823ed56/go.mod h1:GbtQfZSpmtD3cXeD1qX2LCMwY8dH+bnnInDTqd92IsM= -github.com/sagernet/sing-dns v0.0.0-20220711062726-c64e938e4619 h1:oHbOmq1WS0XaZmXp6WpxzyB2xeyRIA1/L8EJKuNntfY= -github.com/sagernet/sing-dns v0.0.0-20220711062726-c64e938e4619/go.mod h1:y2fpvoxukw3G7eApIZwkcpcG/NE4AB8pCQI0Qd8rMqk= +github.com/sagernet/sing v0.0.0-20220720054545-2af19486bb1f h1:eMaEhzlP5jFCd6xvLkeb8vMayLSuAPy446QSCZgdSGg= +github.com/sagernet/sing v0.0.0-20220720054545-2af19486bb1f/go.mod h1:GbtQfZSpmtD3cXeD1qX2LCMwY8dH+bnnInDTqd92IsM= +github.com/sagernet/sing-dns v0.0.0-20220720045209-c44590ebeb0f h1:PCrkSLS+fQtBimPi/2WzjJqeTy0zJtBDaMLykyTAiwQ= +github.com/sagernet/sing-dns v0.0.0-20220720045209-c44590ebeb0f/go.mod h1:y2fpvoxukw3G7eApIZwkcpcG/NE4AB8pCQI0Qd8rMqk= github.com/sagernet/sing-shadowsocks v0.0.0-20220717063942-45a2ad9cd41f h1:F6yiuKbBoXgWiuoP7R0YA14pDEl3emxA1mL7M16Q7gc= github.com/sagernet/sing-shadowsocks v0.0.0-20220717063942-45a2ad9cd41f/go.mod h1:cDrLwa3zwY8AaW6a4sjipn4xgdIr3CT8TPqSW6iFOi0= -github.com/sagernet/sing-tun v0.0.0-20220717030718-f53aabff275f h1:o3YN4sFC7lQznAwutagPqBb23hal7MkgVq/VEvd7Vug= -github.com/sagernet/sing-tun v0.0.0-20220717030718-f53aabff275f/go.mod h1:p7QbUBs2ejf6UQsiHyy1xGAWOk9JWQjZTHy8pOmkWmo= +github.com/sagernet/sing-tun v0.0.0-20220720051454-d35c334b46c9 h1:kzEyWi2iJcq1oNeCCRrJ1Oh/ogbHR0CZRZ/HMxzy+mo= +github.com/sagernet/sing-tun v0.0.0-20220720051454-d35c334b46c9/go.mod h1:p7QbUBs2ejf6UQsiHyy1xGAWOk9JWQjZTHy8pOmkWmo= github.com/sagernet/sing-vmess v0.0.0-20220718031323-07c377156e4a h1:durFxTP1xsOMeDt8x0AV/9BXAPa8uMQRKzPaVkGSOS0= github.com/sagernet/sing-vmess v0.0.0-20220718031323-07c377156e4a/go.mod h1:VjqeHNWtDVoExWInXB7QsCeMp5RozlnJhMgfbW/n4I0= github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= diff --git a/test/shadowsocks_test.go b/test/shadowsocks_test.go index 08ee5c36..e6f9538c 100644 --- a/test/shadowsocks_test.go +++ b/test/shadowsocks_test.go @@ -13,8 +13,13 @@ import ( "github.com/stretchr/testify/require" ) +const ( + serverPort uint16 = 10000 + iota + clientPort + testPort +) + func TestShadowsocks(t *testing.T) { - t.Parallel() for _, method := range []string{ "aes-128-gcm", "aes-256-gcm", @@ -33,7 +38,6 @@ func TestShadowsocks(t *testing.T) { } func TestShadowsocks2022(t *testing.T) { - t.Parallel() for _, method16 := range []string{ "2022-blake3-aes-128-gcm", } { @@ -64,10 +68,6 @@ func TestShadowsocks2022(t *testing.T) { } func testShadowsocksInboundWithShadowsocksRust(t *testing.T, method string, password string) { - t.Parallel() - serverPort := mkPort(t) - clientPort := mkPort(t) - testPort := mkPort(t) startDockerContainer(t, DockerOptions{ Image: ImageShadowsocksRustClient, EntryPoint: "sslocal", @@ -96,10 +96,6 @@ func testShadowsocksInboundWithShadowsocksRust(t *testing.T, method string, pass } func testShadowsocksOutboundWithShadowsocksRust(t *testing.T, method string, password string) { - t.Parallel() - serverPort := mkPort(t) - clientPort := mkPort(t) - testPort := mkPort(t) startDockerContainer(t, DockerOptions{ Image: ImageShadowsocksRustServer, EntryPoint: "ssserver", @@ -139,10 +135,6 @@ func testShadowsocksOutboundWithShadowsocksRust(t *testing.T, method string, pas } func testShadowsocksSelf(t *testing.T, method string, password string) { - t.Parallel() - serverPort := mkPort(t) - clientPort := mkPort(t) - testPort := mkPort(t) startInstance(t, option.Options{ Log: &option.LogOptions{ Level: "error", diff --git a/test/vmess_test.go b/test/vmess_test.go index 3e26fbc4..00ee69ca 100644 --- a/test/vmess_test.go +++ b/test/vmess_test.go @@ -14,7 +14,6 @@ import ( ) func TestVMess(t *testing.T) { - t.Parallel() for _, security := range []string{ "zero", } { @@ -32,7 +31,6 @@ func TestVMess(t *testing.T) { } func testVMess0(t *testing.T, security string) { - t.Parallel() user, err := uuid.DefaultGenerator.NewV4() require.NoError(t, err) t.Run("self", func(t *testing.T) { @@ -56,7 +54,6 @@ func testVMess0(t *testing.T, security string) { } func testVMess1(t *testing.T, security string) { - t.Parallel() user, err := uuid.DefaultGenerator.NewV4() require.NoError(t, err) t.Run("self", func(t *testing.T) { @@ -104,17 +101,11 @@ func testVMess1(t *testing.T, security string) { } func testVMessInboundWithV2Ray(t *testing.T, security string, uuid uuid.UUID, authenticatedLength bool) { - t.Parallel() - content, err := os.ReadFile("config/vmess-client.json") require.NoError(t, err) config, err := ajson.Unmarshal(content) require.NoError(t, err) - serverPort := mkPort(t) - clientPort := mkPort(t) - testPort := mkPort(t) - config.MustKey("inbounds").MustIndex(0).MustKey("port").SetNumeric(float64(clientPort)) outbound := config.MustKey("outbounds").MustIndex(0).MustKey("settings").MustKey("vnext").MustIndex(0) outbound.MustKey("port").SetNumeric(float64(serverPort)) @@ -165,17 +156,11 @@ func testVMessInboundWithV2Ray(t *testing.T, security string, uuid uuid.UUID, au } func testVMessOutboundWithV2Ray(t *testing.T, security string, uuid uuid.UUID, globalPadding bool, authenticatedLength bool, alterId int) { - t.Parallel() - content, err := os.ReadFile("config/vmess-server.json") require.NoError(t, err) config, err := ajson.Unmarshal(content) require.NoError(t, err) - serverPort := mkPort(t) - clientPort := mkPort(t) - testPort := mkPort(t) - inbound := config.MustKey("inbounds").MustIndex(0) inbound.MustKey("port").SetNumeric(float64(serverPort)) inbound.MustKey("settings").MustKey("clients").MustIndex(0).MustKey("id").SetString(uuid.String()) @@ -228,10 +213,6 @@ func testVMessOutboundWithV2Ray(t *testing.T, security string, uuid uuid.UUID, g } func testVMessSelf(t *testing.T, security string, uuid uuid.UUID, globalPadding bool, authenticatedLength bool) { - t.Parallel() - serverPort := mkPort(t) - clientPort := mkPort(t) - testPort := mkPort(t) startInstance(t, option.Options{ Log: &option.LogOptions{ Level: "error",