httpserver

package
v0.0.0-...-6076d7e Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	ListenSpec      string        `yaml:"listen_spec" json:"listen_spec"`           // HTTP listener address string
	ReadTimeout     time.Duration `yaml:"read_timeout" json:"read_timeout"`         // HTTP read timeout duration in sec - default 60 sec
	WriteTimeout    time.Duration `yaml:"write_timeout" json:"write_timeout"`       // HTTP write timeout duration in sec - default 60 sec
	IdleTimeout     time.Duration `yaml:"idle_timeout" json:"idle_timeout"`         // HTTP idle timeout duration in sec - default 60 sec
	ShutdownTimeout time.Duration `yaml:"shutdown_timeout" json:"shutdown_timeout"` // service shutdown timeout in sec - default 30 sec
	MaxHeaderBytes  int           `yaml:"max_header_bytes" json:"max_header_bytes"` // HTTP max header bytes - default 1 MB
	UseProfile      bool          `yaml:"use_go_profile" json:"use_profile"`        // use Go profiling
	UseTLS          bool          `yaml:"use_tls" json:"use_tls"`                   // use Transport Level Security
	TLSCertFile     string        `yaml:"tls_cert_file" json:"tls_cert_file"`       // TLS Certificate file name
	TLSKeyFile      string        `yaml:"tls_key_file" json:"tls_key_file"`         // TLS Private key file name
	TLSMinVersion   uint16        `yaml:"tls_min_version" json:"tls_min_version"`   // TLS min version VersionTLS13, VersionTLS12, VersionTLS11, VersionTLS10, VersionSSL30
	TLSMaxVersion   uint16        `yaml:"tls_max_version" json:"tls_max_version"`   // TLS max version VersionTLS13, VersionTLS12, VersionTLS11, VersionTLS10, VersionSSL30
}

Config represent HTTP server options

type Server

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

Server represent HTTP server

func New

func New(ctx context.Context, errCh chan<- error, cfg *Config, httpService *_http.Service) (*Server, error)

New create HTTP server

func (*Server) Run

func (s *Server) Run() (myerr error)

Run HTTP server - wait for error or exit

func (*Server) Shutdown

func (s *Server) Shutdown() (myerr error)

Shutdown HTTP server

Jump to

Keyboard shortcuts

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