diff --git a/app/commander/commander.go b/app/commander/commander.go index 666a247..c03da83 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 d9bc176..510f321 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 7143ccf..93dd348 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 366b6ff..ad879da 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 50f2062..b3a8def 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 9f5e379..de0d794 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 76e8968..6530d1a 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 2a42b65..76ccbca 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 dd8c881..40533b1 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 6286c3e..86161a8 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 d439a93..f5cae5a 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 83cc322..63be44b 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 9e87d8e..cf445b4 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 50dc62f..99206bf 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 4e4ea74..da36235 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 3674701..fc8e5d6 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 ef7223f..74a02d7 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 ddc765c..cda55f6 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 d4c5959..9b0ba07 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 9f79207..0c1fac5 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 a86fec1..576818c 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 5f2ec2a..9782d6c 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 101990b..f422e62 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 998d3a1..0f81c26 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 cc8b422..4b86c3a 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 3ad2f94..b0860a6 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 b7c43f3..50b8438 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 fff78cb..5898105 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 2322b8a..b9d252a 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 fd42156..cdcb674 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 c92a3b7..b5a5ef9 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 ef473a2..5d98eb4 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 f77bca8..1b71e99 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 0b24157..e8c40ae 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 3c9f542..24dc3db 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 a58ba98..3f56c7a 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 3a49d55..596ae4e 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 e5cd5ec..cb2f831 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 762c3ee..4f9499a 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 e9f4617..dbab9c7 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 686527f..20c3579 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 0f293b9..6af8e0a 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 4a51ea7..a552cda 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 8753769..a38e873 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 28c4732..fd166cc 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 0063c06..7837a86 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 282ff21..39def2a 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 1fec367..906a7b8 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 f6b19a4..0c2b185 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 7aadf3e..02140c0 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 b18adf8..ceecded 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 1bb22f7..0c215a7 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 80a0402..80e243a 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 d6fb86c..f3cb511 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 f096715..369d1b1 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 d871e03..87ebe0a 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 7e9b24d..6f26ca5 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 c531855..5892226 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 423585e..ec640df 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 2439579..2355cc0 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 6a5bc3a..59de0f4 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 462bccc..7aff1fc 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 2725278..eb51a61 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 e2fdeed..c1551de 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 f7c9985..a548403 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 c96846e..90a5d65 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 cbd5d67..c97c5be 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 8c744d0..03a21d7 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 3ba8e32..60dfd5b 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 d4fdcc4..1de1109 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 f4d97af..3813e40 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 54cf178..c917197 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 145157a..d30ab07 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 93b1537..b6d8317 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 4cd5972..88b02af 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 6dce81c..25a4d52 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 cfaa2c8..1b42a63 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 013a888..e10317b 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 4a26c3e..98e31b3 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 9195c6f..e323567 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 422b190..19dd035 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 fe9205d..490c24b 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 c9e4260..703a136 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 d2cb35c..9642b79 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 229fd82..3afe972 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 4fe96c0..80ae7bb 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 f5ded7a..a3598d8 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 9759890..c646beb 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 3331518..8c8151d 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 8fdd5f0..b099036 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 4c45486..2ed25a1 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 ae6e395..ae123c2 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 6a67e2a..ba6ee00 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 713842f..ae80e35 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 9fc6a9a..a05bc74 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 a2c56be..1b977de 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 cfc7a43..3db6dc2 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 d310b00..3176d11 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 9453fa7..e1b6495 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 5be8144..2aa62e0 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 c201ef7..99e0738 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 d7c96cc..038f45f 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 a9ce3da..27afcfc 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 8d253b8..2249e91 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 15b0468..ee7c6df 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 0955716..09689ce 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 87e414c..ae83076 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 3d57321..0b535d2 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 5b337b4..17892bb 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 a7ae364..a8fd8f3 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 fb2620d..be83bb3 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 2d1dc5a..d82e6a3 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 88477ed..f011a64 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 81c20a6..3280cbe 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 b13bae2..69032b6 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 6a69e2b..bee4598 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 c81f089..d6a765b 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 463ad02..e45748d 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 0629a3b..a87020b 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 e1403ab..d6b8ee8 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 829646f..cb158c5 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 c7ffc83..cac1d49 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 d8b606d..e1db105 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 c531952..9f2b0ab 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 232ee70..c20f7a6 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 c59e515..a8185d6 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 50b0973..07fe40e 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 44c0632..cfa0d52 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 750268e..ec50394 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 40bb0b5..4f55307 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 4577331..a485403 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 f964915..3094710 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 caf2a50..3639eb8 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 4a9b898..1314926 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 42b177d..9b7d6ce 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 641dd6e..985d33d 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 aa0443a..6cf2a53 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 5710234..daa9098 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 6f91ff7..fe13eec 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 648b5fc..a349eb4 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 386952f..cc0a3a4 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 8858bfb..b879c4b 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 c3c8282..ab07105 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 be3f4d9..cc82bc2 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 31fb71e..730339f 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 5ea3a61..828bf97 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 8ea2ce0..48ae8d7 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 97619c1..07dc472 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 d5dd741..ca53b61 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 9717793..284d8de 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 4f377eb..c0cf344 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 bf5283c..c1d93f4 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 6342ba0..bd7fbf1 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"