Documentation ¶
Index ¶
- Variables
- func AuthNone() func(ctx *RequestContext, token string) bool
- type DownloadHandler
- type DownloadHandlerFile
- func (handler *DownloadHandlerFile) GetContentType() string
- func (handler *DownloadHandlerFile) GetIsAlive() bool
- func (handler *DownloadHandlerFile) Lifetime() time.Duration
- func (handler *DownloadHandlerFile) Limit() int
- func (handler *DownloadHandlerFile) Match(key string) bool
- func (handler *DownloadHandlerFile) Pull() (reader io.Reader, err error)
- func (handler *DownloadHandlerFile) Remove() (err error)
- type Executor
- func (executor *Executor) AddDownloadHandler(handler DownloadHandler)
- func (executor *Executor) AddHandler(handler Handler)
- func (executor *Executor) CreateQueueEntry(clientMode client.ClientMode, outgoing chan generic.Pair[int, []byte], ...) generic.Pair[*RequestContext, *proto.Promise[proto.Result]]
- func (executor *Executor) ExecuteOne() (err error)
- func (executor *Executor) ExecuteRequest(ctx *RequestContext) (result proto.Result, err error)
- func (executor *Executor) GetDownloadHandlerAlive(key string) (result optionals.Optional[DownloadHandler])
- func (executor *Executor) GetHandler(namespace string, method string) (result optionals.Optional[Handler])
- func (executor *Executor) LoopClearHandlers()
- func (executor *Executor) LoopExecute(duration time.Duration)
- func (executor *Executor) PushRequest(clientMode client.ClientMode, outgoing chan generic.Pair[int, []byte], ...) (entry *proto.Promise[proto.Result], flag bool)
- func (executor *Executor) Start(loop time.Duration) (err error)
- type Handler
- type HandlerAuthFunction
- type HandlerBase
- type HandlerExecuteFunction
- type HandlerMatchFunction
- type RequestContext
- type Server
- func (server *Server) AddDownloadHandler(handler DownloadHandler)
- func (server *Server) AddHandler(handler Handler)
- func (server *Server) Addr() string
- func (server *Server) ErrorResult(err string) (result proto.Result)
- func (server *Server) HandleConnect(ctx *gin.Context)
- func (server *Server) HandleConnection(conn *websocket.Conn)
- func (server *Server) HandleDownload(ctx *gin.Context)
- func (server *Server) HandleExecute(ctx *gin.Context)
- func (server *Server) Run() (err error)
- type Settings
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrorHandlerNotFound = "handler not found" ErrorAuthFailed = "handler auth failed" )
View Source
var (
FallbackErrorMessage = "error"
)
Functions ¶
func AuthNone ¶
func AuthNone() func(ctx *RequestContext, token string) bool
Types ¶
type DownloadHandler ¶
type DownloadHandlerFile ¶
type DownloadHandlerFile struct {
// contains filtered or unexported fields
}
func NewDownloadHandlerFile ¶
func (*DownloadHandlerFile) GetContentType ¶
func (handler *DownloadHandlerFile) GetContentType() string
func (*DownloadHandlerFile) GetIsAlive ¶
func (handler *DownloadHandlerFile) GetIsAlive() bool
func (*DownloadHandlerFile) Lifetime ¶
func (handler *DownloadHandlerFile) Lifetime() time.Duration
func (*DownloadHandlerFile) Limit ¶
func (handler *DownloadHandlerFile) Limit() int
func (*DownloadHandlerFile) Match ¶
func (handler *DownloadHandlerFile) Match(key string) bool
func (*DownloadHandlerFile) Pull ¶
func (handler *DownloadHandlerFile) Pull() (reader io.Reader, err error)
func (*DownloadHandlerFile) Remove ¶
func (handler *DownloadHandlerFile) Remove() (err error)
type Executor ¶
type Executor struct {
// contains filtered or unexported fields
}
func NewExecutor ¶
func (*Executor) AddDownloadHandler ¶
func (executor *Executor) AddDownloadHandler(handler DownloadHandler)
func (*Executor) AddHandler ¶
func (*Executor) CreateQueueEntry ¶
func (*Executor) ExecuteOne ¶
func (*Executor) ExecuteRequest ¶
func (executor *Executor) ExecuteRequest(ctx *RequestContext) (result proto.Result, err error)
func (*Executor) GetDownloadHandlerAlive ¶
func (executor *Executor) GetDownloadHandlerAlive(key string) (result optionals.Optional[DownloadHandler])
func (*Executor) GetHandler ¶
func (*Executor) LoopClearHandlers ¶
func (executor *Executor) LoopClearHandlers()
func (*Executor) LoopExecute ¶
func (*Executor) PushRequest ¶
type Handler ¶
type Handler interface { Match(namespace string, method string) bool Auth(ctx *RequestContext, token string) bool Execute(ctx *RequestContext, request proto.Request) (result proto.Result) }
func NewHandler ¶
func NewHandler( fnMatch HandlerMatchFunction, fnAuth HandlerAuthFunction, fnExecute HandlerExecuteFunction, ) Handler
func NewHandlerWith ¶
func NewHandlerWith(namespace string, method string, fnAuth HandlerAuthFunction, fnExecute HandlerExecuteFunction) Handler
func NewHandlerWithToken ¶
func NewHandlerWithToken(namespace string, method string, token string, fnExecute HandlerExecuteFunction) Handler
type HandlerAuthFunction ¶
type HandlerAuthFunction func(ctx *RequestContext, token string) bool
type HandlerBase ¶
type HandlerBase struct {
// contains filtered or unexported fields
}
func (*HandlerBase) Auth ¶
func (handler *HandlerBase) Auth(ctx *RequestContext, token string) bool
func (*HandlerBase) Execute ¶
func (handler *HandlerBase) Execute(ctx *RequestContext, request proto.Request) (result proto.Result)
type HandlerExecuteFunction ¶
type HandlerExecuteFunction func(ctx *RequestContext, request proto.Request) (result proto.Result)
type HandlerMatchFunction ¶
type RequestContext ¶
type RequestContext struct {
// contains filtered or unexported fields
}
func NewRequestContext ¶
func NewRequestContext(executor *Executor, clientMode client.ClientMode, outgoing chan generic.Pair[int, []byte], request proto.Request) *RequestContext
func (*RequestContext) GetClientMode ¶
func (ctx *RequestContext) GetClientMode() client.ClientMode
func (*RequestContext) GetExecutor ¶
func (ctx *RequestContext) GetExecutor() *Executor
func (*RequestContext) GetRequest ¶
func (ctx *RequestContext) GetRequest() proto.Request
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func NewServerWithSettings ¶
func (*Server) AddDownloadHandler ¶
func (server *Server) AddDownloadHandler(handler DownloadHandler)
func (*Server) AddHandler ¶
func (*Server) HandleConnect ¶
func (*Server) HandleConnection ¶
func (*Server) HandleDownload ¶
func (*Server) HandleExecute ¶
Click to show internal directories.
Click to hide internal directories.