show client address in server dashboard
This commit is contained in:
parent
002831ea82
commit
46bb91f679
File diff suppressed because one or more lines are too long
@ -4,7 +4,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>frps dashboard</title>
|
||||
<script type="module" crossorigin src="./index-Q42Pu2_S.js"></script>
|
||||
<script type="module" crossorigin src="./index-J-KX0R9O.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="./index-rzPDshRD.css">
|
||||
</head>
|
||||
|
||||
|
@ -480,6 +480,7 @@ func (ctl *Control) RegisterProxy(pxyMsg *msg.NewProxy) (remoteAddr string, err
|
||||
GetWorkConnFn: ctl.GetWorkConn,
|
||||
Configurer: pxyConf,
|
||||
ServerCfg: ctl.serverCfg,
|
||||
ClientAddr: ctl.conn.RemoteAddr().String(),
|
||||
})
|
||||
if err != nil {
|
||||
return remoteAddr, err
|
||||
|
@ -199,6 +199,7 @@ func getConfByType(proxyType string) any {
|
||||
type ProxyStatsInfo struct {
|
||||
Name string `json:"name"`
|
||||
Conf interface{} `json:"conf"`
|
||||
ClientAddr string `json:"clientAddr,omitempty"`
|
||||
ClientVersion string `json:"clientVersion,omitempty"`
|
||||
TodayTrafficIn int64 `json:"todayTrafficIn"`
|
||||
TodayTrafficOut int64 `json:"todayTrafficOut"`
|
||||
@ -257,6 +258,7 @@ func (svr *Service) getProxyStatsByType(proxyType string) (proxyInfos []*ProxySt
|
||||
if pxy.GetLoginMsg() != nil {
|
||||
proxyInfo.ClientVersion = pxy.GetLoginMsg().Version
|
||||
}
|
||||
proxyInfo.ClientAddr = pxy.GetClientAddr()
|
||||
} else {
|
||||
proxyInfo.Status = "offline"
|
||||
}
|
||||
|
@ -57,6 +57,7 @@ type Proxy interface {
|
||||
GetUserInfo() plugin.UserInfo
|
||||
GetLimiter() *rate.Limiter
|
||||
GetLoginMsg() *msg.Login
|
||||
GetClientAddr() string
|
||||
Close()
|
||||
}
|
||||
|
||||
@ -72,6 +73,7 @@ type BaseProxy struct {
|
||||
userInfo plugin.UserInfo
|
||||
loginMsg *msg.Login
|
||||
configurer v1.ProxyConfigurer
|
||||
clientAddr string
|
||||
|
||||
mu sync.RWMutex
|
||||
xl *xlog.Logger
|
||||
@ -110,6 +112,10 @@ func (pxy *BaseProxy) GetConfigurer() v1.ProxyConfigurer {
|
||||
return pxy.configurer
|
||||
}
|
||||
|
||||
func (pxy *BaseProxy) GetClientAddr() string {
|
||||
return pxy.clientAddr
|
||||
}
|
||||
|
||||
func (pxy *BaseProxy) Close() {
|
||||
xl := xlog.FromContextSafe(pxy.ctx)
|
||||
xl.Infof("proxy closing")
|
||||
@ -279,6 +285,7 @@ type Options struct {
|
||||
GetWorkConnFn GetWorkConnFn
|
||||
Configurer v1.ProxyConfigurer
|
||||
ServerCfg *v1.ServerConfig
|
||||
ClientAddr string
|
||||
}
|
||||
|
||||
func NewProxy(ctx context.Context, options *Options) (pxy Proxy, err error) {
|
||||
@ -304,6 +311,7 @@ func NewProxy(ctx context.Context, options *Options) (pxy Proxy, err error) {
|
||||
userInfo: options.UserInfo,
|
||||
loginMsg: options.LoginMsg,
|
||||
configurer: configurer,
|
||||
clientAddr: options.ClientAddr,
|
||||
}
|
||||
|
||||
factory := proxyFactoryRegistry[reflect.TypeOf(configurer)]
|
||||
|
@ -51,6 +51,8 @@
|
||||
sortable
|
||||
>
|
||||
</el-table-column>
|
||||
<el-table-column label="ClientAddress" prop="clientAddress" sortable>
|
||||
</el-table-column>
|
||||
<el-table-column label="ClientVersion" prop="clientVersion" sortable>
|
||||
</el-table-column>
|
||||
<el-table-column label="Status" prop="status" sortable>
|
||||
|
@ -10,6 +10,7 @@ class BaseProxy {
|
||||
lastStartTime: string
|
||||
lastCloseTime: string
|
||||
status: string
|
||||
clientAddress: string
|
||||
clientVersion: string
|
||||
addr: string
|
||||
port: number
|
||||
@ -41,6 +42,7 @@ class BaseProxy {
|
||||
this.lastStartTime = proxyStats.lastStartTime
|
||||
this.lastCloseTime = proxyStats.lastCloseTime
|
||||
this.status = proxyStats.status
|
||||
this.clientAddress = proxyStats.clientAddr
|
||||
this.clientVersion = proxyStats.clientVersion
|
||||
|
||||
this.addr = ''
|
||||
|
Loading…
Reference in New Issue
Block a user