diff --git a/api/control/control.go b/api/control/control.go index 9eefb61..077a548 100644 --- a/api/control/control.go +++ b/api/control/control.go @@ -7,11 +7,12 @@ import ( "fmt" "io" + "google.golang.org/grpc" + "github.com/p4gefau1t/trojan-go/api/service" "github.com/p4gefau1t/trojan-go/common" "github.com/p4gefau1t/trojan-go/log" "github.com/p4gefau1t/trojan-go/option" - "google.golang.org/grpc" ) type apiController struct { diff --git a/api/service/client_test.go b/api/service/client_test.go index 4d95746..d2276ac 100644 --- a/api/service/client_test.go +++ b/api/service/client_test.go @@ -6,10 +6,11 @@ import ( "testing" "time" + "google.golang.org/grpc" + "github.com/p4gefau1t/trojan-go/common" "github.com/p4gefau1t/trojan-go/config" "github.com/p4gefau1t/trojan-go/statistic/memory" - "google.golang.org/grpc" ) func TestClientAPI(t *testing.T) { diff --git a/api/service/server.go b/api/service/server.go index 8758982..cb550e5 100644 --- a/api/service/server.go +++ b/api/service/server.go @@ -8,14 +8,15 @@ import ( "io/ioutil" "net" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials" + "github.com/p4gefau1t/trojan-go/api" "github.com/p4gefau1t/trojan-go/common" "github.com/p4gefau1t/trojan-go/config" "github.com/p4gefau1t/trojan-go/log" "github.com/p4gefau1t/trojan-go/statistic" "github.com/p4gefau1t/trojan-go/tunnel/trojan" - "google.golang.org/grpc" - "google.golang.org/grpc/credentials" ) type ServerAPI struct { diff --git a/api/service/server_test.go b/api/service/server_test.go index 521b96f..25bab93 100644 --- a/api/service/server_test.go +++ b/api/service/server_test.go @@ -9,11 +9,12 @@ import ( "testing" "time" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials" + "github.com/p4gefau1t/trojan-go/common" "github.com/p4gefau1t/trojan-go/config" "github.com/p4gefau1t/trojan-go/statistic/memory" - "google.golang.org/grpc" - "google.golang.org/grpc/credentials" ) func TestServerAPI(t *testing.T) { diff --git a/easy/easy.go b/easy/easy.go index 8ff9d1c..ed3d5e5 100644 --- a/easy/easy.go +++ b/easy/easy.go @@ -6,10 +6,9 @@ import ( "net" "strconv" - "github.com/p4gefau1t/trojan-go/option" - "github.com/p4gefau1t/trojan-go/common" "github.com/p4gefau1t/trojan-go/log" + "github.com/p4gefau1t/trojan-go/option" "github.com/p4gefau1t/trojan-go/proxy" ) diff --git a/log/golog/colorful/colorful_test.go b/log/golog/colorful/colorful_test.go index 26dc6a9..78b72a9 100644 --- a/log/golog/colorful/colorful_test.go +++ b/log/golog/colorful/colorful_test.go @@ -8,8 +8,9 @@ package colorful import ( "testing" - "github.com/p4gefau1t/trojan-go/log/golog/buffer" . "github.com/smartystreets/goconvey/convey" + + "github.com/p4gefau1t/trojan-go/log/golog/buffer" ) func TestColorBuffer(t *testing.T) { diff --git a/log/golog/golog.go b/log/golog/golog.go index d781d6c..4a879c9 100644 --- a/log/golog/golog.go +++ b/log/golog/golog.go @@ -12,9 +12,10 @@ import ( "sync" "time" + "golang.org/x/crypto/ssh/terminal" + "github.com/p4gefau1t/trojan-go/log" "github.com/p4gefau1t/trojan-go/log/golog/colorful" - "golang.org/x/crypto/ssh/terminal" ) func init() { diff --git a/main.go b/main.go index 7c3fdfb..870b4cc 100644 --- a/main.go +++ b/main.go @@ -3,10 +3,9 @@ package main import ( "flag" - "github.com/p4gefau1t/trojan-go/option" - _ "github.com/p4gefau1t/trojan-go/component" "github.com/p4gefau1t/trojan-go/log" + "github.com/p4gefau1t/trojan-go/option" ) func main() { diff --git a/proxy/custom/custom.go b/proxy/custom/custom.go index 52ae983..fc6ed49 100644 --- a/proxy/custom/custom.go +++ b/proxy/custom/custom.go @@ -4,11 +4,12 @@ import ( "context" "strings" + "gopkg.in/yaml.v3" + "github.com/p4gefau1t/trojan-go/common" "github.com/p4gefau1t/trojan-go/config" "github.com/p4gefau1t/trojan-go/proxy" "github.com/p4gefau1t/trojan-go/tunnel" - "gopkg.in/yaml.v3" ) func convert(i interface{}) interface{} { diff --git a/statistic/memory/memory.go b/statistic/memory/memory.go index f1dae21..e4c1f52 100644 --- a/statistic/memory/memory.go +++ b/statistic/memory/memory.go @@ -6,13 +6,12 @@ import ( "sync/atomic" "time" - "github.com/p4gefau1t/trojan-go/log" - - "github.com/p4gefau1t/trojan-go/config" + "golang.org/x/time/rate" "github.com/p4gefau1t/trojan-go/common" + "github.com/p4gefau1t/trojan-go/config" + "github.com/p4gefau1t/trojan-go/log" "github.com/p4gefau1t/trojan-go/statistic" - "golang.org/x/time/rate" ) const Name = "MEMORY" diff --git a/test/scenario/proxy_test.go b/test/scenario/proxy_test.go index 857a3c6..dd4d28f 100644 --- a/test/scenario/proxy_test.go +++ b/test/scenario/proxy_test.go @@ -6,13 +6,12 @@ import ( "io/ioutil" "net" "net/http" + _ "net/http/pprof" "sync" "testing" "time" - "github.com/p4gefau1t/trojan-go/test/util" - - _ "net/http/pprof" + netproxy "golang.org/x/net/proxy" _ "github.com/p4gefau1t/trojan-go/api" _ "github.com/p4gefau1t/trojan-go/api/service" @@ -24,7 +23,7 @@ import ( _ "github.com/p4gefau1t/trojan-go/proxy/nat" _ "github.com/p4gefau1t/trojan-go/proxy/server" _ "github.com/p4gefau1t/trojan-go/statistic/memory" - netproxy "golang.org/x/net/proxy" + "github.com/p4gefau1t/trojan-go/test/util" ) // test key and cert diff --git a/test/util/target.go b/test/util/target.go index c7eb08b..a6da498 100644 --- a/test/util/target.go +++ b/test/util/target.go @@ -10,9 +10,10 @@ import ( "sync" "time" + "golang.org/x/net/websocket" + "github.com/p4gefau1t/trojan-go/common" "github.com/p4gefau1t/trojan-go/log" - "golang.org/x/net/websocket" ) var HTTPAddr string diff --git a/tunnel/dokodemo/conn.go b/tunnel/dokodemo/conn.go index 75c6bc0..bc08b2b 100644 --- a/tunnel/dokodemo/conn.go +++ b/tunnel/dokodemo/conn.go @@ -5,7 +5,6 @@ import ( "net" "github.com/p4gefau1t/trojan-go/common" - "github.com/p4gefau1t/trojan-go/tunnel" ) diff --git a/tunnel/freedom/client.go b/tunnel/freedom/client.go index 51cafab..f8d2cf7 100644 --- a/tunnel/freedom/client.go +++ b/tunnel/freedom/client.go @@ -4,11 +4,12 @@ import ( "context" "net" + "github.com/txthinking/socks5" + "golang.org/x/net/proxy" + "github.com/p4gefau1t/trojan-go/common" "github.com/p4gefau1t/trojan-go/config" "github.com/p4gefau1t/trojan-go/tunnel" - "github.com/txthinking/socks5" - "golang.org/x/net/proxy" ) type Client struct { diff --git a/tunnel/freedom/conn.go b/tunnel/freedom/conn.go index ac0bd1a..8ef5456 100644 --- a/tunnel/freedom/conn.go +++ b/tunnel/freedom/conn.go @@ -4,10 +4,11 @@ import ( "bytes" "net" + "github.com/txthinking/socks5" + "github.com/p4gefau1t/trojan-go/common" "github.com/p4gefau1t/trojan-go/log" "github.com/p4gefau1t/trojan-go/tunnel" - "github.com/txthinking/socks5" ) const MaxPacketSize = 1024 * 8 diff --git a/tunnel/freedom/freedom_test.go b/tunnel/freedom/freedom_test.go index c5df9d1..7167fbe 100644 --- a/tunnel/freedom/freedom_test.go +++ b/tunnel/freedom/freedom_test.go @@ -7,10 +7,11 @@ import ( "testing" "time" + "github.com/txthinking/socks5" + "github.com/p4gefau1t/trojan-go/common" "github.com/p4gefau1t/trojan-go/test/util" "github.com/p4gefau1t/trojan-go/tunnel" - "github.com/txthinking/socks5" ) func TestConn(t *testing.T) { diff --git a/tunnel/mux/client.go b/tunnel/mux/client.go index 5418e3d..d863f26 100644 --- a/tunnel/mux/client.go +++ b/tunnel/mux/client.go @@ -7,11 +7,12 @@ import ( "sync" "time" + "github.com/xtaci/smux" + "github.com/p4gefau1t/trojan-go/common" "github.com/p4gefau1t/trojan-go/config" "github.com/p4gefau1t/trojan-go/log" "github.com/p4gefau1t/trojan-go/tunnel" - "github.com/xtaci/smux" ) type muxID uint32 diff --git a/tunnel/mux/mux_test.go b/tunnel/mux/mux_test.go index f989c1c..5a5e323 100644 --- a/tunnel/mux/mux_test.go +++ b/tunnel/mux/mux_test.go @@ -4,12 +4,11 @@ import ( "context" "testing" - "github.com/p4gefau1t/trojan-go/tunnel/freedom" - "github.com/p4gefau1t/trojan-go/tunnel/transport" - "github.com/p4gefau1t/trojan-go/common" "github.com/p4gefau1t/trojan-go/config" "github.com/p4gefau1t/trojan-go/test/util" + "github.com/p4gefau1t/trojan-go/tunnel/freedom" + "github.com/p4gefau1t/trojan-go/tunnel/transport" ) func TestMux(t *testing.T) { diff --git a/tunnel/mux/server.go b/tunnel/mux/server.go index 964dafe..40d22a0 100644 --- a/tunnel/mux/server.go +++ b/tunnel/mux/server.go @@ -3,10 +3,11 @@ package mux import ( "context" + "github.com/xtaci/smux" + "github.com/p4gefau1t/trojan-go/common" "github.com/p4gefau1t/trojan-go/log" "github.com/p4gefau1t/trojan-go/tunnel" - "github.com/xtaci/smux" ) // Server is a smux server diff --git a/tunnel/router/client.go b/tunnel/router/client.go index f880ef8..6c72d20 100644 --- a/tunnel/router/client.go +++ b/tunnel/router/client.go @@ -9,13 +9,14 @@ import ( "strings" "github.com/golang/protobuf/proto" + v2router "github.com/v2fly/v2ray-core/v4/app/router" + "github.com/p4gefau1t/trojan-go/common" "github.com/p4gefau1t/trojan-go/config" "github.com/p4gefau1t/trojan-go/log" "github.com/p4gefau1t/trojan-go/tunnel" "github.com/p4gefau1t/trojan-go/tunnel/freedom" "github.com/p4gefau1t/trojan-go/tunnel/transport" - v2router "github.com/v2fly/v2ray-core/v4/app/router" ) const ( diff --git a/tunnel/shadowsocks/client.go b/tunnel/shadowsocks/client.go index 0ff49ce..62a8764 100644 --- a/tunnel/shadowsocks/client.go +++ b/tunnel/shadowsocks/client.go @@ -3,11 +3,12 @@ package shadowsocks import ( "context" + "github.com/shadowsocks/go-shadowsocks2/core" + "github.com/p4gefau1t/trojan-go/common" "github.com/p4gefau1t/trojan-go/config" "github.com/p4gefau1t/trojan-go/log" "github.com/p4gefau1t/trojan-go/tunnel" - "github.com/shadowsocks/go-shadowsocks2/core" ) type Client struct { diff --git a/tunnel/shadowsocks/server.go b/tunnel/shadowsocks/server.go index f34fd34..2f950b6 100644 --- a/tunnel/shadowsocks/server.go +++ b/tunnel/shadowsocks/server.go @@ -4,12 +4,13 @@ import ( "context" "net" + "github.com/shadowsocks/go-shadowsocks2/core" + "github.com/p4gefau1t/trojan-go/common" "github.com/p4gefau1t/trojan-go/config" "github.com/p4gefau1t/trojan-go/log" "github.com/p4gefau1t/trojan-go/redirector" "github.com/p4gefau1t/trojan-go/tunnel" - "github.com/shadowsocks/go-shadowsocks2/core" ) type Server struct { diff --git a/tunnel/socks/socks_test.go b/tunnel/socks/socks_test.go index 15ce385..fd5a763 100644 --- a/tunnel/socks/socks_test.go +++ b/tunnel/socks/socks_test.go @@ -10,14 +10,15 @@ import ( "testing" "time" + "github.com/txthinking/socks5" + "golang.org/x/net/proxy" + "github.com/p4gefau1t/trojan-go/common" "github.com/p4gefau1t/trojan-go/config" "github.com/p4gefau1t/trojan-go/test/util" "github.com/p4gefau1t/trojan-go/tunnel" "github.com/p4gefau1t/trojan-go/tunnel/adapter" "github.com/p4gefau1t/trojan-go/tunnel/socks" - "github.com/txthinking/socks5" - "golang.org/x/net/proxy" ) func TestSocks(t *testing.T) { diff --git a/tunnel/tls/client.go b/tunnel/tls/client.go index db970f2..f6ffc26 100644 --- a/tunnel/tls/client.go +++ b/tunnel/tls/client.go @@ -9,13 +9,14 @@ import ( "io/ioutil" "strings" + utls "github.com/refraction-networking/utls" + "github.com/p4gefau1t/trojan-go/common" "github.com/p4gefau1t/trojan-go/config" "github.com/p4gefau1t/trojan-go/log" "github.com/p4gefau1t/trojan-go/tunnel" "github.com/p4gefau1t/trojan-go/tunnel/tls/fingerprint" "github.com/p4gefau1t/trojan-go/tunnel/transport" - utls "github.com/refraction-networking/utls" ) // Client is a tls client diff --git a/tunnel/transport/transport_test.go b/tunnel/transport/transport_test.go index 65bed86..a25e818 100644 --- a/tunnel/transport/transport_test.go +++ b/tunnel/transport/transport_test.go @@ -6,11 +6,10 @@ import ( "sync" "testing" - "github.com/p4gefau1t/trojan-go/config" - "github.com/p4gefau1t/trojan-go/tunnel/freedom" - "github.com/p4gefau1t/trojan-go/common" + "github.com/p4gefau1t/trojan-go/config" "github.com/p4gefau1t/trojan-go/test/util" + "github.com/p4gefau1t/trojan-go/tunnel/freedom" ) func TestTransport(t *testing.T) { diff --git a/tunnel/trojan/client.go b/tunnel/trojan/client.go index 79f5411..db17109 100644 --- a/tunnel/trojan/client.go +++ b/tunnel/trojan/client.go @@ -7,14 +7,13 @@ import ( "time" "github.com/p4gefau1t/trojan-go/api" - "github.com/p4gefau1t/trojan-go/config" - "github.com/p4gefau1t/trojan-go/statistic/memory" - "github.com/p4gefau1t/trojan-go/tunnel/mux" - "github.com/p4gefau1t/trojan-go/common" + "github.com/p4gefau1t/trojan-go/config" "github.com/p4gefau1t/trojan-go/log" "github.com/p4gefau1t/trojan-go/statistic" + "github.com/p4gefau1t/trojan-go/statistic/memory" "github.com/p4gefau1t/trojan-go/tunnel" + "github.com/p4gefau1t/trojan-go/tunnel/mux" ) const ( diff --git a/tunnel/trojan/packet.go b/tunnel/trojan/packet.go index 7a737bb..4946057 100644 --- a/tunnel/trojan/packet.go +++ b/tunnel/trojan/packet.go @@ -7,9 +7,8 @@ import ( "io/ioutil" "net" - "github.com/p4gefau1t/trojan-go/log" - "github.com/p4gefau1t/trojan-go/common" + "github.com/p4gefau1t/trojan-go/log" "github.com/p4gefau1t/trojan-go/tunnel" ) diff --git a/tunnel/trojan/server.go b/tunnel/trojan/server.go index 0018bfd..c6c3c85 100644 --- a/tunnel/trojan/server.go +++ b/tunnel/trojan/server.go @@ -7,14 +7,13 @@ import ( "net" "github.com/p4gefau1t/trojan-go/api" - "github.com/p4gefau1t/trojan-go/statistic/memory" - "github.com/p4gefau1t/trojan-go/statistic/mysql" - "github.com/p4gefau1t/trojan-go/common" "github.com/p4gefau1t/trojan-go/config" "github.com/p4gefau1t/trojan-go/log" "github.com/p4gefau1t/trojan-go/redirector" "github.com/p4gefau1t/trojan-go/statistic" + "github.com/p4gefau1t/trojan-go/statistic/memory" + "github.com/p4gefau1t/trojan-go/statistic/mysql" "github.com/p4gefau1t/trojan-go/tunnel" "github.com/p4gefau1t/trojan-go/tunnel/mux" ) diff --git a/tunnel/trojan/trojan_test.go b/tunnel/trojan/trojan_test.go index e9e126d..2295337 100644 --- a/tunnel/trojan/trojan_test.go +++ b/tunnel/trojan/trojan_test.go @@ -11,7 +11,6 @@ import ( "github.com/p4gefau1t/trojan-go/common" "github.com/p4gefau1t/trojan-go/config" "github.com/p4gefau1t/trojan-go/statistic/memory" - _ "github.com/p4gefau1t/trojan-go/statistic/memory" "github.com/p4gefau1t/trojan-go/test/util" "github.com/p4gefau1t/trojan-go/tunnel" "github.com/p4gefau1t/trojan-go/tunnel/freedom" diff --git a/tunnel/websocket/client.go b/tunnel/websocket/client.go index 186b9bc..04522d9 100644 --- a/tunnel/websocket/client.go +++ b/tunnel/websocket/client.go @@ -4,11 +4,12 @@ import ( "context" "strings" + "golang.org/x/net/websocket" + "github.com/p4gefau1t/trojan-go/common" "github.com/p4gefau1t/trojan-go/config" "github.com/p4gefau1t/trojan-go/log" "github.com/p4gefau1t/trojan-go/tunnel" - "golang.org/x/net/websocket" ) type Client struct { diff --git a/tunnel/websocket/conn.go b/tunnel/websocket/conn.go index 1af90bd..ed5468f 100644 --- a/tunnel/websocket/conn.go +++ b/tunnel/websocket/conn.go @@ -4,8 +4,9 @@ import ( "context" "net" - "github.com/p4gefau1t/trojan-go/tunnel" "golang.org/x/net/websocket" + + "github.com/p4gefau1t/trojan-go/tunnel" ) type OutboundConn struct { diff --git a/tunnel/websocket/server.go b/tunnel/websocket/server.go index 5113a62..3d1925e 100644 --- a/tunnel/websocket/server.go +++ b/tunnel/websocket/server.go @@ -9,12 +9,13 @@ import ( "strings" "time" + "golang.org/x/net/websocket" + "github.com/p4gefau1t/trojan-go/common" "github.com/p4gefau1t/trojan-go/config" "github.com/p4gefau1t/trojan-go/log" "github.com/p4gefau1t/trojan-go/redirector" "github.com/p4gefau1t/trojan-go/tunnel" - "golang.org/x/net/websocket" ) // Fake response writer diff --git a/tunnel/websocket/websocket_test.go b/tunnel/websocket/websocket_test.go index ce38494..6c4ffd2 100644 --- a/tunnel/websocket/websocket_test.go +++ b/tunnel/websocket/websocket_test.go @@ -9,13 +9,14 @@ import ( "testing" "time" + "golang.org/x/net/websocket" + "github.com/p4gefau1t/trojan-go/common" "github.com/p4gefau1t/trojan-go/config" "github.com/p4gefau1t/trojan-go/test/util" "github.com/p4gefau1t/trojan-go/tunnel" "github.com/p4gefau1t/trojan-go/tunnel/freedom" "github.com/p4gefau1t/trojan-go/tunnel/transport" - "golang.org/x/net/websocket" ) func TestWebsocket(t *testing.T) { diff --git a/version/version.go b/version/version.go index 50b1daa..8bf58d2 100644 --- a/version/version.go +++ b/version/version.go @@ -5,10 +5,9 @@ import ( "fmt" "runtime" + "github.com/p4gefau1t/trojan-go/common" "github.com/p4gefau1t/trojan-go/constant" "github.com/p4gefau1t/trojan-go/option" - - "github.com/p4gefau1t/trojan-go/common" ) type versionOption struct {