http

package
v1.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 26, 2022 License: MIT Imports: 12 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

type Server struct {
	*http.Server
	// contains filtered or unexported fields
}

Server is an HTTP server wrapper.

func NewServer

func NewServer(opts ...ServerOption) *Server

NewServer creates an HTTP server by options.

func (*Server) Endpoint

func (s *Server) Endpoint() (*url.URL, error)

Endpoint return a real address to registry endpoint. examples:

https://127.0.0.1:8000
Legacy: http://127.0.0.1:8000?isSecure=false

func (*Server) GracefullyStop

func (s *Server) GracefullyStop(ctx context.Context) error

func (*Server) Health

func (s *Server) Health() bool

Health 心跳检测

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(res http.ResponseWriter, req *http.Request)

func (*Server) Start

func (s *Server) Start(ctx context.Context) error

Start start the HTTP server.

func (*Server) Stop

func (s *Server) Stop() error

Stop stop the HTTP server.

type ServerOption

type ServerOption func(*Server)

ServerOption is an HTTP server option.

func Address

func Address(addr string) ServerOption

Address with server address.

func Listener

func Listener(lis net.Listener) ServerOption

Listener with server lis

func Logger added in v1.3.0

func Logger(logger log.Logger) ServerOption

Logger with server logger.

func Middleware

func Middleware(m ...middleware.Middleware) ServerOption

Middleware with service middleware option.

func Network

func Network(network string) ServerOption

Network with server network.

func ReadTimeout

func ReadTimeout(timeout time.Duration) ServerOption

ReadTimeout with server timeout.

func TLSConfig

func TLSConfig(c *tls.Config) ServerOption

TLSConfig with TLS config.

func WriteTimeout added in v1.3.0

func WriteTimeout(timeout time.Duration) ServerOption

WriteTimeout with server timeout.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL