mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-04-22 02:42:49 -04:00
Fixing all the lint errors (#3288)
* Fixing all the lint errors! * update lint settings
This commit is contained in:
parent
efec9ea0dc
commit
442581d897
3
.github/linters/.golangci.yml
vendored
3
.github/linters/.golangci.yml
vendored
@ -32,15 +32,12 @@ linters:
|
||||
- revive
|
||||
- rowserrcheck
|
||||
- staticcheck
|
||||
- structcheck
|
||||
- stylecheck
|
||||
- typecheck
|
||||
- unconvert
|
||||
- unparam
|
||||
- varcheck
|
||||
- whitespace
|
||||
disable:
|
||||
- deadcode
|
||||
- errcheck
|
||||
- unused
|
||||
|
||||
|
@ -4,7 +4,6 @@ package commander
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/v2fly/v2ray-core/v5/features"
|
||||
"net"
|
||||
"sync"
|
||||
|
||||
@ -14,6 +13,7 @@ import (
|
||||
"github.com/v2fly/v2ray-core/v5/common"
|
||||
"github.com/v2fly/v2ray-core/v5/common/serial"
|
||||
"github.com/v2fly/v2ray-core/v5/common/signal/done"
|
||||
"github.com/v2fly/v2ray-core/v5/features"
|
||||
"github.com/v2fly/v2ray-core/v5/features/outbound"
|
||||
"github.com/v2fly/v2ray-core/v5/infra/conf/v5cfg"
|
||||
)
|
||||
|
@ -38,7 +38,6 @@ func newWebCommander(ctx context.Context, config *Config) (*WebCommander, error)
|
||||
}
|
||||
|
||||
return &WebCommander{ctx: ctx, config: config, webRootfs: webRootfs}, nil
|
||||
|
||||
}
|
||||
|
||||
type WebCommander struct {
|
||||
@ -56,9 +55,9 @@ type WebCommander struct {
|
||||
}
|
||||
|
||||
func (w *WebCommander) ServeHTTP(writer http.ResponseWriter, request *http.Request) {
|
||||
api_path := w.config.ApiMountpoint
|
||||
if strings.HasPrefix(request.URL.Path, api_path) {
|
||||
request.URL.Path = strings.TrimPrefix(request.URL.Path, api_path)
|
||||
apiPath := w.config.ApiMountpoint
|
||||
if strings.HasPrefix(request.URL.Path, apiPath) {
|
||||
request.URL.Path = strings.TrimPrefix(request.URL.Path, apiPath)
|
||||
if w.wrappedGrpc.IsGrpcWebRequest(request) {
|
||||
w.wrappedGrpc.ServeHTTP(writer, request)
|
||||
return
|
||||
@ -109,7 +108,6 @@ func (w *WebCommander) Type() interface{} {
|
||||
}
|
||||
|
||||
func (w *WebCommander) Start() error {
|
||||
|
||||
if err := core.RequireFeatures(w.ctx, func(cm commander.CommanderIfce, om outbound.Manager) {
|
||||
w.Lock()
|
||||
defer w.Unlock()
|
||||
@ -118,7 +116,6 @@ func (w *WebCommander) Start() error {
|
||||
w.ohm = om
|
||||
|
||||
go w.asyncStart()
|
||||
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ func Test_parseResponse(t *testing.T) {
|
||||
got.Expire = time.Time{}
|
||||
}
|
||||
if cmp.Diff(got, tt.want) != "" {
|
||||
t.Errorf(cmp.Diff(got, tt.want))
|
||||
t.Errorf("%v", cmp.Diff(got, tt.want))
|
||||
// t.Errorf("handleResponse() = %#v, want %#v", got, tt.want)
|
||||
}
|
||||
})
|
||||
|
@ -97,7 +97,6 @@ func TestServiceSubscribeRoutingStats(t *testing.T) {
|
||||
grpc.WithContextDialer(bufDialer),
|
||||
grpc.WithTransportCredentials(insecure.NewCredentials()),
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
errCh <- err
|
||||
return
|
||||
|
@ -3,10 +3,11 @@ package urlline
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"github.com/v2fly/v2ray-core/v5/app/subscription/containers"
|
||||
"github.com/v2fly/v2ray-core/v5/common"
|
||||
"net/url"
|
||||
"strings"
|
||||
|
||||
"github.com/v2fly/v2ray-core/v5/app/subscription/containers"
|
||||
"github.com/v2fly/v2ray-core/v5/common"
|
||||
)
|
||||
|
||||
func newURLLineParser() containers.SubscriptionContainerDocumentParser {
|
||||
|
@ -77,7 +77,7 @@ type materializedServer struct {
|
||||
serverConfig *specs.SubscriptionServerConfig
|
||||
}
|
||||
|
||||
func (s *trackedSubscription) fillStatus(status *subscription.TrackedSubscriptionStatus) error {
|
||||
func (s *trackedSubscription) fillStatus(status *subscription.TrackedSubscriptionStatus) error { //nolint: unparam
|
||||
status.ImportSource = s.importSource
|
||||
if s.currentDocument == nil {
|
||||
return nil
|
||||
|
@ -2,10 +2,10 @@ package packetaddr
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"github.com/v2fly/v2ray-core/v5/common/errors"
|
||||
gonet "net"
|
||||
|
||||
"github.com/v2fly/v2ray-core/v5/common/buf"
|
||||
"github.com/v2fly/v2ray-core/v5/common/errors"
|
||||
"github.com/v2fly/v2ray-core/v5/common/net"
|
||||
"github.com/v2fly/v2ray-core/v5/common/protocol"
|
||||
)
|
||||
|
@ -57,7 +57,7 @@ func TestWrongErrorCheckOnOSStat(t *testing.T) {
|
||||
// be discovered by the Go runtime, which will lead to failure to
|
||||
// find & read geoip & geosite files.
|
||||
// The correct code is `errors.Is(err, fs.ErrNotExist)`
|
||||
if _, err := os.Stat(p); err != nil && errors.Is(fs.ErrNotExist, err) {
|
||||
if _, err := os.Stat(p); err != nil && errors.Is(fs.ErrNotExist, err) { //nolint: staticcheck
|
||||
continue
|
||||
}
|
||||
// asset found
|
||||
|
@ -147,19 +147,20 @@ type Hy2ConfigCongestion struct {
|
||||
type Hy2Config struct {
|
||||
Password string `json:"password"`
|
||||
Congestion Hy2ConfigCongestion `json:"congestion"`
|
||||
UseUdpExtension bool `json:"use_udp_extension"`
|
||||
UseUDPExtension bool `json:"use_udp_extension"`
|
||||
IgnoreClientBandwidth bool `json:"ignore_client_bandwidth"`
|
||||
}
|
||||
|
||||
// Build implements Buildable.
|
||||
func (c *Hy2Config) Build() (proto.Message, error) {
|
||||
return &hysteria2.Config{Password: c.Password,
|
||||
return &hysteria2.Config{
|
||||
Password: c.Password,
|
||||
Congestion: &hysteria2.Congestion{
|
||||
Type: c.Congestion.Type,
|
||||
DownMbps: c.Congestion.DownMbps,
|
||||
UpMbps: c.Congestion.UpMbps,
|
||||
},
|
||||
UseUdpExtension: c.UseUdpExtension,
|
||||
UseUdpExtension: c.UseUDPExtension,
|
||||
IgnoreClientBandwidth: c.IgnoreClientBandwidth,
|
||||
}, nil
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ Command "%s" not found.
|
||||
Make sure that %s is in your system path or current path.
|
||||
Download %s v%s or later from https://github.com/protocolbuffers/protobuf/releases
|
||||
`, protoc, protoc, protoc, targetedVersion)
|
||||
return "", fmt.Errorf(errStr)
|
||||
return "", fmt.Errorf("%v", errStr)
|
||||
}
|
||||
return path, nil
|
||||
}
|
||||
@ -124,7 +124,7 @@ func getInstalledProtocVersion(protocPath string) (string, error) {
|
||||
matched := versionRegexp.FindStringSubmatch(string(output))
|
||||
installedVersion := ""
|
||||
if len(matched) == 0 {
|
||||
return "", errors.New("Can not parse protoc version.")
|
||||
return "", errors.New("can not parse protoc version")
|
||||
}
|
||||
|
||||
if len(matched) == 2 {
|
||||
|
@ -119,7 +119,7 @@ func executeConvert(cmd *base.Command, args []string) {
|
||||
r := bytes.NewReader(data)
|
||||
pbConfig, err := core.LoadConfig(inputFormat, r)
|
||||
if err != nil {
|
||||
base.Fatalf(err.Error())
|
||||
base.Fatalf("%v", err.Error())
|
||||
}
|
||||
out, err = proto.Marshal(pbConfig)
|
||||
if err != nil {
|
||||
@ -133,12 +133,12 @@ func executeConvert(cmd *base.Command, args []string) {
|
||||
r := bytes.NewReader(data)
|
||||
pbConfig, err := core.LoadConfig(inputFormat, r)
|
||||
if err != nil {
|
||||
base.Fatalf(err.Error())
|
||||
base.Fatalf("%v", err.Error())
|
||||
}
|
||||
w := bytes.NewBuffer(nil)
|
||||
err = jsonpb.DumpJSONPb(pbConfig, w)
|
||||
if err != nil {
|
||||
base.Fatalf(err.Error())
|
||||
base.Fatalf("%v", err.Error())
|
||||
}
|
||||
out = w.Bytes()
|
||||
case v2jsonpb.FormatProtobufV2JSONPB:
|
||||
@ -149,11 +149,11 @@ func executeConvert(cmd *base.Command, args []string) {
|
||||
r := bytes.NewReader(data)
|
||||
pbConfig, err := core.LoadConfig(inputFormat, r)
|
||||
if err != nil {
|
||||
base.Fatalf(err.Error())
|
||||
base.Fatalf("%v", err.Error())
|
||||
}
|
||||
out, err = v2jsonpb.DumpV2JsonPb(pbConfig)
|
||||
if err != nil {
|
||||
base.Fatalf(err.Error())
|
||||
base.Fatalf("%v", err.Error())
|
||||
}
|
||||
default:
|
||||
base.Errorf("invalid output format: %s", outputFormat)
|
||||
|
@ -166,7 +166,7 @@ func readConfDirRecursively(dirPath string, extension []string) cmdarg.Arg {
|
||||
func getConfigFilePath() cmdarg.Arg {
|
||||
extension, err := core.GetLoaderExtensions(*configFormat)
|
||||
if err != nil {
|
||||
base.Fatalf(err.Error())
|
||||
base.Fatalf("%v", err.Error())
|
||||
}
|
||||
dirReader := readConfDir
|
||||
if *configDirRecursively {
|
||||
|
@ -1,11 +1,11 @@
|
||||
package plugin_pprof
|
||||
package plugin_pprof //nolint: stylecheck
|
||||
|
||||
import (
|
||||
"github.com/v2fly/v2ray-core/v5/main/plugins"
|
||||
"net/http"
|
||||
"net/http/pprof"
|
||||
|
||||
"github.com/v2fly/v2ray-core/v5/main/commands/base"
|
||||
"github.com/v2fly/v2ray-core/v5/main/plugins"
|
||||
)
|
||||
|
||||
var pprofPlugin plugins.Plugin = func(cmd *base.Command) func() error {
|
||||
|
@ -88,7 +88,7 @@ func (c *Client) Process(ctx context.Context, link *transport.Link, dialer inter
|
||||
|
||||
if !IsHy2Transport && network == net.Network_UDP {
|
||||
// hysteria2 need to use udp extension to proxy UDP.
|
||||
return newError(hyTransport.CanNotUseUdpExtension)
|
||||
return newError(hyTransport.CanNotUseUDPExtension)
|
||||
}
|
||||
|
||||
user := server.PickUser()
|
||||
|
@ -4,8 +4,8 @@ import (
|
||||
"io"
|
||||
"math/rand"
|
||||
|
||||
hyProtocol "github.com/v2fly/hysteria/core/v2/international/protocol"
|
||||
"github.com/apernet/quic-go/quicvarint"
|
||||
hyProtocol "github.com/v2fly/hysteria/core/v2/international/protocol"
|
||||
|
||||
"github.com/v2fly/v2ray-core/v5/common/buf"
|
||||
"github.com/v2fly/v2ray-core/v5/common/net"
|
||||
@ -59,7 +59,7 @@ func (c *ConnWriter) WriteTCPHeader() error {
|
||||
}
|
||||
|
||||
func QuicLen(s int) int {
|
||||
return int(quicvarint.Len(uint64(s)))
|
||||
return quicvarint.Len(uint64(s))
|
||||
}
|
||||
|
||||
func (c *ConnWriter) writeTCPHeader() error {
|
||||
|
@ -67,7 +67,7 @@ func (s *Server) Process(ctx context.Context, network net.Network, conn internet
|
||||
}
|
||||
|
||||
if !IsHy2Transport && network == net.Network_UDP {
|
||||
return newError(hyTransport.CanNotUseUdpExtension)
|
||||
return newError(hyTransport.CanNotUseUDPExtension)
|
||||
}
|
||||
|
||||
sessionPolicy := s.policyManager.ForLevel(0)
|
||||
|
@ -146,7 +146,7 @@ func createStatusFromConfig(config *UDPProtocolConfig) (*status, error) { //noli
|
||||
return s, nil
|
||||
}
|
||||
|
||||
func enableInterface(s *status) error {
|
||||
func enableInterface(s *status) error { //nolint: unparam
|
||||
s.transport = s
|
||||
if s.config.EnableStabilization {
|
||||
s.transport = uniserver.NewUnifiedConnectionTransportHub(s, s.ctx)
|
||||
|
@ -4,7 +4,6 @@ import (
|
||||
"bytes"
|
||||
"crypto/rand"
|
||||
"fmt"
|
||||
"golang.org/x/net/proxy"
|
||||
"io"
|
||||
"os"
|
||||
"os/exec"
|
||||
@ -14,6 +13,8 @@ import (
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"golang.org/x/net/proxy"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
|
||||
core "github.com/v2fly/v2ray-core/v5"
|
||||
@ -169,7 +170,7 @@ func withDefaultApps(config *core.Config) *core.Config {
|
||||
return config
|
||||
}
|
||||
|
||||
func testTCPConnViaSocks(socksPort, testPort net.Port, payloadSize int, timeout time.Duration) func() error {
|
||||
func testTCPConnViaSocks(socksPort, testPort net.Port, payloadSize int, timeout time.Duration) func() error { //nolint: unparam
|
||||
return func() error {
|
||||
socksDialer, err := proxy.SOCKS5("tcp", "127.0.0.1:"+socksPort.String(), nil, nil)
|
||||
if err != nil {
|
||||
|
@ -2,11 +2,12 @@ package httpupgrade
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"time"
|
||||
|
||||
"github.com/v2fly/v2ray-core/v5/common/buf"
|
||||
"github.com/v2fly/v2ray-core/v5/common/net"
|
||||
"github.com/v2fly/v2ray-core/v5/common/serial"
|
||||
"io"
|
||||
"time"
|
||||
)
|
||||
|
||||
type connection struct {
|
||||
|
@ -43,7 +43,7 @@ func dialhttpUpgrade(ctx context.Context, dest net.Destination, streamSettings *
|
||||
earlyDataSize = int(transportConfiguration.MaxEarlyData)
|
||||
}
|
||||
|
||||
if earlyData != nil && len(earlyData) > 0 {
|
||||
if len(earlyData) > 0 {
|
||||
if transportConfiguration.EarlyDataHeaderName == "" {
|
||||
return nil, nil, newError("EarlyDataHeaderName is not set")
|
||||
}
|
||||
@ -71,7 +71,6 @@ func dialhttpUpgrade(ctx context.Context, dest net.Destination, streamSettings *
|
||||
if resp.Status == "101 Switching Protocols" &&
|
||||
strings.ToLower(resp.Header.Get("Upgrade")) == "websocket" &&
|
||||
strings.ToLower(resp.Header.Get("Connection")) == "upgrade" {
|
||||
|
||||
earlyReplyReader := io.LimitReader(bufferedConn, int64(bufferedConn.Buffered()))
|
||||
return conn, earlyReplyReader, nil
|
||||
}
|
||||
|
@ -3,16 +3,18 @@ package hysteria2
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/apernet/quic-go"
|
||||
hyClient "github.com/v2fly/hysteria/core/v2/client"
|
||||
"github.com/v2fly/hysteria/core/v2/international/protocol"
|
||||
hyServer "github.com/v2fly/hysteria/core/v2/server"
|
||||
"github.com/apernet/quic-go"
|
||||
|
||||
"github.com/v2fly/v2ray-core/v5/common/net"
|
||||
)
|
||||
|
||||
const CanNotUseUdpExtension = "Only hysteria2 proxy protocol can use udpExtension."
|
||||
const Hy2MustNeedTLS = "Hysteria2 based on QUIC that requires TLS."
|
||||
const (
|
||||
CanNotUseUDPExtension = "Only hysteria2 proxy protocol can use udpExtension."
|
||||
Hy2MustNeedTLS = "Hysteria2 based on QUIC that requires TLS."
|
||||
)
|
||||
|
||||
type HyConn struct {
|
||||
IsUDPExtension bool
|
||||
@ -44,7 +46,7 @@ func (c *HyConn) Write(b []byte) (int, error) {
|
||||
|
||||
func (c *HyConn) WritePacket(b []byte, dest net.Destination) (int, error) {
|
||||
if !c.IsUDPExtension {
|
||||
return 0, newError(CanNotUseUdpExtension)
|
||||
return 0, newError(CanNotUseUDPExtension)
|
||||
}
|
||||
|
||||
if c.IsServer {
|
||||
@ -64,7 +66,7 @@ func (c *HyConn) WritePacket(b []byte, dest net.Destination) (int, error) {
|
||||
|
||||
func (c *HyConn) ReadPacket() (int, []byte, *net.Destination, error) {
|
||||
if !c.IsUDPExtension {
|
||||
return 0, nil, nil, newError(CanNotUseUdpExtension)
|
||||
return 0, nil, nil, newError(CanNotUseUDPExtension)
|
||||
}
|
||||
|
||||
if c.IsServer {
|
||||
@ -89,7 +91,7 @@ func (c *HyConn) ReadPacket() (int, []byte, *net.Destination, error) {
|
||||
func (c *HyConn) Close() error {
|
||||
if c.IsUDPExtension {
|
||||
if !c.IsServer && c.ClientUDPSession == nil || (c.IsServer && c.ServerUDPSession == nil) {
|
||||
return newError(CanNotUseUdpExtension)
|
||||
return newError(CanNotUseUDPExtension)
|
||||
}
|
||||
if c.IsServer {
|
||||
c.ServerUDPSession.CloseWithErr(nil)
|
||||
|
@ -4,9 +4,9 @@ import (
|
||||
"context"
|
||||
"sync"
|
||||
|
||||
"github.com/apernet/quic-go/quicvarint"
|
||||
hyClient "github.com/v2fly/hysteria/core/v2/client"
|
||||
hyProtocol "github.com/v2fly/hysteria/core/v2/international/protocol"
|
||||
"github.com/apernet/quic-go/quicvarint"
|
||||
|
||||
"github.com/v2fly/v2ray-core/v5/common"
|
||||
"github.com/v2fly/v2ray-core/v5/common/net"
|
||||
@ -20,9 +20,11 @@ type dialerConf struct {
|
||||
*internet.MemoryStreamConfig
|
||||
}
|
||||
|
||||
var RunningClient map[dialerConf](hyClient.Client)
|
||||
var ClientMutex sync.Mutex
|
||||
var MBps uint64 = 1000000 / 8 // MByte
|
||||
var (
|
||||
RunningClient map[dialerConf](hyClient.Client)
|
||||
ClientMutex sync.Mutex
|
||||
MBps uint64 = 1000000 / 8 // MByte
|
||||
)
|
||||
|
||||
func GetClientTLSConfig(dest net.Destination, streamSettings *internet.MemoryStreamConfig) (*hyClient.TLSConfig, error) {
|
||||
config := tls.ConfigFromStreamSettings(streamSettings)
|
||||
@ -190,7 +192,7 @@ func Dial(ctx context.Context, dest net.Destination, streamSettings *internet.Me
|
||||
}
|
||||
|
||||
// write TCP frame type
|
||||
frameSize := int(quicvarint.Len(hyProtocol.FrameTypeTCPRequest))
|
||||
frameSize := quicvarint.Len(hyProtocol.FrameTypeTCPRequest)
|
||||
buf := make([]byte, frameSize)
|
||||
hyProtocol.VarintPut(buf, hyProtocol.FrameTypeTCPRequest)
|
||||
_, err = conn.stream.Write(buf)
|
||||
|
@ -3,9 +3,9 @@ package hysteria2
|
||||
import (
|
||||
"context"
|
||||
|
||||
hyServer "github.com/v2fly/hysteria/core/v2/server"
|
||||
"github.com/apernet/quic-go"
|
||||
"github.com/apernet/quic-go/http3"
|
||||
hyServer "github.com/v2fly/hysteria/core/v2/server"
|
||||
|
||||
"github.com/v2fly/v2ray-core/v5/common"
|
||||
"github.com/v2fly/v2ray-core/v5/common/net"
|
||||
@ -42,7 +42,7 @@ func (l *Listener) StreamHijacker(ft http3.FrameType, conn quic.Connection, stre
|
||||
return true, nil
|
||||
}
|
||||
|
||||
func (l *Listener) UdpHijacker(entry *hyServer.UdpSessionEntry, originalAddr string) {
|
||||
func (l *Listener) UDPHijacker(entry *hyServer.UdpSessionEntry, originalAddr string) {
|
||||
addr, err := net.ResolveUDPAddr("udp", originalAddr)
|
||||
if err != nil {
|
||||
return
|
||||
@ -90,7 +90,7 @@ func Listen(ctx context.Context, address net.Address, port net.Port, streamSetti
|
||||
Authenticator: &Authenticator{Password: config.GetPassword()},
|
||||
StreamHijacker: listener.StreamHijacker, // acceptStreams
|
||||
BandwidthConfig: hyServer.BandwidthConfig{MaxTx: config.Congestion.GetUpMbps() * MBps, MaxRx: config.GetCongestion().GetDownMbps() * MBps},
|
||||
UdpSessionHijacker: listener.UdpHijacker, // acceptUDPSession
|
||||
UdpSessionHijacker: listener.UDPHijacker, // acceptUDPSession
|
||||
IgnoreClientBandwidth: config.GetIgnoreClientBandwidth(),
|
||||
})
|
||||
if err != nil {
|
||||
|
@ -127,6 +127,7 @@ func TestUDP(t *testing.T) {
|
||||
time.Sleep(time.Second)
|
||||
|
||||
address, err := net.ParseDestination("udp:127.0.0.1:1180")
|
||||
common.Must(err)
|
||||
dctx := session.ContextWithOutbound(context.Background(), &session.Outbound{Target: address})
|
||||
|
||||
conn, err := hysteria2.Dial(dctx, net.TCPDestination(net.LocalHostIP, port), &internet.MemoryStreamConfig{
|
||||
|
@ -122,7 +122,7 @@ copyFromChan:
|
||||
return
|
||||
}
|
||||
}
|
||||
if resp.Data != nil && len(resp.Data) != 0 {
|
||||
if len(resp.Data) != 0 {
|
||||
respReader := bytes.NewReader(resp.Data)
|
||||
for respReader.Len() != 0 {
|
||||
packet, err := packetBundler.ReadFromBundle(respReader)
|
||||
|
@ -104,7 +104,7 @@ func (s *simpleAssemblerServerSession) Close() error {
|
||||
|
||||
func (s *simpleAssemblerServerSession) OnRoundTrip(ctx context.Context, req request.Request, opts ...request.RoundTripperOption,
|
||||
) (resp request.Response, err error) {
|
||||
if req.Data != nil && len(req.Data) > 0 {
|
||||
if len(req.Data) > 0 {
|
||||
select {
|
||||
case <-s.ctx.Done():
|
||||
return request.Response{}, s.ctx.Err()
|
||||
|
@ -56,6 +56,7 @@ func mekyaDial(ctx context.Context, dest net.Destination, streamSettings *intern
|
||||
|
||||
return internet.Dial(ctx, dest, constructedSetting)
|
||||
}
|
||||
|
||||
func mekyaListen(ctx context.Context, address net.Address, port net.Port, streamSettings *internet.MemoryStreamConfig, callback internet.ConnHandler) (internet.Listener, error) {
|
||||
mekyaSetting := streamSettings.ProtocolSettings.(*Config)
|
||||
packetConnAssembler := &packetconn.ServerConfig{}
|
||||
|
@ -91,7 +91,7 @@ func (dl *DefaultListener) Listen(ctx context.Context, addr net.Addr, sockopt *S
|
||||
lc.Control = nil
|
||||
network = addr.Network()
|
||||
address = addr.Name
|
||||
if (runtime.GOOS == "linux" || runtime.GOOS == "android") && address[0] == '@' {
|
||||
if (runtime.GOOS == "linux" || runtime.GOOS == "android") && address[0] == '@' { //nolint: gocritic
|
||||
// linux abstract unix domain socket is lockfree
|
||||
if len(address) > 1 && address[1] == '@' {
|
||||
// but may need padding to work with haproxy
|
||||
|
@ -288,8 +288,8 @@ func (c *Config) GetTLSConfig(opts ...Option) *tls.Config {
|
||||
}
|
||||
|
||||
if len(c.EchConfig) > 0 || len(c.Ech_DOHserver) > 0 {
|
||||
err := ApplyECH(c, config)
|
||||
if err != nil {
|
||||
err := ApplyECH(c, config) //nolint: staticcheck
|
||||
if err != nil { //nolint: staticcheck
|
||||
newError("unable to set ECH").AtError().Base(err).WriteToLog()
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,6 @@ import (
|
||||
"crypto/tls"
|
||||
)
|
||||
|
||||
func ApplyECH(c *Config, config *tls.Config) error {
|
||||
func ApplyECH(c *Config, config *tls.Config) error { //nolint: staticcheck
|
||||
return newError("using ECH require go 1.23 or higher")
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user