httpredirect

package
v0.0.3-alpha Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2023 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConstraintInt             = "int"
	ConstraintBool            = "bool"
	ConstraintFloat           = "float"
	ConstraintAlpha           = "alpha"
	ConstraintGUID            = "guid"
	ConstraintMinLen          = "minLen"
	ConstraintMaxLen          = "maxLen"
	ConstraintLen             = "len"
	ConstraintBetweenLen      = "betweenLen"
	ConstraintMinLenLower     = "minlen"
	ConstraintMaxLenLower     = "maxlen"
	ConstraintBetweenLenLower = "betweenlen"
	ConstraintMin             = "min"
	ConstraintMax             = "max"
	ConstraintRange           = "range"
	ConstraintDatetime        = "datetime"
	ConstraintRegex           = "regex"
)

Route Constraints

Variables

This section is empty.

Functions

func DialHttpProxy

func DialHttpProxy(rawURL string) (net.Conn, error)

func GetTrimmedParam

func GetTrimmedParam(param string) string

GetTrimmedParam trims the ':' & '?' from a string

func ParseRoute

func ParseRoute(pattern string) routeParser

ParseRoute analyzes the route and divides it into segments for constant areas and parameters, this information is needed later when assigning the requests to the declared routesMap

func RemoveEscapeChar

func RemoveEscapeChar(word string) string

RemoveEscapeChar remove escape characters

func RoutePatternMatch

func RoutePatternMatch(path, pattern string) bool

RoutePatternMatch checks if a given path matches a Fiber route pattern.

Types

type Constraint

type Constraint struct {
	ID            TypeConstraint
	RegexCompiler *regexp.Regexp
	Data          []string
}

func (*Constraint) CheckConstraint

func (c *Constraint) CheckConstraint(param string) bool

type HttpProxySrv

type HttpProxySrv struct {
	net.Listener
	Router                 *Router
	Conf                   *config.SrvHttpProxyConf
	DefaultForwardConn     func() (net.Conn, error)
	HttpProxyClientConnMap map[string]net.Conn
	// contains filtered or unexported fields
}

func NewHttpProxy

func NewHttpProxy(conf *config.SrvHttpProxyConf) (*HttpProxySrv, error)

func (*HttpProxySrv) Accept

func (l *HttpProxySrv) Accept() (net.Conn, error)

func (*HttpProxySrv) AddClient

func (l *HttpProxySrv) AddClient(identity *config.ClientHttpProxyConf, conn net.Conn) error

func (*HttpProxySrv) ConnByRouter

func (l *HttpProxySrv) ConnByRouter(r *Route) (net.Conn, error)

func (*HttpProxySrv) ForwardConn

func (l *HttpProxySrv) ForwardConn(addr string) func() (net.Conn, error)

func (*HttpProxySrv) GetClient

func (l *HttpProxySrv) GetClient(uid string) (net.Conn, bool)

func (*HttpProxySrv) Handle

func (l *HttpProxySrv) Handle()

func (*HttpProxySrv) ParseRouter

func (l *HttpProxySrv) ParseRouter(conf *config.SrvHttpProxyConf) (*Router, error)

type Route

type Route struct {
	OriginPath  string `json:"path"`
	RouteParser routeParser
	ForwardConn func() (net.Conn, error)
}

func (*Route) Match

func (r *Route) Match(path string) bool

type Router

type Router struct {
	ForwardConn func() (net.Conn, error)
	// contains filtered or unexported fields
}

func NewRouter

func NewRouter() *Router

func (*Router) Add

func (r *Router) Add(pathRaw string) (*Route, error)

func (*Router) MatchRoute

func (r *Router) MatchRoute(path string) *Route

type TypeConstraint

type TypeConstraint int16

TypeConstraint parameter constraint types

Jump to

Keyboard shortcuts

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