http

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*options)

Option is HTTP server option

func WithAddress

func WithAddress(addr string) Option

WithAddress with server address.

func WithReadTimeout

func WithReadTimeout(timeout time.Duration) Option

WithReadTimeout with read timeout.

func WithWriteTimeout

func WithWriteTimeout(timeout time.Duration) Option

WithWriteTimeout with write timeout.

type Server

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

Server http server struct

func NewServer

func NewServer(opts ...Option) *Server

NewServer create a server

func (*Server) Endpoint

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

Endpoint return a real address to registry endpoint. examples: http://127.0.0.1:8080

func (*Server) ServeHTTP

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

ServeHTTP should write reply headers and data to the ResponseWriter and then return.

func (*Server) Start

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

Start start a server

func (*Server) Stop

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

Stop server

Jump to

Keyboard shortcuts

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