diff --git a/go.mod b/go.mod index 821b54b9..104427d5 100644 --- a/go.mod +++ b/go.mod @@ -3,8 +3,7 @@ module github.com/koho/frpmgr go 1.16 require ( - github.com/fatedier/frp v0.41.0 - github.com/fatedier/golib v0.1.1-0.20220321042308-c306138b83ac + github.com/fatedier/frp v0.42.0 github.com/go-ole/go-ole v1.2.6 github.com/lxn/walk v0.0.0-20210112085537-c389da54e794 github.com/lxn/win v0.0.0-20210218163916-a377121e959e diff --git a/go.sum b/go.sum index 1ab0b341..64088ef1 100644 --- a/go.sum +++ b/go.sum @@ -85,8 +85,8 @@ github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7 github.com/evanphx/json-patch v4.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/fatedier/beego v0.0.0-20171024143340-6c6a4f5bd5eb h1:wCrNShQidLmvVWn/0PikGmpdP0vtQmnvyRg3ZBEhczw= github.com/fatedier/beego v0.0.0-20171024143340-6c6a4f5bd5eb/go.mod h1:wx3gB6dbIfBRcucp94PI9Bt3I0F2c/MyNEWuhzpWiwk= -github.com/fatedier/frp v0.41.0 h1:KIOzLlrWqEZZ9b9eVT8SSSgx4If47gMTAttaEz10l4o= -github.com/fatedier/frp v0.41.0/go.mod h1:3Mp3fWvK8kD3PU8Hy89fKV/655Q5eFSHr+uuUr/lbOg= +github.com/fatedier/frp v0.42.0 h1:IIPCKB5OgGetjIk7vv3MlR3iL8qS0d7uM3kjWs6eymU= +github.com/fatedier/frp v0.42.0/go.mod h1:NahedvXauelo3mcioq3gahG3BdhTfJ4Gia6rRQnE02A= github.com/fatedier/golib v0.1.1-0.20220321042308-c306138b83ac h1:td1FJwN/oz8+9GldeEm3YdBX0Husc0FSPywLesZxi4w= github.com/fatedier/golib v0.1.1-0.20220321042308-c306138b83ac/go.mod h1:fLV0TLwHqrnB/L3jbNl67Gn6PCLggDGHniX1wLrA2Qo= github.com/fatedier/kcp-go v2.0.4-0.20190803094908-fe8645b0a904+incompatible h1:ssXat9YXFvigNge/IkkZvFMn8yeYKFX+uI6wn2mLJ74= @@ -296,8 +296,8 @@ github.com/onsi/gomega v1.13.0/go.mod h1:lRk9szgn8TxENtWd0Tp4c3wjlRfMTMH27I+3Je4 github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= -github.com/pires/go-proxyproto v0.5.0 h1:A4Jv4ZCaV3AFJeGh5mGwkz4iuWUYMlQ7IoO/GTuSuLo= -github.com/pires/go-proxyproto v0.5.0/go.mod h1:Odh9VFOZJCf9G8cLW5o435Xf1J95Jw9Gw5rnCjcwzAY= +github.com/pires/go-proxyproto v0.6.2 h1:KAZ7UteSOt6urjme6ZldyFm4wDe/z0ZUP0Yv0Dos0d8= +github.com/pires/go-proxyproto v0.6.2/go.mod h1:Odh9VFOZJCf9G8cLW5o435Xf1J95Jw9Gw5rnCjcwzAY= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= diff --git a/patches/service.patch b/patches/service.patch index ad91bc93..38bb4224 100644 --- a/patches/service.patch +++ b/patches/service.patch @@ -1,20 +1,20 @@ ---- pkg/mod/github.com/fatedier/frp@v0.41.0/client/service.go 2022-03-24 15:06:41.000000000 +0800 -+++ patches/service.go 2022-03-24 15:10:43.000000000 +0800 -@@ -36,12 +36,13 @@ - "github.com/fatedier/frp/pkg/util/util" +--- pkg/mod/github.com/fatedier/frp@v0.42.0/client/service.go 2022-04-22 14:59:20.000000000 +0800 ++++ patches/service.go 2022-04-22 15:10:29.000000000 +0800 +@@ -39,12 +39,13 @@ "github.com/fatedier/frp/pkg/util/version" "github.com/fatedier/frp/pkg/util/xlog" + "github.com/fatedier/golib/crypto" libdial "github.com/fatedier/golib/net/dial" fmux "github.com/hashicorp/yamux" + frpmgr "github.com/koho/frpmgr/pkg/util" ) - // Service is a client service. - type Service struct { - // uniq id got from frps, attach it in loginMsg - runID string -@@ -248,14 +249,20 @@ + func init() { + crypto.DefaultSalt = "frp" + rand.Seed(time.Now().UnixNano()) + } +@@ -271,14 +272,20 @@ libdial.WithProxyAuth(auth), libdial.WithTLSConfig(tlsConfig), libdial.WithAfterHook(libdial.AfterHook{ @@ -22,7 +22,7 @@ }), ) + var serverAddr = svr.cfg.ServerAddr -+ if svr.cfg.DNSServer != "" && runtime.GOOS == "windows" { ++ if svr.cfg.DNSServer != "" { + if serverAddr, err = frpmgr.LookupIP(svr.cfg.ServerAddr, svr.cfg.DNSServer); err != nil { + return nil, nil, err + } diff --git a/services/frp.go b/services/frp.go index b2b31ce6..cfb9aafd 100644 --- a/services/frp.go +++ b/services/frp.go @@ -4,14 +4,9 @@ import ( _ "github.com/fatedier/frp/assets/frpc" frpc "github.com/fatedier/frp/cmd/frpc/sub" "github.com/fatedier/frp/pkg/config" - "github.com/fatedier/golib/crypto" - "math/rand" - "time" ) func runFrpClient() { - crypto.DefaultSalt = "frp" - rand.Seed(time.Now().UnixNano()) // Change program arguments for frpc to parse // No need to change it for now frpc.Execute()