acl

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2025 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ACLAllow = "allow"
	ACLDeny  = "deny"
)
View Source
const (
	MatcherTypeIP       = "ip"
	MatcherTypeCIDR     = "cidr"
	MatcherTypeTimeZone = "tz"
	MatcherTypeCountry  = "country"
)

Variables

View Source
var (
	ErrResponseNotOK   = gperr.New("response not OK")
	ErrDownloadFailure = gperr.New("download failure")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Default    string                     `json:"default" validate:"omitempty,oneof=allow deny"` // default: allow
	AllowLocal *bool                      `json:"allow_local"`                                   // default: true
	Allow      []string                   `json:"allow"`
	Deny       []string                   `json:"deny"`
	Log        *accesslog.ACLLoggerConfig `json:"log"`

	MaxMind *MaxMindConfig `json:"maxmind" validate:"omitempty"`
	// contains filtered or unexported fields
}

func (*Config) IPAllowed

func (c *Config) IPAllowed(ip net.IP) bool

func (*Config) Start

func (c *Config) Start(parent *task.Task) gperr.Error

func (*Config) Valid

func (c *Config) Valid() bool

func (*Config) Validate

func (c *Config) Validate() gperr.Error

func (*Config) WrapTCP

func (cfg *Config) WrapTCP(lis net.Listener) net.Listener

func (*Config) WrapUDP

func (cfg *Config) WrapUDP(lis net.PacketConn) net.PacketConn

type MaxMindConfig

type MaxMindConfig struct {
	AccountID  string              `json:"account_id" validate:"required"`
	LicenseKey string              `json:"license_key" validate:"required"`
	Database   MaxMindDatabaseType `json:"database" validate:"required,oneof=geolite geoip2"`
	// contains filtered or unexported fields
}

func (*MaxMindConfig) LoadMaxMindDB

func (cfg *MaxMindConfig) LoadMaxMindDB(parent task.Parent) gperr.Error

type MaxMindDatabaseType

type MaxMindDatabaseType string
const (
	MaxMindGeoLite MaxMindDatabaseType = "geolite"
	MaxMindGeoIP2  MaxMindDatabaseType = "geoip2"
)

type TCPListener

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

func (*TCPListener) Accept

func (s *TCPListener) Accept() (net.Conn, error)

func (*TCPListener) Addr

func (s *TCPListener) Addr() net.Addr

func (*TCPListener) Close

func (s *TCPListener) Close() error

type UDPListener

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

func (*UDPListener) Close

func (s *UDPListener) Close() error

func (*UDPListener) LocalAddr

func (s *UDPListener) LocalAddr() net.Addr

func (*UDPListener) ReadFrom

func (s *UDPListener) ReadFrom(p []byte) (int, net.Addr, error)

func (*UDPListener) SetDeadline

func (s *UDPListener) SetDeadline(t time.Time) error

func (*UDPListener) SetReadDeadline

func (s *UDPListener) SetReadDeadline(t time.Time) error

func (*UDPListener) SetWriteDeadline

func (s *UDPListener) SetWriteDeadline(t time.Time) error

func (*UDPListener) WriteTo

func (s *UDPListener) WriteTo(p []byte, addr net.Addr) (int, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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