Documentation
¶
Overview ¶
Package server holds the HTTP handlers of the node-facing server API, authenticated by the node secret and answering in JSON or Protobuf.
Index ¶
- func GetServerConfigHandler(service ServerConfigReader) app.HandlerFunc
- func GetServerUserListHandler(service ServerUserListReader) app.HandlerFunc
- func PushOnlineUsersHandler(service OnlineUsersReporter) app.HandlerFunc
- func QueryServerProtocolConfigHandler(service ServerProtocolConfigReader, nodeSecret func() string) app.HandlerFunc
- func ServerMiddleware(nodeSecret func() string) app.HandlerFunc
- func ServerPushStatusHandler(service ServerStatusReporter) app.HandlerFunc
- func ServerPushUserTrafficHandler(service UserTrafficReporter) app.HandlerFunc
- type OnlineUsersReporter
- type ServerConfigReader
- type ServerProtocolConfigReader
- type ServerStatusReporter
- type ServerUserListReader
- type UserTrafficReporter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetServerConfigHandler ¶
func GetServerConfigHandler(service ServerConfigReader) app.HandlerFunc
GetServerConfigHandler documents Get server config.
@Summary Get server config @Tags node @Accept json @Produce json,application/protobuf @Security NodeSecret @Param request query dto.GetServerConfigRequest false "Request parameters" @Success 200 {object} dto.GetServerConfigResponse @Router /v1/server/config [get]
func GetServerUserListHandler ¶
func GetServerUserListHandler(service ServerUserListReader) app.HandlerFunc
GetServerUserListHandler documents Get user list.
@Summary Get user list @Tags node @Accept json @Produce json,application/protobuf @Security NodeSecret @Param request query dto.GetServerUserListRequest false "Request parameters" @Success 200 {object} dto.GetServerUserListResponse @Router /v1/server/user [get]
func PushOnlineUsersHandler ¶
func PushOnlineUsersHandler(service OnlineUsersReporter) app.HandlerFunc
PushOnlineUsersHandler documents Push online users.
@Summary Push online users @Tags node @Accept json,application/protobuf @Produce json,application/protobuf @Security NodeSecret @Param request body dto.OnlineUsersRequest true "Request parameters" @Success 200 {object} httpx.ResponseSuccessBean @Router /v1/server/online [post]
func QueryServerProtocolConfigHandler ¶
func QueryServerProtocolConfigHandler(service ServerProtocolConfigReader, nodeSecret func() string) app.HandlerFunc
QueryServerProtocolConfigHandler documents Get Server Protocol Config.
@Summary Get Server Protocol Config @Tags node @Produce json,application/protobuf @Security NodeSecret @Param server_id path int true "Server ID" @Param protocols query []string false "Protocols to include" collectionFormat(multi) @Success 200 {object} httpx.ResponseSuccessBean{data=dto.QueryServerConfigResponse} @Router /v2/server/{server_id} [get]
func ServerMiddleware ¶
func ServerMiddleware(nodeSecret func() string) app.HandlerFunc
func ServerPushStatusHandler ¶
func ServerPushStatusHandler(service ServerStatusReporter) app.HandlerFunc
ServerPushStatusHandler documents Push server status.
@Summary Push server status @Tags node @Accept json,application/protobuf @Produce json,application/protobuf @Security NodeSecret @Param request body dto.ServerPushStatusRequest true "Request parameters" @Success 200 {object} httpx.ResponseSuccessBean @Router /v1/server/status [post]
func ServerPushUserTrafficHandler ¶
func ServerPushUserTrafficHandler(service UserTrafficReporter) app.HandlerFunc
ServerPushUserTrafficHandler documents Push user Traffic.
@Summary Push user Traffic @Tags node @Accept json,application/protobuf @Produce json,application/protobuf @Security NodeSecret @Param request body dto.ServerPushUserTrafficRequest true "Request parameters" @Success 200 {object} httpx.ResponseSuccessBean @Router /v1/server/push [post]
Types ¶
type OnlineUsersReporter ¶ added in v1.21.0
type OnlineUsersReporter interface {
PushOnlineUsers(ctx context.Context, req *dto.OnlineUsersRequest) error
}
OnlineUsersReporter is the part of the network facade PushOnlineUsersHandler calls.
type ServerConfigReader ¶ added in v1.21.0
type ServerConfigReader interface {
GetServerConfig(ctx context.Context, req *dto.GetServerConfigRequest, meta network.RequestMeta) (*dto.GetServerConfigResponse, network.ResponseMeta, error)
}
ServerConfigReader is the part of the network facade GetServerConfigHandler calls.
type ServerProtocolConfigReader ¶ added in v1.21.0
type ServerProtocolConfigReader interface {
QueryServerProtocolConfig(ctx context.Context, req *dto.QueryServerConfigRequest) (*dto.QueryServerConfigResponse, error)
}
ServerProtocolConfigReader is the part of the network facade QueryServerProtocolConfigHandler calls.
type ServerStatusReporter ¶ added in v1.21.0
type ServerStatusReporter interface {
ServerPushStatus(ctx context.Context, req *dto.ServerPushStatusRequest) error
}
ServerStatusReporter is the part of the network facade ServerPushStatusHandler calls.
type ServerUserListReader ¶ added in v1.21.0
type ServerUserListReader interface {
GetServerUserList(ctx context.Context, req *dto.GetServerUserListRequest, meta network.RequestMeta) (*dto.GetServerUserListResponse, network.ResponseMeta, error)
}
ServerUserListReader is the part of the network facade GetServerUserListHandler calls.
type UserTrafficReporter ¶ added in v1.21.0
type UserTrafficReporter interface {
ServerPushUserTraffic(ctx context.Context, req *dto.ServerPushUserTrafficRequest) error
}
UserTrafficReporter is the part of the network facade ServerPushUserTrafficHandler calls.