diff --git a/bridge/bridge.go b/bridge/bridge.go index abaa737..53a2e76 100755 --- a/bridge/bridge.go +++ b/bridge/bridge.go @@ -4,6 +4,15 @@ import ( "encoding/binary" "errors" "fmt" + "net" + "os" + "strconv" + "strings" + "sync" + "time" + + "github.com/astaxie/beego" + "github.com/astaxie/beego/logs" "github.com/cnlh/nps/lib/common" "github.com/cnlh/nps/lib/conn" "github.com/cnlh/nps/lib/crypt" @@ -12,14 +21,6 @@ import ( "github.com/cnlh/nps/lib/version" "github.com/cnlh/nps/server/connection" "github.com/cnlh/nps/server/tool" - "github.com/astaxie/beego" - "github.com/astaxie/beego/logs" - "net" - "os" - "strconv" - "strings" - "sync" - "time" ) type Client struct { @@ -146,7 +147,7 @@ func (s *Bridge) GetHealthFromClient(id int, c *conn.Conn) { }) } } - s.DelClient(id, ) + s.DelClient(id) } //验证失败,返回错误验证flag,并且关闭连接 diff --git a/client/client.go b/client/client.go index c338293..52da907 100755 --- a/client/client.go +++ b/client/client.go @@ -2,17 +2,18 @@ package client import ( "bufio" + "net" + "net/http" + "strconv" + "time" + + "github.com/astaxie/beego/logs" "github.com/cnlh/nps/lib/common" "github.com/cnlh/nps/lib/config" "github.com/cnlh/nps/lib/conn" "github.com/cnlh/nps/lib/crypt" "github.com/cnlh/nps/lib/mux" - "github.com/astaxie/beego/logs" "github.com/xtaci/kcp-go" - "net" - "net/http" - "strconv" - "time" ) type TRPClient struct { diff --git a/client/client_test.go b/client/client_test.go index 3ab27db..84ff3b0 100644 --- a/client/client_test.go +++ b/client/client_test.go @@ -1,12 +1,13 @@ package client import ( - "github.com/cnlh/nps/lib/common" - conn2 "github.com/cnlh/nps/lib/conn" - "github.com/cnlh/nps/lib/file" "net" "sync" "testing" + + "github.com/cnlh/nps/lib/common" + conn2 "github.com/cnlh/nps/lib/conn" + "github.com/cnlh/nps/lib/file" ) func TestConfig(t *testing.T) { diff --git a/client/control.go b/client/control.go index 7b0e39b..5673f14 100644 --- a/client/control.go +++ b/client/control.go @@ -5,14 +5,6 @@ import ( "encoding/binary" "errors" "fmt" - "github.com/cnlh/nps/lib/common" - "github.com/cnlh/nps/lib/config" - "github.com/cnlh/nps/lib/conn" - "github.com/cnlh/nps/lib/crypt" - "github.com/cnlh/nps/lib/version" - "github.com/astaxie/beego/logs" - "github.com/xtaci/kcp-go" - "golang.org/x/net/proxy" "io/ioutil" "log" "math" @@ -26,6 +18,15 @@ import ( "strconv" "strings" "time" + + "github.com/astaxie/beego/logs" + "github.com/cnlh/nps/lib/common" + "github.com/cnlh/nps/lib/config" + "github.com/cnlh/nps/lib/conn" + "github.com/cnlh/nps/lib/crypt" + "github.com/cnlh/nps/lib/version" + "github.com/xtaci/kcp-go" + "golang.org/x/net/proxy" ) func GetTaskStatus(path string) { @@ -379,7 +380,7 @@ func sendP2PTestMsg(localConn *net.UDPConn, remoteAddr1, remoteAddr2, remoteAddr ip := common.GetIpByAddr(remoteAddr2) go func() { ports := getRandomPortArr(common.GetPortByAddr(remoteAddr3), common.GetPortByAddr(remoteAddr3)+interval*50) - for i := 0; i <= 50; i ++ { + for i := 0; i <= 50; i++ { go func(port int) { trueAddress := ip + ":" + strconv.Itoa(port) logs.Trace("try send test packet to target %s", trueAddress) diff --git a/client/health.go b/client/health.go index b57e7c0..9e0760f 100644 --- a/client/health.go +++ b/client/health.go @@ -2,15 +2,16 @@ package client import ( "container/heap" - "github.com/cnlh/nps/lib/conn" - "github.com/cnlh/nps/lib/file" - "github.com/cnlh/nps/lib/sheap" - "github.com/astaxie/beego/logs" - "github.com/pkg/errors" "net" "net/http" "strings" "time" + + "github.com/astaxie/beego/logs" + "github.com/cnlh/nps/lib/conn" + "github.com/cnlh/nps/lib/file" + "github.com/cnlh/nps/lib/sheap" + "github.com/pkg/errors" ) var isStart bool @@ -70,7 +71,7 @@ func check(t *file.Health) { var rs *http.Response for _, v := range arr { if t.HealthCheckType == "tcp" { - _, err = net.DialTimeout("tcp", v, time.Duration(t.HealthCheckTimeout)*time.Second); + _, err = net.DialTimeout("tcp", v, time.Duration(t.HealthCheckTimeout)*time.Second) } else { client := &http.Client{} client.Timeout = time.Duration(t.HealthCheckTimeout) * time.Second diff --git a/client/local.go b/client/local.go index 212fd70..55b9df9 100644 --- a/client/local.go +++ b/client/local.go @@ -1,6 +1,12 @@ package client import ( + "net" + "net/http" + "sync" + "time" + + "github.com/astaxie/beego/logs" "github.com/cnlh/nps/lib/common" "github.com/cnlh/nps/lib/config" "github.com/cnlh/nps/lib/conn" @@ -8,12 +14,7 @@ import ( "github.com/cnlh/nps/lib/file" "github.com/cnlh/nps/lib/mux" "github.com/cnlh/nps/server/proxy" - "github.com/astaxie/beego/logs" "github.com/xtaci/kcp-go" - "net" - "net/http" - "sync" - "time" ) var ( @@ -116,7 +117,7 @@ func StartLocalServer(l *config.LocalServer, config *config.CommonConfig) error func handleUdpMonitor(config *config.CommonConfig, l *config.LocalServer) { ticker := time.NewTicker(time.Second * 1) - for{ + for { select { case <-ticker.C: if !udpConnStatus { diff --git a/client/register.go b/client/register.go index 2d994aa..c03fb3c 100644 --- a/client/register.go +++ b/client/register.go @@ -2,9 +2,10 @@ package client import ( "encoding/binary" - "github.com/cnlh/nps/lib/common" "log" "os" + + "github.com/cnlh/nps/lib/common" ) func RegisterLocalIp(server string, vKey string, tp string, proxyUrl string, hour int) { diff --git a/cmd/npc/npc.go b/cmd/npc/npc.go index 501718b..fe5b3f5 100644 --- a/cmd/npc/npc.go +++ b/cmd/npc/npc.go @@ -3,17 +3,18 @@ package main import ( "flag" "fmt" + "os" + "strings" + "time" + + "github.com/astaxie/beego/logs" + "github.com/ccding/go-stun/stun" "github.com/cnlh/nps/client" "github.com/cnlh/nps/lib/common" "github.com/cnlh/nps/lib/config" "github.com/cnlh/nps/lib/daemon" "github.com/cnlh/nps/lib/file" "github.com/cnlh/nps/lib/version" - "github.com/astaxie/beego/logs" - "github.com/ccding/go-stun/stun" - "os" - "strings" - "time" ) var ( diff --git a/cmd/nps/nps.go b/cmd/nps/nps.go index ff54052..f66fe66 100644 --- a/cmd/nps/nps.go +++ b/cmd/nps/nps.go @@ -2,6 +2,12 @@ package main import ( "flag" + "log" + "os" + "path/filepath" + + "github.com/astaxie/beego" + "github.com/astaxie/beego/logs" "github.com/cnlh/nps/lib/common" "github.com/cnlh/nps/lib/crypt" "github.com/cnlh/nps/lib/daemon" @@ -12,12 +18,7 @@ import ( "github.com/cnlh/nps/server/connection" "github.com/cnlh/nps/server/test" "github.com/cnlh/nps/server/tool" - "github.com/astaxie/beego" - "github.com/astaxie/beego/logs" _ "github.com/cnlh/nps/web/routers" - "log" - "os" - "path/filepath" ) var ( diff --git a/lib/common/util.go b/lib/common/util.go index ce4381d..41f8b3c 100755 --- a/lib/common/util.go +++ b/lib/common/util.go @@ -4,8 +4,6 @@ import ( "bytes" "encoding/base64" "encoding/binary" - "github.com/cnlh/nps/lib/crypt" - "github.com/cnlh/nps/lib/pool" "html/template" "io" "io/ioutil" @@ -16,6 +14,9 @@ import ( "strconv" "strings" "sync" + + "github.com/cnlh/nps/lib/crypt" + "github.com/cnlh/nps/lib/pool" ) //Get the corresponding IP address through domain name diff --git a/lib/config/config.go b/lib/config/config.go index 7b4ce5c..c4d144e 100644 --- a/lib/config/config.go +++ b/lib/config/config.go @@ -3,10 +3,11 @@ package config import ( "errors" "fmt" - "github.com/cnlh/nps/lib/common" - "github.com/cnlh/nps/lib/file" "regexp" "strings" + + "github.com/cnlh/nps/lib/common" + "github.com/cnlh/nps/lib/file" ) type CommonConfig struct { diff --git a/lib/conn/conn.go b/lib/conn/conn.go index 91d1779..c60941e 100755 --- a/lib/conn/conn.go +++ b/lib/conn/conn.go @@ -6,13 +6,6 @@ import ( "encoding/binary" "encoding/json" "errors" - "github.com/cnlh/nps/lib/common" - "github.com/cnlh/nps/lib/crypt" - "github.com/cnlh/nps/lib/file" - "github.com/cnlh/nps/lib/mux" - "github.com/cnlh/nps/lib/pool" - "github.com/cnlh/nps/lib/rate" - "github.com/xtaci/kcp-go" "io" "net" "net/http" @@ -21,6 +14,14 @@ import ( "strings" "sync" "time" + + "github.com/cnlh/nps/lib/common" + "github.com/cnlh/nps/lib/crypt" + "github.com/cnlh/nps/lib/file" + "github.com/cnlh/nps/lib/mux" + "github.com/cnlh/nps/lib/pool" + "github.com/cnlh/nps/lib/rate" + "github.com/xtaci/kcp-go" ) type Conn struct { @@ -373,7 +374,7 @@ func CopyWaitGroup(conn1, conn2 net.Conn, crypt bool, snappy bool, rate *rate.Ra } //get crypt or snappy conn -func GetConn(conn net.Conn, cpt, snappy bool, rt *rate.Rate, isServer bool) (io.ReadWriteCloser) { +func GetConn(conn net.Conn, cpt, snappy bool, rt *rate.Rate, isServer bool) io.ReadWriteCloser { if cpt { if isServer { return rate.NewRateConn(crypt.NewTlsServerConn(conn), rt) diff --git a/lib/conn/listener.go b/lib/conn/listener.go index 1d23644..f80e01d 100644 --- a/lib/conn/listener.go +++ b/lib/conn/listener.go @@ -1,10 +1,11 @@ package conn import ( - "github.com/astaxie/beego/logs" - "github.com/xtaci/kcp-go" "net" "strings" + + "github.com/astaxie/beego/logs" + "github.com/xtaci/kcp-go" ) func NewTcpListenerAndProcess(addr string, f func(c net.Conn), listener *net.Listener) error { diff --git a/lib/conn/snappy.go b/lib/conn/snappy.go index 729acb3..a655627 100644 --- a/lib/conn/snappy.go +++ b/lib/conn/snappy.go @@ -1,9 +1,10 @@ package conn import ( + "io" + "github.com/cnlh/nps/lib/pool" "github.com/golang/snappy" - "io" ) type SnappyConn struct { diff --git a/lib/crypt/tls.go b/lib/crypt/tls.go index 75f291a..35a0a74 100644 --- a/lib/crypt/tls.go +++ b/lib/crypt/tls.go @@ -2,9 +2,10 @@ package crypt import ( "crypto/tls" - "github.com/astaxie/beego/logs" "net" "os" + + "github.com/astaxie/beego/logs" ) var pemPath, keyPath string diff --git a/lib/daemon/daemon.go b/lib/daemon/daemon.go index 54454b2..3c41086 100644 --- a/lib/daemon/daemon.go +++ b/lib/daemon/daemon.go @@ -1,7 +1,6 @@ package daemon import ( - "github.com/cnlh/nps/lib/common" "io/ioutil" "log" "os" @@ -9,6 +8,8 @@ import ( "path/filepath" "strconv" "strings" + + "github.com/cnlh/nps/lib/common" ) func InitDaemon(f string, runPath string, pidPath string) { diff --git a/lib/daemon/reload.go b/lib/daemon/reload.go index 6b075b6..2db00ac 100644 --- a/lib/daemon/reload.go +++ b/lib/daemon/reload.go @@ -3,12 +3,13 @@ package daemon import ( - "github.com/cnlh/nps/lib/common" - "github.com/astaxie/beego" "os" "os/signal" "path/filepath" "syscall" + + "github.com/astaxie/beego" + "github.com/cnlh/nps/lib/common" ) func init() { diff --git a/lib/file/db.go b/lib/file/db.go index 69e33d6..c48df2e 100644 --- a/lib/file/db.go +++ b/lib/file/db.go @@ -3,14 +3,15 @@ package file import ( "errors" "fmt" - "github.com/cnlh/nps/lib/common" - "github.com/cnlh/nps/lib/crypt" - "github.com/cnlh/nps/lib/rate" "net/http" "regexp" "sort" "strings" "sync" + + "github.com/cnlh/nps/lib/common" + "github.com/cnlh/nps/lib/crypt" + "github.com/cnlh/nps/lib/rate" ) type DbUtils struct { diff --git a/lib/file/file.go b/lib/file/file.go index 541e617..63f3cb7 100644 --- a/lib/file/file.go +++ b/lib/file/file.go @@ -3,13 +3,14 @@ package file import ( "encoding/json" "errors" - "github.com/cnlh/nps/lib/common" - "github.com/cnlh/nps/lib/rate" "os" "path/filepath" "strings" "sync" "sync/atomic" + + "github.com/cnlh/nps/lib/common" + "github.com/cnlh/nps/lib/rate" ) func NewJsonDb(runPath string) *JsonDb { diff --git a/lib/file/obj.go b/lib/file/obj.go index 3e7acf0..d3a1fbe 100644 --- a/lib/file/obj.go +++ b/lib/file/obj.go @@ -1,12 +1,13 @@ package file import ( - "github.com/cnlh/nps/lib/rate" - "github.com/pkg/errors" "strings" "sync" "sync/atomic" "time" + + "github.com/cnlh/nps/lib/rate" + "github.com/pkg/errors" ) type Flow struct { diff --git a/lib/install/install.go b/lib/install/install.go index 5b2a515..411a2e2 100644 --- a/lib/install/install.go +++ b/lib/install/install.go @@ -3,12 +3,13 @@ package install import ( "errors" "fmt" - "github.com/cnlh/nps/lib/common" "io" "log" "os" "path/filepath" "strings" + + "github.com/cnlh/nps/lib/common" ) func InstallNps() { diff --git a/lib/mux/conn.go b/lib/mux/conn.go index 9e66577..5016771 100644 --- a/lib/mux/conn.go +++ b/lib/mux/conn.go @@ -2,11 +2,12 @@ package mux import ( "errors" - "github.com/cnlh/nps/lib/pool" "io" "net" "sync" "time" + + "github.com/cnlh/nps/lib/pool" ) type conn struct { diff --git a/lib/mux/mux.go b/lib/mux/mux.go index 315bc68..0365a8b 100644 --- a/lib/mux/mux.go +++ b/lib/mux/mux.go @@ -4,12 +4,13 @@ import ( "bytes" "encoding/binary" "errors" - "github.com/cnlh/nps/lib/pool" "math" "net" "sync" "sync/atomic" "time" + + "github.com/cnlh/nps/lib/pool" ) const ( @@ -174,7 +175,7 @@ func (s *Mux) readSession() { case conn.getStatusCh <- struct{}{}: default: } - conn.hasWrite -- + conn.hasWrite-- case MUX_NEW_CONN_OK: //conn ok conn.connStatusOkCh <- struct{}{} case MUX_NEW_CONN_Fail: diff --git a/lib/mux/mux_test.go b/lib/mux/mux_test.go index 463291a..b89e4e9 100644 --- a/lib/mux/mux_test.go +++ b/lib/mux/mux_test.go @@ -1,15 +1,16 @@ package mux import ( - "github.com/cnlh/nps/lib/common" - "github.com/cnlh/nps/lib/pool" - "github.com/astaxie/beego/logs" "log" "net" "net/http" _ "net/http/pprof" "testing" "time" + + "github.com/astaxie/beego/logs" + "github.com/cnlh/nps/lib/common" + "github.com/cnlh/nps/lib/pool" ) var conn1 net.Conn diff --git a/lib/mux/pmux.go b/lib/mux/pmux.go index b750838..e593bb0 100644 --- a/lib/mux/pmux.go +++ b/lib/mux/pmux.go @@ -5,15 +5,16 @@ package mux import ( "bufio" "bytes" - "github.com/cnlh/nps/lib/common" - "github.com/astaxie/beego/logs" - "github.com/pkg/errors" "io" "net" "os" "strconv" "strings" "time" + + "github.com/astaxie/beego/logs" + "github.com/cnlh/nps/lib/common" + "github.com/pkg/errors" ) const ( diff --git a/lib/mux/pmux_test.go b/lib/mux/pmux_test.go index c3c0705..4c8e44e 100644 --- a/lib/mux/pmux_test.go +++ b/lib/mux/pmux_test.go @@ -1,9 +1,10 @@ package mux import ( - "github.com/astaxie/beego/logs" "testing" "time" + + "github.com/astaxie/beego/logs" ) func TestPortMux_Close(t *testing.T) { @@ -11,7 +12,7 @@ func TestPortMux_Close(t *testing.T) { logs.EnableFuncCallDepth(true) logs.SetLogFuncCallDepth(3) - pMux := NewPortMux(8888,"Ds") + pMux := NewPortMux(8888, "Ds") go func() { if pMux.Start() != nil { logs.Warn("Error") diff --git a/lib/mux/queue.go b/lib/mux/queue.go index f03bafd..9487845 100644 --- a/lib/mux/queue.go +++ b/lib/mux/queue.go @@ -2,8 +2,9 @@ package mux import ( "errors" - "github.com/cnlh/nps/lib/pool" "sync" + + "github.com/cnlh/nps/lib/pool" ) type Element *bufNode diff --git a/lib/pool/pool.go b/lib/pool/pool.go index 70e0477..ace8b07 100644 --- a/lib/pool/pool.go +++ b/lib/pool/pool.go @@ -36,6 +36,7 @@ var BufPoolCopy = sync.Pool{ return &buf }, } + func PutBufPoolUdp(buf []byte) { if cap(buf) == PoolSizeUdp { BufPoolUdp.Put(buf[:PoolSizeUdp]) @@ -48,7 +49,7 @@ func PutBufPoolCopy(buf []byte) { } } -func GetBufPoolCopy() ([]byte) { +func GetBufPoolCopy() []byte { return (*BufPoolCopy.Get().(*[]byte))[:PoolSizeCopy] } diff --git a/server/connection/connection.go b/server/connection/connection.go index 73eac1d..dbd74ca 100644 --- a/server/connection/connection.go +++ b/server/connection/connection.go @@ -1,12 +1,13 @@ package connection import ( - "github.com/cnlh/nps/lib/mux" - "github.com/astaxie/beego" - "github.com/astaxie/beego/logs" "net" "os" "strconv" + + "github.com/astaxie/beego" + "github.com/astaxie/beego/logs" + "github.com/cnlh/nps/lib/mux" ) var pMux *mux.PortMux diff --git a/server/proxy/base.go b/server/proxy/base.go index 68cce5b..93774f3 100644 --- a/server/proxy/base.go +++ b/server/proxy/base.go @@ -2,14 +2,15 @@ package proxy import ( "errors" + "net" + "net/http" + "sync" + + "github.com/astaxie/beego/logs" "github.com/cnlh/nps/bridge" "github.com/cnlh/nps/lib/common" "github.com/cnlh/nps/lib/conn" "github.com/cnlh/nps/lib/file" - "github.com/astaxie/beego/logs" - "net" - "net/http" - "sync" ) type Service interface { diff --git a/server/proxy/http.go b/server/proxy/http.go index bf12060..31ec81c 100644 --- a/server/proxy/http.go +++ b/server/proxy/http.go @@ -3,13 +3,6 @@ package proxy import ( "bufio" "crypto/tls" - "github.com/cnlh/nps/bridge" - "github.com/cnlh/nps/lib/cache" - "github.com/cnlh/nps/lib/common" - "github.com/cnlh/nps/lib/conn" - "github.com/cnlh/nps/lib/file" - "github.com/cnlh/nps/server/connection" - "github.com/astaxie/beego/logs" "io" "net" "net/http" @@ -19,6 +12,14 @@ import ( "strconv" "strings" "sync" + + "github.com/astaxie/beego/logs" + "github.com/cnlh/nps/bridge" + "github.com/cnlh/nps/lib/cache" + "github.com/cnlh/nps/lib/common" + "github.com/cnlh/nps/lib/conn" + "github.com/cnlh/nps/lib/file" + "github.com/cnlh/nps/server/connection" ) type httpServer struct { diff --git a/server/proxy/https.go b/server/proxy/https.go index 997a851..303b92d 100644 --- a/server/proxy/https.go +++ b/server/proxy/https.go @@ -1,18 +1,19 @@ package proxy import ( + "net" + "net/http" + "net/url" + "sync" + + "github.com/astaxie/beego" + "github.com/astaxie/beego/logs" "github.com/cnlh/nps/lib/cache" "github.com/cnlh/nps/lib/common" "github.com/cnlh/nps/lib/conn" "github.com/cnlh/nps/lib/crypt" "github.com/cnlh/nps/lib/file" - "github.com/astaxie/beego" - "github.com/astaxie/beego/logs" "github.com/pkg/errors" - "net" - "net/http" - "net/url" - "sync" ) type HttpsServer struct { diff --git a/server/proxy/p2p.go b/server/proxy/p2p.go index 470963f..dc6eb07 100644 --- a/server/proxy/p2p.go +++ b/server/proxy/p2p.go @@ -1,12 +1,13 @@ package proxy import ( - "github.com/cnlh/nps/lib/common" - "github.com/cnlh/nps/lib/pool" - "github.com/astaxie/beego/logs" "net" "strings" "time" + + "github.com/astaxie/beego/logs" + "github.com/cnlh/nps/lib/common" + "github.com/cnlh/nps/lib/pool" ) type P2PServer struct { diff --git a/server/proxy/socks5.go b/server/proxy/socks5.go index 2215734..2fe72c1 100755 --- a/server/proxy/socks5.go +++ b/server/proxy/socks5.go @@ -3,13 +3,14 @@ package proxy import ( "encoding/binary" "errors" - "github.com/cnlh/nps/lib/common" - "github.com/cnlh/nps/lib/conn" - "github.com/cnlh/nps/lib/file" - "github.com/astaxie/beego/logs" "io" "net" "strconv" + + "github.com/astaxie/beego/logs" + "github.com/cnlh/nps/lib/common" + "github.com/cnlh/nps/lib/conn" + "github.com/cnlh/nps/lib/file" ) const ( @@ -273,4 +274,4 @@ func NewSock5ModeServer(bridge NetBridge, task *file.Tunnel) *Sock5ModeServer { //close func (s *Sock5ModeServer) Close() error { return s.listener.Close() -} \ No newline at end of file +} diff --git a/server/proxy/transport.go b/server/proxy/transport.go index 364a7b8..d622683 100644 --- a/server/proxy/transport.go +++ b/server/proxy/transport.go @@ -3,11 +3,12 @@ package proxy import ( - "github.com/cnlh/nps/lib/common" - "github.com/cnlh/nps/lib/conn" "net" "strconv" "syscall" + + "github.com/cnlh/nps/lib/common" + "github.com/cnlh/nps/lib/conn" ) func HandleTrans(c *conn.Conn, s *TunnelModeServer) error { diff --git a/server/proxy/udp.go b/server/proxy/udp.go index 82f2cf2..d2bc130 100755 --- a/server/proxy/udp.go +++ b/server/proxy/udp.go @@ -1,14 +1,15 @@ package proxy import ( + "net" + "strings" + + "github.com/astaxie/beego/logs" "github.com/cnlh/nps/bridge" "github.com/cnlh/nps/lib/common" "github.com/cnlh/nps/lib/conn" "github.com/cnlh/nps/lib/file" "github.com/cnlh/nps/lib/pool" - "github.com/astaxie/beego/logs" - "net" - "strings" ) type UdpModeServer struct { diff --git a/server/server.go b/server/server.go index 2534f6e..5e72617 100644 --- a/server/server.go +++ b/server/server.go @@ -8,13 +8,13 @@ import ( "strings" "time" + "github.com/astaxie/beego" + "github.com/astaxie/beego/logs" "github.com/cnlh/nps/bridge" "github.com/cnlh/nps/lib/common" "github.com/cnlh/nps/lib/file" "github.com/cnlh/nps/server/proxy" "github.com/cnlh/nps/server/tool" - "github.com/astaxie/beego" - "github.com/astaxie/beego/logs" "github.com/shirou/gopsutil/cpu" "github.com/shirou/gopsutil/load" "github.com/shirou/gopsutil/mem" diff --git a/server/test/test.go b/server/test/test.go index fbd8eb7..0a8fbfd 100644 --- a/server/test/test.go +++ b/server/test/test.go @@ -1,12 +1,13 @@ package test import ( - "github.com/cnlh/nps/lib/common" - "github.com/cnlh/nps/lib/file" - "github.com/astaxie/beego" "log" "path/filepath" "strconv" + + "github.com/astaxie/beego" + "github.com/cnlh/nps/lib/common" + "github.com/cnlh/nps/lib/file" ) func TestServerConfig() { diff --git a/server/tool/utils.go b/server/tool/utils.go index 9d801a6..6a58bab 100644 --- a/server/tool/utils.go +++ b/server/tool/utils.go @@ -1,15 +1,16 @@ package tool import ( - "github.com/cnlh/nps/lib/common" + "math" + "strconv" + "time" + "github.com/astaxie/beego" + "github.com/cnlh/nps/lib/common" "github.com/shirou/gopsutil/cpu" "github.com/shirou/gopsutil/load" "github.com/shirou/gopsutil/mem" "github.com/shirou/gopsutil/net" - "math" - "strconv" - "time" ) var ( diff --git a/web/controllers/auth.go b/web/controllers/auth.go index 5d8cac6..3b6b4c5 100644 --- a/web/controllers/auth.go +++ b/web/controllers/auth.go @@ -2,9 +2,10 @@ package controllers import ( "encoding/hex" - "github.com/cnlh/nps/lib/crypt" - "github.com/astaxie/beego" "time" + + "github.com/astaxie/beego" + "github.com/cnlh/nps/lib/crypt" ) type AuthController struct { diff --git a/web/controllers/base.go b/web/controllers/base.go index 089cee4..b608478 100755 --- a/web/controllers/base.go +++ b/web/controllers/base.go @@ -1,16 +1,17 @@ package controllers import ( - "github.com/cnlh/nps/lib/common" - "github.com/cnlh/nps/lib/crypt" - "github.com/cnlh/nps/lib/file" - "github.com/cnlh/nps/server" - "github.com/astaxie/beego" "html" "math" "strconv" "strings" "time" + + "github.com/astaxie/beego" + "github.com/cnlh/nps/lib/common" + "github.com/cnlh/nps/lib/crypt" + "github.com/cnlh/nps/lib/file" + "github.com/cnlh/nps/server" ) type BaseController struct { diff --git a/web/controllers/client.go b/web/controllers/client.go index ffe5f59..8a3ae31 100644 --- a/web/controllers/client.go +++ b/web/controllers/client.go @@ -1,11 +1,11 @@ package controllers import ( + "github.com/astaxie/beego" "github.com/cnlh/nps/lib/common" "github.com/cnlh/nps/lib/file" "github.com/cnlh/nps/lib/rate" "github.com/cnlh/nps/server" - "github.com/astaxie/beego" ) type ClientController struct { diff --git a/web/controllers/login.go b/web/controllers/login.go index da40e64..c31e9a1 100755 --- a/web/controllers/login.go +++ b/web/controllers/login.go @@ -1,11 +1,12 @@ package controllers import ( + "time" + + "github.com/astaxie/beego" "github.com/cnlh/nps/lib/common" "github.com/cnlh/nps/lib/file" "github.com/cnlh/nps/server" - "github.com/astaxie/beego" - "time" ) type LoginController struct {