http

package
v0.0.0-...-03b0f71 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultReadTimeout  = 5 * time.Second
	DefaultWriteTimeout = 10 * time.Second
)

Variables

View Source
var Config core.Config

Functions

This section is empty.

Types

type HttpConfig

type HttpConfig struct {
	Addr         string
	ReadTimeout  time.Duration
	WriteTimeout time.Duration
	TLSCertFile  string
	TLSKeyFile   string
}

func NewHttpConfig

func NewHttpConfig() *HttpConfig

func (*HttpConfig) SetAddr

func (c *HttpConfig) SetAddr(port string) *HttpConfig

func (*HttpConfig) SetReadTimetout

func (c *HttpConfig) SetReadTimetout(t time.Duration) *HttpConfig

func (*HttpConfig) SetTLSCertFile

func (c *HttpConfig) SetTLSCertFile(file string) *HttpConfig

func (*HttpConfig) SetTLSKeyFile

func (c *HttpConfig) SetTLSKeyFile(file string) *HttpConfig

func (*HttpConfig) SetWriteTimeout

func (c *HttpConfig) SetWriteTimeout(t time.Duration) *HttpConfig

type HttpServer

type HttpServer struct {
	// contains filtered or unexported fields
}

func NewHttpServer

func NewHttpServer(conf *HttpConfig) *HttpServer

func (*HttpServer) Build

func (s *HttpServer) Build() *HttpServer

func (*HttpServer) ListenAndServe

func (s *HttpServer) ListenAndServe() error

func (*HttpServer) ListenAndServeTLS

func (s *HttpServer) ListenAndServeTLS(cert, key string) error

func (*HttpServer) WithHandler

func (s *HttpServer) WithHandler(handler http.Handler) *HttpServer

Jump to

Keyboard shortcuts

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