From 5763eb3689a0619e00cbdfef14bb6b2e47fefe87 Mon Sep 17 00:00:00 2001 From: fatedier Date: Wed, 23 Sep 2020 13:39:20 +0800 Subject: [PATCH] rename models to pkg --- Makefile | 5 ++-- client/admin.go | 2 +- client/admin_api.go | 4 +-- client/control.go | 12 ++++---- client/event/event.go | 2 +- client/health/health.go | 2 +- client/proxy/proxy.go | 14 +++++----- client/proxy/proxy_manager.go | 6 ++-- client/proxy/proxy_wrapper.go | 6 ++-- client/service.go | 16 +++++------ client/visitor.go | 12 ++++---- client/visitor_manager.go | 4 +-- cmd/frpc/sub/http.go | 6 ++-- cmd/frpc/sub/https.go | 4 +-- cmd/frpc/sub/reload.go | 4 +-- cmd/frpc/sub/root.go | 12 ++++---- cmd/frpc/sub/status.go | 6 ++-- cmd/frpc/sub/stcp.go | 6 ++-- cmd/frpc/sub/sudp.go | 6 ++-- cmd/frpc/sub/tcp.go | 4 +-- cmd/frpc/sub/tcpmux.go | 4 +-- cmd/frpc/sub/udp.go | 6 ++-- cmd/frpc/sub/xtcp.go | 6 ++-- cmd/frps/main.go | 2 +- cmd/frps/root.go | 14 +++++----- {models => pkg}/auth/auth.go | 4 +-- {models => pkg}/auth/oidc.go | 2 +- {models => pkg}/auth/token.go | 4 +-- {models => pkg}/config/client_common.go | 4 +-- {models => pkg}/config/proxy.go | 6 ++-- {models => pkg}/config/server_common.go | 8 +++--- {models => pkg}/config/types.go | 0 {models => pkg}/config/types_test.go | 0 {models => pkg}/config/value.go | 0 {models => pkg}/config/visitor.go | 2 +- {models => pkg}/consts/consts.go | 0 {models => pkg}/errors/errors.go | 0 {models => pkg}/metrics/aggregate/server.go | 4 +-- {models => pkg}/metrics/mem/server.go | 4 +-- {models => pkg}/metrics/mem/types.go | 2 +- {models => pkg}/metrics/metrics.go | 2 +- {models => pkg}/metrics/prometheus/server.go | 0 {models => pkg}/msg/ctl.go | 0 {models => pkg}/msg/msg.go | 0 {models => pkg}/nathole/nathole.go | 6 ++-- {models => pkg}/plugin/client/http2https.go | 2 +- {models => pkg}/plugin/client/http_proxy.go | 2 +- {models => pkg}/plugin/client/https2http.go | 2 +- {models => pkg}/plugin/client/plugin.go | 0 {models => pkg}/plugin/client/socks5.go | 2 +- {models => pkg}/plugin/client/static_file.go | 2 +- .../plugin/client/unix_domain_socket.go | 0 {models => pkg}/plugin/server/http.go | 0 {models => pkg}/plugin/server/manager.go | 4 +-- {models => pkg}/plugin/server/plugin.go | 0 {models => pkg}/plugin/server/tracer.go | 0 {models => pkg}/plugin/server/types.go | 2 +- {models => pkg}/proto/udp/udp.go | 2 +- {models => pkg}/proto/udp/udp_test.go | 0 {models => pkg}/transport/tls.go | 0 {utils => pkg/util}/limit/reader.go | 0 {utils => pkg/util}/limit/writer.go | 0 {utils => pkg/util}/log/log.go | 0 {utils => pkg/util}/metric/counter.go | 0 {utils => pkg/util}/metric/counter_test.go | 0 {utils => pkg/util}/metric/date_counter.go | 0 .../util}/metric/date_counter_test.go | 0 {utils => pkg/util}/metric/metrics.go | 0 {utils => pkg/util}/net/conn.go | 3 +- {utils => pkg/util}/net/http.go | 0 {utils => pkg/util}/net/kcp.go | 0 {utils => pkg/util}/net/listener.go | 0 {utils => pkg/util}/net/tls.go | 0 {utils => pkg/util}/net/udp.go | 0 {utils => pkg/util}/net/websocket.go | 0 {utils => pkg/util}/tcpmux/httpconnect.go | 4 +-- {utils => pkg/util}/util/http.go | 0 {utils => pkg/util}/util/util.go | 0 {utils => pkg/util}/util/util_test.go | 0 {utils => pkg/util}/version/version.go | 0 {utils => pkg/util}/version/version_test.go | 0 {utils => pkg/util}/vhost/http.go | 4 +-- {utils => pkg/util}/vhost/https.go | 0 {utils => pkg/util}/vhost/resource.go | 4 +-- {utils => pkg/util}/vhost/reverseproxy.go | 0 {utils => pkg/util}/vhost/router.go | 0 {utils => pkg/util}/vhost/vhost.go | 6 ++-- {utils => pkg/util}/xlog/ctx.go | 0 {utils => pkg/util}/xlog/xlog.go | 2 +- server/control.go | 18 ++++++------ server/controller/resource.go | 8 +++--- server/dashboard.go | 2 +- server/dashboard_api.go | 10 +++---- server/group/http.go | 2 +- server/group/tcpmux.go | 6 ++-- server/proxy/http.go | 8 +++--- server/proxy/https.go | 6 ++-- server/proxy/proxy.go | 10 +++---- server/proxy/stcp.go | 2 +- server/proxy/sudp.go | 2 +- server/proxy/tcp.go | 2 +- server/proxy/tcpmux.go | 8 +++--- server/proxy/udp.go | 8 +++--- server/proxy/xtcp.go | 4 +-- server/service.go | 28 +++++++++---------- server/visitor/visitor.go | 4 +-- test/e2e/e2e.go | 2 +- test/e2e/e2e_test.go | 2 +- test/e2e/framework/process.go | 2 +- test/e2e/mock/echoserver/echoserver.go | 2 +- tests/mock/echo_server.go | 2 +- 111 files changed, 196 insertions(+), 196 deletions(-) rename {models => pkg}/auth/auth.go (98%) rename {models => pkg}/auth/oidc.go (99%) rename {models => pkg}/auth/token.go (97%) rename {models => pkg}/config/client_common.go (99%) rename {models => pkg}/config/proxy.go (99%) rename {models => pkg}/config/server_common.go (99%) rename {models => pkg}/config/types.go (100%) rename {models => pkg}/config/types_test.go (100%) rename {models => pkg}/config/value.go (100%) rename {models => pkg}/config/visitor.go (99%) rename {models => pkg}/consts/consts.go (100%) rename {models => pkg}/errors/errors.go (100%) rename {models => pkg}/metrics/aggregate/server.go (95%) rename {models => pkg}/metrics/mem/server.go (98%) rename {models => pkg}/metrics/mem/types.go (97%) rename {models => pkg}/metrics/metrics.go (68%) rename {models => pkg}/metrics/prometheus/server.go (100%) rename {models => pkg}/msg/ctl.go (100%) rename {models => pkg}/msg/msg.go (100%) rename {models => pkg}/nathole/nathole.go (97%) rename {models => pkg}/plugin/client/http2https.go (98%) rename {models => pkg}/plugin/client/http_proxy.go (99%) rename {models => pkg}/plugin/client/https2http.go (98%) rename {models => pkg}/plugin/client/plugin.go (100%) rename {models => pkg}/plugin/client/socks5.go (97%) rename {models => pkg}/plugin/client/static_file.go (97%) rename {models => pkg}/plugin/client/unix_domain_socket.go (100%) rename {models => pkg}/plugin/server/http.go (100%) rename {models => pkg}/plugin/server/manager.go (98%) rename {models => pkg}/plugin/server/plugin.go (100%) rename {models => pkg}/plugin/server/tracer.go (100%) rename {models => pkg}/plugin/server/types.go (97%) rename {models => pkg}/proto/udp/udp.go (98%) rename {models => pkg}/proto/udp/udp_test.go (100%) rename {models => pkg}/transport/tls.go (100%) rename {utils => pkg/util}/limit/reader.go (100%) rename {utils => pkg/util}/limit/writer.go (100%) rename {utils => pkg/util}/log/log.go (100%) rename {utils => pkg/util}/metric/counter.go (100%) rename {utils => pkg/util}/metric/counter_test.go (100%) rename {utils => pkg/util}/metric/date_counter.go (100%) rename {utils => pkg/util}/metric/date_counter_test.go (100%) rename {utils => pkg/util}/metric/metrics.go (100%) rename {utils => pkg/util}/net/conn.go (99%) rename {utils => pkg/util}/net/http.go (100%) rename {utils => pkg/util}/net/kcp.go (100%) rename {utils => pkg/util}/net/listener.go (100%) rename {utils => pkg/util}/net/tls.go (100%) rename {utils => pkg/util}/net/udp.go (100%) rename {utils => pkg/util}/net/websocket.go (100%) rename {utils => pkg/util}/tcpmux/httpconnect.go (95%) rename {utils => pkg/util}/util/http.go (100%) rename {utils => pkg/util}/util/util.go (100%) rename {utils => pkg/util}/util/util_test.go (100%) rename {utils => pkg/util}/version/version.go (100%) rename {utils => pkg/util}/version/version_test.go (100%) rename {utils => pkg/util}/vhost/http.go (98%) rename {utils => pkg/util}/vhost/https.go (100%) rename {utils => pkg/util}/vhost/resource.go (96%) rename {utils => pkg/util}/vhost/reverseproxy.go (100%) rename {utils => pkg/util}/vhost/router.go (100%) rename {utils => pkg/util}/vhost/vhost.go (97%) rename {utils => pkg/util}/xlog/ctx.go (100%) rename {utils => pkg/util}/xlog/xlog.go (97%) diff --git a/Makefile b/Makefile index 691cee2..b3035dd 100644 --- a/Makefile +++ b/Makefile @@ -28,11 +28,10 @@ test: gotest gotest: go test -v --cover ./assets/... - go test -v --cover ./client/... go test -v --cover ./cmd/... - go test -v --cover ./models/... + go test -v --cover ./client/... go test -v --cover ./server/... - go test -v --cover ./utils/... + go test -v --cover ./pkg/... ci: go test -count=1 -p=1 -v ./tests/... diff --git a/client/admin.go b/client/admin.go index 52babe2..fdef060 100644 --- a/client/admin.go +++ b/client/admin.go @@ -21,7 +21,7 @@ import ( "time" "github.com/fatedier/frp/assets" - frpNet "github.com/fatedier/frp/utils/net" + frpNet "github.com/fatedier/frp/pkg/util/net" "github.com/gorilla/mux" ) diff --git a/client/admin_api.go b/client/admin_api.go index 1462673..3977df1 100644 --- a/client/admin_api.go +++ b/client/admin_api.go @@ -23,8 +23,8 @@ import ( "strings" "github.com/fatedier/frp/client/proxy" - "github.com/fatedier/frp/models/config" - "github.com/fatedier/frp/utils/log" + "github.com/fatedier/frp/pkg/config" + "github.com/fatedier/frp/pkg/util/log" ) type GeneralResponse struct { diff --git a/client/control.go b/client/control.go index 861c977..c8ad7ed 100644 --- a/client/control.go +++ b/client/control.go @@ -25,12 +25,12 @@ import ( "time" "github.com/fatedier/frp/client/proxy" - "github.com/fatedier/frp/models/auth" - "github.com/fatedier/frp/models/config" - "github.com/fatedier/frp/models/msg" - "github.com/fatedier/frp/models/transport" - frpNet "github.com/fatedier/frp/utils/net" - "github.com/fatedier/frp/utils/xlog" + "github.com/fatedier/frp/pkg/auth" + "github.com/fatedier/frp/pkg/config" + "github.com/fatedier/frp/pkg/msg" + "github.com/fatedier/frp/pkg/transport" + frpNet "github.com/fatedier/frp/pkg/util/net" + "github.com/fatedier/frp/pkg/util/xlog" "github.com/fatedier/golib/control/shutdown" "github.com/fatedier/golib/crypto" diff --git a/client/event/event.go b/client/event/event.go index 71d6173..f971844 100644 --- a/client/event/event.go +++ b/client/event/event.go @@ -3,7 +3,7 @@ package event import ( "errors" - "github.com/fatedier/frp/models/msg" + "github.com/fatedier/frp/pkg/msg" ) type Type int diff --git a/client/health/health.go b/client/health/health.go index d2ae910..5a7b369 100644 --- a/client/health/health.go +++ b/client/health/health.go @@ -24,7 +24,7 @@ import ( "net/http" "time" - "github.com/fatedier/frp/utils/xlog" + "github.com/fatedier/frp/pkg/util/xlog" ) var ( diff --git a/client/proxy/proxy.go b/client/proxy/proxy.go index cb7d517..3e97784 100644 --- a/client/proxy/proxy.go +++ b/client/proxy/proxy.go @@ -26,13 +26,13 @@ import ( "sync" "time" - "github.com/fatedier/frp/models/config" - "github.com/fatedier/frp/models/msg" - plugin "github.com/fatedier/frp/models/plugin/client" - "github.com/fatedier/frp/models/proto/udp" - "github.com/fatedier/frp/utils/limit" - frpNet "github.com/fatedier/frp/utils/net" - "github.com/fatedier/frp/utils/xlog" + "github.com/fatedier/frp/pkg/config" + "github.com/fatedier/frp/pkg/msg" + plugin "github.com/fatedier/frp/pkg/plugin/client" + "github.com/fatedier/frp/pkg/proto/udp" + "github.com/fatedier/frp/pkg/util/limit" + frpNet "github.com/fatedier/frp/pkg/util/net" + "github.com/fatedier/frp/pkg/util/xlog" "github.com/fatedier/golib/errors" frpIo "github.com/fatedier/golib/io" diff --git a/client/proxy/proxy_manager.go b/client/proxy/proxy_manager.go index 9a78f0f..98c17fa 100644 --- a/client/proxy/proxy_manager.go +++ b/client/proxy/proxy_manager.go @@ -7,9 +7,9 @@ import ( "sync" "github.com/fatedier/frp/client/event" - "github.com/fatedier/frp/models/config" - "github.com/fatedier/frp/models/msg" - "github.com/fatedier/frp/utils/xlog" + "github.com/fatedier/frp/pkg/config" + "github.com/fatedier/frp/pkg/msg" + "github.com/fatedier/frp/pkg/util/xlog" "github.com/fatedier/golib/errors" ) diff --git a/client/proxy/proxy_wrapper.go b/client/proxy/proxy_wrapper.go index b3b375e..f1cd765 100644 --- a/client/proxy/proxy_wrapper.go +++ b/client/proxy/proxy_wrapper.go @@ -10,9 +10,9 @@ import ( "github.com/fatedier/frp/client/event" "github.com/fatedier/frp/client/health" - "github.com/fatedier/frp/models/config" - "github.com/fatedier/frp/models/msg" - "github.com/fatedier/frp/utils/xlog" + "github.com/fatedier/frp/pkg/config" + "github.com/fatedier/frp/pkg/msg" + "github.com/fatedier/frp/pkg/util/xlog" "github.com/fatedier/golib/errors" ) diff --git a/client/service.go b/client/service.go index e6451ff..f503918 100644 --- a/client/service.go +++ b/client/service.go @@ -18,7 +18,6 @@ import ( "context" "crypto/tls" "fmt" - "github.com/fatedier/frp/models/transport" "io/ioutil" "net" "runtime" @@ -27,13 +26,14 @@ import ( "time" "github.com/fatedier/frp/assets" - "github.com/fatedier/frp/models/auth" - "github.com/fatedier/frp/models/config" - "github.com/fatedier/frp/models/msg" - "github.com/fatedier/frp/utils/log" - frpNet "github.com/fatedier/frp/utils/net" - "github.com/fatedier/frp/utils/version" - "github.com/fatedier/frp/utils/xlog" + "github.com/fatedier/frp/pkg/auth" + "github.com/fatedier/frp/pkg/config" + "github.com/fatedier/frp/pkg/msg" + "github.com/fatedier/frp/pkg/transport" + "github.com/fatedier/frp/pkg/util/log" + frpNet "github.com/fatedier/frp/pkg/util/net" + "github.com/fatedier/frp/pkg/util/version" + "github.com/fatedier/frp/pkg/util/xlog" fmux "github.com/hashicorp/yamux" ) diff --git a/client/visitor.go b/client/visitor.go index ce5625f..85f6a15 100644 --- a/client/visitor.go +++ b/client/visitor.go @@ -24,12 +24,12 @@ import ( "sync" "time" - "github.com/fatedier/frp/models/config" - "github.com/fatedier/frp/models/msg" - "github.com/fatedier/frp/models/proto/udp" - frpNet "github.com/fatedier/frp/utils/net" - "github.com/fatedier/frp/utils/util" - "github.com/fatedier/frp/utils/xlog" + "github.com/fatedier/frp/pkg/config" + "github.com/fatedier/frp/pkg/msg" + "github.com/fatedier/frp/pkg/proto/udp" + frpNet "github.com/fatedier/frp/pkg/util/net" + "github.com/fatedier/frp/pkg/util/util" + "github.com/fatedier/frp/pkg/util/xlog" "github.com/fatedier/golib/errors" frpIo "github.com/fatedier/golib/io" diff --git a/client/visitor_manager.go b/client/visitor_manager.go index ea32eac..642b21e 100644 --- a/client/visitor_manager.go +++ b/client/visitor_manager.go @@ -19,8 +19,8 @@ import ( "sync" "time" - "github.com/fatedier/frp/models/config" - "github.com/fatedier/frp/utils/xlog" + "github.com/fatedier/frp/pkg/config" + "github.com/fatedier/frp/pkg/util/xlog" ) type VisitorManager struct { diff --git a/cmd/frpc/sub/http.go b/cmd/frpc/sub/http.go index 801ac5b..d1286b2 100644 --- a/cmd/frpc/sub/http.go +++ b/cmd/frpc/sub/http.go @@ -19,10 +19,10 @@ import ( "os" "strings" - "github.com/spf13/cobra" + "github.com/fatedier/frp/pkg/config" + "github.com/fatedier/frp/pkg/consts" - "github.com/fatedier/frp/models/config" - "github.com/fatedier/frp/models/consts" + "github.com/spf13/cobra" ) func init() { diff --git a/cmd/frpc/sub/https.go b/cmd/frpc/sub/https.go index 0c01f55..99a2295 100644 --- a/cmd/frpc/sub/https.go +++ b/cmd/frpc/sub/https.go @@ -21,8 +21,8 @@ import ( "github.com/spf13/cobra" - "github.com/fatedier/frp/models/config" - "github.com/fatedier/frp/models/consts" + "github.com/fatedier/frp/pkg/config" + "github.com/fatedier/frp/pkg/consts" ) func init() { diff --git a/cmd/frpc/sub/reload.go b/cmd/frpc/sub/reload.go index f351475..44b1677 100644 --- a/cmd/frpc/sub/reload.go +++ b/cmd/frpc/sub/reload.go @@ -22,9 +22,9 @@ import ( "os" "strings" - "github.com/spf13/cobra" + "github.com/fatedier/frp/pkg/config" - "github.com/fatedier/frp/models/config" + "github.com/spf13/cobra" ) func init() { diff --git a/cmd/frpc/sub/root.go b/cmd/frpc/sub/root.go index 4490476..d84ce82 100644 --- a/cmd/frpc/sub/root.go +++ b/cmd/frpc/sub/root.go @@ -25,13 +25,13 @@ import ( "syscall" "time" - "github.com/spf13/cobra" - "github.com/fatedier/frp/client" - "github.com/fatedier/frp/models/auth" - "github.com/fatedier/frp/models/config" - "github.com/fatedier/frp/utils/log" - "github.com/fatedier/frp/utils/version" + "github.com/fatedier/frp/pkg/auth" + "github.com/fatedier/frp/pkg/config" + "github.com/fatedier/frp/pkg/util/log" + "github.com/fatedier/frp/pkg/util/version" + + "github.com/spf13/cobra" ) const ( diff --git a/cmd/frpc/sub/status.go b/cmd/frpc/sub/status.go index a9123f9..774de53 100644 --- a/cmd/frpc/sub/status.go +++ b/cmd/frpc/sub/status.go @@ -23,11 +23,11 @@ import ( "os" "strings" + "github.com/fatedier/frp/client" + "github.com/fatedier/frp/pkg/config" + "github.com/rodaine/table" "github.com/spf13/cobra" - - "github.com/fatedier/frp/client" - "github.com/fatedier/frp/models/config" ) func init() { diff --git a/cmd/frpc/sub/stcp.go b/cmd/frpc/sub/stcp.go index 24e881d..1b4ac0f 100644 --- a/cmd/frpc/sub/stcp.go +++ b/cmd/frpc/sub/stcp.go @@ -18,10 +18,10 @@ import ( "fmt" "os" - "github.com/spf13/cobra" + "github.com/fatedier/frp/pkg/config" + "github.com/fatedier/frp/pkg/consts" - "github.com/fatedier/frp/models/config" - "github.com/fatedier/frp/models/consts" + "github.com/spf13/cobra" ) func init() { diff --git a/cmd/frpc/sub/sudp.go b/cmd/frpc/sub/sudp.go index 399a562..d730677 100644 --- a/cmd/frpc/sub/sudp.go +++ b/cmd/frpc/sub/sudp.go @@ -18,10 +18,10 @@ import ( "fmt" "os" - "github.com/spf13/cobra" + "github.com/fatedier/frp/pkg/config" + "github.com/fatedier/frp/pkg/consts" - "github.com/fatedier/frp/models/config" - "github.com/fatedier/frp/models/consts" + "github.com/spf13/cobra" ) func init() { diff --git a/cmd/frpc/sub/tcp.go b/cmd/frpc/sub/tcp.go index ee30669..e6f310f 100644 --- a/cmd/frpc/sub/tcp.go +++ b/cmd/frpc/sub/tcp.go @@ -20,8 +20,8 @@ import ( "github.com/spf13/cobra" - "github.com/fatedier/frp/models/config" - "github.com/fatedier/frp/models/consts" + "github.com/fatedier/frp/pkg/config" + "github.com/fatedier/frp/pkg/consts" ) func init() { diff --git a/cmd/frpc/sub/tcpmux.go b/cmd/frpc/sub/tcpmux.go index 7a15094..065bf9c 100644 --- a/cmd/frpc/sub/tcpmux.go +++ b/cmd/frpc/sub/tcpmux.go @@ -21,8 +21,8 @@ import ( "github.com/spf13/cobra" - "github.com/fatedier/frp/models/config" - "github.com/fatedier/frp/models/consts" + "github.com/fatedier/frp/pkg/config" + "github.com/fatedier/frp/pkg/consts" ) func init() { diff --git a/cmd/frpc/sub/udp.go b/cmd/frpc/sub/udp.go index 01ff466..c521996 100644 --- a/cmd/frpc/sub/udp.go +++ b/cmd/frpc/sub/udp.go @@ -18,10 +18,10 @@ import ( "fmt" "os" - "github.com/spf13/cobra" + "github.com/fatedier/frp/pkg/config" + "github.com/fatedier/frp/pkg/consts" - "github.com/fatedier/frp/models/config" - "github.com/fatedier/frp/models/consts" + "github.com/spf13/cobra" ) func init() { diff --git a/cmd/frpc/sub/xtcp.go b/cmd/frpc/sub/xtcp.go index 018cbf3..6e66f95 100644 --- a/cmd/frpc/sub/xtcp.go +++ b/cmd/frpc/sub/xtcp.go @@ -18,10 +18,10 @@ import ( "fmt" "os" - "github.com/spf13/cobra" + "github.com/fatedier/frp/pkg/config" + "github.com/fatedier/frp/pkg/consts" - "github.com/fatedier/frp/models/config" - "github.com/fatedier/frp/models/consts" + "github.com/spf13/cobra" ) func init() { diff --git a/cmd/frps/main.go b/cmd/frps/main.go index 50be586..d95d842 100644 --- a/cmd/frps/main.go +++ b/cmd/frps/main.go @@ -21,7 +21,7 @@ import ( "github.com/fatedier/golib/crypto" _ "github.com/fatedier/frp/assets/frps/statik" - _ "github.com/fatedier/frp/models/metrics" + _ "github.com/fatedier/frp/pkg/metrics" ) func main() { diff --git a/cmd/frps/root.go b/cmd/frps/root.go index b6fb362..fb4fbd0 100644 --- a/cmd/frps/root.go +++ b/cmd/frps/root.go @@ -18,14 +18,14 @@ import ( "fmt" "os" - "github.com/spf13/cobra" - - "github.com/fatedier/frp/models/auth" - "github.com/fatedier/frp/models/config" + "github.com/fatedier/frp/pkg/auth" + "github.com/fatedier/frp/pkg/config" + "github.com/fatedier/frp/pkg/util/log" + "github.com/fatedier/frp/pkg/util/util" + "github.com/fatedier/frp/pkg/util/version" "github.com/fatedier/frp/server" - "github.com/fatedier/frp/utils/log" - "github.com/fatedier/frp/utils/util" - "github.com/fatedier/frp/utils/version" + + "github.com/spf13/cobra" ) const ( diff --git a/models/auth/auth.go b/pkg/auth/auth.go similarity index 98% rename from models/auth/auth.go rename to pkg/auth/auth.go index adbcb3d..a77123f 100644 --- a/models/auth/auth.go +++ b/pkg/auth/auth.go @@ -17,8 +17,8 @@ package auth import ( "fmt" - "github.com/fatedier/frp/models/consts" - "github.com/fatedier/frp/models/msg" + "github.com/fatedier/frp/pkg/consts" + "github.com/fatedier/frp/pkg/msg" "github.com/vaughan0/go-ini" ) diff --git a/models/auth/oidc.go b/pkg/auth/oidc.go similarity index 99% rename from models/auth/oidc.go rename to pkg/auth/oidc.go index 91c70be..a1e791a 100644 --- a/models/auth/oidc.go +++ b/pkg/auth/oidc.go @@ -18,7 +18,7 @@ import ( "context" "fmt" - "github.com/fatedier/frp/models/msg" + "github.com/fatedier/frp/pkg/msg" "github.com/coreos/go-oidc" "github.com/vaughan0/go-ini" diff --git a/models/auth/token.go b/pkg/auth/token.go similarity index 97% rename from models/auth/token.go rename to pkg/auth/token.go index 4c680d7..02faf2f 100644 --- a/models/auth/token.go +++ b/pkg/auth/token.go @@ -18,8 +18,8 @@ import ( "fmt" "time" - "github.com/fatedier/frp/models/msg" - "github.com/fatedier/frp/utils/util" + "github.com/fatedier/frp/pkg/msg" + "github.com/fatedier/frp/pkg/util/util" "github.com/vaughan0/go-ini" ) diff --git a/models/config/client_common.go b/pkg/config/client_common.go similarity index 99% rename from models/config/client_common.go rename to pkg/config/client_common.go index 505b988..1af9074 100644 --- a/models/config/client_common.go +++ b/pkg/config/client_common.go @@ -20,9 +20,9 @@ import ( "strconv" "strings" - ini "github.com/vaughan0/go-ini" + "github.com/fatedier/frp/pkg/auth" - "github.com/fatedier/frp/models/auth" + ini "github.com/vaughan0/go-ini" ) // ClientCommonConf contains information for a client service. It is diff --git a/models/config/proxy.go b/pkg/config/proxy.go similarity index 99% rename from models/config/proxy.go rename to pkg/config/proxy.go index 7c143a1..ad5b64b 100644 --- a/models/config/proxy.go +++ b/pkg/config/proxy.go @@ -20,9 +20,9 @@ import ( "strconv" "strings" - "github.com/fatedier/frp/models/consts" - "github.com/fatedier/frp/models/msg" - "github.com/fatedier/frp/utils/util" + "github.com/fatedier/frp/pkg/consts" + "github.com/fatedier/frp/pkg/msg" + "github.com/fatedier/frp/pkg/util/util" ini "github.com/vaughan0/go-ini" ) diff --git a/models/config/server_common.go b/pkg/config/server_common.go similarity index 99% rename from models/config/server_common.go rename to pkg/config/server_common.go index 1690aa0..594ad31 100644 --- a/models/config/server_common.go +++ b/pkg/config/server_common.go @@ -19,11 +19,11 @@ import ( "strconv" "strings" - ini "github.com/vaughan0/go-ini" + "github.com/fatedier/frp/pkg/auth" + plugin "github.com/fatedier/frp/pkg/plugin/server" + "github.com/fatedier/frp/pkg/util/util" - "github.com/fatedier/frp/models/auth" - plugin "github.com/fatedier/frp/models/plugin/server" - "github.com/fatedier/frp/utils/util" + ini "github.com/vaughan0/go-ini" ) // ServerCommonConf contains information for a server service. It is diff --git a/models/config/types.go b/pkg/config/types.go similarity index 100% rename from models/config/types.go rename to pkg/config/types.go diff --git a/models/config/types_test.go b/pkg/config/types_test.go similarity index 100% rename from models/config/types_test.go rename to pkg/config/types_test.go diff --git a/models/config/value.go b/pkg/config/value.go similarity index 100% rename from models/config/value.go rename to pkg/config/value.go diff --git a/models/config/visitor.go b/pkg/config/visitor.go similarity index 99% rename from models/config/visitor.go rename to pkg/config/visitor.go index a356841..39958ea 100644 --- a/models/config/visitor.go +++ b/pkg/config/visitor.go @@ -19,7 +19,7 @@ import ( "reflect" "strconv" - "github.com/fatedier/frp/models/consts" + "github.com/fatedier/frp/pkg/consts" ini "github.com/vaughan0/go-ini" ) diff --git a/models/consts/consts.go b/pkg/consts/consts.go similarity index 100% rename from models/consts/consts.go rename to pkg/consts/consts.go diff --git a/models/errors/errors.go b/pkg/errors/errors.go similarity index 100% rename from models/errors/errors.go rename to pkg/errors/errors.go diff --git a/models/metrics/aggregate/server.go b/pkg/metrics/aggregate/server.go similarity index 95% rename from models/metrics/aggregate/server.go rename to pkg/metrics/aggregate/server.go index 39549f9..1ff15e4 100644 --- a/models/metrics/aggregate/server.go +++ b/pkg/metrics/aggregate/server.go @@ -15,8 +15,8 @@ package aggregate import ( - "github.com/fatedier/frp/models/metrics/mem" - "github.com/fatedier/frp/models/metrics/prometheus" + "github.com/fatedier/frp/pkg/metrics/mem" + "github.com/fatedier/frp/pkg/metrics/prometheus" "github.com/fatedier/frp/server/metrics" ) diff --git a/models/metrics/mem/server.go b/pkg/metrics/mem/server.go similarity index 98% rename from models/metrics/mem/server.go rename to pkg/metrics/mem/server.go index 307583a..f3c8559 100644 --- a/models/metrics/mem/server.go +++ b/pkg/metrics/mem/server.go @@ -18,9 +18,9 @@ import ( "sync" "time" + "github.com/fatedier/frp/pkg/util/log" + "github.com/fatedier/frp/pkg/util/metric" server "github.com/fatedier/frp/server/metrics" - "github.com/fatedier/frp/utils/log" - "github.com/fatedier/frp/utils/metric" ) var sm *serverMetrics = newServerMetrics() diff --git a/models/metrics/mem/types.go b/pkg/metrics/mem/types.go similarity index 97% rename from models/metrics/mem/types.go rename to pkg/metrics/mem/types.go index bdb1863..2650b54 100644 --- a/models/metrics/mem/types.go +++ b/pkg/metrics/mem/types.go @@ -17,7 +17,7 @@ package mem import ( "time" - "github.com/fatedier/frp/utils/metric" + "github.com/fatedier/frp/pkg/util/metric" ) const ( diff --git a/models/metrics/metrics.go b/pkg/metrics/metrics.go similarity index 68% rename from models/metrics/metrics.go rename to pkg/metrics/metrics.go index b9fb308..6520317 100644 --- a/models/metrics/metrics.go +++ b/pkg/metrics/metrics.go @@ -1,7 +1,7 @@ package metrics import ( - "github.com/fatedier/frp/models/metrics/aggregate" + "github.com/fatedier/frp/pkg/metrics/aggregate" ) var EnableMem = aggregate.EnableMem diff --git a/models/metrics/prometheus/server.go b/pkg/metrics/prometheus/server.go similarity index 100% rename from models/metrics/prometheus/server.go rename to pkg/metrics/prometheus/server.go diff --git a/models/msg/ctl.go b/pkg/msg/ctl.go similarity index 100% rename from models/msg/ctl.go rename to pkg/msg/ctl.go diff --git a/models/msg/msg.go b/pkg/msg/msg.go similarity index 100% rename from models/msg/msg.go rename to pkg/msg/msg.go diff --git a/models/nathole/nathole.go b/pkg/nathole/nathole.go similarity index 97% rename from models/nathole/nathole.go rename to pkg/nathole/nathole.go index e44e149..545ad7a 100644 --- a/models/nathole/nathole.go +++ b/pkg/nathole/nathole.go @@ -7,9 +7,9 @@ import ( "sync" "time" - "github.com/fatedier/frp/models/msg" - "github.com/fatedier/frp/utils/log" - "github.com/fatedier/frp/utils/util" + "github.com/fatedier/frp/pkg/msg" + "github.com/fatedier/frp/pkg/util/log" + "github.com/fatedier/frp/pkg/util/util" "github.com/fatedier/golib/errors" "github.com/fatedier/golib/pool" diff --git a/models/plugin/client/http2https.go b/pkg/plugin/client/http2https.go similarity index 98% rename from models/plugin/client/http2https.go rename to pkg/plugin/client/http2https.go index 570b3f9..ddf559a 100644 --- a/models/plugin/client/http2https.go +++ b/pkg/plugin/client/http2https.go @@ -23,7 +23,7 @@ import ( "net/http/httputil" "strings" - frpNet "github.com/fatedier/frp/utils/net" + frpNet "github.com/fatedier/frp/pkg/util/net" ) const PluginHTTP2HTTPS = "http2https" diff --git a/models/plugin/client/http_proxy.go b/pkg/plugin/client/http_proxy.go similarity index 99% rename from models/plugin/client/http_proxy.go rename to pkg/plugin/client/http_proxy.go index 0860082..45bd3a9 100644 --- a/models/plugin/client/http_proxy.go +++ b/pkg/plugin/client/http_proxy.go @@ -22,7 +22,7 @@ import ( "net/http" "strings" - frpNet "github.com/fatedier/frp/utils/net" + frpNet "github.com/fatedier/frp/pkg/util/net" frpIo "github.com/fatedier/golib/io" gnet "github.com/fatedier/golib/net" diff --git a/models/plugin/client/https2http.go b/pkg/plugin/client/https2http.go similarity index 98% rename from models/plugin/client/https2http.go rename to pkg/plugin/client/https2http.go index 093a74f..81806e3 100644 --- a/models/plugin/client/https2http.go +++ b/pkg/plugin/client/https2http.go @@ -23,7 +23,7 @@ import ( "net/http/httputil" "strings" - frpNet "github.com/fatedier/frp/utils/net" + frpNet "github.com/fatedier/frp/pkg/util/net" ) const PluginHTTPS2HTTP = "https2http" diff --git a/models/plugin/client/plugin.go b/pkg/plugin/client/plugin.go similarity index 100% rename from models/plugin/client/plugin.go rename to pkg/plugin/client/plugin.go diff --git a/models/plugin/client/socks5.go b/pkg/plugin/client/socks5.go similarity index 97% rename from models/plugin/client/socks5.go rename to pkg/plugin/client/socks5.go index dc08934..79919e4 100644 --- a/models/plugin/client/socks5.go +++ b/pkg/plugin/client/socks5.go @@ -20,7 +20,7 @@ import ( "log" "net" - frpNet "github.com/fatedier/frp/utils/net" + frpNet "github.com/fatedier/frp/pkg/util/net" gosocks5 "github.com/armon/go-socks5" ) diff --git a/models/plugin/client/static_file.go b/pkg/plugin/client/static_file.go similarity index 97% rename from models/plugin/client/static_file.go rename to pkg/plugin/client/static_file.go index 668a033..1eeea3b 100644 --- a/models/plugin/client/static_file.go +++ b/pkg/plugin/client/static_file.go @@ -19,7 +19,7 @@ import ( "net" "net/http" - frpNet "github.com/fatedier/frp/utils/net" + frpNet "github.com/fatedier/frp/pkg/util/net" "github.com/gorilla/mux" ) diff --git a/models/plugin/client/unix_domain_socket.go b/pkg/plugin/client/unix_domain_socket.go similarity index 100% rename from models/plugin/client/unix_domain_socket.go rename to pkg/plugin/client/unix_domain_socket.go diff --git a/models/plugin/server/http.go b/pkg/plugin/server/http.go similarity index 100% rename from models/plugin/server/http.go rename to pkg/plugin/server/http.go diff --git a/models/plugin/server/manager.go b/pkg/plugin/server/manager.go similarity index 98% rename from models/plugin/server/manager.go rename to pkg/plugin/server/manager.go index dd2b67f..19c894b 100644 --- a/models/plugin/server/manager.go +++ b/pkg/plugin/server/manager.go @@ -19,8 +19,8 @@ import ( "errors" "fmt" - "github.com/fatedier/frp/utils/util" - "github.com/fatedier/frp/utils/xlog" + "github.com/fatedier/frp/pkg/util/util" + "github.com/fatedier/frp/pkg/util/xlog" ) type Manager struct { diff --git a/models/plugin/server/plugin.go b/pkg/plugin/server/plugin.go similarity index 100% rename from models/plugin/server/plugin.go rename to pkg/plugin/server/plugin.go diff --git a/models/plugin/server/tracer.go b/pkg/plugin/server/tracer.go similarity index 100% rename from models/plugin/server/tracer.go rename to pkg/plugin/server/tracer.go diff --git a/models/plugin/server/types.go b/pkg/plugin/server/types.go similarity index 97% rename from models/plugin/server/types.go rename to pkg/plugin/server/types.go index 5667625..82d4032 100644 --- a/models/plugin/server/types.go +++ b/pkg/plugin/server/types.go @@ -15,7 +15,7 @@ package plugin import ( - "github.com/fatedier/frp/models/msg" + "github.com/fatedier/frp/pkg/msg" ) type Request struct { diff --git a/models/proto/udp/udp.go b/pkg/proto/udp/udp.go similarity index 98% rename from models/proto/udp/udp.go rename to pkg/proto/udp/udp.go index 5a05896..97f6ea4 100644 --- a/models/proto/udp/udp.go +++ b/pkg/proto/udp/udp.go @@ -20,7 +20,7 @@ import ( "sync" "time" - "github.com/fatedier/frp/models/msg" + "github.com/fatedier/frp/pkg/msg" "github.com/fatedier/golib/errors" "github.com/fatedier/golib/pool" diff --git a/models/proto/udp/udp_test.go b/pkg/proto/udp/udp_test.go similarity index 100% rename from models/proto/udp/udp_test.go rename to pkg/proto/udp/udp_test.go diff --git a/models/transport/tls.go b/pkg/transport/tls.go similarity index 100% rename from models/transport/tls.go rename to pkg/transport/tls.go diff --git a/utils/limit/reader.go b/pkg/util/limit/reader.go similarity index 100% rename from utils/limit/reader.go rename to pkg/util/limit/reader.go diff --git a/utils/limit/writer.go b/pkg/util/limit/writer.go similarity index 100% rename from utils/limit/writer.go rename to pkg/util/limit/writer.go diff --git a/utils/log/log.go b/pkg/util/log/log.go similarity index 100% rename from utils/log/log.go rename to pkg/util/log/log.go diff --git a/utils/metric/counter.go b/pkg/util/metric/counter.go similarity index 100% rename from utils/metric/counter.go rename to pkg/util/metric/counter.go diff --git a/utils/metric/counter_test.go b/pkg/util/metric/counter_test.go similarity index 100% rename from utils/metric/counter_test.go rename to pkg/util/metric/counter_test.go diff --git a/utils/metric/date_counter.go b/pkg/util/metric/date_counter.go similarity index 100% rename from utils/metric/date_counter.go rename to pkg/util/metric/date_counter.go diff --git a/utils/metric/date_counter_test.go b/pkg/util/metric/date_counter_test.go similarity index 100% rename from utils/metric/date_counter_test.go rename to pkg/util/metric/date_counter_test.go diff --git a/utils/metric/metrics.go b/pkg/util/metric/metrics.go similarity index 100% rename from utils/metric/metrics.go rename to pkg/util/metric/metrics.go diff --git a/utils/net/conn.go b/pkg/util/net/conn.go similarity index 99% rename from utils/net/conn.go rename to pkg/util/net/conn.go index 4a122b0..5a33dd6 100644 --- a/utils/net/conn.go +++ b/pkg/util/net/conn.go @@ -24,7 +24,8 @@ import ( "sync/atomic" "time" - "github.com/fatedier/frp/utils/xlog" + "github.com/fatedier/frp/pkg/util/xlog" + gnet "github.com/fatedier/golib/net" kcp "github.com/fatedier/kcp-go" ) diff --git a/utils/net/http.go b/pkg/util/net/http.go similarity index 100% rename from utils/net/http.go rename to pkg/util/net/http.go diff --git a/utils/net/kcp.go b/pkg/util/net/kcp.go similarity index 100% rename from utils/net/kcp.go rename to pkg/util/net/kcp.go diff --git a/utils/net/listener.go b/pkg/util/net/listener.go similarity index 100% rename from utils/net/listener.go rename to pkg/util/net/listener.go diff --git a/utils/net/tls.go b/pkg/util/net/tls.go similarity index 100% rename from utils/net/tls.go rename to pkg/util/net/tls.go diff --git a/utils/net/udp.go b/pkg/util/net/udp.go similarity index 100% rename from utils/net/udp.go rename to pkg/util/net/udp.go diff --git a/utils/net/websocket.go b/pkg/util/net/websocket.go similarity index 100% rename from utils/net/websocket.go rename to pkg/util/net/websocket.go diff --git a/utils/tcpmux/httpconnect.go b/pkg/util/tcpmux/httpconnect.go similarity index 95% rename from utils/tcpmux/httpconnect.go rename to pkg/util/tcpmux/httpconnect.go index 145d38a..014f688 100644 --- a/utils/tcpmux/httpconnect.go +++ b/pkg/util/tcpmux/httpconnect.go @@ -22,8 +22,8 @@ import ( "net/http" "time" - "github.com/fatedier/frp/utils/util" - "github.com/fatedier/frp/utils/vhost" + "github.com/fatedier/frp/pkg/util/util" + "github.com/fatedier/frp/pkg/util/vhost" ) type HTTPConnectTCPMuxer struct { diff --git a/utils/util/http.go b/pkg/util/util/http.go similarity index 100% rename from utils/util/http.go rename to pkg/util/util/http.go diff --git a/utils/util/util.go b/pkg/util/util/util.go similarity index 100% rename from utils/util/util.go rename to pkg/util/util/util.go diff --git a/utils/util/util_test.go b/pkg/util/util/util_test.go similarity index 100% rename from utils/util/util_test.go rename to pkg/util/util/util_test.go diff --git a/utils/version/version.go b/pkg/util/version/version.go similarity index 100% rename from utils/version/version.go rename to pkg/util/version/version.go diff --git a/utils/version/version_test.go b/pkg/util/version/version_test.go similarity index 100% rename from utils/version/version_test.go rename to pkg/util/version/version_test.go diff --git a/utils/vhost/http.go b/pkg/util/vhost/http.go similarity index 98% rename from utils/vhost/http.go rename to pkg/util/vhost/http.go index 3175964..de105cb 100644 --- a/utils/vhost/http.go +++ b/pkg/util/vhost/http.go @@ -25,8 +25,8 @@ import ( "strings" "time" - frpLog "github.com/fatedier/frp/utils/log" - "github.com/fatedier/frp/utils/util" + frpLog "github.com/fatedier/frp/pkg/util/log" + "github.com/fatedier/frp/pkg/util/util" "github.com/fatedier/golib/pool" ) diff --git a/utils/vhost/https.go b/pkg/util/vhost/https.go similarity index 100% rename from utils/vhost/https.go rename to pkg/util/vhost/https.go diff --git a/utils/vhost/resource.go b/pkg/util/vhost/resource.go similarity index 96% rename from utils/vhost/resource.go rename to pkg/util/vhost/resource.go index 5c08430..f89348e 100644 --- a/utils/vhost/resource.go +++ b/pkg/util/vhost/resource.go @@ -19,8 +19,8 @@ import ( "io/ioutil" "net/http" - frpLog "github.com/fatedier/frp/utils/log" - "github.com/fatedier/frp/utils/version" + frpLog "github.com/fatedier/frp/pkg/util/log" + "github.com/fatedier/frp/pkg/util/version" ) var ( diff --git a/utils/vhost/reverseproxy.go b/pkg/util/vhost/reverseproxy.go similarity index 100% rename from utils/vhost/reverseproxy.go rename to pkg/util/vhost/reverseproxy.go diff --git a/utils/vhost/router.go b/pkg/util/vhost/router.go similarity index 100% rename from utils/vhost/router.go rename to pkg/util/vhost/router.go diff --git a/utils/vhost/vhost.go b/pkg/util/vhost/vhost.go similarity index 97% rename from utils/vhost/vhost.go rename to pkg/util/vhost/vhost.go index 363d0ea..9049f28 100644 --- a/utils/vhost/vhost.go +++ b/pkg/util/vhost/vhost.go @@ -19,9 +19,9 @@ import ( "strings" "time" - "github.com/fatedier/frp/utils/log" - frpNet "github.com/fatedier/frp/utils/net" - "github.com/fatedier/frp/utils/xlog" + "github.com/fatedier/frp/pkg/util/log" + frpNet "github.com/fatedier/frp/pkg/util/net" + "github.com/fatedier/frp/pkg/util/xlog" "github.com/fatedier/golib/errors" ) diff --git a/utils/xlog/ctx.go b/pkg/util/xlog/ctx.go similarity index 100% rename from utils/xlog/ctx.go rename to pkg/util/xlog/ctx.go diff --git a/utils/xlog/xlog.go b/pkg/util/xlog/xlog.go similarity index 97% rename from utils/xlog/xlog.go rename to pkg/util/xlog/xlog.go index a1c4867..b5746f9 100644 --- a/utils/xlog/xlog.go +++ b/pkg/util/xlog/xlog.go @@ -15,7 +15,7 @@ package xlog import ( - "github.com/fatedier/frp/utils/log" + "github.com/fatedier/frp/pkg/util/log" ) // Logger is not thread safety for operations on prefix diff --git a/server/control.go b/server/control.go index e148459..ef470f5 100644 --- a/server/control.go +++ b/server/control.go @@ -23,18 +23,18 @@ import ( "sync" "time" - "github.com/fatedier/frp/models/auth" - "github.com/fatedier/frp/models/config" - "github.com/fatedier/frp/models/consts" - frpErr "github.com/fatedier/frp/models/errors" - "github.com/fatedier/frp/models/msg" - plugin "github.com/fatedier/frp/models/plugin/server" + "github.com/fatedier/frp/pkg/auth" + "github.com/fatedier/frp/pkg/config" + "github.com/fatedier/frp/pkg/consts" + frpErr "github.com/fatedier/frp/pkg/errors" + "github.com/fatedier/frp/pkg/msg" + plugin "github.com/fatedier/frp/pkg/plugin/server" + "github.com/fatedier/frp/pkg/util/util" + "github.com/fatedier/frp/pkg/util/version" + "github.com/fatedier/frp/pkg/util/xlog" "github.com/fatedier/frp/server/controller" "github.com/fatedier/frp/server/metrics" "github.com/fatedier/frp/server/proxy" - "github.com/fatedier/frp/utils/util" - "github.com/fatedier/frp/utils/version" - "github.com/fatedier/frp/utils/xlog" "github.com/fatedier/golib/control/shutdown" "github.com/fatedier/golib/crypto" diff --git a/server/controller/resource.go b/server/controller/resource.go index 6e128b8..47236c9 100644 --- a/server/controller/resource.go +++ b/server/controller/resource.go @@ -15,13 +15,13 @@ package controller import ( - "github.com/fatedier/frp/models/nathole" - plugin "github.com/fatedier/frp/models/plugin/server" + "github.com/fatedier/frp/pkg/nathole" + plugin "github.com/fatedier/frp/pkg/plugin/server" + "github.com/fatedier/frp/pkg/util/tcpmux" + "github.com/fatedier/frp/pkg/util/vhost" "github.com/fatedier/frp/server/group" "github.com/fatedier/frp/server/ports" "github.com/fatedier/frp/server/visitor" - "github.com/fatedier/frp/utils/tcpmux" - "github.com/fatedier/frp/utils/vhost" ) // All resource managers and controllers diff --git a/server/dashboard.go b/server/dashboard.go index 473f37e..7af9df2 100644 --- a/server/dashboard.go +++ b/server/dashboard.go @@ -21,7 +21,7 @@ import ( "time" "github.com/fatedier/frp/assets" - frpNet "github.com/fatedier/frp/utils/net" + frpNet "github.com/fatedier/frp/pkg/util/net" "github.com/gorilla/mux" "github.com/prometheus/client_golang/prometheus/promhttp" diff --git a/server/dashboard_api.go b/server/dashboard_api.go index e0b10ce..210b6e3 100644 --- a/server/dashboard_api.go +++ b/server/dashboard_api.go @@ -18,11 +18,11 @@ import ( "encoding/json" "net/http" - "github.com/fatedier/frp/models/config" - "github.com/fatedier/frp/models/consts" - "github.com/fatedier/frp/models/metrics/mem" - "github.com/fatedier/frp/utils/log" - "github.com/fatedier/frp/utils/version" + "github.com/fatedier/frp/pkg/config" + "github.com/fatedier/frp/pkg/consts" + "github.com/fatedier/frp/pkg/metrics/mem" + "github.com/fatedier/frp/pkg/util/log" + "github.com/fatedier/frp/pkg/util/version" "github.com/gorilla/mux" ) diff --git a/server/group/http.go b/server/group/http.go index 90b8229..0039b8a 100644 --- a/server/group/http.go +++ b/server/group/http.go @@ -6,7 +6,7 @@ import ( "sync" "sync/atomic" - "github.com/fatedier/frp/utils/vhost" + "github.com/fatedier/frp/pkg/util/vhost" ) type HTTPGroupController struct { diff --git a/server/group/tcpmux.go b/server/group/tcpmux.go index 61058ca..f2db8de 100644 --- a/server/group/tcpmux.go +++ b/server/group/tcpmux.go @@ -20,9 +20,9 @@ import ( "net" "sync" - "github.com/fatedier/frp/models/consts" - "github.com/fatedier/frp/utils/tcpmux" - "github.com/fatedier/frp/utils/vhost" + "github.com/fatedier/frp/pkg/consts" + "github.com/fatedier/frp/pkg/util/tcpmux" + "github.com/fatedier/frp/pkg/util/vhost" gerr "github.com/fatedier/golib/errors" ) diff --git a/server/proxy/http.go b/server/proxy/http.go index ce14388..8692528 100644 --- a/server/proxy/http.go +++ b/server/proxy/http.go @@ -19,11 +19,11 @@ import ( "net" "strings" - "github.com/fatedier/frp/models/config" + "github.com/fatedier/frp/pkg/config" + frpNet "github.com/fatedier/frp/pkg/util/net" + "github.com/fatedier/frp/pkg/util/util" + "github.com/fatedier/frp/pkg/util/vhost" "github.com/fatedier/frp/server/metrics" - frpNet "github.com/fatedier/frp/utils/net" - "github.com/fatedier/frp/utils/util" - "github.com/fatedier/frp/utils/vhost" frpIo "github.com/fatedier/golib/io" ) diff --git a/server/proxy/https.go b/server/proxy/https.go index 4a1c999..cd56646 100644 --- a/server/proxy/https.go +++ b/server/proxy/https.go @@ -17,9 +17,9 @@ package proxy import ( "strings" - "github.com/fatedier/frp/models/config" - "github.com/fatedier/frp/utils/util" - "github.com/fatedier/frp/utils/vhost" + "github.com/fatedier/frp/pkg/config" + "github.com/fatedier/frp/pkg/util/util" + "github.com/fatedier/frp/pkg/util/vhost" ) type HTTPSProxy struct { diff --git a/server/proxy/proxy.go b/server/proxy/proxy.go index b82fce9..88c2376 100644 --- a/server/proxy/proxy.go +++ b/server/proxy/proxy.go @@ -22,13 +22,13 @@ import ( "strconv" "sync" - "github.com/fatedier/frp/models/config" - "github.com/fatedier/frp/models/msg" - plugin "github.com/fatedier/frp/models/plugin/server" + "github.com/fatedier/frp/pkg/config" + "github.com/fatedier/frp/pkg/msg" + plugin "github.com/fatedier/frp/pkg/plugin/server" + frpNet "github.com/fatedier/frp/pkg/util/net" + "github.com/fatedier/frp/pkg/util/xlog" "github.com/fatedier/frp/server/controller" "github.com/fatedier/frp/server/metrics" - frpNet "github.com/fatedier/frp/utils/net" - "github.com/fatedier/frp/utils/xlog" frpIo "github.com/fatedier/golib/io" ) diff --git a/server/proxy/stcp.go b/server/proxy/stcp.go index 44be1b3..5ac47ea 100644 --- a/server/proxy/stcp.go +++ b/server/proxy/stcp.go @@ -15,7 +15,7 @@ package proxy import ( - "github.com/fatedier/frp/models/config" + "github.com/fatedier/frp/pkg/config" ) type STCPProxy struct { diff --git a/server/proxy/sudp.go b/server/proxy/sudp.go index 182c792..c4dba6d 100644 --- a/server/proxy/sudp.go +++ b/server/proxy/sudp.go @@ -15,7 +15,7 @@ package proxy import ( - "github.com/fatedier/frp/models/config" + "github.com/fatedier/frp/pkg/config" ) type SUDPProxy struct { diff --git a/server/proxy/tcp.go b/server/proxy/tcp.go index 786c1a5..420f43f 100644 --- a/server/proxy/tcp.go +++ b/server/proxy/tcp.go @@ -18,7 +18,7 @@ import ( "fmt" "net" - "github.com/fatedier/frp/models/config" + "github.com/fatedier/frp/pkg/config" ) type TCPProxy struct { diff --git a/server/proxy/tcpmux.go b/server/proxy/tcpmux.go index d0da63b..16cbcff 100644 --- a/server/proxy/tcpmux.go +++ b/server/proxy/tcpmux.go @@ -19,10 +19,10 @@ import ( "net" "strings" - "github.com/fatedier/frp/models/config" - "github.com/fatedier/frp/models/consts" - "github.com/fatedier/frp/utils/util" - "github.com/fatedier/frp/utils/vhost" + "github.com/fatedier/frp/pkg/config" + "github.com/fatedier/frp/pkg/consts" + "github.com/fatedier/frp/pkg/util/util" + "github.com/fatedier/frp/pkg/util/vhost" ) type TCPMuxProxy struct { diff --git a/server/proxy/udp.go b/server/proxy/udp.go index d87e0ef..0984265 100644 --- a/server/proxy/udp.go +++ b/server/proxy/udp.go @@ -21,11 +21,11 @@ import ( "net" "time" - "github.com/fatedier/frp/models/config" - "github.com/fatedier/frp/models/msg" - "github.com/fatedier/frp/models/proto/udp" + "github.com/fatedier/frp/pkg/config" + "github.com/fatedier/frp/pkg/msg" + "github.com/fatedier/frp/pkg/proto/udp" + frpNet "github.com/fatedier/frp/pkg/util/net" "github.com/fatedier/frp/server/metrics" - frpNet "github.com/fatedier/frp/utils/net" "github.com/fatedier/golib/errors" frpIo "github.com/fatedier/golib/io" diff --git a/server/proxy/xtcp.go b/server/proxy/xtcp.go index 8dbb881..317a3d4 100644 --- a/server/proxy/xtcp.go +++ b/server/proxy/xtcp.go @@ -17,8 +17,8 @@ package proxy import ( "fmt" - "github.com/fatedier/frp/models/config" - "github.com/fatedier/frp/models/msg" + "github.com/fatedier/frp/pkg/config" + "github.com/fatedier/frp/pkg/msg" "github.com/fatedier/golib/errors" ) diff --git a/server/service.go b/server/service.go index 3880d38..0bbe955 100644 --- a/server/service.go +++ b/server/service.go @@ -26,26 +26,26 @@ import ( "time" "github.com/fatedier/frp/assets" - "github.com/fatedier/frp/models/auth" - "github.com/fatedier/frp/models/config" - modelmetrics "github.com/fatedier/frp/models/metrics" - "github.com/fatedier/frp/models/msg" - "github.com/fatedier/frp/models/nathole" - plugin "github.com/fatedier/frp/models/plugin/server" - "github.com/fatedier/frp/models/transport" + "github.com/fatedier/frp/pkg/auth" + "github.com/fatedier/frp/pkg/config" + modelmetrics "github.com/fatedier/frp/pkg/metrics" + "github.com/fatedier/frp/pkg/msg" + "github.com/fatedier/frp/pkg/nathole" + plugin "github.com/fatedier/frp/pkg/plugin/server" + "github.com/fatedier/frp/pkg/transport" + "github.com/fatedier/frp/pkg/util/log" + frpNet "github.com/fatedier/frp/pkg/util/net" + "github.com/fatedier/frp/pkg/util/tcpmux" + "github.com/fatedier/frp/pkg/util/util" + "github.com/fatedier/frp/pkg/util/version" + "github.com/fatedier/frp/pkg/util/vhost" + "github.com/fatedier/frp/pkg/util/xlog" "github.com/fatedier/frp/server/controller" "github.com/fatedier/frp/server/group" "github.com/fatedier/frp/server/metrics" "github.com/fatedier/frp/server/ports" "github.com/fatedier/frp/server/proxy" "github.com/fatedier/frp/server/visitor" - "github.com/fatedier/frp/utils/log" - frpNet "github.com/fatedier/frp/utils/net" - "github.com/fatedier/frp/utils/tcpmux" - "github.com/fatedier/frp/utils/util" - "github.com/fatedier/frp/utils/version" - "github.com/fatedier/frp/utils/vhost" - "github.com/fatedier/frp/utils/xlog" "github.com/fatedier/golib/net/mux" fmux "github.com/hashicorp/yamux" diff --git a/server/visitor/visitor.go b/server/visitor/visitor.go index 7b54ab1..4796b41 100644 --- a/server/visitor/visitor.go +++ b/server/visitor/visitor.go @@ -20,8 +20,8 @@ import ( "net" "sync" - frpNet "github.com/fatedier/frp/utils/net" - "github.com/fatedier/frp/utils/util" + frpNet "github.com/fatedier/frp/pkg/util/net" + "github.com/fatedier/frp/pkg/util/util" frpIo "github.com/fatedier/golib/io" ) diff --git a/test/e2e/e2e.go b/test/e2e/e2e.go index 60d73c5..ce830fd 100644 --- a/test/e2e/e2e.go +++ b/test/e2e/e2e.go @@ -3,8 +3,8 @@ package e2e import ( "testing" + "github.com/fatedier/frp/pkg/util/log" "github.com/fatedier/frp/test/e2e/framework" - "github.com/fatedier/frp/utils/log" "github.com/onsi/ginkgo" "github.com/onsi/ginkgo/config" diff --git a/test/e2e/e2e_test.go b/test/e2e/e2e_test.go index afe77c3..ea0bfdf 100644 --- a/test/e2e/e2e_test.go +++ b/test/e2e/e2e_test.go @@ -6,8 +6,8 @@ import ( "os" "testing" + "github.com/fatedier/frp/pkg/util/log" "github.com/fatedier/frp/test/e2e/framework" - "github.com/fatedier/frp/utils/log" // test source _ "github.com/fatedier/frp/test/e2e/basic" diff --git a/test/e2e/framework/process.go b/test/e2e/framework/process.go index 5be4572..1e477ee 100644 --- a/test/e2e/framework/process.go +++ b/test/e2e/framework/process.go @@ -6,8 +6,8 @@ import ( "path/filepath" "time" + flog "github.com/fatedier/frp/pkg/util/log" "github.com/fatedier/frp/test/e2e/pkg/process" - flog "github.com/fatedier/frp/utils/log" ) func GenerateConfigFile(path string, content string) error { diff --git a/test/e2e/mock/echoserver/echoserver.go b/test/e2e/mock/echoserver/echoserver.go index 9d51490..09a2095 100644 --- a/test/e2e/mock/echoserver/echoserver.go +++ b/test/e2e/mock/echoserver/echoserver.go @@ -5,7 +5,7 @@ import ( "net" "strings" - fnet "github.com/fatedier/frp/utils/net" + fnet "github.com/fatedier/frp/pkg/util/net" ) type ServerType string diff --git a/tests/mock/echo_server.go b/tests/mock/echo_server.go index ad49a55..20ee183 100644 --- a/tests/mock/echo_server.go +++ b/tests/mock/echo_server.go @@ -7,7 +7,7 @@ import ( "os" "syscall" - frpNet "github.com/fatedier/frp/utils/net" + frpNet "github.com/fatedier/frp/pkg/util/net" ) type EchoServer struct { -- GitLab