http

package
v3.0.1 Latest Latest
Warning

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

Go to latest
Published: May 22, 2024 License: MIT Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRulePriority

func GetRulePriority(rule string) int

GetRulePriority computes the priority for a given rule. The priority is calculated using the length of rule.

func IsASCII

func IsASCII(s string) bool

IsASCII checks if the given string contains only ASCII characters.

func ParseDomains

func ParseDomains(rule string) ([]string, error)

ParseDomains extract domains from rule.

Types

type Muxer

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

Muxer handles routing with rules.

func NewMuxer

func NewMuxer() (*Muxer, error)

NewMuxer returns a new muxer instance.

func (*Muxer) AddRoute

func (m *Muxer) AddRoute(rule string, syntax string, priority int, handler http.Handler) error

AddRoute add a new route to the router.

func (*Muxer) ServeHTTP

func (m *Muxer) ServeHTTP(rw http.ResponseWriter, req *http.Request)

ServeHTTP forwards the connection to the matching HTTP handler. Serves 404 if no handler is found.

func (*Muxer) SetDefaultHandler

func (m *Muxer) SetDefaultHandler(handler http.Handler)

SetDefaultHandler sets the muxer default handler.

Jump to

Keyboard shortcuts

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