|
|
|
@ -33,16 +33,20 @@ type GeneralResponse struct {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
type serverInfoResp struct { |
|
|
|
|
Version string `json:"version"` |
|
|
|
|
BindPort int `json:"bind_port"` |
|
|
|
|
BindUDPPort int `json:"bind_udp_port"` |
|
|
|
|
VhostHTTPPort int `json:"vhost_http_port"` |
|
|
|
|
VhostHTTPSPort int `json:"vhost_https_port"` |
|
|
|
|
KCPBindPort int `json:"kcp_bind_port"` |
|
|
|
|
SubdomainHost string `json:"subdomain_host"` |
|
|
|
|
MaxPoolCount int64 `json:"max_pool_count"` |
|
|
|
|
MaxPortsPerClient int64 `json:"max_ports_per_client"` |
|
|
|
|
HeartBeatTimeout int64 `json:"heart_beat_timeout"` |
|
|
|
|
Version string `json:"version"` |
|
|
|
|
BindPort int `json:"bind_port"` |
|
|
|
|
BindUDPPort int `json:"bind_udp_port"` |
|
|
|
|
VhostHTTPPort int `json:"vhost_http_port"` |
|
|
|
|
VhostHTTPSPort int `json:"vhost_https_port"` |
|
|
|
|
TCPMuxHTTPConnectPort int `json:"tcpmux_httpconnect_port"` |
|
|
|
|
KCPBindPort int `json:"kcp_bind_port"` |
|
|
|
|
QUICBindPort int `json:"quic_bind_port"` |
|
|
|
|
SubdomainHost string `json:"subdomain_host"` |
|
|
|
|
MaxPoolCount int64 `json:"max_pool_count"` |
|
|
|
|
MaxPortsPerClient int64 `json:"max_ports_per_client"` |
|
|
|
|
HeartBeatTimeout int64 `json:"heart_beat_timeout"` |
|
|
|
|
AllowPortsStr string `json:"allow_ports_str,omitempty"` |
|
|
|
|
TLSOnly bool `json:"tls_only,omitempty"` |
|
|
|
|
|
|
|
|
|
TotalTrafficIn int64 `json:"total_traffic_in"` |
|
|
|
|
TotalTrafficOut int64 `json:"total_traffic_out"` |
|
|
|
@ -70,16 +74,20 @@ func (svr *Service) APIServerInfo(w http.ResponseWriter, r *http.Request) {
|
|
|
|
|
log.Info("Http request: [%s]", r.URL.Path) |
|
|
|
|
serverStats := mem.StatsCollector.GetServer() |
|
|
|
|
svrResp := serverInfoResp{ |
|
|
|
|
Version: version.Full(), |
|
|
|
|
BindPort: svr.cfg.BindPort, |
|
|
|
|
BindUDPPort: svr.cfg.BindUDPPort, |
|
|
|
|
VhostHTTPPort: svr.cfg.VhostHTTPPort, |
|
|
|
|
VhostHTTPSPort: svr.cfg.VhostHTTPSPort, |
|
|
|
|
KCPBindPort: svr.cfg.KCPBindPort, |
|
|
|
|
SubdomainHost: svr.cfg.SubDomainHost, |
|
|
|
|
MaxPoolCount: svr.cfg.MaxPoolCount, |
|
|
|
|
MaxPortsPerClient: svr.cfg.MaxPortsPerClient, |
|
|
|
|
HeartBeatTimeout: svr.cfg.HeartbeatTimeout, |
|
|
|
|
Version: version.Full(), |
|
|
|
|
BindPort: svr.cfg.BindPort, |
|
|
|
|
BindUDPPort: svr.cfg.BindUDPPort, |
|
|
|
|
VhostHTTPPort: svr.cfg.VhostHTTPPort, |
|
|
|
|
VhostHTTPSPort: svr.cfg.VhostHTTPSPort, |
|
|
|
|
TCPMuxHTTPConnectPort: svr.cfg.TCPMuxHTTPConnectPort, |
|
|
|
|
KCPBindPort: svr.cfg.KCPBindPort, |
|
|
|
|
QUICBindPort: svr.cfg.QUICBindPort, |
|
|
|
|
SubdomainHost: svr.cfg.SubDomainHost, |
|
|
|
|
MaxPoolCount: svr.cfg.MaxPoolCount, |
|
|
|
|
MaxPortsPerClient: svr.cfg.MaxPortsPerClient, |
|
|
|
|
HeartBeatTimeout: svr.cfg.HeartbeatTimeout, |
|
|
|
|
AllowPortsStr: svr.cfg.AllowPortsStr, |
|
|
|
|
TLSOnly: svr.cfg.TLSOnly, |
|
|
|
|
|
|
|
|
|
TotalTrafficIn: serverStats.TotalTrafficIn, |
|
|
|
|
TotalTrafficOut: serverStats.TotalTrafficOut, |
|
|
|
@ -157,6 +165,7 @@ func getConfByType(proxyType string) interface{} {
|
|
|
|
|
type ProxyStatsInfo struct { |
|
|
|
|
Name string `json:"name"` |
|
|
|
|
Conf interface{} `json:"conf"` |
|
|
|
|
ClientVersion string `json:"client_version,omitempty"` |
|
|
|
|
TodayTrafficIn int64 `json:"today_traffic_in"` |
|
|
|
|
TodayTrafficOut int64 `json:"today_traffic_out"` |
|
|
|
|
CurConns int64 `json:"cur_conns"` |
|
|
|
@ -208,6 +217,9 @@ func (svr *Service) getProxyStatsByType(proxyType string) (proxyInfos []*ProxySt
|
|
|
|
|
continue |
|
|
|
|
} |
|
|
|
|
proxyInfo.Status = consts.Online |
|
|
|
|
if pxy.GetLoginMsg() != nil { |
|
|
|
|
proxyInfo.ClientVersion = pxy.GetLoginMsg().Version |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
proxyInfo.Status = consts.Offline |
|
|
|
|
} |
|
|
|
|