host

package
v0.7.4 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotHandler = fmt.Errorf("error not handler")
	ErrNotDomain  = fmt.Errorf("error not router")
)
View Source
var (
	ErrFormat = fmt.Errorf("error only a single asterisk is currently supported")
)

Functions

func NewHostWithConfig

func NewHostWithConfig(conf *Config) (http.Handler, error)

Types

type Config

type Config struct {
	Hosts    []*Route
	NotFound http.Handler `json:",omitempty"`
}

type Host

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

Host is an host multiplexer.

func NewHost

func NewHost() *Host

func (*Host) Handle

func (h *Host) Handle(host string, handler http.Handler) error

func (*Host) Handler

func (h *Host) Handler(host string) (handler http.Handler)

handler returns most matching handler and prefix bytes data to use for the given reader.

func (*Host) NotFound

func (h *Host) NotFound(handler http.Handler)

func (*Host) ServeHTTP

func (h *Host) ServeHTTP(rw http.ResponseWriter, r *http.Request)

type Route

type Route struct {
	Domains []string
	Handler http.Handler
}

Jump to

Keyboard shortcuts

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