acl

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ActionDirect = Action(iota)
	ActionProxy
	ActionBlock
	ActionHijack
)
View Source
const (
	ProtocolAll = Protocol(iota)
	ProtocolTCP
	ProtocolUDP
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action byte

type Engine

type Engine struct {
	DefaultAction Action
	Entries       []Entry
	Cache         *lru.ARCCache
	ResolveIPAddr func(string) (*net.IPAddr, error)
	GeoIPReader   *geoip2.Reader
}

func LoadFromFile

func LoadFromFile(filename string, resolveIPAddr func(string) (*net.IPAddr, error), geoIPLoadFunc func() (*geoip2.Reader, error)) (*Engine, error)

func (*Engine) ResolveAndMatch

func (e *Engine) ResolveAndMatch(host string, port uint16, isUDP bool) (Action, string, bool, *net.IPAddr, error)

action, arg, isDomain, resolvedIP, error

type Entry

type Entry struct {
	Action    Action
	ActionArg string
	Matcher   Matcher
}

func ParseEntry

func ParseEntry(s string) (Entry, error)

func (Entry) Match

func (e Entry) Match(r MatchRequest) bool

type MatchRequest

type MatchRequest struct {
	IP     net.IP
	Domain string

	Protocol Protocol
	Port     uint16

	DB *geoip2.Reader
}

type Matcher

type Matcher interface {
	Match(MatchRequest) bool
}

type Protocol

type Protocol byte

Jump to

Keyboard shortcuts

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