From 3696e81eb45867f296706638d6ab25a1aeb86754 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Wed, 6 Jul 2022 15:01:09 +0800 Subject: [PATCH] Update gci format --- adapter/router.go | 3 ++- cmd/sing-box/cmd_check.go | 4 +++- cmd/sing-box/cmd_format.go | 3 ++- cmd/sing-box/cmd_run.go | 4 +++- cmd/sing-box/cmd_version.go | 4 +++- cmd/sing-box/main.go | 1 + common/badjson/array.go | 3 ++- common/badjson/json.go | 3 ++- common/badjson/object.go | 3 ++- common/geoip/reader.go | 3 ++- common/sniff/dns.go | 6 ++++-- common/sniff/http.go | 3 ++- common/sniff/quic.go | 1 + common/sniff/tls.go | 3 ++- format.go | 2 +- inbound/builder.go | 7 ++++--- inbound/default.go | 12 +++++++----- 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 | 4 +++- log/logrus_hook.go | 3 ++- option/config.go | 3 ++- option/inbound.go | 6 ++++-- option/json.go | 6 ++++-- option/outbound.go | 6 ++++-- option/route.go | 6 ++++-- option/types.go | 6 ++++-- outbound/block.go | 5 +++-- outbound/builder.go | 7 ++++--- outbound/default.go | 3 ++- outbound/dialer/default.go | 8 +++++--- outbound/dialer/detour.go | 5 +++-- outbound/dialer/dialer.go | 5 +++-- outbound/dialer/override.go | 5 +++-- outbound/direct.go | 7 ++++--- outbound/http.go | 9 +++++---- outbound/shadowsocks.go | 14 ++++++++------ outbound/socks.go | 9 +++++---- route/router.go | 15 ++++++++------- route/rule.go | 7 ++++--- route/rule_cidr.go | 3 ++- route/rule_domain.go | 3 ++- route/rule_domain_regex.go | 3 ++- route/rule_geoip.go | 3 ++- route/rule_geosite.go | 3 ++- route/rule_inbound.go | 3 ++- route/rule_logical.go | 7 ++++--- route/rule_port.go | 3 ++- route/rule_protocol.go | 3 ++- service.go | 7 ++++--- 55 files changed, 194 insertions(+), 124 deletions(-) diff --git a/adapter/router.go b/adapter/router.go index 38826ed5..79291a8d 100644 --- a/adapter/router.go +++ b/adapter/router.go @@ -4,9 +4,10 @@ import ( "context" "net" + N "github.com/sagernet/sing/common/network" + "github.com/sagernet/sing-box/common/geoip" "github.com/sagernet/sing-box/common/geosite" - N "github.com/sagernet/sing/common/network" ) type Router interface { diff --git a/cmd/sing-box/cmd_check.go b/cmd/sing-box/cmd_check.go index 559d413c..3a48d52c 100644 --- a/cmd/sing-box/cmd_check.go +++ b/cmd/sing-box/cmd_check.go @@ -4,9 +4,11 @@ import ( "context" "os" - "github.com/goccy/go-json" "github.com/sagernet/sing-box" + "github.com/sagernet/sing-box/option" + + "github.com/goccy/go-json" "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) diff --git a/cmd/sing-box/cmd_format.go b/cmd/sing-box/cmd_format.go index fd2c6e63..d5cbbcf9 100644 --- a/cmd/sing-box/cmd_format.go +++ b/cmd/sing-box/cmd_format.go @@ -5,8 +5,9 @@ import ( "os" "path/filepath" - "github.com/goccy/go-json" "github.com/sagernet/sing-box/option" + + "github.com/goccy/go-json" "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) diff --git a/cmd/sing-box/cmd_run.go b/cmd/sing-box/cmd_run.go index d7df3762..374f66ef 100644 --- a/cmd/sing-box/cmd_run.go +++ b/cmd/sing-box/cmd_run.go @@ -6,9 +6,11 @@ import ( "os/signal" "syscall" - "github.com/goccy/go-json" "github.com/sagernet/sing-box" + "github.com/sagernet/sing-box/option" + + "github.com/goccy/go-json" "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) diff --git a/cmd/sing-box/cmd_version.go b/cmd/sing-box/cmd_version.go index ee399d33..fd327086 100644 --- a/cmd/sing-box/cmd_version.go +++ b/cmd/sing-box/cmd_version.go @@ -4,8 +4,10 @@ import ( "os" "runtime" - C "github.com/sagernet/sing-box/constant" F "github.com/sagernet/sing/common/format" + + C "github.com/sagernet/sing-box/constant" + "github.com/spf13/cobra" ) diff --git a/cmd/sing-box/main.go b/cmd/sing-box/main.go index bda56fd2..e1b31b58 100644 --- a/cmd/sing-box/main.go +++ b/cmd/sing-box/main.go @@ -4,6 +4,7 @@ import ( "os" "github.com/sagernet/sing-box/log" + "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) diff --git a/common/badjson/array.go b/common/badjson/array.go index 11cee88a..9f93acd4 100644 --- a/common/badjson/array.go +++ b/common/badjson/array.go @@ -3,8 +3,9 @@ package badjson import ( "bytes" - "github.com/goccy/go-json" E "github.com/sagernet/sing/common/exceptions" + + "github.com/goccy/go-json" ) type JSONArray[T any] []T diff --git a/common/badjson/json.go b/common/badjson/json.go index 903960ac..a6d6a776 100644 --- a/common/badjson/json.go +++ b/common/badjson/json.go @@ -1,8 +1,9 @@ package badjson import ( - "github.com/goccy/go-json" E "github.com/sagernet/sing/common/exceptions" + + "github.com/goccy/go-json" ) func decodeJSON(decoder *json.Decoder) (any, error) { diff --git a/common/badjson/object.go b/common/badjson/object.go index 8b9020a2..eb0de894 100644 --- a/common/badjson/object.go +++ b/common/badjson/object.go @@ -4,9 +4,10 @@ import ( "bytes" "strings" - "github.com/goccy/go-json" E "github.com/sagernet/sing/common/exceptions" "github.com/sagernet/sing/common/x/linkedhashmap" + + "github.com/goccy/go-json" ) type JSONObject struct { diff --git a/common/geoip/reader.go b/common/geoip/reader.go index b7488ef0..40d773d9 100644 --- a/common/geoip/reader.go +++ b/common/geoip/reader.go @@ -3,9 +3,10 @@ package geoip import ( "net/netip" - "github.com/oschwald/maxminddb-golang" E "github.com/sagernet/sing/common/exceptions" N "github.com/sagernet/sing/common/network" + + "github.com/oschwald/maxminddb-golang" ) type Reader struct { diff --git a/common/sniff/dns.go b/common/sniff/dns.go index 5637eb4c..01efae7b 100644 --- a/common/sniff/dns.go +++ b/common/sniff/dns.go @@ -7,11 +7,13 @@ 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 9cd16624..4a2c5735 100644 --- a/common/sniff/http.go +++ b/common/sniff/http.go @@ -5,9 +5,10 @@ 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/quic.go b/common/sniff/quic.go index 7e4c5c87..1128776d 100644 --- a/common/sniff/quic.go +++ b/common/sniff/quic.go @@ -12,6 +12,7 @@ import ( "github.com/sagernet/sing-box/adapter" "github.com/sagernet/sing-box/common/sniff/internal/qtls" C "github.com/sagernet/sing-box/constant" + "golang.org/x/crypto/hkdf" ) diff --git a/common/sniff/tls.go b/common/sniff/tls.go index 063ccb18..e7b45b76 100644 --- a/common/sniff/tls.go +++ b/common/sniff/tls.go @@ -5,9 +5,10 @@ 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/format.go b/format.go index 46555340..16f31fb2 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 . +//go:generate gci write -s "standard,prefix(github.com/sagernet/sing/),prefix(github.com/sagernet),prefix(github.com/sagernet/sing-box/),default" . diff --git a/inbound/builder.go b/inbound/builder.go index 251a2cf6..3ff48987 100644 --- a/inbound/builder.go +++ b/inbound/builder.go @@ -3,13 +3,14 @@ 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 119547e8..40ad7507 100644 --- a/inbound/default.go +++ b/inbound/default.go @@ -8,16 +8,18 @@ import ( "sync" "time" - "github.com/database64128/tfo-go" - "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" ) var _ adapter.Inbound = (*myInboundAdapter)(nil) diff --git a/inbound/direct.go b/inbound/direct.go index ddfe7ac3..d7313262 100644 --- a/inbound/direct.go +++ b/inbound/direct.go @@ -5,14 +5,15 @@ import ( "net" "net/netip" - "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" + + "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 = (*Direct)(nil) diff --git a/inbound/http.go b/inbound/http.go index 11708f80..e9f1fcb4 100644 --- a/inbound/http.go +++ b/inbound/http.go @@ -5,13 +5,14 @@ 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 d956bc2c..9607ee31 100644 --- a/inbound/mixed.go +++ b/inbound/mixed.go @@ -5,10 +5,6 @@ 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" @@ -18,6 +14,11 @@ 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 549b93fc..a5bdf6c6 100644 --- a/inbound/shadowsocks.go +++ b/inbound/shadowsocks.go @@ -4,17 +4,19 @@ 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-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" + + "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" ) 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 b2fa7e60..1d0ec6f7 100644 --- a/inbound/shadowsocks_multi.go +++ b/inbound/shadowsocks_multi.go @@ -4,16 +4,18 @@ 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-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" + + "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" ) var _ adapter.Inbound = (*ShadowsocksMulti)(nil) diff --git a/inbound/shadowsocks_relay.go b/inbound/shadowsocks_relay.go index f673a149..f632d586 100644 --- a/inbound/shadowsocks_relay.go +++ b/inbound/shadowsocks_relay.go @@ -4,16 +4,18 @@ 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-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" + + "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" ) var _ adapter.Inbound = (*ShadowsocksMulti)(nil) diff --git a/inbound/socks.go b/inbound/socks.go index 496804a7..e642eef5 100644 --- a/inbound/socks.go +++ b/inbound/socks.go @@ -4,13 +4,14 @@ 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 9191b47e..4eb47978 100644 --- a/log/logrus.go +++ b/log/logrus.go @@ -4,10 +4,12 @@ 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/log/logrus_hook.go b/log/logrus_hook.go index 672ced28..ac92b206 100644 --- a/log/logrus_hook.go +++ b/log/logrus_hook.go @@ -1,8 +1,9 @@ package log import ( - "github.com/logrusorgru/aurora" F "github.com/sagernet/sing/common/format" + + "github.com/logrusorgru/aurora" "github.com/sirupsen/logrus" ) diff --git a/option/config.go b/option/config.go index 9dc2f318..8608dc27 100644 --- a/option/config.go +++ b/option/config.go @@ -3,8 +3,9 @@ package option import ( "bytes" - "github.com/goccy/go-json" "github.com/sagernet/sing/common" + + "github.com/goccy/go-json" ) type _Options struct { diff --git a/option/inbound.go b/option/inbound.go index 970b5cdf..5a701397 100644 --- a/option/inbound.go +++ b/option/inbound.go @@ -1,11 +1,13 @@ package option import ( - "github.com/goccy/go-json" - 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" ) type _Inbound struct { diff --git a/option/json.go b/option/json.go index a735a305..f7378150 100644 --- a/option/json.go +++ b/option/json.go @@ -3,10 +3,12 @@ package option import ( "bytes" - "github.com/goccy/go-json" - "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" ) func ToMap(v any) (*badjson.JSONObject, error) { diff --git a/option/outbound.go b/option/outbound.go index 8f8b1945..1d086a14 100644 --- a/option/outbound.go +++ b/option/outbound.go @@ -1,10 +1,12 @@ package option import ( - "github.com/goccy/go-json" - 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" ) type _Outbound struct { diff --git a/option/route.go b/option/route.go index de53e934..a55e4140 100644 --- a/option/route.go +++ b/option/route.go @@ -1,10 +1,12 @@ package option import ( - "github.com/goccy/go-json" - 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" ) type RouteOptions struct { diff --git a/option/types.go b/option/types.go index ba5ff5a3..86ebe728 100644 --- a/option/types.go +++ b/option/types.go @@ -4,9 +4,11 @@ import ( "net/netip" "strings" - "github.com/goccy/go-json" - C "github.com/sagernet/sing-box/constant" E "github.com/sagernet/sing/common/exceptions" + + C "github.com/sagernet/sing-box/constant" + + "github.com/goccy/go-json" ) type ListenAddress netip.Addr diff --git a/outbound/block.go b/outbound/block.go index dc3cad53..a54c1944 100644 --- a/outbound/block.go +++ b/outbound/block.go @@ -5,11 +5,12 @@ 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 e5817aa3..0dc8c455 100644 --- a/outbound/builder.go +++ b/outbound/builder.go @@ -1,13 +1,14 @@ 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 7acd3ef7..7aa36b76 100644 --- a/outbound/default.go +++ b/outbound/default.go @@ -6,11 +6,12 @@ import ( "runtime" "time" - "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" + + "github.com/sagernet/sing-box/log" ) type myOutboundAdapter struct { diff --git a/outbound/dialer/default.go b/outbound/dialer/default.go index 75752a7a..251ec133 100644 --- a/outbound/dialer/default.go +++ b/outbound/dialer/default.go @@ -5,12 +5,14 @@ import ( "net" "time" - "github.com/database64128/tfo-go" - 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" N "github.com/sagernet/sing/common/network" + + C "github.com/sagernet/sing-box/constant" + "github.com/sagernet/sing-box/option" + + "github.com/database64128/tfo-go" ) type defaultDialer struct { diff --git a/outbound/dialer/detour.go b/outbound/dialer/detour.go index 4080574b..a88b1dad 100644 --- a/outbound/dialer/detour.go +++ b/outbound/dialer/detour.go @@ -5,11 +5,12 @@ import ( "net" "sync" - "github.com/sagernet/sing-box/adapter" - "github.com/sagernet/sing-box/option" 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/option" ) type detourDialer struct { diff --git a/outbound/dialer/dialer.go b/outbound/dialer/dialer.go index 0b2fa7b1..78d52a3c 100644 --- a/outbound/dialer/dialer.go +++ b/outbound/dialer/dialer.go @@ -1,10 +1,11 @@ package dialer import ( - "github.com/sagernet/sing-box/adapter" - "github.com/sagernet/sing-box/option" "github.com/sagernet/sing/common" N "github.com/sagernet/sing/common/network" + + "github.com/sagernet/sing-box/adapter" + "github.com/sagernet/sing-box/option" ) func New(router adapter.Router, options option.DialerOptions) N.Dialer { diff --git a/outbound/dialer/override.go b/outbound/dialer/override.go index 053bddfc..8ee4e569 100644 --- a/outbound/dialer/override.go +++ b/outbound/dialer/override.go @@ -5,11 +5,12 @@ 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/outbound/direct.go b/outbound/direct.go index d2c58572..4127cf80 100644 --- a/outbound/direct.go +++ b/outbound/direct.go @@ -4,14 +4,15 @@ 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-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-box/outbound/dialer" - "github.com/sagernet/sing/common/bufio" - 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 23ad9383..254d1984 100644 --- a/outbound/http.go +++ b/outbound/http.go @@ -5,15 +5,16 @@ import ( "net" "os" + "github.com/sagernet/sing/common/bufio" + 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" C "github.com/sagernet/sing-box/constant" "github.com/sagernet/sing-box/log" "github.com/sagernet/sing-box/option" "github.com/sagernet/sing-box/outbound/dialer" - "github.com/sagernet/sing/common/bufio" - 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 2163cb0c..ade64c0e 100644 --- a/outbound/shadowsocks.go +++ b/outbound/shadowsocks.go @@ -4,17 +4,19 @@ import ( "context" "net" + "github.com/sagernet/sing/common/bufio" + 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-shadowsocks" + "github.com/sagernet/sing-shadowsocks/shadowimpl" + "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-box/outbound/dialer" - "github.com/sagernet/sing-shadowsocks" - "github.com/sagernet/sing-shadowsocks/shadowimpl" - "github.com/sagernet/sing/common/bufio" - E "github.com/sagernet/sing/common/exceptions" - 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 c6972f8a..b4d60ff2 100644 --- a/outbound/socks.go +++ b/outbound/socks.go @@ -4,15 +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/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-box/outbound/dialer" - "github.com/sagernet/sing/common/bufio" - 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 7643c12e..ffa836d4 100644 --- a/route/router.go +++ b/route/router.go @@ -9,13 +9,6 @@ import ( "path/filepath" "time" - "github.com/sagernet/sing-box/adapter" - "github.com/sagernet/sing-box/common/geoip" - "github.com/sagernet/sing-box/common/geosite" - "github.com/sagernet/sing-box/common/sniff" - 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" "github.com/sagernet/sing/common/bufio" @@ -24,6 +17,14 @@ import ( 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/geoip" + "github.com/sagernet/sing-box/common/geosite" + "github.com/sagernet/sing-box/common/sniff" + C "github.com/sagernet/sing-box/constant" + "github.com/sagernet/sing-box/log" + "github.com/sagernet/sing-box/option" ) var _ adapter.Router = (*Router)(nil) diff --git a/route/rule.go b/route/rule.go index 8a35e281..77f6caf1 100644 --- a/route/rule.go +++ b/route/rule.go @@ -3,13 +3,14 @@ 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 1d3bfd3c..8514593c 100644 --- a/route/rule_cidr.go +++ b/route/rule_cidr.go @@ -4,10 +4,11 @@ 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_domain.go b/route/rule_domain.go index dfdee095..cb09b385 100644 --- a/route/rule_domain.go +++ b/route/rule_domain.go @@ -3,9 +3,10 @@ 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 c9cf788b..c5e8483b 100644 --- a/route/rule_domain_regex.go +++ b/route/rule_domain_regex.go @@ -4,9 +4,10 @@ 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_geoip.go b/route/rule_geoip.go index cd5831e4..2b65d041 100644 --- a/route/rule_geoip.go +++ b/route/rule_geoip.go @@ -3,9 +3,10 @@ package route import ( "strings" + N "github.com/sagernet/sing/common/network" + "github.com/sagernet/sing-box/adapter" "github.com/sagernet/sing-box/log" - N "github.com/sagernet/sing/common/network" ) var _ RuleItem = (*GeoIPItem)(nil) diff --git a/route/rule_geosite.go b/route/rule_geosite.go index f9b72f1d..4fe120b7 100644 --- a/route/rule_geosite.go +++ b/route/rule_geosite.go @@ -3,11 +3,12 @@ package route import ( "strings" + E "github.com/sagernet/sing/common/exceptions" + "github.com/sagernet/sing-box/adapter" "github.com/sagernet/sing-box/common/geosite" "github.com/sagernet/sing-box/log" "github.com/sagernet/sing-box/option" - E "github.com/sagernet/sing/common/exceptions" ) var _ RuleItem = (*GeositeItem)(nil) diff --git a/route/rule_inbound.go b/route/rule_inbound.go index 7e28781f..7e842d78 100644 --- a/route/rule_inbound.go +++ b/route/rule_inbound.go @@ -3,8 +3,9 @@ package route import ( "strings" - "github.com/sagernet/sing-box/adapter" F "github.com/sagernet/sing/common/format" + + "github.com/sagernet/sing-box/adapter" ) var _ RuleItem = (*InboundItem)(nil) diff --git a/route/rule_logical.go b/route/rule_logical.go index 9e912bdd..141a3ab3 100644 --- a/route/rule_logical.go +++ b/route/rule_logical.go @@ -3,13 +3,14 @@ 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" ) var _ adapter.Rule = (*LogicalRule)(nil) diff --git a/route/rule_port.go b/route/rule_port.go index 839325bb..20f9e963 100644 --- a/route/rule_port.go +++ b/route/rule_port.go @@ -3,9 +3,10 @@ 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 1988f8ad..33a7f562 100644 --- a/route/rule_protocol.go +++ b/route/rule_protocol.go @@ -3,8 +3,9 @@ package route import ( "strings" - "github.com/sagernet/sing-box/adapter" F "github.com/sagernet/sing/common/format" + + "github.com/sagernet/sing-box/adapter" ) var _ RuleItem = (*ProtocolItem)(nil) diff --git a/service.go b/service.go index 4ee7f18f..7772491e 100644 --- a/service.go +++ b/service.go @@ -4,15 +4,16 @@ 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 = (*Service)(nil)