Documentation
¶
Index ¶
- Constants
- func HandleUserTcpConnection(pxy Proxy, userConn frpNet.Conn)
- func MakeGzipHandler(h http.Handler) http.Handler
- func RunDashboardServer(addr string, port int64) (err error)
- func StatsAddTrafficIn(name string, trafficIn int64)
- func StatsAddTrafficOut(name string, trafficOut int64)
- func StatsClearUselessInfo()
- func StatsCloseClient(runid string)
- func StatsCloseConnection(name string)
- func StatsCloseProxy(proxyName string, proxyType string)
- func StatsNewClient(runid string)
- func StatsNewProxy(name string, proxyType string, runid string)
- func StatsOpenConnection(name string)
- type AuthWraper
- type BaseProxy
- type ClientStatistics
- type ClientStats
- type ClientStatsInfo
- type Control
- func (ctl *Control) GetFreePort() (port int64)
- func (ctl *Control) GetFtpPort() (port int64)
- func (ctl *Control) GetWorkConn() (workConn net.Conn, err error)
- func (ctl *Control) RegisterProxy(pxyMsg *msg.NewProxy) (resp *msg.NewProxyResp, err error)
- func (ctl *Control) RegisterWorkConn(conn net.Conn)
- func (ctl *Control) Replaced(newCtl *Control)
- func (ctl *Control) Start()
- type ControlManager
- type FtpProxy
- type GeneralResponse
- type GetClientInfoResp
- type GetFreePortResp
- type GetPortResp
- type GetProxyInfoResp
- type GetProxyTrafficResp
- type GzipWraper
- type HttpProxy
- type HttpsProxy
- type PortManager
- type Proxy
- type ProxyManager
- type ProxyStatistics
- type ProxyStats
- type ProxyStatsInfo
- type ProxyTrafficInfo
- type ServerInfoResp
- type ServerStatistics
- type ServerStats
- type Service
- func (svr *Service) DelProxy(name string)
- func (svr *Service) RegisterControl(ctlConn frpNet.Conn, loginMsg *msg.Login) (err error)
- func (svr *Service) RegisterProxy(name string, pxy Proxy) error
- func (svr *Service) RegisterWorkConn(workConn frpNet.Conn, newMsg *msg.NewWorkConn)
- func (svr *Service) Run()
- type TcpProxy
- type UdpProxy
Constants ¶
const (
ReserveDays = 7
)
Variables ¶
This section is empty.
Functions ¶
func HandleUserTcpConnection ¶
HandleUserTcpConnection is used for incoming tcp user connections. It can be used for tcp, http, https type.
func RunDashboardServer ¶
func StatsAddTrafficIn ¶
func StatsAddTrafficOut ¶
func StatsClearUselessInfo ¶
func StatsClearUselessInfo()
func StatsCloseClient ¶
func StatsCloseClient(runid string)
func StatsCloseConnection ¶
func StatsCloseConnection(name string)
func StatsCloseProxy ¶
func StatsNewClient ¶
func StatsNewClient(runid string)
func StatsNewProxy ¶
func StatsOpenConnection ¶
func StatsOpenConnection(name string)
Types ¶
type AuthWraper ¶
type AuthWraper struct {
// contains filtered or unexported fields
}
func (*AuthWraper) ServeHTTP ¶
func (aw *AuthWraper) ServeHTTP(w http.ResponseWriter, r *http.Request)
type BaseProxy ¶
func (*BaseProxy) GetControl ¶
type ClientStatistics ¶ added in v0.8.698
type ClientStats ¶ added in v0.8.698
type ClientStats struct { RunId string ProxyNum int64 ConnNum int64 LastStartTime string LastCloseTime string }
func StatsGetClient ¶ added in v0.8.698
func StatsGetClient(online int) []*ClientStats
online is 1, means online; otherwise offline
type ClientStatsInfo ¶ added in v0.8.698
type ClientStatsInfo struct { RunId string `json:"runid"` ProxyNum int64 `json:"proxy_num"` ConnNum int64 `json:"conn_num"` LastStartTime string `json:"last_start_time"` LastCloseTime string `json:"last_close_time"` }
Get client info
type Control ¶
type Control struct {
// contains filtered or unexported fields
}
func (*Control) GetFreePort ¶
Get free port for client, every client has only one free port
func (*Control) GetFtpPort ¶
Get ftp port for ftp client
func (*Control) GetWorkConn ¶
When frps get one user connection, we get one work connection from the pool and return it. If no workConn available in the pool, send message to frpc to get one or more and wait until it is available. return an error if wait timeout
func (*Control) RegisterProxy ¶
func (*Control) RegisterWorkConn ¶
type ControlManager ¶
type ControlManager struct {
// contains filtered or unexported fields
}
func NewControlManager ¶
func NewControlManager() *ControlManager
type FtpProxy ¶
type FtpProxy struct { BaseProxy // contains filtered or unexported fields }
ftp proxy
func (*FtpProxy) GetRemotePort ¶ added in v0.8.698
type GeneralResponse ¶
type GetClientInfoResp ¶ added in v0.8.698
type GetClientInfoResp struct { GeneralResponse TotalPage int64 `json:"total_page"` TotalNum int64 `json:"total_num"` Clients []*ClientStatsInfo `json:"clients"` }
type GetFreePortResp ¶
type GetFreePortResp struct { GeneralResponse Proto string `json:"proto"` FreePort int `json:"free_port"` }
/api/port/getfree/:proto
type GetPortResp ¶
type GetPortResp struct { GeneralResponse Port int64 `json:"port"` }
type GetProxyInfoResp ¶
type GetProxyInfoResp struct { GeneralResponse TotalPage int64 `json:"total_page"` TotalNum int64 `json:"total_num"` Proxies []*ProxyStatsInfo `json:"proxies"` }
type GetProxyTrafficResp ¶
type GetProxyTrafficResp struct { GeneralResponse Name string `json:"name"` TrafficIn []int64 `json:"traffic_in"` TrafficOut []int64 `json:"traffic_out"` }
api/proxy/traffic/:name
type GzipWraper ¶
type GzipWraper struct {
// contains filtered or unexported fields
}
func (*GzipWraper) ServeHTTP ¶
func (gw *GzipWraper) ServeHTTP(w http.ResponseWriter, r *http.Request)
type HttpProxy ¶
type HttpProxy struct { BaseProxy // contains filtered or unexported fields }
func (*HttpProxy) GetRemotePort ¶ added in v0.8.698
type HttpsProxy ¶
type HttpsProxy struct { BaseProxy // contains filtered or unexported fields }
func (*HttpsProxy) Close ¶
func (pxy *HttpsProxy) Close()
func (*HttpsProxy) GetConf ¶
func (pxy *HttpsProxy) GetConf() config.ProxyConf
func (*HttpsProxy) GetRemotePort ¶ added in v0.8.698
func (pxy *HttpsProxy) GetRemotePort() int64
func (*HttpsProxy) Run ¶
func (pxy *HttpsProxy) Run() (err error)
type PortManager ¶
type PortManager struct {
// contains filtered or unexported fields
}
func NewPortManager ¶
func NewPortManager() *PortManager
func (*PortManager) AddFtp ¶
func (pm *PortManager) AddFtp(runId string, port int64) (oldPort int64)
func (*PortManager) GetFtpById ¶
func (pm *PortManager) GetFtpById(runId string) (port int64, ok bool)
type Proxy ¶
type ProxyManager ¶
type ProxyManager struct {
// contains filtered or unexported fields
}
func NewProxyManager ¶
func NewProxyManager() *ProxyManager
func (*ProxyManager) Del ¶
func (pm *ProxyManager) Del(name string)
type ProxyStatistics ¶
type ProxyStats ¶
type ProxyStats struct { Name string RunId string Type string TodayTrafficIn int64 TodayTrafficOut int64 LastStartTime string LastCloseTime string CurConns int64 }
func StatsGetProxiesByType ¶
func StatsGetProxiesByType(proxyType string) []*ProxyStats
type ProxyStatsInfo ¶
type ProxyStatsInfo struct { Name string `json:"name"` Conf config.ProxyConf `json:"conf"` TodayTrafficIn int64 `json:"today_traffic_in"` TodayTrafficOut int64 `json:"today_traffic_out"` CurConns int64 `json:"cur_conns"` LastStartTime string `json:"last_start_time"` LastCloseTime string `json:"last_close_time"` Status string `json:"status"` }
Get proxy info.
type ProxyTrafficInfo ¶
func StatsGetProxyTraffic ¶
func StatsGetProxyTraffic(name string) (res *ProxyTrafficInfo)
type ServerInfoResp ¶
type ServerInfoResp struct { GeneralResponse Version string `json:"version"` VhostHttpPort int64 `json:"vhost_http_port"` VhostHttpsPort int64 `json:"vhost_https_port"` AuthTimeout int64 `json:"auth_timeout"` SubdomainHost string `json:"subdomain_host"` MaxPoolCount int64 `json:"max_pool_count"` HeartBeatTimeout int64 `json:"heart_beat_timeout"` TotalTrafficIn int64 `json:"total_traffic_in"` TotalTrafficOut int64 `json:"total_traffic_out"` CurConns int64 `json:"cur_conns"` ClientCounts int64 `json:"client_counts"` ProxyTypeCounts map[string]int64 `json:"proxy_type_count"` }
api/serverinfo
type ServerStatistics ¶
type ServerStatistics struct { TotalTrafficIn metric.DateCounter TotalTrafficOut metric.DateCounter CurConns metric.Counter // counter for clients ClientCounts metric.Counter // counter for proxy types ProxyTypeCounts map[string]metric.Counter // statistics for different proxies // key is proxy name ProxyStatistics map[string]*ProxyStatistics // statistics for client // key is runid ClientStatistics map[string]*ClientStatistics // contains filtered or unexported fields }
type ServerStats ¶
type ServerStats struct { TotalTrafficIn int64 TotalTrafficOut int64 CurConns int64 ClientCounts int64 ProxyTypeCounts map[string]int64 }
Functions for getting server stats.
func StatsGetServer ¶
func StatsGetServer() *ServerStats
type Service ¶
type Service struct { // For http proxies, route requests to different clients by hostname and other infomation. VhostHttpMuxer *vhost.HttpMuxer // For https proxies, route requests to different clients by hostname and other infomation. VhostHttpsMuxer *vhost.HttpsMuxer // contains filtered or unexported fields }
Server service.
var ServerService *Service
func NewService ¶
func (*Service) RegisterControl ¶
func (*Service) RegisterWorkConn ¶
func (svr *Service) RegisterWorkConn(workConn frpNet.Conn, newMsg *msg.NewWorkConn)
RegisterWorkConn register a new work connection to control and proxies need it.
type TcpProxy ¶
type TcpProxy struct { BaseProxy // contains filtered or unexported fields }
func (*TcpProxy) GetRemotePort ¶ added in v0.8.698
type UdpProxy ¶
type UdpProxy struct { BaseProxy // contains filtered or unexported fields }