Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Logging bool CorsHeaders string Version string SocketGroup string TLSConfig *tls.Config }
Config provides the configuration for the API server
type HTTPServer ¶
type HTTPServer struct {
// contains filtered or unexported fields
}
HTTPServer contains an instance of http server and the listener. srv *http.Server, contains configuration to create an http server and a mux router with all api end points. l net.Listener, is a TCP or Socket listener that dispatches incoming request to the router.
func (*HTTPServer) Close ¶
func (s *HTTPServer) Close() error
Close closes the HTTPServer from listening for the inbound requests.
Close: 将关闭HTTPServer侦听入站请求
func (*HTTPServer) Serve ¶
func (s *HTTPServer) Serve() error
Serve starts listening for inbound requests.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server contains instance details for the server
Server 包含服务器的实例详细信息
func New ¶
New returns a new instance of the server based on the specified configuration. It allocates resources which will be needed for ServeAPI(ports, unix-sockets).
func (*Server) Close ¶
func (s *Server) Close()
Close closes servers and thus stop receiving requests
Close: 关闭服务器, 因此停止接收请求
func (*Server) InitRouter ¶
InitRouter initializes the list of routers for the server. This method also enables the Go profiler.
func (*Server) UseMiddleware ¶
func (s *Server) UseMiddleware(m middleware.Middleware)
UseMiddleware appends a new middleware to the request chain. This needs to be called before the API routes are configured.