Documentation ¶
Index ¶
- func CORS(c *gin.Context)
- func Recover() gin.HandlerFunc
- func RequestLog() gin.HandlerFunc
- func Trace(traceHeader string) gin.HandlerFunc
- type Conn
- type HTTPServer
- func (server *HTTPServer) EnableAvailableHealthCheck() *HTTPServer
- func (server *HTTPServer) EnableCorsMiddleware() *HTTPServer
- func (server *HTTPServer) EnablePprofHandler() *HTTPServer
- func (server *HTTPServer) EnableReleaseMode() *HTTPServer
- func (server *HTTPServer) EnableSwaggerHandler() *HTTPServer
- func (server *HTTPServer) EnableTraceMiddleware(traceHeader string) *HTTPServer
- func (server *HTTPServer) RegisterRouteLoader(loader func(router *gin.Engine)) *HTTPServer
- func (server *HTTPServer) Serve(stop <-chan struct{})
- func (server *HTTPServer) Shutdown()
- func (server *HTTPServer) WithDefaultRecoverMiddleware() *HTTPServer
- func (server *HTTPServer) WithDefaultRequestLogMiddleware() *HTTPServer
- func (server *HTTPServer) WithNotFoundHandler(notFoundHandler ...gin.HandlerFunc) *HTTPServer
- type RPCServer
- func (server *RPCServer) RegisterService(register func(s *grpc.Server)) *RPCServer
- func (server *RPCServer) Serve(stop <-chan struct{})
- func (server *RPCServer) Shutdown()
- func (server *RPCServer) WithChainUnaryInterceptor(interceptors ...grpc.UnaryServerInterceptor) *RPCServer
- func (server *RPCServer) WithKeepAliveParams(kp keepalive.ServerParameters) *RPCServer
- func (server *RPCServer) WithOptions(opts ...grpc.ServerOption) *RPCServer
- type Schema
- type Server
- type WebSocketServer
- func (server *WebSocketServer) OnConnect(handler func(conn Conn)) *WebSocketServer
- func (server *WebSocketServer) OnDisconnect(handler func(conn Conn)) *WebSocketServer
- func (server *WebSocketServer) OnMessage(handler func(conn Conn, msg []byte)) *WebSocketServer
- func (server *WebSocketServer) Serve(stop <-chan struct{})
- func (server *WebSocketServer) Shutdown()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Recover ¶
func Recover() gin.HandlerFunc
func RequestLog ¶
func RequestLog() gin.HandlerFunc
func Trace ¶
func Trace(traceHeader string) gin.HandlerFunc
Types ¶
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
Conn websocket connection
type HTTPServer ¶
type HTTPServer struct {
// contains filtered or unexported fields
}
func NewHTTPServer ¶
func NewHTTPServer(addr string) *HTTPServer
func (*HTTPServer) EnableAvailableHealthCheck ¶
func (server *HTTPServer) EnableAvailableHealthCheck() *HTTPServer
EnableAvailableHealthCheck enables the health check
func (*HTTPServer) EnableCorsMiddleware ¶
func (server *HTTPServer) EnableCorsMiddleware() *HTTPServer
EnableCorsMiddleware enables cors middleware
func (*HTTPServer) EnablePprofHandler ¶
func (server *HTTPServer) EnablePprofHandler() *HTTPServer
EnablePprofHandler enables the profiler for the http server
func (*HTTPServer) EnableReleaseMode ¶
func (server *HTTPServer) EnableReleaseMode() *HTTPServer
EnableReleaseMode enables the release mode for the http server,it will hide the route tables
func (*HTTPServer) EnableSwaggerHandler ¶
func (server *HTTPServer) EnableSwaggerHandler() *HTTPServer
EnableSwaggerHandler enables the swagger handler for the http server
func (*HTTPServer) EnableTraceMiddleware ¶
func (server *HTTPServer) EnableTraceMiddleware(traceHeader string) *HTTPServer
EnableTraceMiddleware enables trace middleware with trace header name
func (*HTTPServer) RegisterRouteLoader ¶
func (server *HTTPServer) RegisterRouteLoader(loader func(router *gin.Engine)) *HTTPServer
RegisterRouteLoader registers a route loader
func (*HTTPServer) Serve ¶
func (server *HTTPServer) Serve(stop <-chan struct{})
func (*HTTPServer) WithDefaultRecoverMiddleware ¶
func (server *HTTPServer) WithDefaultRecoverMiddleware() *HTTPServer
WithDefaultRecoverMiddleware enables default recover middleware
func (*HTTPServer) WithDefaultRequestLogMiddleware ¶
func (server *HTTPServer) WithDefaultRequestLogMiddleware() *HTTPServer
WithDefaultRequestLogMiddleware enables the default request log middleware.
func (*HTTPServer) WithNotFoundHandler ¶
func (server *HTTPServer) WithNotFoundHandler(notFoundHandler ...gin.HandlerFunc) *HTTPServer
WithNotFoundHandler provide the handler for not found routes and methods
type RPCServer ¶
type RPCServer struct {
// contains filtered or unexported fields
}
func NewGRPCServer ¶
func (*RPCServer) RegisterService ¶
RegisterService registers grpc service
func (*RPCServer) Serve ¶
func (server *RPCServer) Serve(stop <-chan struct{})
Serve start grpc listener
func (*RPCServer) WithChainUnaryInterceptor ¶
func (server *RPCServer) WithChainUnaryInterceptor(interceptors ...grpc.UnaryServerInterceptor) *RPCServer
WithChainUnaryInterceptor sets the interceptors.It must be called before RegisterService.
func (*RPCServer) WithKeepAliveParams ¶
func (server *RPCServer) WithKeepAliveParams(kp keepalive.ServerParameters) *RPCServer
WithKeepAliveParams sets the KeepAlive option.It must be called before RegisterService.
func (*RPCServer) WithOptions ¶
func (server *RPCServer) WithOptions(opts ...grpc.ServerOption) *RPCServer
WithOptions sets the options for the RPC server.It must be called before RegisterService.
type WebSocketServer ¶
type WebSocketServer struct {
// contains filtered or unexported fields
}
WebSocketServer provide the websocket server.
func NewWebSocketServer ¶
func NewWebSocketServer(bind string) *WebSocketServer
func (*WebSocketServer) OnConnect ¶
func (server *WebSocketServer) OnConnect(handler func(conn Conn)) *WebSocketServer
OnConnect is set callback when the connection is established
func (*WebSocketServer) OnDisconnect ¶
func (server *WebSocketServer) OnDisconnect(handler func(conn Conn)) *WebSocketServer
OnDisconnect is set callback when the client disconnects from the server
func (*WebSocketServer) OnMessage ¶
func (server *WebSocketServer) OnMessage(handler func(conn Conn, msg []byte)) *WebSocketServer
OnMessage is set callback when a message is received.
func (*WebSocketServer) Serve ¶
func (server *WebSocketServer) Serve(stop <-chan struct{})
Serve start websocket server
func (*WebSocketServer) Shutdown ¶
func (server *WebSocketServer) Shutdown()
Shutdown stop websocket server.