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