From f448b6b97741f59c4672497f89d4eca0e0f99eff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Fri, 8 Jul 2022 23:03:57 +0800 Subject: [PATCH] Update gci format --- adapter/inbound.go | 3 +-- adapter/router.go | 3 +-- box.go | 7 +++---- cmd/sing-box/cmd_check.go | 1 - cmd/sing-box/cmd_run.go | 1 - cmd/sing-box/cmd_version.go | 3 +-- common/dialer/default.go | 5 ++--- common/dialer/detour.go | 3 +-- common/dialer/dialer.go | 5 ++--- common/dialer/override.go | 5 ++--- common/dialer/parallel.go | 3 +-- common/dialer/resolve.go | 5 ++--- common/dialer/resolve_conn.go | 5 ++--- common/sniff/dns.go | 5 ++--- common/sniff/http.go | 3 +-- common/sniff/tls.go | 3 +-- dns/client.go | 7 +++---- dns/client_test.go | 5 ++--- dns/dialer.go | 5 ++--- dns/transport.go | 5 ++--- dns/transport_base.go | 5 ++--- dns/transport_https.go | 5 ++--- dns/transport_local.go | 3 +-- dns/transport_tcp.go | 5 ++--- dns/transport_test.go | 5 ++--- dns/transport_tls.go | 5 ++--- dns/transport_udp.go | 5 ++--- format.go | 2 +- inbound/builder.go | 7 +++---- inbound/default.go | 9 ++++----- inbound/direct.go | 9 ++++----- inbound/http.go | 7 +++---- inbound/mixed.go | 9 ++++----- inbound/shadowsocks.go | 16 +++++++--------- inbound/shadowsocks_multi.go | 14 ++++++-------- inbound/shadowsocks_relay.go | 14 ++++++-------- inbound/socks.go | 7 +++---- log/logrus.go | 3 +-- option/dns.go | 3 +-- option/inbound.go | 3 +-- option/json.go | 3 +-- option/outbound.go | 3 +-- option/route.go | 3 +-- option/types.go | 3 +-- outbound/block.go | 5 ++--- outbound/builder.go | 7 +++---- outbound/default.go | 9 ++++----- outbound/direct.go | 5 ++--- outbound/http.go | 7 +++---- outbound/shadowsocks.go | 12 +++++------- outbound/socks.go | 7 +++---- route/router.go | 17 ++++++++--------- route/rule.go | 7 +++---- route/rule_cidr.go | 3 +-- route/rule_dns.go | 7 +++---- route/rule_domain.go | 3 +-- route/rule_domain_regex.go | 3 +-- route/rule_geosite.go | 3 +-- route/rule_inbound.go | 3 +-- route/rule_outbound.go | 3 +-- route/rule_port.go | 3 +-- route/rule_protocol.go | 3 +-- 62 files changed, 136 insertions(+), 201 deletions(-) diff --git a/adapter/inbound.go b/adapter/inbound.go index 6d35c7572..0e9aa12bc 100644 --- a/adapter/inbound.go +++ b/adapter/inbound.go @@ -4,9 +4,8 @@ import ( "context" "net/netip" - M "github.com/sagernet/sing/common/metadata" - C "github.com/sagernet/sing-box/constant" + M "github.com/sagernet/sing/common/metadata" ) type Inbound interface { diff --git a/adapter/router.go b/adapter/router.go index 446d815c7..9f88ae11c 100644 --- a/adapter/router.go +++ b/adapter/router.go @@ -5,10 +5,9 @@ import ( "net" "net/netip" - N "github.com/sagernet/sing/common/network" - "github.com/sagernet/sing-box/common/geoip" C "github.com/sagernet/sing-box/constant" + N "github.com/sagernet/sing/common/network" "golang.org/x/net/dns/dnsmessage" ) diff --git a/box.go b/box.go index e4e941baa..3f524854e 100644 --- a/box.go +++ b/box.go @@ -4,16 +4,15 @@ import ( "context" "time" - "github.com/sagernet/sing/common" - E "github.com/sagernet/sing/common/exceptions" - F "github.com/sagernet/sing/common/format" - "github.com/sagernet/sing-box/adapter" "github.com/sagernet/sing-box/inbound" "github.com/sagernet/sing-box/log" "github.com/sagernet/sing-box/option" "github.com/sagernet/sing-box/outbound" "github.com/sagernet/sing-box/route" + "github.com/sagernet/sing/common" + E "github.com/sagernet/sing/common/exceptions" + F "github.com/sagernet/sing/common/format" ) var _ adapter.Service = (*Box)(nil) diff --git a/cmd/sing-box/cmd_check.go b/cmd/sing-box/cmd_check.go index 41a97a59d..adca5743a 100644 --- a/cmd/sing-box/cmd_check.go +++ b/cmd/sing-box/cmd_check.go @@ -5,7 +5,6 @@ import ( "os" "github.com/sagernet/sing-box" - "github.com/sagernet/sing-box/option" "github.com/goccy/go-json" diff --git a/cmd/sing-box/cmd_run.go b/cmd/sing-box/cmd_run.go index a41669fa1..b98f4000b 100644 --- a/cmd/sing-box/cmd_run.go +++ b/cmd/sing-box/cmd_run.go @@ -7,7 +7,6 @@ import ( "syscall" "github.com/sagernet/sing-box" - "github.com/sagernet/sing-box/option" "github.com/goccy/go-json" diff --git a/cmd/sing-box/cmd_version.go b/cmd/sing-box/cmd_version.go index fd3270861..989565359 100644 --- a/cmd/sing-box/cmd_version.go +++ b/cmd/sing-box/cmd_version.go @@ -4,9 +4,8 @@ import ( "os" "runtime" - F "github.com/sagernet/sing/common/format" - C "github.com/sagernet/sing-box/constant" + F "github.com/sagernet/sing/common/format" "github.com/spf13/cobra" ) diff --git a/common/dialer/default.go b/common/dialer/default.go index 430ad9bc6..c9dc63bd7 100644 --- a/common/dialer/default.go +++ b/common/dialer/default.go @@ -5,11 +5,10 @@ import ( "net" "time" - "github.com/sagernet/sing/common/control" - M "github.com/sagernet/sing/common/metadata" - C "github.com/sagernet/sing-box/constant" "github.com/sagernet/sing-box/option" + "github.com/sagernet/sing/common/control" + M "github.com/sagernet/sing/common/metadata" "github.com/database64128/tfo-go" ) diff --git a/common/dialer/detour.go b/common/dialer/detour.go index 43fa654a7..81600913d 100644 --- a/common/dialer/detour.go +++ b/common/dialer/detour.go @@ -5,11 +5,10 @@ import ( "net" "sync" + "github.com/sagernet/sing-box/adapter" E "github.com/sagernet/sing/common/exceptions" M "github.com/sagernet/sing/common/metadata" N "github.com/sagernet/sing/common/network" - - "github.com/sagernet/sing-box/adapter" ) type DetourDialer struct { diff --git a/common/dialer/dialer.go b/common/dialer/dialer.go index 3dcf06a06..4376d6194 100644 --- a/common/dialer/dialer.go +++ b/common/dialer/dialer.go @@ -3,12 +3,11 @@ package dialer import ( "time" - "github.com/sagernet/sing/common" - N "github.com/sagernet/sing/common/network" - "github.com/sagernet/sing-box/adapter" C "github.com/sagernet/sing-box/constant" "github.com/sagernet/sing-box/option" + "github.com/sagernet/sing/common" + N "github.com/sagernet/sing/common/network" ) func New(router adapter.Router, options option.DialerOptions) N.Dialer { diff --git a/common/dialer/override.go b/common/dialer/override.go index dce05c959..139d9e520 100644 --- a/common/dialer/override.go +++ b/common/dialer/override.go @@ -5,12 +5,11 @@ import ( "crypto/tls" "net" + C "github.com/sagernet/sing-box/constant" + "github.com/sagernet/sing-box/option" M "github.com/sagernet/sing/common/metadata" N "github.com/sagernet/sing/common/network" "github.com/sagernet/sing/common/uot" - - C "github.com/sagernet/sing-box/constant" - "github.com/sagernet/sing-box/option" ) var _ N.Dialer = (*OverrideDialer)(nil) diff --git a/common/dialer/parallel.go b/common/dialer/parallel.go index 227f52286..d1c44ea3a 100644 --- a/common/dialer/parallel.go +++ b/common/dialer/parallel.go @@ -6,11 +6,10 @@ import ( "net/netip" "time" + C "github.com/sagernet/sing-box/constant" "github.com/sagernet/sing/common" M "github.com/sagernet/sing/common/metadata" N "github.com/sagernet/sing/common/network" - - C "github.com/sagernet/sing-box/constant" ) func DialParallel(ctx context.Context, dialer N.Dialer, network string, destination M.Socksaddr, destinationAddresses []netip.Addr, strategy C.DomainStrategy, fallbackDelay time.Duration) (net.Conn, error) { diff --git a/common/dialer/resolve.go b/common/dialer/resolve.go index 51b707e72..864d74ba7 100644 --- a/common/dialer/resolve.go +++ b/common/dialer/resolve.go @@ -6,11 +6,10 @@ import ( "net/netip" "time" - M "github.com/sagernet/sing/common/metadata" - N "github.com/sagernet/sing/common/network" - "github.com/sagernet/sing-box/adapter" C "github.com/sagernet/sing-box/constant" + M "github.com/sagernet/sing/common/metadata" + N "github.com/sagernet/sing/common/network" ) type ResolveDialer struct { diff --git a/common/dialer/resolve_conn.go b/common/dialer/resolve_conn.go index 9def84987..42fc10b20 100644 --- a/common/dialer/resolve_conn.go +++ b/common/dialer/resolve_conn.go @@ -4,13 +4,12 @@ import ( "context" "net" + "github.com/sagernet/sing-box/adapter" + C "github.com/sagernet/sing-box/constant" "github.com/sagernet/sing/common" "github.com/sagernet/sing/common/buf" M "github.com/sagernet/sing/common/metadata" N "github.com/sagernet/sing/common/network" - - "github.com/sagernet/sing-box/adapter" - C "github.com/sagernet/sing-box/constant" ) func NewResolvePacketConn(router adapter.Router, strategy C.DomainStrategy, conn net.PacketConn) N.NetPacketConn { diff --git a/common/sniff/dns.go b/common/sniff/dns.go index 01efae7ba..13bd7b98c 100644 --- a/common/sniff/dns.go +++ b/common/sniff/dns.go @@ -7,13 +7,12 @@ import ( "os" "time" + "github.com/sagernet/sing-box/adapter" + C "github.com/sagernet/sing-box/constant" "github.com/sagernet/sing/common" "github.com/sagernet/sing/common/buf" "github.com/sagernet/sing/common/task" - "github.com/sagernet/sing-box/adapter" - C "github.com/sagernet/sing-box/constant" - "golang.org/x/net/dns/dnsmessage" ) diff --git a/common/sniff/http.go b/common/sniff/http.go index 4a2c57353..9cd166248 100644 --- a/common/sniff/http.go +++ b/common/sniff/http.go @@ -5,10 +5,9 @@ import ( "context" "io" - "github.com/sagernet/sing/protocol/http" - "github.com/sagernet/sing-box/adapter" C "github.com/sagernet/sing-box/constant" + "github.com/sagernet/sing/protocol/http" ) func HTTPHost(ctx context.Context, reader io.Reader) (*adapter.InboundContext, error) { diff --git a/common/sniff/tls.go b/common/sniff/tls.go index a65f547e1..dcba195af 100644 --- a/common/sniff/tls.go +++ b/common/sniff/tls.go @@ -5,10 +5,9 @@ import ( "crypto/tls" "io" - "github.com/sagernet/sing/common/bufio" - "github.com/sagernet/sing-box/adapter" C "github.com/sagernet/sing-box/constant" + "github.com/sagernet/sing/common/bufio" ) func TLSClientHello(ctx context.Context, reader io.Reader) (*adapter.InboundContext, error) { diff --git a/dns/client.go b/dns/client.go index 1f5968611..b9270b2c0 100644 --- a/dns/client.go +++ b/dns/client.go @@ -7,15 +7,14 @@ import ( "strings" "time" + "github.com/sagernet/sing-box/adapter" + C "github.com/sagernet/sing-box/constant" + "github.com/sagernet/sing-box/option" "github.com/sagernet/sing/common" "github.com/sagernet/sing/common/cache" E "github.com/sagernet/sing/common/exceptions" "github.com/sagernet/sing/common/task" - "github.com/sagernet/sing-box/adapter" - C "github.com/sagernet/sing-box/constant" - "github.com/sagernet/sing-box/option" - "golang.org/x/net/dns/dnsmessage" ) diff --git a/dns/client_test.go b/dns/client_test.go index cda7f5435..4cd37f6fd 100644 --- a/dns/client_test.go +++ b/dns/client_test.go @@ -5,13 +5,12 @@ import ( "testing" "time" - M "github.com/sagernet/sing/common/metadata" - N "github.com/sagernet/sing/common/network" - C "github.com/sagernet/sing-box/constant" "github.com/sagernet/sing-box/dns" "github.com/sagernet/sing-box/log" "github.com/sagernet/sing-box/option" + M "github.com/sagernet/sing/common/metadata" + N "github.com/sagernet/sing/common/network" "github.com/stretchr/testify/require" "golang.org/x/net/dns/dnsmessage" diff --git a/dns/dialer.go b/dns/dialer.go index a2a730295..efb663eb9 100644 --- a/dns/dialer.go +++ b/dns/dialer.go @@ -4,12 +4,11 @@ import ( "context" "net" - M "github.com/sagernet/sing/common/metadata" - N "github.com/sagernet/sing/common/network" - "github.com/sagernet/sing-box/adapter" "github.com/sagernet/sing-box/common/dialer" C "github.com/sagernet/sing-box/constant" + M "github.com/sagernet/sing/common/metadata" + N "github.com/sagernet/sing/common/network" ) type DialerWrapper struct { diff --git a/dns/transport.go b/dns/transport.go index 148941961..0b959aea7 100644 --- a/dns/transport.go +++ b/dns/transport.go @@ -4,12 +4,11 @@ import ( "context" "net/url" + "github.com/sagernet/sing-box/adapter" + "github.com/sagernet/sing-box/log" E "github.com/sagernet/sing/common/exceptions" M "github.com/sagernet/sing/common/metadata" N "github.com/sagernet/sing/common/network" - - "github.com/sagernet/sing-box/adapter" - "github.com/sagernet/sing-box/log" ) func NewTransport(ctx context.Context, dialer N.Dialer, logger log.Logger, address string) (adapter.DNSTransport, error) { diff --git a/dns/transport_base.go b/dns/transport_base.go index a52a36b0c..dbc20f853 100644 --- a/dns/transport_base.go +++ b/dns/transport_base.go @@ -6,11 +6,10 @@ import ( "os" "sync" - M "github.com/sagernet/sing/common/metadata" - N "github.com/sagernet/sing/common/network" - C "github.com/sagernet/sing-box/constant" "github.com/sagernet/sing-box/log" + M "github.com/sagernet/sing/common/metadata" + N "github.com/sagernet/sing/common/network" ) type myTransportAdapter struct { diff --git a/dns/transport_https.go b/dns/transport_https.go index 039d03a5e..07a4fd20f 100644 --- a/dns/transport_https.go +++ b/dns/transport_https.go @@ -8,14 +8,13 @@ import ( "net/netip" "os" + "github.com/sagernet/sing-box/adapter" + C "github.com/sagernet/sing-box/constant" "github.com/sagernet/sing/common" "github.com/sagernet/sing/common/buf" M "github.com/sagernet/sing/common/metadata" N "github.com/sagernet/sing/common/network" - "github.com/sagernet/sing-box/adapter" - C "github.com/sagernet/sing-box/constant" - "golang.org/x/net/dns/dnsmessage" ) diff --git a/dns/transport_local.go b/dns/transport_local.go index c5e23f4ab..a70441600 100644 --- a/dns/transport_local.go +++ b/dns/transport_local.go @@ -7,10 +7,9 @@ import ( "os" "sort" - "github.com/sagernet/sing/common" - "github.com/sagernet/sing-box/adapter" C "github.com/sagernet/sing-box/constant" + "github.com/sagernet/sing/common" "golang.org/x/net/dns/dnsmessage" ) diff --git a/dns/transport_tcp.go b/dns/transport_tcp.go index 5e0f502a5..ff5385754 100644 --- a/dns/transport_tcp.go +++ b/dns/transport_tcp.go @@ -7,6 +7,8 @@ import ( "os" "sync" + "github.com/sagernet/sing-box/adapter" + "github.com/sagernet/sing-box/log" "github.com/sagernet/sing/common" "github.com/sagernet/sing/common/buf" E "github.com/sagernet/sing/common/exceptions" @@ -14,9 +16,6 @@ import ( N "github.com/sagernet/sing/common/network" "github.com/sagernet/sing/common/task" - "github.com/sagernet/sing-box/adapter" - "github.com/sagernet/sing-box/log" - "golang.org/x/net/dns/dnsmessage" ) diff --git a/dns/transport_test.go b/dns/transport_test.go index 7a929437a..cce193de6 100644 --- a/dns/transport_test.go +++ b/dns/transport_test.go @@ -5,11 +5,10 @@ import ( "testing" "time" - M "github.com/sagernet/sing/common/metadata" - N "github.com/sagernet/sing/common/network" - C "github.com/sagernet/sing-box/constant" "github.com/sagernet/sing-box/log" + M "github.com/sagernet/sing/common/metadata" + N "github.com/sagernet/sing/common/network" "github.com/stretchr/testify/require" "golang.org/x/net/dns/dnsmessage" diff --git a/dns/transport_tls.go b/dns/transport_tls.go index 152bc3fa7..be317a738 100644 --- a/dns/transport_tls.go +++ b/dns/transport_tls.go @@ -6,6 +6,8 @@ import ( "encoding/binary" "os" + "github.com/sagernet/sing-box/adapter" + "github.com/sagernet/sing-box/log" "github.com/sagernet/sing/common" "github.com/sagernet/sing/common/buf" E "github.com/sagernet/sing/common/exceptions" @@ -13,9 +15,6 @@ import ( N "github.com/sagernet/sing/common/network" "github.com/sagernet/sing/common/task" - "github.com/sagernet/sing-box/adapter" - "github.com/sagernet/sing-box/log" - "golang.org/x/net/dns/dnsmessage" ) diff --git a/dns/transport_udp.go b/dns/transport_udp.go index d60c171b3..3f2b9f4d8 100644 --- a/dns/transport_udp.go +++ b/dns/transport_udp.go @@ -4,15 +4,14 @@ import ( "context" "os" + "github.com/sagernet/sing-box/adapter" + "github.com/sagernet/sing-box/log" "github.com/sagernet/sing/common" "github.com/sagernet/sing/common/buf" M "github.com/sagernet/sing/common/metadata" N "github.com/sagernet/sing/common/network" "github.com/sagernet/sing/common/task" - "github.com/sagernet/sing-box/adapter" - "github.com/sagernet/sing-box/log" - "golang.org/x/net/dns/dnsmessage" ) diff --git a/format.go b/format.go index 16f31fb2f..6840452d4 100644 --- a/format.go +++ b/format.go @@ -4,4 +4,4 @@ package box //go:generate go install -v github.com/daixiang0/gci@latest //go:generate gofumpt -l -w . //go:generate gofmt -s -w . -//go:generate gci write -s "standard,prefix(github.com/sagernet/sing/),prefix(github.com/sagernet),prefix(github.com/sagernet/sing-box/),default" . +//go:generate gci write -s "standard,prefix(github.com/sagernet/),default" . diff --git a/inbound/builder.go b/inbound/builder.go index 3ff489872..251a2cf6e 100644 --- a/inbound/builder.go +++ b/inbound/builder.go @@ -3,14 +3,13 @@ package inbound import ( "context" - "github.com/sagernet/sing/common" - E "github.com/sagernet/sing/common/exceptions" - F "github.com/sagernet/sing/common/format" - "github.com/sagernet/sing-box/adapter" C "github.com/sagernet/sing-box/constant" "github.com/sagernet/sing-box/log" "github.com/sagernet/sing-box/option" + "github.com/sagernet/sing/common" + E "github.com/sagernet/sing/common/exceptions" + F "github.com/sagernet/sing/common/format" ) func New(ctx context.Context, router adapter.Router, logger log.Logger, index int, options option.Inbound) (adapter.Inbound, error) { diff --git a/inbound/default.go b/inbound/default.go index 5bc7f9aff..d79e7b2c2 100644 --- a/inbound/default.go +++ b/inbound/default.go @@ -8,17 +8,16 @@ import ( "sync" "time" + "github.com/sagernet/sing-box/adapter" + C "github.com/sagernet/sing-box/constant" + "github.com/sagernet/sing-box/log" + "github.com/sagernet/sing-box/option" "github.com/sagernet/sing/common" "github.com/sagernet/sing/common/buf" E "github.com/sagernet/sing/common/exceptions" M "github.com/sagernet/sing/common/metadata" N "github.com/sagernet/sing/common/network" - "github.com/sagernet/sing-box/adapter" - C "github.com/sagernet/sing-box/constant" - "github.com/sagernet/sing-box/log" - "github.com/sagernet/sing-box/option" - "github.com/database64128/tfo-go" ) diff --git a/inbound/direct.go b/inbound/direct.go index d73132620..ddfe7ac33 100644 --- a/inbound/direct.go +++ b/inbound/direct.go @@ -5,15 +5,14 @@ import ( "net" "net/netip" - "github.com/sagernet/sing/common/buf" - M "github.com/sagernet/sing/common/metadata" - N "github.com/sagernet/sing/common/network" - "github.com/sagernet/sing/common/udpnat" - "github.com/sagernet/sing-box/adapter" C "github.com/sagernet/sing-box/constant" "github.com/sagernet/sing-box/log" "github.com/sagernet/sing-box/option" + "github.com/sagernet/sing/common/buf" + M "github.com/sagernet/sing/common/metadata" + N "github.com/sagernet/sing/common/network" + "github.com/sagernet/sing/common/udpnat" ) var _ adapter.Inbound = (*Direct)(nil) diff --git a/inbound/http.go b/inbound/http.go index e9f1fcb4e..11708f800 100644 --- a/inbound/http.go +++ b/inbound/http.go @@ -5,14 +5,13 @@ import ( "context" "net" - "github.com/sagernet/sing/common/auth" - M "github.com/sagernet/sing/common/metadata" - "github.com/sagernet/sing/protocol/http" - "github.com/sagernet/sing-box/adapter" C "github.com/sagernet/sing-box/constant" "github.com/sagernet/sing-box/log" "github.com/sagernet/sing-box/option" + "github.com/sagernet/sing/common/auth" + M "github.com/sagernet/sing/common/metadata" + "github.com/sagernet/sing/protocol/http" ) var _ adapter.Inbound = (*HTTP)(nil) diff --git a/inbound/mixed.go b/inbound/mixed.go index 9607ee318..d956bc2c3 100644 --- a/inbound/mixed.go +++ b/inbound/mixed.go @@ -5,6 +5,10 @@ import ( "context" "net" + "github.com/sagernet/sing-box/adapter" + C "github.com/sagernet/sing-box/constant" + "github.com/sagernet/sing-box/log" + "github.com/sagernet/sing-box/option" "github.com/sagernet/sing/common/auth" "github.com/sagernet/sing/common/buf" "github.com/sagernet/sing/common/bufio" @@ -14,11 +18,6 @@ import ( "github.com/sagernet/sing/protocol/socks" "github.com/sagernet/sing/protocol/socks/socks4" "github.com/sagernet/sing/protocol/socks/socks5" - - "github.com/sagernet/sing-box/adapter" - C "github.com/sagernet/sing-box/constant" - "github.com/sagernet/sing-box/log" - "github.com/sagernet/sing-box/option" ) var _ adapter.Inbound = (*Mixed)(nil) diff --git a/inbound/shadowsocks.go b/inbound/shadowsocks.go index a5bdf6c6b..549b93fcf 100644 --- a/inbound/shadowsocks.go +++ b/inbound/shadowsocks.go @@ -4,19 +4,17 @@ import ( "context" "net" - "github.com/sagernet/sing/common" - "github.com/sagernet/sing/common/buf" - E "github.com/sagernet/sing/common/exceptions" - N "github.com/sagernet/sing/common/network" - - "github.com/sagernet/sing-shadowsocks" - "github.com/sagernet/sing-shadowsocks/shadowaead" - "github.com/sagernet/sing-shadowsocks/shadowaead_2022" - "github.com/sagernet/sing-box/adapter" C "github.com/sagernet/sing-box/constant" "github.com/sagernet/sing-box/log" "github.com/sagernet/sing-box/option" + "github.com/sagernet/sing-shadowsocks" + "github.com/sagernet/sing-shadowsocks/shadowaead" + "github.com/sagernet/sing-shadowsocks/shadowaead_2022" + "github.com/sagernet/sing/common" + "github.com/sagernet/sing/common/buf" + E "github.com/sagernet/sing/common/exceptions" + N "github.com/sagernet/sing/common/network" ) func NewShadowsocks(ctx context.Context, router adapter.Router, logger log.Logger, tag string, options option.ShadowsocksInboundOptions) (adapter.Inbound, error) { diff --git a/inbound/shadowsocks_multi.go b/inbound/shadowsocks_multi.go index 1d0ec6f78..b2fa7e60f 100644 --- a/inbound/shadowsocks_multi.go +++ b/inbound/shadowsocks_multi.go @@ -4,18 +4,16 @@ import ( "context" "net" - "github.com/sagernet/sing/common" - "github.com/sagernet/sing/common/buf" - F "github.com/sagernet/sing/common/format" - N "github.com/sagernet/sing/common/network" - - "github.com/sagernet/sing-shadowsocks" - "github.com/sagernet/sing-shadowsocks/shadowaead_2022" - "github.com/sagernet/sing-box/adapter" C "github.com/sagernet/sing-box/constant" "github.com/sagernet/sing-box/log" "github.com/sagernet/sing-box/option" + "github.com/sagernet/sing-shadowsocks" + "github.com/sagernet/sing-shadowsocks/shadowaead_2022" + "github.com/sagernet/sing/common" + "github.com/sagernet/sing/common/buf" + F "github.com/sagernet/sing/common/format" + N "github.com/sagernet/sing/common/network" ) var _ adapter.Inbound = (*ShadowsocksMulti)(nil) diff --git a/inbound/shadowsocks_relay.go b/inbound/shadowsocks_relay.go index f632d586f..f673a1493 100644 --- a/inbound/shadowsocks_relay.go +++ b/inbound/shadowsocks_relay.go @@ -4,18 +4,16 @@ import ( "context" "net" - "github.com/sagernet/sing/common" - "github.com/sagernet/sing/common/buf" - F "github.com/sagernet/sing/common/format" - N "github.com/sagernet/sing/common/network" - - "github.com/sagernet/sing-shadowsocks" - "github.com/sagernet/sing-shadowsocks/shadowaead_2022" - "github.com/sagernet/sing-box/adapter" C "github.com/sagernet/sing-box/constant" "github.com/sagernet/sing-box/log" "github.com/sagernet/sing-box/option" + "github.com/sagernet/sing-shadowsocks" + "github.com/sagernet/sing-shadowsocks/shadowaead_2022" + "github.com/sagernet/sing/common" + "github.com/sagernet/sing/common/buf" + F "github.com/sagernet/sing/common/format" + N "github.com/sagernet/sing/common/network" ) var _ adapter.Inbound = (*ShadowsocksMulti)(nil) diff --git a/inbound/socks.go b/inbound/socks.go index e642eef57..496804a78 100644 --- a/inbound/socks.go +++ b/inbound/socks.go @@ -4,14 +4,13 @@ import ( "context" "net" - "github.com/sagernet/sing/common/auth" - M "github.com/sagernet/sing/common/metadata" - "github.com/sagernet/sing/protocol/socks" - "github.com/sagernet/sing-box/adapter" C "github.com/sagernet/sing-box/constant" "github.com/sagernet/sing-box/log" "github.com/sagernet/sing-box/option" + "github.com/sagernet/sing/common/auth" + M "github.com/sagernet/sing/common/metadata" + "github.com/sagernet/sing/protocol/socks" ) var _ adapter.Inbound = (*Socks)(nil) diff --git a/log/logrus.go b/log/logrus.go index 4eb479784..61d8f6583 100644 --- a/log/logrus.go +++ b/log/logrus.go @@ -4,12 +4,11 @@ import ( "context" "os" + "github.com/sagernet/sing-box/option" "github.com/sagernet/sing/common" E "github.com/sagernet/sing/common/exceptions" F "github.com/sagernet/sing/common/format" - "github.com/sagernet/sing-box/option" - "github.com/sirupsen/logrus" ) diff --git a/option/dns.go b/option/dns.go index 02d6779e0..a891070dc 100644 --- a/option/dns.go +++ b/option/dns.go @@ -1,11 +1,10 @@ package option import ( + C "github.com/sagernet/sing-box/constant" "github.com/sagernet/sing/common" E "github.com/sagernet/sing/common/exceptions" - C "github.com/sagernet/sing-box/constant" - "github.com/goccy/go-json" ) diff --git a/option/inbound.go b/option/inbound.go index 65c895d1b..2d1877dbd 100644 --- a/option/inbound.go +++ b/option/inbound.go @@ -1,12 +1,11 @@ package option import ( + C "github.com/sagernet/sing-box/constant" "github.com/sagernet/sing/common" "github.com/sagernet/sing/common/auth" E "github.com/sagernet/sing/common/exceptions" - C "github.com/sagernet/sing-box/constant" - "github.com/goccy/go-json" ) diff --git a/option/json.go b/option/json.go index f73781505..f65c9d894 100644 --- a/option/json.go +++ b/option/json.go @@ -3,11 +3,10 @@ package option import ( "bytes" + "github.com/sagernet/sing-box/common/badjson" "github.com/sagernet/sing/common" E "github.com/sagernet/sing/common/exceptions" - "github.com/sagernet/sing-box/common/badjson" - "github.com/goccy/go-json" ) diff --git a/option/outbound.go b/option/outbound.go index 344f2adc9..6bf930c75 100644 --- a/option/outbound.go +++ b/option/outbound.go @@ -1,11 +1,10 @@ package option import ( + C "github.com/sagernet/sing-box/constant" E "github.com/sagernet/sing/common/exceptions" M "github.com/sagernet/sing/common/metadata" - C "github.com/sagernet/sing-box/constant" - "github.com/goccy/go-json" ) diff --git a/option/route.go b/option/route.go index 875074ea0..f26feb31a 100644 --- a/option/route.go +++ b/option/route.go @@ -1,11 +1,10 @@ package option import ( + C "github.com/sagernet/sing-box/constant" "github.com/sagernet/sing/common" E "github.com/sagernet/sing/common/exceptions" - C "github.com/sagernet/sing-box/constant" - "github.com/goccy/go-json" ) diff --git a/option/types.go b/option/types.go index dfc5aef48..3f2b2a51f 100644 --- a/option/types.go +++ b/option/types.go @@ -5,9 +5,8 @@ import ( "strings" "time" - E "github.com/sagernet/sing/common/exceptions" - C "github.com/sagernet/sing-box/constant" + E "github.com/sagernet/sing/common/exceptions" "github.com/goccy/go-json" ) diff --git a/outbound/block.go b/outbound/block.go index 8e7864427..685c00bf3 100644 --- a/outbound/block.go +++ b/outbound/block.go @@ -5,12 +5,11 @@ import ( "io" "net" - M "github.com/sagernet/sing/common/metadata" - N "github.com/sagernet/sing/common/network" - "github.com/sagernet/sing-box/adapter" C "github.com/sagernet/sing-box/constant" "github.com/sagernet/sing-box/log" + M "github.com/sagernet/sing/common/metadata" + N "github.com/sagernet/sing/common/network" ) var _ adapter.Outbound = (*Block)(nil) diff --git a/outbound/builder.go b/outbound/builder.go index 0dc8c455c..e5817aa35 100644 --- a/outbound/builder.go +++ b/outbound/builder.go @@ -1,14 +1,13 @@ package outbound import ( - "github.com/sagernet/sing/common" - E "github.com/sagernet/sing/common/exceptions" - F "github.com/sagernet/sing/common/format" - "github.com/sagernet/sing-box/adapter" C "github.com/sagernet/sing-box/constant" "github.com/sagernet/sing-box/log" "github.com/sagernet/sing-box/option" + "github.com/sagernet/sing/common" + E "github.com/sagernet/sing/common/exceptions" + F "github.com/sagernet/sing/common/format" ) func New(router adapter.Router, logger log.Logger, index int, options option.Outbound) (adapter.Outbound, error) { diff --git a/outbound/default.go b/outbound/default.go index c5c0265f0..1fafe7fa4 100644 --- a/outbound/default.go +++ b/outbound/default.go @@ -6,16 +6,15 @@ import ( "runtime" "time" + "github.com/sagernet/sing-box/adapter" + "github.com/sagernet/sing-box/common/dialer" + C "github.com/sagernet/sing-box/constant" + "github.com/sagernet/sing-box/log" "github.com/sagernet/sing/common" "github.com/sagernet/sing/common/buf" "github.com/sagernet/sing/common/bufio" E "github.com/sagernet/sing/common/exceptions" N "github.com/sagernet/sing/common/network" - - "github.com/sagernet/sing-box/adapter" - "github.com/sagernet/sing-box/common/dialer" - C "github.com/sagernet/sing-box/constant" - "github.com/sagernet/sing-box/log" ) type myOutboundAdapter struct { diff --git a/outbound/direct.go b/outbound/direct.go index 97749cffc..42446f57d 100644 --- a/outbound/direct.go +++ b/outbound/direct.go @@ -4,14 +4,13 @@ import ( "context" "net" - M "github.com/sagernet/sing/common/metadata" - N "github.com/sagernet/sing/common/network" - "github.com/sagernet/sing-box/adapter" "github.com/sagernet/sing-box/common/dialer" C "github.com/sagernet/sing-box/constant" "github.com/sagernet/sing-box/log" "github.com/sagernet/sing-box/option" + M "github.com/sagernet/sing/common/metadata" + N "github.com/sagernet/sing/common/network" ) var _ adapter.Outbound = (*Direct)(nil) diff --git a/outbound/http.go b/outbound/http.go index 2833b34a3..743135811 100644 --- a/outbound/http.go +++ b/outbound/http.go @@ -5,15 +5,14 @@ import ( "net" "os" - M "github.com/sagernet/sing/common/metadata" - N "github.com/sagernet/sing/common/network" - "github.com/sagernet/sing/protocol/http" - "github.com/sagernet/sing-box/adapter" "github.com/sagernet/sing-box/common/dialer" C "github.com/sagernet/sing-box/constant" "github.com/sagernet/sing-box/log" "github.com/sagernet/sing-box/option" + M "github.com/sagernet/sing/common/metadata" + N "github.com/sagernet/sing/common/network" + "github.com/sagernet/sing/protocol/http" ) var _ adapter.Outbound = (*HTTP)(nil) diff --git a/outbound/shadowsocks.go b/outbound/shadowsocks.go index 81510842d..d8af37ea9 100644 --- a/outbound/shadowsocks.go +++ b/outbound/shadowsocks.go @@ -4,18 +4,16 @@ import ( "context" "net" - "github.com/sagernet/sing/common/bufio" - M "github.com/sagernet/sing/common/metadata" - N "github.com/sagernet/sing/common/network" - - "github.com/sagernet/sing-shadowsocks" - "github.com/sagernet/sing-shadowsocks/shadowimpl" - "github.com/sagernet/sing-box/adapter" "github.com/sagernet/sing-box/common/dialer" C "github.com/sagernet/sing-box/constant" "github.com/sagernet/sing-box/log" "github.com/sagernet/sing-box/option" + "github.com/sagernet/sing-shadowsocks" + "github.com/sagernet/sing-shadowsocks/shadowimpl" + "github.com/sagernet/sing/common/bufio" + M "github.com/sagernet/sing/common/metadata" + N "github.com/sagernet/sing/common/network" ) var _ adapter.Outbound = (*Shadowsocks)(nil) diff --git a/outbound/socks.go b/outbound/socks.go index 833c7c94d..644fb7651 100644 --- a/outbound/socks.go +++ b/outbound/socks.go @@ -4,15 +4,14 @@ import ( "context" "net" - M "github.com/sagernet/sing/common/metadata" - N "github.com/sagernet/sing/common/network" - "github.com/sagernet/sing/protocol/socks" - "github.com/sagernet/sing-box/adapter" "github.com/sagernet/sing-box/common/dialer" C "github.com/sagernet/sing-box/constant" "github.com/sagernet/sing-box/log" "github.com/sagernet/sing-box/option" + M "github.com/sagernet/sing/common/metadata" + N "github.com/sagernet/sing/common/network" + "github.com/sagernet/sing/protocol/socks" ) var _ adapter.Outbound = (*Socks)(nil) diff --git a/route/router.go b/route/router.go index 0f34cc620..65a61430e 100644 --- a/route/router.go +++ b/route/router.go @@ -11,15 +11,6 @@ import ( "strings" "time" - "github.com/sagernet/sing/common" - "github.com/sagernet/sing/common/buf" - "github.com/sagernet/sing/common/bufio" - E "github.com/sagernet/sing/common/exceptions" - F "github.com/sagernet/sing/common/format" - M "github.com/sagernet/sing/common/metadata" - N "github.com/sagernet/sing/common/network" - "github.com/sagernet/sing/common/rw" - "github.com/sagernet/sing-box/adapter" "github.com/sagernet/sing-box/common/dialer" "github.com/sagernet/sing-box/common/geoip" @@ -29,6 +20,14 @@ import ( "github.com/sagernet/sing-box/dns" "github.com/sagernet/sing-box/log" "github.com/sagernet/sing-box/option" + "github.com/sagernet/sing/common" + "github.com/sagernet/sing/common/buf" + "github.com/sagernet/sing/common/bufio" + E "github.com/sagernet/sing/common/exceptions" + F "github.com/sagernet/sing/common/format" + M "github.com/sagernet/sing/common/metadata" + N "github.com/sagernet/sing/common/network" + "github.com/sagernet/sing/common/rw" "golang.org/x/net/dns/dnsmessage" ) diff --git a/route/rule.go b/route/rule.go index ae570cd70..d2656017c 100644 --- a/route/rule.go +++ b/route/rule.go @@ -3,14 +3,13 @@ package route import ( "strings" - "github.com/sagernet/sing/common" - E "github.com/sagernet/sing/common/exceptions" - F "github.com/sagernet/sing/common/format" - "github.com/sagernet/sing-box/adapter" C "github.com/sagernet/sing-box/constant" "github.com/sagernet/sing-box/log" "github.com/sagernet/sing-box/option" + "github.com/sagernet/sing/common" + E "github.com/sagernet/sing/common/exceptions" + F "github.com/sagernet/sing/common/format" ) func NewRule(router adapter.Router, logger log.Logger, options option.Rule) (adapter.Rule, error) { diff --git a/route/rule_cidr.go b/route/rule_cidr.go index 05636bdbd..571a41249 100644 --- a/route/rule_cidr.go +++ b/route/rule_cidr.go @@ -4,11 +4,10 @@ import ( "net/netip" "strings" + "github.com/sagernet/sing-box/adapter" "github.com/sagernet/sing/common" E "github.com/sagernet/sing/common/exceptions" F "github.com/sagernet/sing/common/format" - - "github.com/sagernet/sing-box/adapter" ) var _ RuleItem = (*IPCIDRItem)(nil) diff --git a/route/rule_dns.go b/route/rule_dns.go index 85f2bf017..7f5c0d75a 100644 --- a/route/rule_dns.go +++ b/route/rule_dns.go @@ -3,14 +3,13 @@ package route import ( "strings" - "github.com/sagernet/sing/common" - E "github.com/sagernet/sing/common/exceptions" - F "github.com/sagernet/sing/common/format" - "github.com/sagernet/sing-box/adapter" C "github.com/sagernet/sing-box/constant" "github.com/sagernet/sing-box/log" "github.com/sagernet/sing-box/option" + "github.com/sagernet/sing/common" + E "github.com/sagernet/sing/common/exceptions" + F "github.com/sagernet/sing/common/format" ) func NewDNSRule(router adapter.Router, logger log.Logger, options option.DNSRule) (adapter.Rule, error) { diff --git a/route/rule_domain.go b/route/rule_domain.go index cb09b3855..dfdee0956 100644 --- a/route/rule_domain.go +++ b/route/rule_domain.go @@ -3,10 +3,9 @@ package route import ( "strings" - "github.com/sagernet/sing/common" - "github.com/sagernet/sing-box/adapter" "github.com/sagernet/sing-box/common/domain" + "github.com/sagernet/sing/common" ) var _ RuleItem = (*DomainItem)(nil) diff --git a/route/rule_domain_regex.go b/route/rule_domain_regex.go index c5e8483b4..c9cf788bf 100644 --- a/route/rule_domain_regex.go +++ b/route/rule_domain_regex.go @@ -4,10 +4,9 @@ import ( "regexp" "strings" + "github.com/sagernet/sing-box/adapter" E "github.com/sagernet/sing/common/exceptions" F "github.com/sagernet/sing/common/format" - - "github.com/sagernet/sing-box/adapter" ) var _ RuleItem = (*DomainRegexItem)(nil) diff --git a/route/rule_geosite.go b/route/rule_geosite.go index d334c08aa..7fc5d7d6f 100644 --- a/route/rule_geosite.go +++ b/route/rule_geosite.go @@ -3,10 +3,9 @@ package route import ( "strings" - E "github.com/sagernet/sing/common/exceptions" - "github.com/sagernet/sing-box/adapter" "github.com/sagernet/sing-box/log" + E "github.com/sagernet/sing/common/exceptions" ) var _ RuleItem = (*GeositeItem)(nil) diff --git a/route/rule_inbound.go b/route/rule_inbound.go index 7e842d785..7e28781f0 100644 --- a/route/rule_inbound.go +++ b/route/rule_inbound.go @@ -3,9 +3,8 @@ package route import ( "strings" - F "github.com/sagernet/sing/common/format" - "github.com/sagernet/sing-box/adapter" + F "github.com/sagernet/sing/common/format" ) var _ RuleItem = (*InboundItem)(nil) diff --git a/route/rule_outbound.go b/route/rule_outbound.go index 612d48765..952e1b648 100644 --- a/route/rule_outbound.go +++ b/route/rule_outbound.go @@ -3,9 +3,8 @@ package route import ( "strings" - F "github.com/sagernet/sing/common/format" - "github.com/sagernet/sing-box/adapter" + F "github.com/sagernet/sing/common/format" ) var _ RuleItem = (*OutboundItem)(nil) diff --git a/route/rule_port.go b/route/rule_port.go index 20f9e9639..839325bb3 100644 --- a/route/rule_port.go +++ b/route/rule_port.go @@ -3,10 +3,9 @@ package route import ( "strings" + "github.com/sagernet/sing-box/adapter" "github.com/sagernet/sing/common" F "github.com/sagernet/sing/common/format" - - "github.com/sagernet/sing-box/adapter" ) var _ RuleItem = (*PortItem)(nil) diff --git a/route/rule_protocol.go b/route/rule_protocol.go index 33a7f5620..1988f8ade 100644 --- a/route/rule_protocol.go +++ b/route/rule_protocol.go @@ -3,9 +3,8 @@ package route import ( "strings" - F "github.com/sagernet/sing/common/format" - "github.com/sagernet/sing-box/adapter" + F "github.com/sagernet/sing/common/format" ) var _ RuleItem = (*ProtocolItem)(nil)