Documentation ¶
Index ¶
- func Write(w http.ResponseWriter, status int, text string)
- func WriteBytes(w http.ResponseWriter, status int, text []byte)
- func WriteError(w http.ResponseWriter, status int, errorMsg string, err error)
- func WriteErrorWithJSON(w http.ResponseWriter, status int, res []byte, msg string)
- func WriteJSON(w http.ResponseWriter, status int, body map[string]interface{})
- func WriteSuccessWithJSON(w http.ResponseWriter, status int, res []byte, msg string)
- type App
- type DocsHandler
- type KickMsg
- type KickUserHandler
- type PushMsg
- type PushToUsersHandler
- type RPCHandler
- type RequestHandler
- type ServersHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Write ¶
func Write(w http.ResponseWriter, status int, text string)
Write to response with status code
func WriteBytes ¶
func WriteBytes(w http.ResponseWriter, status int, text []byte)
WriteBytes to the response and with the status code
func WriteError ¶
func WriteError(w http.ResponseWriter, status int, errorMsg string, err error)
WriteError to the response with message and log error message
func WriteErrorWithJSON ¶
func WriteErrorWithJSON(w http.ResponseWriter, status int, res []byte, msg string)
WriteErrorWithJSON sends a response with status error and log error msg
func WriteJSON ¶
func WriteJSON(w http.ResponseWriter, status int, body map[string]interface{})
WriteJSON to the response and with the status code
func WriteSuccessWithJSON ¶
func WriteSuccessWithJSON(w http.ResponseWriter, status int, res []byte, msg string)
WriteSuccessWithJSON sends response with statusOK to request and log success msg
Types ¶
type App ¶
type App struct { Address string Router *mux.Router Server *http.Server Logger logrus.FieldLogger Config *viper.Viper }
App struct
func (*App) GetRemoteDocsRoute ¶
GetRemoteDocsRoute gets the route for the autodoc handler
func (*App) GetRemoteProtosRoute ¶
GetRemoteProtosRoute gets the route for the protos handler
type DocsHandler ¶
type DocsHandler struct {
App *App
}
DocsHandler handle documentation routes
func NewDocsHandler ¶
func NewDocsHandler(a *App) *DocsHandler
NewDocsHandler create new docs handler
func (*DocsHandler) ServeHTTP ¶
func (s *DocsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP method. Docs will only work if server has a remote for autodoc
type KickUserHandler ¶
type KickUserHandler struct {
App *App
}
KickUserHandler handle kick route
func NewKickUserHandler ¶
func NewKickUserHandler(a *App) *KickUserHandler
NewKickUserHandler creates a new kick user handler
func (*KickUserHandler) ServeHTTP ¶
func (s *KickUserHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type PushToUsersHandler ¶
type PushToUsersHandler struct {
App *App
}
PushToUsersHandler handle push route
func NewPushToUsersHandler ¶
func NewPushToUsersHandler(a *App) *PushToUsersHandler
NewPushToUsersHandler creates a new push to users handler
func (*PushToUsersHandler) ServeHTTP ¶
func (s *PushToUsersHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP method
type RPCHandler ¶
type RPCHandler struct {
App *App
}
RPCHandler handles RPC routes
func (*RPCHandler) ServeHTTP ¶
func (s *RPCHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP method
type RequestHandler ¶
type RequestHandler struct { App *App // contains filtered or unexported fields }
RequestHandler handle requests
func NewRequestHandler ¶
func NewRequestHandler(a *App) *RequestHandler
NewRequestHandler creates a new request handler
func (*RequestHandler) ServeHTTP ¶
func (s *RequestHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP creates a web socket connection with the user
type ServersHandler ¶
type ServersHandler struct {
App *App
}
ServersHandler handle list server routes
func NewServersHandler ¶
func NewServersHandler(a *App) *ServersHandler
NewServersHandler creates a new servers handler
func (*ServersHandler) ServeHTTP ¶
func (s *ServersHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP method