diff --git a/client/service.go b/client/service.go index f14edf9..356b6bf 100644 --- a/client/service.go +++ b/client/service.go @@ -96,7 +96,7 @@ func (svr *Service) Run() error { if g.GlbClientCfg.AdminPort != 0 { // Init admin server assets - err := assets.Load("") + err := assets.Load(g.GlbClientCfg.AssetsDir) if err != nil { return fmt.Errorf("Load assets error: %v", err) } diff --git a/conf/frpc_full.ini b/conf/frpc_full.ini index 90f9e41..158ff23 100644 --- a/conf/frpc_full.ini +++ b/conf/frpc_full.ini @@ -29,6 +29,8 @@ admin_addr = 127.0.0.1 admin_port = 7400 admin_user = admin admin_pwd = admin +# Admin assets directory. By default, these assets are bundled with frpc. +# assets_dir = ./static # connections will be established in advance, default value is zero pool_count = 5 diff --git a/go.sum b/go.sum index 3eeac45..5ddda4e 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,6 @@ github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 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= @@ -27,6 +28,7 @@ github.com/pires/go-proxyproto v0.0.0-20190111085350-4d51b51e3bfc h1:lNOt1SMsgHX github.com/pires/go-proxyproto v0.0.0-20190111085350-4d51b51e3bfc/go.mod h1:6/gX3+E/IYGa0wMORlSMla999awQFdbaeQCHjSMKIzY= github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rakyll/statik v0.1.1 h1:fCLHsIMajHqD5RKigbFXpvX3dN7c80Pm12+NCrI3kvg= github.com/rakyll/statik v0.1.1/go.mod h1:OEi9wJV/fMUAGx1eNjq75DKDsJVuEv1U0oYdX6GX8Zs= diff --git a/models/config/client_common.go b/models/config/client_common.go index 7b9e0c5..7b7040e 100644 --- a/models/config/client_common.go +++ b/models/config/client_common.go @@ -38,6 +38,7 @@ type ClientCommonConf struct { AdminPort int `json:"admin_port"` AdminUser string `json:"admin_user"` AdminPwd string `json:"admin_pwd"` + AssetsDir string `json:"assets_dir"` PoolCount int `json:"pool_count"` TcpMux bool `json:"tcp_mux"` User string `json:"user"` @@ -65,6 +66,7 @@ func GetDefaultClientConf() *ClientCommonConf { AdminPort: 0, AdminUser: "", AdminPwd: "", + AssetsDir: "", PoolCount: 1, TcpMux: true, User: "", @@ -160,6 +162,10 @@ func UnmarshalClientConfFromIni(defaultCfg *ClientCommonConf, content string) (c cfg.AdminPwd = tmpStr } + if tmpStr, ok = conf.Get("common", "assets_dir"); ok { + cfg.AssetsDir = tmpStr + } + if tmpStr, ok = conf.Get("common", "pool_count"); ok { if v, err = strconv.ParseInt(tmpStr, 10, 64); err == nil { cfg.PoolCount = int(v)