diff --git a/app/commander/commander.go b/app/commander/commander.go index 666a247c1..c03da83fe 100644 --- a/app/commander/commander.go +++ b/app/commander/commander.go @@ -7,12 +7,11 @@ import ( "net" "sync" - "google.golang.org/grpc" - "github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common/signal/done" core "github.com/xtls/xray-core/core" "github.com/xtls/xray-core/features/outbound" + "google.golang.org/grpc" ) // Commander is a Xray feature that provides gRPC methods to external clients. diff --git a/app/commander/service.go b/app/commander/service.go index d9bc17609..510f321f4 100644 --- a/app/commander/service.go +++ b/app/commander/service.go @@ -3,10 +3,9 @@ package commander import ( "context" + "github.com/xtls/xray-core/common" "google.golang.org/grpc" "google.golang.org/grpc/reflection" - - "github.com/xtls/xray-core/common" ) // Service is a Commander service. diff --git a/app/dispatcher/default.go b/app/dispatcher/default.go index 7143ccfc0..93dd348f0 100644 --- a/app/dispatcher/default.go +++ b/app/dispatcher/default.go @@ -161,7 +161,7 @@ func (d *DefaultDispatcher) getLink(ctx context.Context, network net.Network, sn } } } else { - if (ip2domain == nil) { + if ip2domain == nil { ip2domain = new(sync.Map) newError("[fakedns client] create a new map").WriteToLog(session.ExportIDToError(ctx)) } @@ -171,7 +171,7 @@ func (d *DefaultDispatcher) getLink(ctx context.Context, network net.Network, sn for _, ip := range ips { ip2domain.Store(ip.String(), domain) } - newError("[fakedns client] candidate ip: " + fmt.Sprintf("%v", ips), " for xUDP buffer at ", i).WriteToLog(session.ExportIDToError(ctx)) + newError("[fakedns client] candidate ip: "+fmt.Sprintf("%v", ips), " for xUDP buffer at ", i).WriteToLog(session.ExportIDToError(ctx)) } else { newError("[fakedns client] failed to look up IP for ", domain, " for xUDP buffer at ", i).Base(err).WriteToLog(session.ExportIDToError(ctx)) } diff --git a/app/dispatcher/fakednssniffer.go b/app/dispatcher/fakednssniffer.go index 366b6ff52..ad879daf5 100644 --- a/app/dispatcher/fakednssniffer.go +++ b/app/dispatcher/fakednssniffer.go @@ -85,7 +85,8 @@ func (f DNSThenOthersSniffResult) Domain() string { } func newFakeDNSThenOthers(ctx context.Context, fakeDNSSniffer protocolSnifferWithMetadata, others []protocolSnifferWithMetadata) ( - protocolSnifferWithMetadata, error) { // nolint: unparam + protocolSnifferWithMetadata, error, +) { // nolint: unparam // ctx may be used in the future _ = ctx return protocolSnifferWithMetadata{ diff --git a/app/dns/dns_test.go b/app/dns/dns_test.go index 50f2062b6..b3a8def88 100644 --- a/app/dns/dns_test.go +++ b/app/dns/dns_test.go @@ -6,7 +6,6 @@ import ( "github.com/google/go-cmp/cmp" "github.com/miekg/dns" - "github.com/xtls/xray-core/app/dispatcher" . "github.com/xtls/xray-core/app/dns" "github.com/xtls/xray-core/app/policy" diff --git a/app/dns/dnscommon.go b/app/dns/dnscommon.go index 9f5e37959..de0d794cc 100644 --- a/app/dns/dnscommon.go +++ b/app/dns/dnscommon.go @@ -5,12 +5,11 @@ import ( "strings" "time" - "golang.org/x/net/dns/dnsmessage" - "github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common/errors" "github.com/xtls/xray-core/common/net" dns_feature "github.com/xtls/xray-core/features/dns" + "golang.org/x/net/dns/dnsmessage" ) // Fqdn normalizes domain make sure it ends with '.' diff --git a/app/dns/dnscommon_test.go b/app/dns/dnscommon_test.go index 76e896887..6530d1a00 100644 --- a/app/dns/dnscommon_test.go +++ b/app/dns/dnscommon_test.go @@ -7,11 +7,10 @@ import ( "github.com/google/go-cmp/cmp" "github.com/miekg/dns" - "golang.org/x/net/dns/dnsmessage" - "github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common/net" dns_feature "github.com/xtls/xray-core/features/dns" + "golang.org/x/net/dns/dnsmessage" ) func Test_parseResponse(t *testing.T) { diff --git a/app/dns/fakedns/fakedns_test.go b/app/dns/fakedns/fakedns_test.go index 2a42b65ff..76ccbca67 100644 --- a/app/dns/fakedns/fakedns_test.go +++ b/app/dns/fakedns/fakedns_test.go @@ -6,13 +6,11 @@ import ( "testing" "github.com/stretchr/testify/assert" - - "golang.org/x/sync/errgroup" - "github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common/net" "github.com/xtls/xray-core/common/uuid" "github.com/xtls/xray-core/features/dns" + "golang.org/x/sync/errgroup" ) var ipPrefix = "198.1" diff --git a/app/dns/hosts_test.go b/app/dns/hosts_test.go index dd8c88138..40533b112 100644 --- a/app/dns/hosts_test.go +++ b/app/dns/hosts_test.go @@ -4,7 +4,6 @@ import ( "testing" "github.com/google/go-cmp/cmp" - . "github.com/xtls/xray-core/app/dns" "github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common/net" diff --git a/app/dns/nameserver_doh.go b/app/dns/nameserver_doh.go index 6286c3e54..86161a85b 100644 --- a/app/dns/nameserver_doh.go +++ b/app/dns/nameserver_doh.go @@ -11,8 +11,6 @@ import ( "sync/atomic" "time" - "golang.org/x/net/dns/dnsmessage" - "github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common/log" "github.com/xtls/xray-core/common/net" @@ -24,6 +22,7 @@ import ( dns_feature "github.com/xtls/xray-core/features/dns" "github.com/xtls/xray-core/features/routing" "github.com/xtls/xray-core/transport/internet" + "golang.org/x/net/dns/dnsmessage" ) // DoHNameServer implemented DNS over HTTPS (RFC8484) Wire Format, diff --git a/app/dns/nameserver_doh_test.go b/app/dns/nameserver_doh_test.go index d439a93ba..f5cae5a67 100644 --- a/app/dns/nameserver_doh_test.go +++ b/app/dns/nameserver_doh_test.go @@ -7,7 +7,6 @@ import ( "time" "github.com/google/go-cmp/cmp" - . "github.com/xtls/xray-core/app/dns" "github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common/net" diff --git a/app/dns/nameserver_quic.go b/app/dns/nameserver_quic.go index 83cc32254..63be44ba8 100644 --- a/app/dns/nameserver_quic.go +++ b/app/dns/nameserver_quic.go @@ -8,9 +8,6 @@ import ( "time" "github.com/lucas-clemente/quic-go" - "golang.org/x/net/dns/dnsmessage" - "golang.org/x/net/http2" - "github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common/buf" "github.com/xtls/xray-core/common/net" @@ -20,6 +17,8 @@ import ( "github.com/xtls/xray-core/common/task" dns_feature "github.com/xtls/xray-core/features/dns" "github.com/xtls/xray-core/transport/internet/tls" + "golang.org/x/net/dns/dnsmessage" + "golang.org/x/net/http2" ) // NextProtoDQ - During connection establishment, DNS/QUIC support is indicated diff --git a/app/dns/nameserver_quic_test.go b/app/dns/nameserver_quic_test.go index 9e87d8e18..cf445b43e 100644 --- a/app/dns/nameserver_quic_test.go +++ b/app/dns/nameserver_quic_test.go @@ -7,7 +7,6 @@ import ( "time" "github.com/google/go-cmp/cmp" - . "github.com/xtls/xray-core/app/dns" "github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common/net" diff --git a/app/dns/nameserver_tcp.go b/app/dns/nameserver_tcp.go index 50dc62f09..99206bfc2 100644 --- a/app/dns/nameserver_tcp.go +++ b/app/dns/nameserver_tcp.go @@ -9,8 +9,6 @@ import ( "sync/atomic" "time" - "golang.org/x/net/dns/dnsmessage" - "github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common/buf" "github.com/xtls/xray-core/common/net" @@ -22,6 +20,7 @@ import ( dns_feature "github.com/xtls/xray-core/features/dns" "github.com/xtls/xray-core/features/routing" "github.com/xtls/xray-core/transport/internet" + "golang.org/x/net/dns/dnsmessage" ) // TCPNameServer implemented DNS over TCP (RFC7766). diff --git a/app/dns/nameserver_tcp_test.go b/app/dns/nameserver_tcp_test.go index 4e4ea7468..da362355a 100644 --- a/app/dns/nameserver_tcp_test.go +++ b/app/dns/nameserver_tcp_test.go @@ -7,7 +7,6 @@ import ( "time" "github.com/google/go-cmp/cmp" - . "github.com/xtls/xray-core/app/dns" "github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common/net" diff --git a/app/dns/nameserver_udp.go b/app/dns/nameserver_udp.go index 367470167..fc8e5d68e 100644 --- a/app/dns/nameserver_udp.go +++ b/app/dns/nameserver_udp.go @@ -7,8 +7,6 @@ import ( "sync/atomic" "time" - "golang.org/x/net/dns/dnsmessage" - "github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common/log" "github.com/xtls/xray-core/common/net" @@ -21,6 +19,7 @@ import ( dns_feature "github.com/xtls/xray-core/features/dns" "github.com/xtls/xray-core/features/routing" "github.com/xtls/xray-core/transport/internet/udp" + "golang.org/x/net/dns/dnsmessage" ) // ClassicNameServer implemented traditional UDP DNS. diff --git a/app/log/command/command.go b/app/log/command/command.go index ef7223f35..74a02d771 100644 --- a/app/log/command/command.go +++ b/app/log/command/command.go @@ -5,11 +5,10 @@ package command import ( "context" - grpc "google.golang.org/grpc" - "github.com/xtls/xray-core/app/log" "github.com/xtls/xray-core/common" "github.com/xtls/xray-core/core" + grpc "google.golang.org/grpc" ) type LoggerServer struct { diff --git a/app/log/log_test.go b/app/log/log_test.go index ddc765c45..cda55f628 100644 --- a/app/log/log_test.go +++ b/app/log/log_test.go @@ -5,7 +5,6 @@ import ( "testing" "github.com/golang/mock/gomock" - "github.com/xtls/xray-core/app/log" "github.com/xtls/xray-core/common" clog "github.com/xtls/xray-core/common/log" diff --git a/app/metrics/metrics.go b/app/metrics/metrics.go index d4c595902..9b0ba0712 100644 --- a/app/metrics/metrics.go +++ b/app/metrics/metrics.go @@ -39,7 +39,7 @@ func NewMetricsHandler(ctx context.Context, config *Config) (*MetricsHandler, er if !ok { return nil } - var resp = map[string]map[string]map[string]int64{ + resp := map[string]map[string]map[string]int64{ "inbound": {}, "outbound": {}, "user": {}, @@ -68,7 +68,7 @@ func NewMetricsHandler(ctx context.Context, config *Config) (*MetricsHandler, er return nil } } - var resp = map[string]*observatory.OutboundStatus{} + resp := map[string]*observatory.OutboundStatus{} if o, err := c.observatory.GetObservation(context.Background()); err != nil { return err } else { diff --git a/app/observatory/command/command.go b/app/observatory/command/command.go index 9f79207af..0c1fac519 100644 --- a/app/observatory/command/command.go +++ b/app/observatory/command/command.go @@ -6,12 +6,11 @@ package command import ( "context" - "google.golang.org/grpc" - "github.com/xtls/xray-core/app/observatory" "github.com/xtls/xray-core/common" core "github.com/xtls/xray-core/core" "github.com/xtls/xray-core/features/extension" + "google.golang.org/grpc" ) type service struct { diff --git a/app/observatory/observer.go b/app/observatory/observer.go index a86fec10e..576818c45 100644 --- a/app/observatory/observer.go +++ b/app/observatory/observer.go @@ -10,7 +10,6 @@ import ( "time" "github.com/golang/protobuf/proto" - "github.com/xtls/xray-core/common" v2net "github.com/xtls/xray-core/common/net" "github.com/xtls/xray-core/common/session" diff --git a/app/proxyman/command/command.go b/app/proxyman/command/command.go index 5f2ec2ae8..9782d6c10 100644 --- a/app/proxyman/command/command.go +++ b/app/proxyman/command/command.go @@ -3,13 +3,12 @@ package command import ( "context" - grpc "google.golang.org/grpc" - "github.com/xtls/xray-core/common" "github.com/xtls/xray-core/core" "github.com/xtls/xray-core/features/inbound" "github.com/xtls/xray-core/features/outbound" "github.com/xtls/xray-core/proxy" + grpc "google.golang.org/grpc" ) // InboundOperation is the interface for operations that applies to inbound handlers. diff --git a/app/proxyman/inbound/always.go b/app/proxyman/inbound/always.go index 101990b25..f422e626e 100644 --- a/app/proxyman/inbound/always.go +++ b/app/proxyman/inbound/always.go @@ -144,7 +144,6 @@ func NewAlwaysOnInboundHandler(ctx context.Context, tag string, receiverConfig * } } } - } return h, nil diff --git a/app/proxyman/inbound/dynamic.go b/app/proxyman/inbound/dynamic.go index 998d3a18b..0f81c26e7 100644 --- a/app/proxyman/inbound/dynamic.go +++ b/app/proxyman/inbound/dynamic.go @@ -87,7 +87,6 @@ func (h *DynamicInboundHandler) allocatePort() net.Port { return port } } - } func (h *DynamicInboundHandler) closeWorkers(workers []worker) { diff --git a/app/reverse/bridge.go b/app/reverse/bridge.go index cc8b42265..4b86c3a29 100644 --- a/app/reverse/bridge.go +++ b/app/reverse/bridge.go @@ -5,7 +5,6 @@ import ( "time" "github.com/golang/protobuf/proto" - "github.com/xtls/xray-core/common/mux" "github.com/xtls/xray-core/common/net" "github.com/xtls/xray-core/common/session" diff --git a/app/reverse/portal.go b/app/reverse/portal.go index 3ad2f9498..b0860a6ee 100644 --- a/app/reverse/portal.go +++ b/app/reverse/portal.go @@ -6,7 +6,6 @@ import ( "time" "github.com/golang/protobuf/proto" - "github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common/buf" "github.com/xtls/xray-core/common/mux" diff --git a/app/router/balancing.go b/app/router/balancing.go index b7c43f32f..50b84388d 100644 --- a/app/router/balancing.go +++ b/app/router/balancing.go @@ -44,6 +44,7 @@ func (b *Balancer) PickOutbound() (string, error) { } return tag, nil } + func (b *Balancer) InjectContext(ctx context.Context) { if contextReceiver, ok := b.strategy.(extension.ContextReceiver); ok { contextReceiver.InjectContext(ctx) diff --git a/app/router/command/command.go b/app/router/command/command.go index fff78cb71..589810561 100644 --- a/app/router/command/command.go +++ b/app/router/command/command.go @@ -6,12 +6,11 @@ import ( "context" "time" - "google.golang.org/grpc" - "github.com/xtls/xray-core/common" "github.com/xtls/xray-core/core" "github.com/xtls/xray-core/features/routing" "github.com/xtls/xray-core/features/stats" + "google.golang.org/grpc" ) // routingServer is an implementation of RoutingService. diff --git a/app/router/command/command_test.go b/app/router/command/command_test.go index 2322b8a3c..b9d252a66 100644 --- a/app/router/command/command_test.go +++ b/app/router/command/command_test.go @@ -8,9 +8,6 @@ import ( "github.com/golang/mock/gomock" "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" - "google.golang.org/grpc" - "google.golang.org/grpc/test/bufconn" - "github.com/xtls/xray-core/app/router" . "github.com/xtls/xray-core/app/router/command" "github.com/xtls/xray-core/app/stats" @@ -18,6 +15,8 @@ import ( "github.com/xtls/xray-core/common/net" "github.com/xtls/xray-core/features/routing" "github.com/xtls/xray-core/testing/mocks" + "google.golang.org/grpc" + "google.golang.org/grpc/test/bufconn" ) func TestServiceSubscribeRoutingStats(t *testing.T) { diff --git a/app/router/condition.go b/app/router/condition.go index fd4215601..cdcb67475 100644 --- a/app/router/condition.go +++ b/app/router/condition.go @@ -3,12 +3,11 @@ package router import ( "strings" - "go.starlark.net/starlark" - "go.starlark.net/syntax" - "github.com/xtls/xray-core/common/net" "github.com/xtls/xray-core/common/strmatcher" "github.com/xtls/xray-core/features/routing" + "go.starlark.net/starlark" + "go.starlark.net/syntax" ) type Condition interface { diff --git a/app/router/condition_geoip_test.go b/app/router/condition_geoip_test.go index c92a3b788..b5a5ef909 100644 --- a/app/router/condition_geoip_test.go +++ b/app/router/condition_geoip_test.go @@ -6,7 +6,6 @@ import ( "testing" "github.com/golang/protobuf/proto" - "github.com/xtls/xray-core/app/router" "github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common/net" diff --git a/app/router/condition_test.go b/app/router/condition_test.go index ef473a248..5d98eb43e 100644 --- a/app/router/condition_test.go +++ b/app/router/condition_test.go @@ -7,7 +7,6 @@ import ( "testing" "github.com/golang/protobuf/proto" - . "github.com/xtls/xray-core/app/router" "github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common/errors" diff --git a/app/router/router_test.go b/app/router/router_test.go index f77bca8e4..1b71e99bc 100644 --- a/app/router/router_test.go +++ b/app/router/router_test.go @@ -5,7 +5,6 @@ import ( "testing" "github.com/golang/mock/gomock" - . "github.com/xtls/xray-core/app/router" "github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common/net" diff --git a/app/router/strategy_leastping.go b/app/router/strategy_leastping.go index 0b241576c..e8c40aead 100644 --- a/app/router/strategy_leastping.go +++ b/app/router/strategy_leastping.go @@ -45,7 +45,7 @@ func (l *LeastPingStrategy) PickOutbound(strings []string) string { return selectedOutboundName } - //No way to understand observeReport + // No way to understand observeReport return "" } diff --git a/app/stats/command/command.go b/app/stats/command/command.go index 3c9f54243..24dc3db69 100644 --- a/app/stats/command/command.go +++ b/app/stats/command/command.go @@ -7,13 +7,12 @@ import ( "runtime" "time" - grpc "google.golang.org/grpc" - "github.com/xtls/xray-core/app/stats" "github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common/strmatcher" "github.com/xtls/xray-core/core" feature_stats "github.com/xtls/xray-core/features/stats" + grpc "google.golang.org/grpc" ) // statsServer is an implementation of StatsService. diff --git a/app/stats/command/command_test.go b/app/stats/command/command_test.go index a58ba9823..3f56c7a3f 100644 --- a/app/stats/command/command_test.go +++ b/app/stats/command/command_test.go @@ -6,7 +6,6 @@ import ( "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" - "github.com/xtls/xray-core/app/stats" . "github.com/xtls/xray-core/app/stats/command" "github.com/xtls/xray-core/common" diff --git a/common/buf/buffer_test.go b/common/buf/buffer_test.go index 3a49d55f2..596ae4e1b 100644 --- a/common/buf/buffer_test.go +++ b/common/buf/buffer_test.go @@ -6,7 +6,6 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/xtls/xray-core/common" . "github.com/xtls/xray-core/common/buf" ) diff --git a/common/buf/copy_test.go b/common/buf/copy_test.go index e5cd5ecee..cb2f831b1 100644 --- a/common/buf/copy_test.go +++ b/common/buf/copy_test.go @@ -6,7 +6,6 @@ import ( "testing" "github.com/golang/mock/gomock" - "github.com/xtls/xray-core/common/buf" "github.com/xtls/xray-core/common/errors" "github.com/xtls/xray-core/testing/mocks" diff --git a/common/buf/multi_buffer_test.go b/common/buf/multi_buffer_test.go index 762c3ee3a..4f9499aff 100644 --- a/common/buf/multi_buffer_test.go +++ b/common/buf/multi_buffer_test.go @@ -8,7 +8,6 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/xtls/xray-core/common" . "github.com/xtls/xray-core/common/buf" ) diff --git a/common/buf/readv_test.go b/common/buf/readv_test.go index e9f46171a..dbab9c764 100644 --- a/common/buf/readv_test.go +++ b/common/buf/readv_test.go @@ -9,11 +9,10 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "golang.org/x/sync/errgroup" - "github.com/xtls/xray-core/common" . "github.com/xtls/xray-core/common/buf" "github.com/xtls/xray-core/testing/servers/tcp" + "golang.org/x/sync/errgroup" ) func TestReadvReader(t *testing.T) { diff --git a/common/buf/writer_test.go b/common/buf/writer_test.go index 686527f5d..20c3579a7 100644 --- a/common/buf/writer_test.go +++ b/common/buf/writer_test.go @@ -8,7 +8,6 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/xtls/xray-core/common" . "github.com/xtls/xray-core/common/buf" "github.com/xtls/xray-core/transport/pipe" diff --git a/common/crypto/auth_test.go b/common/crypto/auth_test.go index 0f293b9ac..6af8e0ad9 100644 --- a/common/crypto/auth_test.go +++ b/common/crypto/auth_test.go @@ -9,7 +9,6 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common/buf" . "github.com/xtls/xray-core/common/crypto" diff --git a/common/crypto/chacha20_test.go b/common/crypto/chacha20_test.go index 4a51ea759..a552cdac2 100644 --- a/common/crypto/chacha20_test.go +++ b/common/crypto/chacha20_test.go @@ -6,7 +6,6 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/xtls/xray-core/common" . "github.com/xtls/xray-core/common/crypto" ) diff --git a/common/errors/errors_test.go b/common/errors/errors_test.go index 875376961..a38e87330 100644 --- a/common/errors/errors_test.go +++ b/common/errors/errors_test.go @@ -6,7 +6,6 @@ import ( "testing" "github.com/google/go-cmp/cmp" - . "github.com/xtls/xray-core/common/errors" "github.com/xtls/xray-core/common/log" ) diff --git a/common/log/log_test.go b/common/log/log_test.go index 28c473257..fd166cc63 100644 --- a/common/log/log_test.go +++ b/common/log/log_test.go @@ -4,7 +4,6 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/xtls/xray-core/common/log" "github.com/xtls/xray-core/common/net" ) diff --git a/common/mux/client_test.go b/common/mux/client_test.go index 0063c0614..7837a86e7 100644 --- a/common/mux/client_test.go +++ b/common/mux/client_test.go @@ -6,7 +6,6 @@ import ( "time" "github.com/golang/mock/gomock" - "github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common/errors" "github.com/xtls/xray-core/common/mux" diff --git a/common/mux/mux_test.go b/common/mux/mux_test.go index 282ff2102..39def2ab0 100644 --- a/common/mux/mux_test.go +++ b/common/mux/mux_test.go @@ -5,7 +5,6 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common/buf" . "github.com/xtls/xray-core/common/mux" diff --git a/common/net/address_test.go b/common/net/address_test.go index 1fec36715..906a7b851 100644 --- a/common/net/address_test.go +++ b/common/net/address_test.go @@ -5,7 +5,6 @@ import ( "testing" "github.com/google/go-cmp/cmp" - . "github.com/xtls/xray-core/common/net" ) diff --git a/common/net/destination_test.go b/common/net/destination_test.go index f6b19a4ce..0c2b18545 100644 --- a/common/net/destination_test.go +++ b/common/net/destination_test.go @@ -4,7 +4,6 @@ import ( "testing" "github.com/google/go-cmp/cmp" - . "github.com/xtls/xray-core/common/net" ) diff --git a/common/ocsp/ocsp.go b/common/ocsp/ocsp.go index 7aadf3efa..02140c0d1 100644 --- a/common/ocsp/ocsp.go +++ b/common/ocsp/ocsp.go @@ -8,9 +8,8 @@ import ( "net/http" "os" - "golang.org/x/crypto/ocsp" - "github.com/xtls/xray-core/common/platform/filesystem" + "golang.org/x/crypto/ocsp" ) func GetOCSPForFile(path string) ([]byte, error) { diff --git a/common/protocol/address_test.go b/common/protocol/address_test.go index b18adf820..ceecded2e 100644 --- a/common/protocol/address_test.go +++ b/common/protocol/address_test.go @@ -5,7 +5,6 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common/buf" "github.com/xtls/xray-core/common/net" diff --git a/common/protocol/dns/io.go b/common/protocol/dns/io.go index 1bb22f74e..0c215a702 100644 --- a/common/protocol/dns/io.go +++ b/common/protocol/dns/io.go @@ -4,11 +4,10 @@ import ( "encoding/binary" "sync" - "golang.org/x/net/dns/dnsmessage" - "github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common/buf" "github.com/xtls/xray-core/common/serial" + "golang.org/x/net/dns/dnsmessage" ) func PackMessage(msg *dnsmessage.Message) (*buf.Buffer, error) { diff --git a/common/protocol/http/headers_test.go b/common/protocol/http/headers_test.go index 80a0402b8..80e243aeb 100644 --- a/common/protocol/http/headers_test.go +++ b/common/protocol/http/headers_test.go @@ -7,7 +7,6 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common/net" . "github.com/xtls/xray-core/common/protocol/http" diff --git a/common/serial/serial_test.go b/common/serial/serial_test.go index d6fb86ce0..f3cb511aa 100644 --- a/common/serial/serial_test.go +++ b/common/serial/serial_test.go @@ -5,7 +5,6 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common/buf" "github.com/xtls/xray-core/common/serial" diff --git a/common/serial/string_test.go b/common/serial/string_test.go index f0967158f..369d1b10a 100644 --- a/common/serial/string_test.go +++ b/common/serial/string_test.go @@ -5,7 +5,6 @@ import ( "testing" "github.com/google/go-cmp/cmp" - . "github.com/xtls/xray-core/common/serial" ) diff --git a/common/task/task_test.go b/common/task/task_test.go index d871e03e8..87ebe0aac 100644 --- a/common/task/task_test.go +++ b/common/task/task_test.go @@ -8,7 +8,6 @@ import ( "time" "github.com/google/go-cmp/cmp" - "github.com/xtls/xray-core/common" . "github.com/xtls/xray-core/common/task" ) diff --git a/common/uuid/uuid_test.go b/common/uuid/uuid_test.go index 7e9b24d89..6f26ca5b2 100644 --- a/common/uuid/uuid_test.go +++ b/common/uuid/uuid_test.go @@ -4,7 +4,6 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/xtls/xray-core/common" . "github.com/xtls/xray-core/common/uuid" ) diff --git a/core/config.go b/core/config.go index c5318558d..5892226b0 100644 --- a/core/config.go +++ b/core/config.go @@ -5,7 +5,6 @@ import ( "strings" "github.com/golang/protobuf/proto" - "github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common/buf" "github.com/xtls/xray-core/common/cmdarg" diff --git a/core/context_test.go b/core/context_test.go index 423585e15..ec640dfd7 100644 --- a/core/context_test.go +++ b/core/context_test.go @@ -3,9 +3,9 @@ package core_test import ( "context" "testing" + _ "unsafe" . "github.com/xtls/xray-core/core" - _ "unsafe" ) func TestFromContextPanic(t *testing.T) { diff --git a/core/functions_test.go b/core/functions_test.go index 2439579ee..2355cc03e 100644 --- a/core/functions_test.go +++ b/core/functions_test.go @@ -9,7 +9,6 @@ import ( "github.com/golang/protobuf/proto" "github.com/google/go-cmp/cmp" - "github.com/xtls/xray-core/app/dispatcher" "github.com/xtls/xray-core/app/proxyman" "github.com/xtls/xray-core/common" diff --git a/core/xray_test.go b/core/xray_test.go index 6a5bc3a99..59de0f46d 100644 --- a/core/xray_test.go +++ b/core/xray_test.go @@ -4,7 +4,6 @@ import ( "testing" "github.com/golang/protobuf/proto" - "github.com/xtls/xray-core/app/dispatcher" "github.com/xtls/xray-core/app/proxyman" "github.com/xtls/xray-core/common" diff --git a/features/dns/fakedns.go b/features/dns/fakedns.go index 462bcccf5..7aff1fcb5 100644 --- a/features/dns/fakedns.go +++ b/features/dns/fakedns.go @@ -11,8 +11,10 @@ type FakeDNSEngine interface { GetDomainFromFakeDNS(ip net.Address) string } -var FakeIPv4Pool = "198.18.0.0/15" -var FakeIPv6Pool = "fc00::/18" +var ( + FakeIPv4Pool = "198.18.0.0/15" + FakeIPv6Pool = "fc00::/18" +) type FakeDNSEngineRev0 interface { FakeDNSEngine diff --git a/features/extension/observatory.go b/features/extension/observatory.go index 27252782a..eb51a61bd 100644 --- a/features/extension/observatory.go +++ b/features/extension/observatory.go @@ -4,7 +4,6 @@ import ( "context" "github.com/golang/protobuf/proto" - "github.com/xtls/xray-core/features" ) diff --git a/infra/conf/blackhole.go b/infra/conf/blackhole.go index e2fdeedc5..c1551de1b 100644 --- a/infra/conf/blackhole.go +++ b/infra/conf/blackhole.go @@ -4,7 +4,6 @@ import ( "encoding/json" "github.com/golang/protobuf/proto" - "github.com/xtls/xray-core/common/serial" "github.com/xtls/xray-core/proxy/blackhole" ) diff --git a/infra/conf/common_test.go b/infra/conf/common_test.go index f7c9985b1..a5484034b 100644 --- a/infra/conf/common_test.go +++ b/infra/conf/common_test.go @@ -7,7 +7,6 @@ import ( "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" - "github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common/net" "github.com/xtls/xray-core/common/protocol" diff --git a/infra/conf/dns_proxy.go b/infra/conf/dns_proxy.go index c96846e31..90a5d65e3 100644 --- a/infra/conf/dns_proxy.go +++ b/infra/conf/dns_proxy.go @@ -2,7 +2,6 @@ package conf import ( "github.com/golang/protobuf/proto" - "github.com/xtls/xray-core/common/net" "github.com/xtls/xray-core/proxy/dns" ) diff --git a/infra/conf/dns_test.go b/infra/conf/dns_test.go index cbd5d6729..c97c5bea7 100644 --- a/infra/conf/dns_test.go +++ b/infra/conf/dns_test.go @@ -7,7 +7,6 @@ import ( "testing" "github.com/golang/protobuf/proto" - "github.com/xtls/xray-core/app/dns" "github.com/xtls/xray-core/app/router" "github.com/xtls/xray-core/common" diff --git a/infra/conf/dokodemo.go b/infra/conf/dokodemo.go index 8c744d01e..03a21d711 100644 --- a/infra/conf/dokodemo.go +++ b/infra/conf/dokodemo.go @@ -2,7 +2,6 @@ package conf import ( "github.com/golang/protobuf/proto" - "github.com/xtls/xray-core/proxy/dokodemo" ) diff --git a/infra/conf/freedom.go b/infra/conf/freedom.go index 3ba8e321d..60dfd5b87 100644 --- a/infra/conf/freedom.go +++ b/infra/conf/freedom.go @@ -5,7 +5,6 @@ import ( "strings" "github.com/golang/protobuf/proto" - v2net "github.com/xtls/xray-core/common/net" "github.com/xtls/xray-core/common/protocol" "github.com/xtls/xray-core/proxy/freedom" diff --git a/infra/conf/general_test.go b/infra/conf/general_test.go index d4fdcc48d..1de1109c9 100644 --- a/infra/conf/general_test.go +++ b/infra/conf/general_test.go @@ -5,7 +5,6 @@ import ( "testing" "github.com/golang/protobuf/proto" - "github.com/xtls/xray-core/common" . "github.com/xtls/xray-core/infra/conf" ) diff --git a/infra/conf/grpc.go b/infra/conf/grpc.go index f4d97af58..3813e40d9 100644 --- a/infra/conf/grpc.go +++ b/infra/conf/grpc.go @@ -2,7 +2,6 @@ package conf import ( "github.com/golang/protobuf/proto" - "github.com/xtls/xray-core/transport/internet/grpc" ) diff --git a/infra/conf/http.go b/infra/conf/http.go index 54cf178b0..c917197c4 100644 --- a/infra/conf/http.go +++ b/infra/conf/http.go @@ -4,7 +4,6 @@ import ( "encoding/json" "github.com/golang/protobuf/proto" - "github.com/xtls/xray-core/common/protocol" "github.com/xtls/xray-core/common/serial" "github.com/xtls/xray-core/proxy/http" diff --git a/infra/conf/json/reader_test.go b/infra/conf/json/reader_test.go index 145157a06..d30ab0729 100644 --- a/infra/conf/json/reader_test.go +++ b/infra/conf/json/reader_test.go @@ -6,7 +6,6 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/xtls/xray-core/common" . "github.com/xtls/xray-core/infra/conf/json" ) diff --git a/infra/conf/loopback.go b/infra/conf/loopback.go index 93b1537c6..b6d83178a 100644 --- a/infra/conf/loopback.go +++ b/infra/conf/loopback.go @@ -2,7 +2,6 @@ package conf import ( "github.com/golang/protobuf/proto" - "github.com/xtls/xray-core/proxy/loopback" ) diff --git a/infra/conf/mtproto.go b/infra/conf/mtproto.go index 4cd5972e9..88b02af59 100644 --- a/infra/conf/mtproto.go +++ b/infra/conf/mtproto.go @@ -5,7 +5,6 @@ import ( "encoding/json" "github.com/golang/protobuf/proto" - "github.com/xtls/xray-core/common/protocol" "github.com/xtls/xray-core/common/serial" "github.com/xtls/xray-core/proxy/mtproto" diff --git a/infra/conf/observatory.go b/infra/conf/observatory.go index 6dce81ca9..25a4d52cb 100644 --- a/infra/conf/observatory.go +++ b/infra/conf/observatory.go @@ -2,7 +2,6 @@ package conf import ( "github.com/golang/protobuf/proto" - "github.com/xtls/xray-core/app/observatory" "github.com/xtls/xray-core/infra/conf/cfgcommon/duration" ) diff --git a/infra/conf/reverse.go b/infra/conf/reverse.go index cfaa2c83e..1b42a63a0 100644 --- a/infra/conf/reverse.go +++ b/infra/conf/reverse.go @@ -2,7 +2,6 @@ package conf import ( "github.com/golang/protobuf/proto" - "github.com/xtls/xray-core/app/reverse" ) diff --git a/infra/conf/router.go b/infra/conf/router.go index 013a88824..e10317bd3 100644 --- a/infra/conf/router.go +++ b/infra/conf/router.go @@ -7,7 +7,6 @@ import ( "strings" "github.com/golang/protobuf/proto" - "github.com/xtls/xray-core/app/router" "github.com/xtls/xray-core/common/net" "github.com/xtls/xray-core/common/platform/filesystem" diff --git a/infra/conf/router_test.go b/infra/conf/router_test.go index 4a26c3e0d..98e31b3a7 100644 --- a/infra/conf/router_test.go +++ b/infra/conf/router_test.go @@ -8,7 +8,6 @@ import ( _ "unsafe" "github.com/golang/protobuf/proto" - "github.com/xtls/xray-core/app/router" "github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common/net" diff --git a/infra/conf/serial/loader.go b/infra/conf/serial/loader.go index 9195c6f7a..e3235675d 100644 --- a/infra/conf/serial/loader.go +++ b/infra/conf/serial/loader.go @@ -7,7 +7,6 @@ import ( "github.com/ghodss/yaml" "github.com/pelletier/go-toml" - "github.com/xtls/xray-core/common/errors" "github.com/xtls/xray-core/core" "github.com/xtls/xray-core/infra/conf" diff --git a/infra/conf/shadowsocks.go b/infra/conf/shadowsocks.go index 422b1903d..19dd035f0 100644 --- a/infra/conf/shadowsocks.go +++ b/infra/conf/shadowsocks.go @@ -4,7 +4,6 @@ import ( "strings" "github.com/golang/protobuf/proto" - "github.com/xtls/xray-core/common/protocol" "github.com/xtls/xray-core/common/serial" "github.com/xtls/xray-core/proxy/shadowsocks" diff --git a/infra/conf/socks.go b/infra/conf/socks.go index fe9205dad..490c24bde 100644 --- a/infra/conf/socks.go +++ b/infra/conf/socks.go @@ -5,7 +5,6 @@ import ( "strings" "github.com/golang/protobuf/proto" - "github.com/xtls/xray-core/common/protocol" "github.com/xtls/xray-core/common/serial" "github.com/xtls/xray-core/proxy/socks" diff --git a/infra/conf/transport_authenticators.go b/infra/conf/transport_authenticators.go index c9e42605b..703a13662 100644 --- a/infra/conf/transport_authenticators.go +++ b/infra/conf/transport_authenticators.go @@ -4,7 +4,6 @@ import ( "sort" "github.com/golang/protobuf/proto" - "github.com/xtls/xray-core/transport/internet/headers/http" "github.com/xtls/xray-core/transport/internet/headers/noop" "github.com/xtls/xray-core/transport/internet/headers/srtp" diff --git a/infra/conf/transport_internet.go b/infra/conf/transport_internet.go index d2cb35cdd..9642b792c 100644 --- a/infra/conf/transport_internet.go +++ b/infra/conf/transport_internet.go @@ -9,7 +9,6 @@ import ( "strings" "github.com/golang/protobuf/proto" - "github.com/xtls/xray-core/common/platform/filesystem" "github.com/xtls/xray-core/common/protocol" "github.com/xtls/xray-core/common/serial" diff --git a/infra/conf/transport_test.go b/infra/conf/transport_test.go index 229fd829f..3afe9729e 100644 --- a/infra/conf/transport_test.go +++ b/infra/conf/transport_test.go @@ -5,7 +5,6 @@ import ( "testing" "github.com/golang/protobuf/proto" - "github.com/xtls/xray-core/common/protocol" "github.com/xtls/xray-core/common/serial" . "github.com/xtls/xray-core/infra/conf" diff --git a/infra/conf/trojan.go b/infra/conf/trojan.go index 4fe96c071..80ae7bb65 100644 --- a/infra/conf/trojan.go +++ b/infra/conf/trojan.go @@ -7,7 +7,6 @@ import ( "syscall" "github.com/golang/protobuf/proto" - "github.com/xtls/xray-core/common/net" "github.com/xtls/xray-core/common/protocol" "github.com/xtls/xray-core/common/serial" diff --git a/infra/conf/vless.go b/infra/conf/vless.go index f5ded7a00..a3598d8be 100644 --- a/infra/conf/vless.go +++ b/infra/conf/vless.go @@ -7,7 +7,6 @@ import ( "syscall" "github.com/golang/protobuf/proto" - "github.com/xtls/xray-core/common/net" "github.com/xtls/xray-core/common/protocol" "github.com/xtls/xray-core/common/serial" diff --git a/infra/conf/vmess.go b/infra/conf/vmess.go index 9759890d4..c646bebbd 100644 --- a/infra/conf/vmess.go +++ b/infra/conf/vmess.go @@ -5,7 +5,6 @@ import ( "strings" "github.com/golang/protobuf/proto" - "github.com/xtls/xray-core/common/protocol" "github.com/xtls/xray-core/common/serial" "github.com/xtls/xray-core/common/uuid" diff --git a/infra/conf/xray_test.go b/infra/conf/xray_test.go index 3331518e9..8c8151de7 100644 --- a/infra/conf/xray_test.go +++ b/infra/conf/xray_test.go @@ -7,7 +7,6 @@ import ( "github.com/golang/protobuf/proto" "github.com/google/go-cmp/cmp" - "github.com/xtls/xray-core/app/dispatcher" "github.com/xtls/xray-core/app/log" "github.com/xtls/xray-core/app/proxyman" diff --git a/main/commands/all/api/shared.go b/main/commands/all/api/shared.go index 8fdd5f0a0..b09903689 100644 --- a/main/commands/all/api/shared.go +++ b/main/commands/all/api/shared.go @@ -13,11 +13,10 @@ import ( "strings" "time" - "google.golang.org/grpc" - "google.golang.org/protobuf/proto" - "github.com/xtls/xray-core/common/buf" "github.com/xtls/xray-core/main/commands/base" + "google.golang.org/grpc" + "google.golang.org/protobuf/proto" ) type serviceHandler func(ctx context.Context, conn *grpc.ClientConn, cmd *base.Command, args []string) string diff --git a/main/commands/all/convert.go b/main/commands/all/convert.go index 4c454861e..2ed25a135 100644 --- a/main/commands/all/convert.go +++ b/main/commands/all/convert.go @@ -10,13 +10,12 @@ import ( "strings" "time" - "google.golang.org/protobuf/proto" - "github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common/buf" "github.com/xtls/xray-core/infra/conf" "github.com/xtls/xray-core/infra/conf/serial" "github.com/xtls/xray-core/main/commands/base" + "google.golang.org/protobuf/proto" ) var cmdConvert = &base.Command{ diff --git a/proxy/dns/dns.go b/proxy/dns/dns.go index ae6e39531..ae123c28b 100644 --- a/proxy/dns/dns.go +++ b/proxy/dns/dns.go @@ -6,8 +6,6 @@ import ( "sync" "time" - "golang.org/x/net/dns/dnsmessage" - "github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common/buf" "github.com/xtls/xray-core/common/net" @@ -21,6 +19,7 @@ import ( "github.com/xtls/xray-core/transport" "github.com/xtls/xray-core/transport/internet" "github.com/xtls/xray-core/transport/internet/stat" + "golang.org/x/net/dns/dnsmessage" ) func init() { diff --git a/proxy/dns/dns_test.go b/proxy/dns/dns_test.go index 6a67e2a0a..ba6ee00e3 100644 --- a/proxy/dns/dns_test.go +++ b/proxy/dns/dns_test.go @@ -7,7 +7,6 @@ import ( "github.com/google/go-cmp/cmp" "github.com/miekg/dns" - "github.com/xtls/xray-core/app/dispatcher" dnsapp "github.com/xtls/xray-core/app/dns" "github.com/xtls/xray-core/app/policy" diff --git a/proxy/http/client.go b/proxy/http/client.go index 713842f56..ae80e354d 100644 --- a/proxy/http/client.go +++ b/proxy/http/client.go @@ -9,8 +9,6 @@ import ( "net/url" "sync" - "golang.org/x/net/http2" - "github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common/buf" "github.com/xtls/xray-core/common/bytespool" @@ -26,6 +24,7 @@ import ( "github.com/xtls/xray-core/transport/internet" "github.com/xtls/xray-core/transport/internet/stat" "github.com/xtls/xray-core/transport/internet/tls" + "golang.org/x/net/http2" ) type Client struct { diff --git a/proxy/mtproto/auth_test.go b/proxy/mtproto/auth_test.go index 9fc6a9a08..a05bc7434 100644 --- a/proxy/mtproto/auth_test.go +++ b/proxy/mtproto/auth_test.go @@ -6,7 +6,6 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/xtls/xray-core/common" . "github.com/xtls/xray-core/proxy/mtproto" ) diff --git a/proxy/shadowsocks/config.go b/proxy/shadowsocks/config.go index a2c56be14..1b977dede 100644 --- a/proxy/shadowsocks/config.go +++ b/proxy/shadowsocks/config.go @@ -8,14 +8,13 @@ import ( "crypto/sha1" "io" - "golang.org/x/crypto/chacha20poly1305" - "golang.org/x/crypto/hkdf" - "github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common/antireplay" "github.com/xtls/xray-core/common/buf" "github.com/xtls/xray-core/common/crypto" "github.com/xtls/xray-core/common/protocol" + "golang.org/x/crypto/chacha20poly1305" + "golang.org/x/crypto/hkdf" ) // MemoryAccount is an account type converted from Account. @@ -26,9 +25,7 @@ type MemoryAccount struct { replayFilter antireplay.GeneralizedReplayFilter } -var ( - ErrIVNotUnique = newError("IV is not unique") -) +var ErrIVNotUnique = newError("IV is not unique") // Equals implements protocol.Account.Equals(). func (a *MemoryAccount) Equals(another protocol.Account) bool { diff --git a/proxy/shadowsocks/config_test.go b/proxy/shadowsocks/config_test.go index cfc7a43b6..3db6dc2dd 100644 --- a/proxy/shadowsocks/config_test.go +++ b/proxy/shadowsocks/config_test.go @@ -5,7 +5,6 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common/buf" "github.com/xtls/xray-core/proxy/shadowsocks" diff --git a/proxy/shadowsocks/protocol.go b/proxy/shadowsocks/protocol.go index d310b009c..3176d118c 100644 --- a/proxy/shadowsocks/protocol.go +++ b/proxy/shadowsocks/protocol.go @@ -172,7 +172,6 @@ func ReadTCPResponse(user *protocol.MemoryUser, reader io.Reader) (buf.Reader, e behaviorSeed := crc32.ChecksumIEEE(hashkdf.Sum(nil)) drainer, err := drain.NewBehaviorSeedLimitedDrainer(int64(behaviorSeed), 16+38, 3266, 64) - if err != nil { return nil, newError("failed to initialize drainer").Base(err) } diff --git a/proxy/shadowsocks/protocol_test.go b/proxy/shadowsocks/protocol_test.go index 9453fa744..e1b6495ef 100644 --- a/proxy/shadowsocks/protocol_test.go +++ b/proxy/shadowsocks/protocol_test.go @@ -4,7 +4,6 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common/buf" "github.com/xtls/xray-core/common/net" diff --git a/proxy/shadowsocks/validator.go b/proxy/shadowsocks/validator.go index 5be81447c..2aa62e068 100644 --- a/proxy/shadowsocks/validator.go +++ b/proxy/shadowsocks/validator.go @@ -21,9 +21,7 @@ type Validator struct { behaviorFused bool } -var ( - ErrNotFound = newError("Not Found") -) +var ErrNotFound = newError("Not Found") // Add a Shadowsocks user. func (v *Validator) Add(u *protocol.MemoryUser) error { diff --git a/proxy/socks/protocol_test.go b/proxy/socks/protocol_test.go index c201ef7da..99e073890 100644 --- a/proxy/socks/protocol_test.go +++ b/proxy/socks/protocol_test.go @@ -5,7 +5,6 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common/buf" "github.com/xtls/xray-core/common/net" diff --git a/proxy/trojan/protocol_test.go b/proxy/trojan/protocol_test.go index d7c96ccad..038f45fdd 100644 --- a/proxy/trojan/protocol_test.go +++ b/proxy/trojan/protocol_test.go @@ -4,7 +4,6 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common/buf" "github.com/xtls/xray-core/common/net" diff --git a/proxy/trojan/server.go b/proxy/trojan/server.go index a9ce3da4a..27afcfc9e 100644 --- a/proxy/trojan/server.go +++ b/proxy/trojan/server.go @@ -343,7 +343,8 @@ func (s *Server) handleUDPPayload(ctx context.Context, clientReader *PacketReade func (s *Server) handleConnection(ctx context.Context, sessionPolicy policy.Session, destination net.Destination, clientReader buf.Reader, - clientWriter buf.Writer, dispatcher routing.Dispatcher, iConn stat.Connection, rawConn syscall.RawConn, statConn *stat.CounterConnection) error { + clientWriter buf.Writer, dispatcher routing.Dispatcher, iConn stat.Connection, rawConn syscall.RawConn, statConn *stat.CounterConnection, +) error { ctx, cancel := context.WithCancel(ctx) timer := signal.CancelAfterInactivity(ctx, cancel, sessionPolicy.Timeouts.ConnectionIdle) ctx = policy.ContextWithBufferPolicy(ctx, sessionPolicy.Buffer) diff --git a/proxy/vless/encoding/addons.go b/proxy/vless/encoding/addons.go index 8d253b8d3..2249e916e 100644 --- a/proxy/vless/encoding/addons.go +++ b/proxy/vless/encoding/addons.go @@ -4,7 +4,6 @@ import ( "io" "github.com/golang/protobuf/proto" - "github.com/xtls/xray-core/common/buf" "github.com/xtls/xray-core/common/protocol" "github.com/xtls/xray-core/proxy/vless" diff --git a/proxy/vless/encoding/encoding_test.go b/proxy/vless/encoding/encoding_test.go index 15b0468e0..ee7c6df0a 100644 --- a/proxy/vless/encoding/encoding_test.go +++ b/proxy/vless/encoding/encoding_test.go @@ -4,7 +4,6 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common/buf" "github.com/xtls/xray-core/common/net" diff --git a/proxy/vmess/encoding/auth.go b/proxy/vmess/encoding/auth.go index 095571612..09689cea8 100644 --- a/proxy/vmess/encoding/auth.go +++ b/proxy/vmess/encoding/auth.go @@ -5,10 +5,9 @@ import ( "encoding/binary" "hash/fnv" - "golang.org/x/crypto/sha3" - "github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common/crypto" + "golang.org/x/crypto/sha3" ) // Authenticate authenticates a byte array using Fnv hash. diff --git a/proxy/vmess/encoding/auth_test.go b/proxy/vmess/encoding/auth_test.go index 87e414c15..ae83076f6 100644 --- a/proxy/vmess/encoding/auth_test.go +++ b/proxy/vmess/encoding/auth_test.go @@ -5,7 +5,6 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/xtls/xray-core/common" . "github.com/xtls/xray-core/proxy/vmess/encoding" ) diff --git a/proxy/vmess/encoding/client.go b/proxy/vmess/encoding/client.go index 3d5732105..0b535d2a0 100644 --- a/proxy/vmess/encoding/client.go +++ b/proxy/vmess/encoding/client.go @@ -13,8 +13,6 @@ import ( "hash/fnv" "io" - "golang.org/x/crypto/chacha20poly1305" - "github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common/bitmask" "github.com/xtls/xray-core/common/buf" @@ -25,6 +23,7 @@ import ( "github.com/xtls/xray-core/common/serial" "github.com/xtls/xray-core/proxy/vmess" vmessaead "github.com/xtls/xray-core/proxy/vmess/aead" + "golang.org/x/crypto/chacha20poly1305" ) func hashTimestamp(h hash.Hash, t protocol.Timestamp) []byte { diff --git a/proxy/vmess/encoding/commands_test.go b/proxy/vmess/encoding/commands_test.go index 5b337b46a..17892bb63 100644 --- a/proxy/vmess/encoding/commands_test.go +++ b/proxy/vmess/encoding/commands_test.go @@ -5,7 +5,6 @@ import ( "github.com/google/go-cmp/cmp" "github.com/stretchr/testify/assert" - "github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common/buf" "github.com/xtls/xray-core/common/protocol" diff --git a/proxy/vmess/encoding/encoding_test.go b/proxy/vmess/encoding/encoding_test.go index a7ae364db..a8fd8f3af 100644 --- a/proxy/vmess/encoding/encoding_test.go +++ b/proxy/vmess/encoding/encoding_test.go @@ -5,7 +5,6 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common/buf" "github.com/xtls/xray-core/common/net" diff --git a/proxy/vmess/encoding/server.go b/proxy/vmess/encoding/server.go index fb2620d6d..be83bb312 100644 --- a/proxy/vmess/encoding/server.go +++ b/proxy/vmess/encoding/server.go @@ -12,8 +12,6 @@ import ( "sync" "time" - "golang.org/x/crypto/chacha20poly1305" - "github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common/bitmask" "github.com/xtls/xray-core/common/buf" @@ -24,6 +22,7 @@ import ( "github.com/xtls/xray-core/common/task" "github.com/xtls/xray-core/proxy/vmess" vmessaead "github.com/xtls/xray-core/proxy/vmess/aead" + "golang.org/x/crypto/chacha20poly1305" ) type sessionID struct { @@ -140,7 +139,6 @@ func (s *ServerSession) DecodeRequestHeader(reader io.Reader, isDrain bool) (*pr buffer := buf.New() drainer, err := drain.NewBehaviorSeedLimitedDrainer(int64(s.userValidator.GetBehaviorSeed()), 16+38, 3266, 64) - if err != nil { return nil, newError("failed to initialize drainer").Base(err) } diff --git a/testing/scenarios/command_test.go b/testing/scenarios/command_test.go index 2d1dc5ad0..d82e6a371 100644 --- a/testing/scenarios/command_test.go +++ b/testing/scenarios/command_test.go @@ -10,8 +10,6 @@ import ( "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" - "google.golang.org/grpc" - "github.com/xtls/xray-core/app/commander" "github.com/xtls/xray-core/app/policy" "github.com/xtls/xray-core/app/proxyman" @@ -31,6 +29,7 @@ import ( "github.com/xtls/xray-core/proxy/vmess/inbound" "github.com/xtls/xray-core/proxy/vmess/outbound" "github.com/xtls/xray-core/testing/servers/tcp" + "google.golang.org/grpc" ) func TestCommanderRemoveHandler(t *testing.T) { diff --git a/testing/scenarios/common.go b/testing/scenarios/common.go index 88477ed68..f011a64f8 100644 --- a/testing/scenarios/common.go +++ b/testing/scenarios/common.go @@ -15,7 +15,6 @@ import ( "time" "github.com/golang/protobuf/proto" - "github.com/xtls/xray-core/app/dispatcher" "github.com/xtls/xray-core/app/proxyman" "github.com/xtls/xray-core/common" diff --git a/testing/scenarios/dns_test.go b/testing/scenarios/dns_test.go index 81c20a664..3280cbec7 100644 --- a/testing/scenarios/dns_test.go +++ b/testing/scenarios/dns_test.go @@ -5,8 +5,6 @@ import ( "testing" "time" - xproxy "golang.org/x/net/proxy" - "github.com/xtls/xray-core/app/dns" "github.com/xtls/xray-core/app/proxyman" "github.com/xtls/xray-core/app/router" @@ -18,6 +16,7 @@ import ( "github.com/xtls/xray-core/proxy/freedom" "github.com/xtls/xray-core/proxy/socks" "github.com/xtls/xray-core/testing/servers/tcp" + xproxy "golang.org/x/net/proxy" ) func TestResolveIP(t *testing.T) { diff --git a/testing/scenarios/dokodemo_test.go b/testing/scenarios/dokodemo_test.go index b13bae27d..69032b6ed 100644 --- a/testing/scenarios/dokodemo_test.go +++ b/testing/scenarios/dokodemo_test.go @@ -4,8 +4,6 @@ import ( "testing" "time" - "golang.org/x/sync/errgroup" - "github.com/xtls/xray-core/app/log" "github.com/xtls/xray-core/app/proxyman" "github.com/xtls/xray-core/common" @@ -22,6 +20,7 @@ import ( "github.com/xtls/xray-core/proxy/vmess/outbound" "github.com/xtls/xray-core/testing/servers/tcp" "github.com/xtls/xray-core/testing/servers/udp" + "golang.org/x/sync/errgroup" ) func TestDokodemoTCP(t *testing.T) { diff --git a/testing/scenarios/feature_test.go b/testing/scenarios/feature_test.go index 6a69e2bb3..bee4598f9 100644 --- a/testing/scenarios/feature_test.go +++ b/testing/scenarios/feature_test.go @@ -8,8 +8,6 @@ import ( "testing" "time" - xproxy "golang.org/x/net/proxy" - "github.com/xtls/xray-core/app/dispatcher" "github.com/xtls/xray-core/app/log" "github.com/xtls/xray-core/app/proxyman" @@ -34,6 +32,7 @@ import ( "github.com/xtls/xray-core/testing/servers/tcp" "github.com/xtls/xray-core/testing/servers/udp" "github.com/xtls/xray-core/transport/internet" + xproxy "golang.org/x/net/proxy" ) func TestPassiveConnection(t *testing.T) { diff --git a/testing/scenarios/http_test.go b/testing/scenarios/http_test.go index c81f089b3..d6a765bb0 100644 --- a/testing/scenarios/http_test.go +++ b/testing/scenarios/http_test.go @@ -11,7 +11,6 @@ import ( "time" "github.com/google/go-cmp/cmp" - "github.com/xtls/xray-core/app/proxyman" "github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common/buf" diff --git a/testing/scenarios/policy_test.go b/testing/scenarios/policy_test.go index 463ad0201..e45748d5d 100644 --- a/testing/scenarios/policy_test.go +++ b/testing/scenarios/policy_test.go @@ -5,8 +5,6 @@ import ( "testing" "time" - "golang.org/x/sync/errgroup" - "github.com/xtls/xray-core/app/log" "github.com/xtls/xray-core/app/policy" "github.com/xtls/xray-core/app/proxyman" @@ -23,6 +21,7 @@ import ( "github.com/xtls/xray-core/proxy/vmess/inbound" "github.com/xtls/xray-core/proxy/vmess/outbound" "github.com/xtls/xray-core/testing/servers/tcp" + "golang.org/x/sync/errgroup" ) func startQuickClosingTCPServer() (net.Listener, error) { diff --git a/testing/scenarios/reverse_test.go b/testing/scenarios/reverse_test.go index 0629a3b2f..a87020b6b 100644 --- a/testing/scenarios/reverse_test.go +++ b/testing/scenarios/reverse_test.go @@ -4,8 +4,6 @@ import ( "testing" "time" - "golang.org/x/sync/errgroup" - "github.com/xtls/xray-core/app/log" "github.com/xtls/xray-core/app/policy" "github.com/xtls/xray-core/app/proxyman" @@ -25,6 +23,7 @@ import ( "github.com/xtls/xray-core/proxy/vmess/inbound" "github.com/xtls/xray-core/proxy/vmess/outbound" "github.com/xtls/xray-core/testing/servers/tcp" + "golang.org/x/sync/errgroup" ) func TestReverseProxy(t *testing.T) { diff --git a/testing/scenarios/shadowsocks_test.go b/testing/scenarios/shadowsocks_test.go index e1403ab9f..d6b8ee828 100644 --- a/testing/scenarios/shadowsocks_test.go +++ b/testing/scenarios/shadowsocks_test.go @@ -4,8 +4,6 @@ import ( "testing" "time" - "golang.org/x/sync/errgroup" - "github.com/xtls/xray-core/app/log" "github.com/xtls/xray-core/app/proxyman" "github.com/xtls/xray-core/common" @@ -19,6 +17,7 @@ import ( "github.com/xtls/xray-core/proxy/shadowsocks" "github.com/xtls/xray-core/testing/servers/tcp" "github.com/xtls/xray-core/testing/servers/udp" + "golang.org/x/sync/errgroup" ) func TestShadowsocksChaCha20Poly1305TCP(t *testing.T) { diff --git a/testing/scenarios/socks_test.go b/testing/scenarios/socks_test.go index 829646fe0..cb158c586 100644 --- a/testing/scenarios/socks_test.go +++ b/testing/scenarios/socks_test.go @@ -4,9 +4,6 @@ import ( "testing" "time" - xproxy "golang.org/x/net/proxy" - socks4 "h12.io/socks" - "github.com/xtls/xray-core/app/proxyman" "github.com/xtls/xray-core/app/router" "github.com/xtls/xray-core/common" @@ -20,6 +17,8 @@ import ( "github.com/xtls/xray-core/proxy/socks" "github.com/xtls/xray-core/testing/servers/tcp" "github.com/xtls/xray-core/testing/servers/udp" + xproxy "golang.org/x/net/proxy" + socks4 "h12.io/socks" ) func TestSocksBridgeTCP(t *testing.T) { diff --git a/testing/scenarios/tls_test.go b/testing/scenarios/tls_test.go index c7ffc8343..cac1d4993 100644 --- a/testing/scenarios/tls_test.go +++ b/testing/scenarios/tls_test.go @@ -6,8 +6,6 @@ import ( "testing" "time" - "golang.org/x/sync/errgroup" - "github.com/xtls/xray-core/app/proxyman" "github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common/net" @@ -28,6 +26,7 @@ import ( "github.com/xtls/xray-core/transport/internet/http" "github.com/xtls/xray-core/transport/internet/tls" "github.com/xtls/xray-core/transport/internet/websocket" + "golang.org/x/sync/errgroup" ) func TestSimpleTLSConnection(t *testing.T) { diff --git a/testing/scenarios/transport_test.go b/testing/scenarios/transport_test.go index d8b606de0..e1db105ea 100644 --- a/testing/scenarios/transport_test.go +++ b/testing/scenarios/transport_test.go @@ -6,8 +6,6 @@ import ( "testing" "time" - "golang.org/x/sync/errgroup" - "github.com/xtls/xray-core/app/log" "github.com/xtls/xray-core/app/proxyman" "github.com/xtls/xray-core/common" @@ -30,6 +28,7 @@ import ( "github.com/xtls/xray-core/transport/internet/headers/wechat" "github.com/xtls/xray-core/transport/internet/quic" tcptransport "github.com/xtls/xray-core/transport/internet/tcp" + "golang.org/x/sync/errgroup" ) func TestHTTPConnectionHeader(t *testing.T) { diff --git a/testing/scenarios/vmess_test.go b/testing/scenarios/vmess_test.go index c53195210..9f2b0abc6 100644 --- a/testing/scenarios/vmess_test.go +++ b/testing/scenarios/vmess_test.go @@ -5,8 +5,6 @@ import ( "testing" "time" - "golang.org/x/sync/errgroup" - "github.com/xtls/xray-core/app/log" "github.com/xtls/xray-core/app/proxyman" "github.com/xtls/xray-core/common" @@ -25,6 +23,7 @@ import ( "github.com/xtls/xray-core/testing/servers/udp" "github.com/xtls/xray-core/transport/internet" "github.com/xtls/xray-core/transport/internet/kcp" + "golang.org/x/sync/errgroup" ) func TestVMessDynamicPort(t *testing.T) { diff --git a/transport/internet/dialer_test.go b/transport/internet/dialer_test.go index 232ee7098..c20f7a6ec 100644 --- a/transport/internet/dialer_test.go +++ b/transport/internet/dialer_test.go @@ -5,7 +5,6 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common/net" "github.com/xtls/xray-core/testing/servers/tcp" diff --git a/transport/internet/domainsocket/listener.go b/transport/internet/domainsocket/listener.go index c59e515d8..a8185d6b8 100644 --- a/transport/internet/domainsocket/listener.go +++ b/transport/internet/domainsocket/listener.go @@ -10,14 +10,13 @@ import ( "strings" goxtls "github.com/xtls/go" - "golang.org/x/sys/unix" - "github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common/net" "github.com/xtls/xray-core/transport/internet" "github.com/xtls/xray-core/transport/internet/stat" "github.com/xtls/xray-core/transport/internet/tls" "github.com/xtls/xray-core/transport/internet/xtls" + "golang.org/x/sys/unix" ) type Listener struct { diff --git a/transport/internet/grpc/dial.go b/transport/internet/grpc/dial.go index 50b097349..07fe40e81 100644 --- a/transport/internet/grpc/dial.go +++ b/transport/internet/grpc/dial.go @@ -6,12 +6,6 @@ import ( "sync" "time" - "google.golang.org/grpc" - "google.golang.org/grpc/backoff" - "google.golang.org/grpc/connectivity" - "google.golang.org/grpc/credentials" - "google.golang.org/grpc/keepalive" - "github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common/net" "github.com/xtls/xray-core/common/session" @@ -19,6 +13,11 @@ import ( "github.com/xtls/xray-core/transport/internet/grpc/encoding" "github.com/xtls/xray-core/transport/internet/stat" "github.com/xtls/xray-core/transport/internet/tls" + "google.golang.org/grpc" + "google.golang.org/grpc/backoff" + "google.golang.org/grpc/connectivity" + "google.golang.org/grpc/credentials" + "google.golang.org/grpc/keepalive" ) func Dial(ctx context.Context, dest net.Destination, streamSettings *internet.MemoryStreamConfig) (stat.Connection, error) { diff --git a/transport/internet/grpc/encoding/hunkconn.go b/transport/internet/grpc/encoding/hunkconn.go index 44c06322e..cfa0d5279 100644 --- a/transport/internet/grpc/encoding/hunkconn.go +++ b/transport/internet/grpc/encoding/hunkconn.go @@ -5,13 +5,12 @@ import ( "io" "net" - "google.golang.org/grpc/metadata" - "google.golang.org/grpc/peer" - "github.com/xtls/xray-core/common/buf" xnet "github.com/xtls/xray-core/common/net" "github.com/xtls/xray-core/common/net/cnc" "github.com/xtls/xray-core/common/signal/done" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/peer" ) type HunkConn interface { diff --git a/transport/internet/grpc/encoding/multiconn.go b/transport/internet/grpc/encoding/multiconn.go index 750268efd..ec5039470 100644 --- a/transport/internet/grpc/encoding/multiconn.go +++ b/transport/internet/grpc/encoding/multiconn.go @@ -5,13 +5,12 @@ import ( "io" "net" - "google.golang.org/grpc/metadata" - "google.golang.org/grpc/peer" - "github.com/xtls/xray-core/common/buf" xnet "github.com/xtls/xray-core/common/net" "github.com/xtls/xray-core/common/net/cnc" "github.com/xtls/xray-core/common/signal/done" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/peer" ) type MultiHunkConn interface { diff --git a/transport/internet/grpc/hub.go b/transport/internet/grpc/hub.go index 40bb0b511..4f5530700 100644 --- a/transport/internet/grpc/hub.go +++ b/transport/internet/grpc/hub.go @@ -4,16 +4,15 @@ import ( "context" "time" - "google.golang.org/grpc" - "google.golang.org/grpc/credentials" - "google.golang.org/grpc/keepalive" - "github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common/net" "github.com/xtls/xray-core/common/session" "github.com/xtls/xray-core/transport/internet" "github.com/xtls/xray-core/transport/internet/grpc/encoding" "github.com/xtls/xray-core/transport/internet/tls" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials" + "google.golang.org/grpc/keepalive" ) type Listener struct { diff --git a/transport/internet/headers/http/linkedreadRequest.go b/transport/internet/headers/http/linkedreadRequest.go index 457733125..a485403ef 100644 --- a/transport/internet/headers/http/linkedreadRequest.go +++ b/transport/internet/headers/http/linkedreadRequest.go @@ -3,7 +3,6 @@ package http import ( "bufio" "net/http" - // required to use go:linkname _ "unsafe" ) diff --git a/transport/internet/http/dialer.go b/transport/internet/http/dialer.go index f96491564..309471034 100644 --- a/transport/internet/http/dialer.go +++ b/transport/internet/http/dialer.go @@ -8,8 +8,6 @@ import ( "sync" "time" - "golang.org/x/net/http2" - "github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common/buf" "github.com/xtls/xray-core/common/net" @@ -19,6 +17,7 @@ import ( "github.com/xtls/xray-core/transport/internet/stat" "github.com/xtls/xray-core/transport/internet/tls" "github.com/xtls/xray-core/transport/pipe" + "golang.org/x/net/http2" ) type dialerConf struct { diff --git a/transport/internet/http/http_test.go b/transport/internet/http/http_test.go index caf2a509d..3639eb846 100644 --- a/transport/internet/http/http_test.go +++ b/transport/internet/http/http_test.go @@ -7,7 +7,6 @@ import ( "time" "github.com/google/go-cmp/cmp" - "github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common/buf" "github.com/xtls/xray-core/common/net" diff --git a/transport/internet/http/hub.go b/transport/internet/http/hub.go index 4a9b89898..131492673 100644 --- a/transport/internet/http/hub.go +++ b/transport/internet/http/hub.go @@ -7,9 +7,6 @@ import ( "strings" "time" - "golang.org/x/net/http2" - "golang.org/x/net/http2/h2c" - "github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common/net" "github.com/xtls/xray-core/common/net/cnc" @@ -19,6 +16,8 @@ import ( "github.com/xtls/xray-core/common/signal/done" "github.com/xtls/xray-core/transport/internet" "github.com/xtls/xray-core/transport/internet/tls" + "golang.org/x/net/http2" + "golang.org/x/net/http2/h2c" ) type Listener struct { diff --git a/transport/internet/kcp/crypt_test.go b/transport/internet/kcp/crypt_test.go index 42b177d7a..9b7d6ce6b 100644 --- a/transport/internet/kcp/crypt_test.go +++ b/transport/internet/kcp/crypt_test.go @@ -4,7 +4,6 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/xtls/xray-core/common" . "github.com/xtls/xray-core/transport/internet/kcp" ) diff --git a/transport/internet/kcp/kcp_test.go b/transport/internet/kcp/kcp_test.go index 641dd6e3f..985d33d29 100644 --- a/transport/internet/kcp/kcp_test.go +++ b/transport/internet/kcp/kcp_test.go @@ -8,14 +8,13 @@ import ( "time" "github.com/google/go-cmp/cmp" - "golang.org/x/sync/errgroup" - "github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common/errors" "github.com/xtls/xray-core/common/net" "github.com/xtls/xray-core/transport/internet" . "github.com/xtls/xray-core/transport/internet/kcp" "github.com/xtls/xray-core/transport/internet/stat" + "golang.org/x/sync/errgroup" ) func TestDialAndListen(t *testing.T) { diff --git a/transport/internet/kcp/listener.go b/transport/internet/kcp/listener.go index aa0443acf..6cf2a5398 100644 --- a/transport/internet/kcp/listener.go +++ b/transport/internet/kcp/listener.go @@ -7,7 +7,6 @@ import ( "sync" goxtls "github.com/xtls/go" - "github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common/buf" "github.com/xtls/xray-core/common/net" diff --git a/transport/internet/kcp/segment_test.go b/transport/internet/kcp/segment_test.go index 571023423..daa9098a7 100644 --- a/transport/internet/kcp/segment_test.go +++ b/transport/internet/kcp/segment_test.go @@ -5,7 +5,6 @@ import ( "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" - . "github.com/xtls/xray-core/transport/internet/kcp" ) diff --git a/transport/internet/quic/config.go b/transport/internet/quic/config.go index 6f91ff72b..fe13eec60 100644 --- a/transport/internet/quic/config.go +++ b/transport/internet/quic/config.go @@ -5,11 +5,10 @@ import ( "crypto/cipher" "crypto/sha256" - "golang.org/x/crypto/chacha20poly1305" - "github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common/protocol" "github.com/xtls/xray-core/transport/internet" + "golang.org/x/crypto/chacha20poly1305" ) func getAuth(config *Config) (cipher.AEAD, error) { diff --git a/transport/internet/quic/conn.go b/transport/internet/quic/conn.go index 648b5fccd..a349eb42d 100644 --- a/transport/internet/quic/conn.go +++ b/transport/internet/quic/conn.go @@ -8,7 +8,6 @@ import ( "time" "github.com/lucas-clemente/quic-go" - "github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common/buf" "github.com/xtls/xray-core/common/net" diff --git a/transport/internet/quic/dialer.go b/transport/internet/quic/dialer.go index 386952f7f..cc0a3a4ca 100644 --- a/transport/internet/quic/dialer.go +++ b/transport/internet/quic/dialer.go @@ -9,7 +9,6 @@ import ( "github.com/lucas-clemente/quic-go" "github.com/lucas-clemente/quic-go/logging" "github.com/lucas-clemente/quic-go/qlog" - "github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common/net" "github.com/xtls/xray-core/common/task" diff --git a/transport/internet/quic/hub.go b/transport/internet/quic/hub.go index 8858bfbf4..b879c4bdf 100644 --- a/transport/internet/quic/hub.go +++ b/transport/internet/quic/hub.go @@ -8,7 +8,6 @@ import ( "github.com/lucas-clemente/quic-go" "github.com/lucas-clemente/quic-go/logging" "github.com/lucas-clemente/quic-go/qlog" - "github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common/net" "github.com/xtls/xray-core/common/protocol/tls/cert" diff --git a/transport/internet/quic/quic_test.go b/transport/internet/quic/quic_test.go index c3c828221..ab0710589 100644 --- a/transport/internet/quic/quic_test.go +++ b/transport/internet/quic/quic_test.go @@ -7,7 +7,6 @@ import ( "time" "github.com/google/go-cmp/cmp" - "github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common/buf" "github.com/xtls/xray-core/common/net" diff --git a/transport/internet/sockopt_test.go b/transport/internet/sockopt_test.go index be3f4d908..cc82bc214 100644 --- a/transport/internet/sockopt_test.go +++ b/transport/internet/sockopt_test.go @@ -5,7 +5,6 @@ import ( "testing" "github.com/google/go-cmp/cmp" - "github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common/buf" "github.com/xtls/xray-core/testing/servers/tcp" diff --git a/transport/internet/system_listener.go b/transport/internet/system_listener.go index 31fb71ec3..730339f50 100644 --- a/transport/internet/system_listener.go +++ b/transport/internet/system_listener.go @@ -9,7 +9,6 @@ import ( "syscall" "github.com/pires/go-proxyproto" - "github.com/xtls/xray-core/common/net" "github.com/xtls/xray-core/common/session" ) diff --git a/transport/internet/tcp/hub.go b/transport/internet/tcp/hub.go index 5ea3a613f..828bf9726 100644 --- a/transport/internet/tcp/hub.go +++ b/transport/internet/tcp/hub.go @@ -7,7 +7,6 @@ import ( "time" goxtls "github.com/xtls/go" - "github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common/net" "github.com/xtls/xray-core/common/session" @@ -39,8 +38,7 @@ func ListenTCP(ctx context.Context, address net.Address, port net.Port, streamSe if streamSettings.SocketSettings == nil { streamSettings.SocketSettings = &internet.SocketConfig{} } - streamSettings.SocketSettings.AcceptProxyProtocol = - l.config.AcceptProxyProtocol || streamSettings.SocketSettings.AcceptProxyProtocol + streamSettings.SocketSettings.AcceptProxyProtocol = l.config.AcceptProxyProtocol || streamSettings.SocketSettings.AcceptProxyProtocol } var listener net.Listener var err error diff --git a/transport/internet/tls/tls.go b/transport/internet/tls/tls.go index 8ea2ce0f0..48ae8d724 100644 --- a/transport/internet/tls/tls.go +++ b/transport/internet/tls/tls.go @@ -4,7 +4,6 @@ import ( "crypto/tls" utls "github.com/refraction-networking/utls" - "github.com/xtls/xray-core/common/buf" "github.com/xtls/xray-core/common/net" ) diff --git a/transport/internet/udp/hub_linux.go b/transport/internet/udp/hub_linux.go index 97619c197..07dc472eb 100644 --- a/transport/internet/udp/hub_linux.go +++ b/transport/internet/udp/hub_linux.go @@ -6,9 +6,8 @@ package udp import ( "syscall" - "golang.org/x/sys/unix" - "github.com/xtls/xray-core/common/net" + "golang.org/x/sys/unix" ) func RetrieveOriginalDest(oob []byte) net.Destination { diff --git a/transport/internet/websocket/connection.go b/transport/internet/websocket/connection.go index d5dd74195..ca53b619a 100644 --- a/transport/internet/websocket/connection.go +++ b/transport/internet/websocket/connection.go @@ -6,7 +6,6 @@ import ( "time" "github.com/gorilla/websocket" - "github.com/xtls/xray-core/common/buf" "github.com/xtls/xray-core/common/errors" "github.com/xtls/xray-core/common/serial" diff --git a/transport/internet/websocket/dialer.go b/transport/internet/websocket/dialer.go index 971779384..284d8deed 100644 --- a/transport/internet/websocket/dialer.go +++ b/transport/internet/websocket/dialer.go @@ -11,7 +11,6 @@ import ( "time" "github.com/gorilla/websocket" - "github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common/net" "github.com/xtls/xray-core/common/session" diff --git a/transport/internet/websocket/hub.go b/transport/internet/websocket/hub.go index 4f377ebef..c0cf34467 100644 --- a/transport/internet/websocket/hub.go +++ b/transport/internet/websocket/hub.go @@ -12,7 +12,6 @@ import ( "time" "github.com/gorilla/websocket" - "github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common/net" http_proto "github.com/xtls/xray-core/common/protocol/http" @@ -89,8 +88,7 @@ func ListenWS(ctx context.Context, address net.Address, port net.Port, streamSet if streamSettings.SocketSettings == nil { streamSettings.SocketSettings = &internet.SocketConfig{} } - streamSettings.SocketSettings.AcceptProxyProtocol = - l.config.AcceptProxyProtocol || streamSettings.SocketSettings.AcceptProxyProtocol + streamSettings.SocketSettings.AcceptProxyProtocol = l.config.AcceptProxyProtocol || streamSettings.SocketSettings.AcceptProxyProtocol } var listener net.Listener var err error diff --git a/transport/internet/xtls/config.go b/transport/internet/xtls/config.go index bf5283cee..c1d93f4c6 100644 --- a/transport/internet/xtls/config.go +++ b/transport/internet/xtls/config.go @@ -9,7 +9,6 @@ import ( "time" xtls "github.com/xtls/go" - "github.com/xtls/xray-core/common/net" "github.com/xtls/xray-core/common/ocsp" "github.com/xtls/xray-core/common/platform/filesystem" diff --git a/transport/internet/xtls/config_test.go b/transport/internet/xtls/config_test.go index 6342ba072..bd7fbf1d1 100644 --- a/transport/internet/xtls/config_test.go +++ b/transport/internet/xtls/config_test.go @@ -6,7 +6,6 @@ import ( "time" xtls "github.com/xtls/go" - "github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common/protocol/tls/cert" . "github.com/xtls/xray-core/transport/internet/xtls"