From 7d84f7d3e0198484badedf765d90862d8cea1c04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Fri, 21 Aug 2026 12:40:57 +0800 Subject: [PATCH] Fix lint errors --- .golangci.yml | 1 + experimental/boxdd/peer_linux.go | 1 - experimental/boxdd/peer_windows.go | 1 - protocol/bridge/backend.go | 2 +- transport/v2raygrpc/client.go | 3 +++ transport/v2raygrpc/tls_credentials.go | 2 -- 6 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 49918915..9196b7db 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -31,6 +31,7 @@ linters: - -QF1008 # could remove embedded field "" from selector - -ST1003 # should not use ALL_CAPS in Go names; use CamelCase instead - -QF1001 # could apply De Morgan's law + - -SA4023 # impossible nil comparison, false positive on platform-specific implementations exclusions: generated: lax presets: diff --git a/experimental/boxdd/peer_linux.go b/experimental/boxdd/peer_linux.go index 10e3822f..f586f321 100644 --- a/experimental/boxdd/peer_linux.go +++ b/experimental/boxdd/peer_linux.go @@ -70,7 +70,6 @@ func (c *linuxTransportCredentials) ServerHandshake(rawConnection net.Conn) (net func (c *linuxTransportCredentials) Info() credentials.ProtocolInfo { return credentials.ProtocolInfo{ SecurityProtocol: "linux-local-process", - SecurityVersion: "1", } } diff --git a/experimental/boxdd/peer_windows.go b/experimental/boxdd/peer_windows.go index 345e2b55..7ccaf167 100644 --- a/experimental/boxdd/peer_windows.go +++ b/experimental/boxdd/peer_windows.go @@ -259,7 +259,6 @@ func (c *windowsTransportCredentials) serverHandshake(rawConnection net.Conn) (n func (c *windowsTransportCredentials) Info() credentials.ProtocolInfo { return credentials.ProtocolInfo{ SecurityProtocol: "windows-local-process", - SecurityVersion: "1", } } diff --git a/protocol/bridge/backend.go b/protocol/bridge/backend.go index 4f0a6277..0c33c753 100644 --- a/protocol/bridge/backend.go +++ b/protocol/bridge/backend.go @@ -83,7 +83,7 @@ func (b *backendBase) AttachReturn(returnPath tun.Return) error { if slices.Contains(b.returnPaths, returnPath) { return nil } - b.returnPaths = append(b.returnPaths[:len(b.returnPaths):len(b.returnPaths)], returnPath) + b.returnPaths = append(slices.Clip(b.returnPaths), returnPath) return nil } diff --git a/transport/v2raygrpc/client.go b/transport/v2raygrpc/client.go index a915e1eb..7c5e87ca 100644 --- a/transport/v2raygrpc/client.go +++ b/transport/v2raygrpc/client.go @@ -40,6 +40,9 @@ func NewClient(ctx context.Context, dialer N.Dialer, serverAddr M.Socksaddr, opt tlsConfig.SetNextProtos([]string{http2.NextProtoTLS}) } dialOptions = append(dialOptions, grpc.WithTransportCredentials(NewTLSTransportCredentials(tlsConfig))) + if tlsConfig.ServerName() != "" { + dialOptions = append(dialOptions, grpc.WithAuthority(tlsConfig.ServerName())) + } } else { dialOptions = append(dialOptions, grpc.WithTransportCredentials(insecure.NewCredentials())) } diff --git a/transport/v2raygrpc/tls_credentials.go b/transport/v2raygrpc/tls_credentials.go index 53a3b7ab..c695ac14 100644 --- a/transport/v2raygrpc/tls_credentials.go +++ b/transport/v2raygrpc/tls_credentials.go @@ -22,8 +22,6 @@ func NewTLSTransportCredentials(config tls.Config) credentials.TransportCredenti func (c *TLSTransportCredentials) Info() credentials.ProtocolInfo { return credentials.ProtocolInfo{ SecurityProtocol: "tls", - SecurityVersion: "1.2", - ServerName: c.config.ServerName(), } }