Documentation ¶
Index ¶
- type Connector
- type Control
- func (ctl *Control) Close() error
- func (ctl *Control) Done() <-chan struct{}
- func (ctl *Control) GracefulClose(d time.Duration) error
- func (ctl *Control) Run(proxyCfgs []v1.ProxyConfigurer, visitorCfgs []v1.VisitorConfigurer)
- func (ctl *Control) SetInWorkConnCallback(cb func(*v1.ProxyBaseConfig, net.Conn, *msg.StartWorkConn) bool)
- func (ctl *Control) UpdateAllConfigurer(proxyCfgs []v1.ProxyConfigurer, visitorCfgs []v1.VisitorConfigurer) error
- type GeneralResponse
- type ProxyStatusResp
- type Service
- type ServiceOptions
- type SessionContext
- type StatusExporter
- type StatusResp
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Connector ¶
Connector is an interface for establishing connections to the server.
func NewConnector ¶
func NewConnector(ctx context.Context, cfg *v1.ClientCommonConfig) Connector
type Control ¶
type Control struct {
// contains filtered or unexported fields
}
func NewControl ¶
func NewControl(ctx context.Context, sessionCtx *SessionContext) (*Control, error)
func (*Control) Done ¶
func (ctl *Control) Done() <-chan struct{}
Done returns a channel that will be closed after all resources are released
func (*Control) Run ¶
func (ctl *Control) Run(proxyCfgs []v1.ProxyConfigurer, visitorCfgs []v1.VisitorConfigurer)
func (*Control) SetInWorkConnCallback ¶
func (ctl *Control) SetInWorkConnCallback(cb func(*v1.ProxyBaseConfig, net.Conn, *msg.StartWorkConn) bool)
func (*Control) UpdateAllConfigurer ¶
func (ctl *Control) UpdateAllConfigurer(proxyCfgs []v1.ProxyConfigurer, visitorCfgs []v1.VisitorConfigurer) error
type GeneralResponse ¶
type ProxyStatusResp ¶
type ProxyStatusResp struct { Name string `json:"name"` Type string `json:"type"` Status string `json:"status"` Err string `json:"err"` LocalAddr string `json:"local_addr"` Plugin string `json:"plugin"` RemoteAddr string `json:"remote_addr"` }
func NewProxyStatusResp ¶
func NewProxyStatusResp(status *proxy.WorkingStatus, serverAddr string) ProxyStatusResp
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is the client service that connects to frps and provides proxy services.
func NewService ¶
func NewService(options ServiceOptions) (*Service, error)
func (*Service) GracefulClose ¶
func (*Service) StatusExporter ¶
func (svr *Service) StatusExporter() StatusExporter
func (*Service) UpdateAllConfigurer ¶
func (svr *Service) UpdateAllConfigurer(proxyCfgs []v1.ProxyConfigurer, visitorCfgs []v1.VisitorConfigurer) error
type ServiceOptions ¶
type ServiceOptions struct { Common *v1.ClientCommonConfig ProxyCfgs []v1.ProxyConfigurer VisitorCfgs []v1.VisitorConfigurer // ConfigFilePath is the path to the configuration file used to initialize. // If it is empty, it means that the configuration file is not used for initialization. // It may be initialized using command line parameters or called directly. ConfigFilePath string // ClientSpec is the client specification that control the client behavior. ClientSpec *msg.ClientSpec // ConnectorCreator is a function that creates a new connector to make connections to the server. // The Connector shields the underlying connection details, whether it is through TCP or QUIC connection, // and regardless of whether multiplexing is used. // // If it is not set, the default frpc connector will be used. // By using a custom Connector, it can be used to implement a VirtualClient, which connects to frps // through a pipe instead of a real physical connection. ConnectorCreator func(context.Context, *v1.ClientCommonConfig) Connector // HandleWorkConnCb is a callback function that is called when a new work connection is created. // // If it is not set, the default frpc implementation will be used. HandleWorkConnCb func(*v1.ProxyBaseConfig, net.Conn, *msg.StartWorkConn) bool }
ServiceOptions contains options for creating a new client service.
type SessionContext ¶
type SessionContext struct { // The client common configuration. Common *v1.ClientCommonConfig // Unique ID obtained from frps. // It should be attached to the login message when reconnecting. RunID string // Underlying control connection. Once conn is closed, the msgDispatcher and the entire Control will exit. Conn net.Conn // Indicates whether the connection is encrypted. ConnEncrypted bool // Sets authentication based on selected method AuthSetter auth.Setter // Connector is used to create new connections, which could be real TCP connections or virtual streams. Connector Connector }
type StatusExporter ¶
type StatusExporter interface {
GetProxyStatus(name string) (*proxy.WorkingStatus, bool)
}
type StatusResp ¶
type StatusResp map[string][]ProxyStatusResp
Click to show internal directories.
Click to hide internal directories.