http

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2023 License: MIT Imports: 9 Imported by: 1

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 http server struct

func NewServer

func NewServer(opts ...ServerOption) *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 stop server

type ServerOption

type ServerOption func(*Server)

ServerOption is HTTP server option

func WithAddress

func WithAddress(addr string) ServerOption

WithAddress with server address.

func WithReadTimeout

func WithReadTimeout(timeout time.Duration) ServerOption

WithReadTimeout with read timeout.

func WithWriteTimeout

func WithWriteTimeout(timeout time.Duration) ServerOption

WithWriteTimeout with write timeout.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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