server

package
v0.0.0-...-bd20790 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 1, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ConfigFile        string = "./frps.ini"
	BindAddr          string = "0.0.0.0"
	BindPort          int64  = 7000
	VhostHttpPort     int64  = 0 // if VhostHttpPort equals 0, don't listen a public port for http protocol
	VhostHttpsPort    int64  = 0 // if VhostHttpsPort equals 0, don't listen a public port for https protocol
	DashboardPort     int64  = 0 // if DashboardPort equals 0, dashboard is not available
	DashboardUsername string = "admin"
	DashboardPassword string = "admin"
	AssetsDir         string = ""
	LogFile           string = "console"
	LogWay            string = "console" // console or file
	LogLevel          string = "info"
	LogMaxDays        int64  = 3
	PrivilegeMode     bool   = false
	PrivilegeToken    string = ""
	AuthTimeout       int64  = 900
	SubDomainHost     string = ""

	// if PrivilegeAllowPorts is not nil, tcp proxies which remote port exist in this map can be connected
	PrivilegeAllowPorts map[int64]struct{}
	MaxPoolCount        int64 = 100
	HeartBeatTimeout    int64 = 30
	UserConnTimeout     int64 = 10

	VhostHttpMuxer    *vhost.HttpMuxer
	VhostHttpsMuxer   *vhost.HttpsMuxer
	ProxyServers      map[string]*ProxyServer = make(map[string]*ProxyServer) // all proxy servers info and resources
	ProxyServersMutex sync.RWMutex
)

common config

Functions

func CreateProxy

func CreateProxy(s *ProxyServer) error

func DeleteProxy

func DeleteProxy(proxyName string)

func LoadConf

func LoadConf(confFile string) (err error)

func ReloadConf

func ReloadConf(confFile string) (err error)

the function can only reload proxy configures common section won't be changed

func RunDashboardServer

func RunDashboardServer(addr string, port int64) (err error)

Types

type GeneralResponse

type GeneralResponse struct {
	Code int64  `json:"code"`
	Msg  string `json:"msg"`
}

type Listener

type Listener interface {
	Accept() (*conn.Conn, error)
	Close() error
}

type ProxiesResponse

type ProxiesResponse struct {
	Code    int64                  `json:"code"`
	Msg     string                 `json:"msg"`
	Proxies []*metric.ServerMetric `json:"proxies"`
}

type ProxyServer

type ProxyServer struct {
	config.BaseConf
	BindAddr      string
	ListenPort    int64
	CustomDomains []string
	Locations     []string

	Status      int64
	CtlConn     *conn.Conn // control connection with frpc
	WorkConnUdp *conn.Conn // work connection for udp
	// contains filtered or unexported fields
}

func GetProxyServer

func GetProxyServer(proxyName string) (p *ProxyServer, ok bool)

func NewProxyServer

func NewProxyServer() (p *ProxyServer)

func NewProxyServerFromCtlMsg

func NewProxyServerFromCtlMsg(req *msg.ControlReq) (p *ProxyServer)

func (*ProxyServer) Close

func (p *ProxyServer) Close()

func (*ProxyServer) Compare

func (p *ProxyServer) Compare(p2 *ProxyServer) bool

func (*ProxyServer) Init

func (p *ProxyServer) Init()

func (*ProxyServer) Lock

func (p *ProxyServer) Lock()

func (*ProxyServer) RegisterNewWorkConn

func (p *ProxyServer) RegisterNewWorkConn(c *conn.Conn)

func (*ProxyServer) RegisterNewWorkConnUdp

func (p *ProxyServer) RegisterNewWorkConnUdp(c *conn.Conn)

create a tcp connection for forwarding udp packages

func (*ProxyServer) Release

func (p *ProxyServer) Release()

func (*ProxyServer) Start

func (p *ProxyServer) Start(c *conn.Conn) (err error)

start listening for user conns

func (*ProxyServer) Unlock

func (p *ProxyServer) Unlock()

func (*ProxyServer) WaitUserConn

func (p *ProxyServer) WaitUserConn() (closeFlag bool)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL