Browse Source

Update gci format

世界 3 năm trước cách đây
mục cha
commit
f448b6b977
62 tập tin đã thay đổi với 136 bổ sung201 xóa
  1. 1 2
      adapter/inbound.go
  2. 1 2
      adapter/router.go
  3. 3 4
      box.go
  4. 0 1
      cmd/sing-box/cmd_check.go
  5. 0 1
      cmd/sing-box/cmd_run.go
  6. 1 2
      cmd/sing-box/cmd_version.go
  7. 2 3
      common/dialer/default.go
  8. 1 2
      common/dialer/detour.go
  9. 2 3
      common/dialer/dialer.go
  10. 2 3
      common/dialer/override.go
  11. 1 2
      common/dialer/parallel.go
  12. 2 3
      common/dialer/resolve.go
  13. 2 3
      common/dialer/resolve_conn.go
  14. 2 3
      common/sniff/dns.go
  15. 1 2
      common/sniff/http.go
  16. 1 2
      common/sniff/tls.go
  17. 3 4
      dns/client.go
  18. 2 3
      dns/client_test.go
  19. 2 3
      dns/dialer.go
  20. 2 3
      dns/transport.go
  21. 2 3
      dns/transport_base.go
  22. 2 3
      dns/transport_https.go
  23. 1 2
      dns/transport_local.go
  24. 2 3
      dns/transport_tcp.go
  25. 2 3
      dns/transport_test.go
  26. 2 3
      dns/transport_tls.go
  27. 2 3
      dns/transport_udp.go
  28. 1 1
      format.go
  29. 3 4
      inbound/builder.go
  30. 4 5
      inbound/default.go
  31. 4 5
      inbound/direct.go
  32. 3 4
      inbound/http.go
  33. 4 5
      inbound/mixed.go
  34. 7 9
      inbound/shadowsocks.go
  35. 6 8
      inbound/shadowsocks_multi.go
  36. 6 8
      inbound/shadowsocks_relay.go
  37. 3 4
      inbound/socks.go
  38. 1 2
      log/logrus.go
  39. 1 2
      option/dns.go
  40. 1 2
      option/inbound.go
  41. 1 2
      option/json.go
  42. 1 2
      option/outbound.go
  43. 1 2
      option/route.go
  44. 1 2
      option/types.go
  45. 2 3
      outbound/block.go
  46. 3 4
      outbound/builder.go
  47. 4 5
      outbound/default.go
  48. 2 3
      outbound/direct.go
  49. 3 4
      outbound/http.go
  50. 5 7
      outbound/shadowsocks.go
  51. 3 4
      outbound/socks.go
  52. 8 9
      route/router.go
  53. 3 4
      route/rule.go
  54. 1 2
      route/rule_cidr.go
  55. 3 4
      route/rule_dns.go
  56. 1 2
      route/rule_domain.go
  57. 1 2
      route/rule_domain_regex.go
  58. 1 2
      route/rule_geosite.go
  59. 1 2
      route/rule_inbound.go
  60. 1 2
      route/rule_outbound.go
  61. 1 2
      route/rule_port.go
  62. 1 2
      route/rule_protocol.go

+ 1 - 2
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 {

+ 1 - 2
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"
 )

+ 3 - 4
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)

+ 0 - 1
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"

+ 0 - 1
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"

+ 1 - 2
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"
 )

+ 2 - 3
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"
 )

+ 1 - 2
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 {

+ 2 - 3
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 {

+ 2 - 3
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)

+ 1 - 2
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) {

+ 2 - 3
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 {

+ 2 - 3
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 {

+ 2 - 3
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"
 )
 

+ 1 - 2
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) {

+ 1 - 2
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) {

+ 3 - 4
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"
 )
 

+ 2 - 3
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"

+ 2 - 3
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 {

+ 2 - 3
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) {

+ 2 - 3
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 {

+ 2 - 3
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"
 )
 

+ 1 - 2
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"
 )

+ 2 - 3
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"
 )
 

+ 2 - 3
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"

+ 2 - 3
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"
 )
 

+ 2 - 3
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"
 )
 

+ 1 - 1
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" .

+ 3 - 4
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) {

+ 4 - 5
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"
 )
 

+ 4 - 5
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)

+ 3 - 4
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)

+ 4 - 5
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)

+ 7 - 9
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) {

+ 6 - 8
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)

+ 6 - 8
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)

+ 3 - 4
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)

+ 1 - 2
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"
 )
 

+ 1 - 2
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"
 )
 

+ 1 - 2
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"
 )
 

+ 1 - 2
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"
 )
 

+ 1 - 2
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"
 )
 

+ 1 - 2
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"
 )
 

+ 1 - 2
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"
 )

+ 2 - 3
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)

+ 3 - 4
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) {

+ 4 - 5
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 {

+ 2 - 3
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)

+ 3 - 4
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)

+ 5 - 7
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)

+ 3 - 4
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)

+ 8 - 9
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"
 )

+ 3 - 4
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) {

+ 1 - 2
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)

+ 3 - 4
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) {

+ 1 - 2
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)

+ 1 - 2
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)

+ 1 - 2
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)

+ 1 - 2
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)

+ 1 - 2
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)

+ 1 - 2
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)

+ 1 - 2
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)