@@ -3,18 +3,13 @@ package shared
33import (
44 "context"
55 "crypto/tls"
6- "embed"
76 "net"
87 "net/http"
98 "os"
109 "path/filepath"
1110 "sync"
1211
1312 bizcommon "github.com/VaalaCat/frp-panel/biz/common"
14- bizmaster "github.com/VaalaCat/frp-panel/biz/master"
15- "github.com/VaalaCat/frp-panel/biz/master/shell"
16- "github.com/VaalaCat/frp-panel/biz/master/streamlog"
17- bizserver "github.com/VaalaCat/frp-panel/biz/server"
1813 "github.com/VaalaCat/frp-panel/conf"
1914 "github.com/VaalaCat/frp-panel/defs"
2015 "github.com/VaalaCat/frp-panel/models"
@@ -43,12 +38,14 @@ import (
4338 "gorm.io/gorm"
4439)
4540
46- func NewLogHookManager () app.StreamLogHookMgr {
47- return & bizcommon.HookMgr {}
41+ type Finish struct {
42+ fx.Out
43+
44+ Context context.Context
4845}
4946
50- func NewPTYManager () app.ShellPTYMgr {
51- return shell . NewPTYMgr ()
47+ func NewLogHookManager () app.StreamLogHookMgr {
48+ return & bizcommon. HookMgr {}
5249}
5350
5451func NewBaseApp (param struct {
@@ -68,10 +65,6 @@ func NewBaseApp(param struct {
6865 return appInstance
6966}
7067
71- func NewClientsManager () app.ClientsManager {
72- return rpc .NewClientsManager ()
73- }
74-
7568func NewPatchedConfig (param struct {
7669 fx.In
7770
@@ -88,8 +81,16 @@ func NewContext(appInstance app.Application) *app.Context {
8881 return app .NewContext (context .Background (), appInstance )
8982}
9083
91- func NewClientLogManager () app.ClientLogManager {
92- return streamlog .NewClientLogManager ()
84+ func NewAndFinishNormalContext (param struct {
85+ fx.In
86+
87+ Ctx * app.Context
88+ Cfg conf.Config
89+ }) Finish {
90+
91+ return Finish {
92+ Context : param .Ctx ,
93+ }
9394}
9495
9596func NewDBManager (ctx * app.Context , appInstance app.Application ) app.DBManager {
@@ -151,14 +152,6 @@ func NewMasterTLSConfig(ctx *app.Context) *tls.Config {
151152 return dao .NewQuery (ctx ).InitCert (conf .GetCertTemplate (ctx .GetApp ().GetConfig ()))
152153}
153154
154- func NewMasterRouter (fs embed.FS , appInstance app.Application ) * gin.Engine {
155- return bizmaster .NewRouter (fs , appInstance )
156- }
157-
158- func NewListenerOptions (ctx * app.Context , cfg conf.Config ) conf.LisOpt {
159- return conf .GetListener (ctx , cfg )
160- }
161-
162155func NewTLSMasterService (appInstance app.Application , masterTLSConfig * tls.Config ) master.MasterService {
163156 return master .NewMasterService (appInstance , credentials .NewTLS (masterTLSConfig ))
164157}
@@ -167,14 +160,6 @@ func NewHTTPMasterService(appInstance app.Application) master.MasterService {
167160 return master .NewMasterService (appInstance , insecure .NewCredentials ())
168161}
169162
170- func NewServerMasterCli (appInstance app.Application ) app.MasterClient {
171- return rpc .NewMasterCli (appInstance )
172- }
173-
174- func NewClientMasterCli (appInstance app.Application ) app.MasterClient {
175- return rpc .NewMasterCli (appInstance )
176- }
177-
178163func NewMux (param struct {
179164 fx.In
180165
@@ -214,10 +199,6 @@ func NewWSUpgrader(ctx *app.Context, cfg conf.Config) *websocket.Upgrader {
214199 }
215200}
216201
217- func NewServerRouter (appInstance app.Application ) * gin.Engine {
218- return bizserver .NewRouter (appInstance )
219- }
220-
221202func NewServerAPI (param struct {
222203 fx.In
223204 Ctx * app.Context
@@ -305,7 +286,7 @@ func NewAutoJoin(param struct {
305286 Ctx * app.Context
306287 Cfg conf.Config `name:"argsPatchedConfig"`
307288 CommonArgs CommonArgs
308- }) conf.Config {
289+ }) conf.Config { // provide final config
309290 var (
310291 ctx = param .Ctx
311292 clientID = param .Cfg .Client .ID
0 commit comments