router

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2020 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EmptyRouter

type EmptyRouter struct {
	DefaultPolicy Policy
}

func (*EmptyRouter) RouteRequest

func (r *EmptyRouter) RouteRequest(req *protocol.Request) (Policy, error)

type GeoRouter added in v0.0.17

type GeoRouter struct {
	Router
	// contains filtered or unexported fields
}

func NewGeoRouter added in v0.0.17

func NewGeoRouter(matchPolicy Policy, nonMatchPolicy Policy, routeByIP bool, routeByIPOnNonmatch bool) (*GeoRouter, error)

func (*GeoRouter) LoadGeoData added in v0.0.17

func (r *GeoRouter) LoadGeoData(geoipData []byte, ipCode []string, geositeData []byte, siteCode []string) error

func (*GeoRouter) RouteRequest added in v0.0.17

func (r *GeoRouter) RouteRequest(req *protocol.Request) (Policy, error)

type ListRouter

type ListRouter struct {
	Router
	// contains filtered or unexported fields
}

func NewListRouter

func NewListRouter(matchPolicy Policy, nonMatchPolicy Policy, routeByIP bool, routeByIPOnNonmatch bool, list []byte) (*ListRouter, error)

func (*ListRouter) LoadList

func (r *ListRouter) LoadList(data []byte) error

func (*ListRouter) RouteRequest

func (r *ListRouter) RouteRequest(req *protocol.Request) (Policy, error)

type MixedRouter

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

func (*MixedRouter) RouteRequest

func (r *MixedRouter) RouteRequest(req *protocol.Request) (Policy, error)

type Policy

type Policy int
const (
	Proxy Policy = iota
	Bypass
	Block
	Unknown
)

type Router

type Router interface {
	RouteRequest(*protocol.Request) (Policy, error)
}

func NewMixedRouter

func NewMixedRouter(config *conf.GlobalConfig) (Router, error)

Jump to

Keyboard shortcuts

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