Documentation
¶
Index ¶
- type Controller
- func (c *Controller) GetConfig(ctx *httppkg.Context) (any, error)
- func (c *Controller) PutConfig(ctx *httppkg.Context) (any, error)
- func (c *Controller) Reload(ctx *httppkg.Context) (any, error)
- func (c *Controller) Status(ctx *httppkg.Context) (any, error)
- func (c *Controller) Stop(ctx *httppkg.Context) (any, error)
- type ControllerParams
- type ProxyStatusResp
- type StatusResp
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller handles HTTP API requests for frpc.
func NewController ¶
func NewController(params ControllerParams) *Controller
NewController creates a new Controller.
func (*Controller) GetConfig ¶
func (c *Controller) GetConfig(ctx *httppkg.Context) (any, error)
GetConfig handles GET /api/config
func (*Controller) PutConfig ¶
func (c *Controller) PutConfig(ctx *httppkg.Context) (any, error)
PutConfig handles PUT /api/config
func (*Controller) Reload ¶
func (c *Controller) Reload(ctx *httppkg.Context) (any, error)
Reload handles GET /api/reload
type ControllerParams ¶
type ControllerParams struct {
GetProxyStatus func() []*proxy.WorkingStatus
ServerAddr string
ConfigFilePath string
UnsafeFeatures *security.UnsafeFeatures
UpdateConfig func(proxyCfgs []v1.ProxyConfigurer, visitorCfgs []v1.VisitorConfigurer) error
GracefulClose func(d time.Duration)
}
ControllerParams contains parameters for creating an APIController.
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"`
}
ProxyStatusResp contains proxy status information
type StatusResp ¶
type StatusResp map[string][]ProxyStatusResp
StatusResp is the response for GET /api/status
Click to show internal directories.
Click to hide internal directories.