http

package module
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IHttpServer

type IHttpServer interface {
	SafeHandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request))
	HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request))
	GetPort() int
	OnReady(cb func())
}

type Option

type Option struct {
	Host             string   `koanf:"Host"`
	MinPort          int      `koanf:"MinPort"`
	MaxPort          int      `koanf:"MaxPort"`
	KeepAliveSeconds int      `koanf:"KeepAliveSeconds"`
	TimeoutSeconds   int      `koanf:"TimeoutSeconds"`
	WhiteList        []string `koanf:"WhiteList"`
	Debug            bool     `koanf:"Debug"`
}

type Server

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

func (*Server) Construct

func (ss *Server) Construct(opt *option.Option[*Option], logger *logging.Logger[Server])

func (*Server) GetPort

func (ss *Server) GetPort() int

func (*Server) HandleFunc

func (ss *Server) HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request))

func (*Server) OnReady

func (ss *Server) OnReady(callback func())

func (*Server) SafeHandleFunc

func (ss *Server) SafeHandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request))

func (*Server) Start

func (ss *Server) Start(ctx context.Context, wg *sync.TimeoutWaitGroup)

func (*Server) Stop

func (ss *Server) Stop(ctx context.Context, wg *sync.TimeoutWaitGroup)

Jump to

Keyboard shortcuts

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