acl

package
v2.0.8 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2023 License: BSD-2-Clause Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetFreePort

func GetFreePort() (int, error)

GetFreePort returns a random open port

func MakeDecision

func MakeDecision(c *ConnInfo, a []ACL) error

MakeDecision loops through all the ACLs and makes a decision for the connection

Types

type ACL

type ACL interface {
	Decide(*ConnInfo) error
	Name() string
	Priority() uint
	ConfigAndStart(*zerolog.Logger, *koanf.Koanf) error
}

func StartACLs

func StartACLs(log *zerolog.Logger, k *koanf.Koanf) ([]ACL, error)

StartACLs starts all the ACLs that have been configured and registered

type ByPriority

type ByPriority []ACL

func (ByPriority) Len

func (a ByPriority) Len() int

func (ByPriority) Less

func (a ByPriority) Less(i, j int) bool

func (ByPriority) Swap

func (a ByPriority) Swap(i, j int)

type ConnInfo

type ConnInfo struct {
	SrcIP  net.Addr
	DstIP  net.TCPAddr
	Domain string
	Decision
}

ConnInfo contains all the information about a connection that is available it also serves as an ACL enforcer in a sense that if IsRejected is set to true the connection is dropped

type Decision

type Decision string

Decision is the type of decision that an ACL can make for each connection info

const (
	// Accept shows the indifference of the ACL to the connection
	Accept Decision = "Accept"
	// Reject shows that the ACL has rejected the connection. each ACL should check this before proceeding to check the connection against its rules
	Reject Decision = "Reject"
	// ProxyIP shows that the ACL has decided to proxy the connection through sniproxy rather than the origin IP
	ProxyIP Decision = "ProxyIP"
	// OriginIP shows that the ACL has decided to proxy the connection through the origin IP rather than sniproxy
	OriginIP Decision = "OriginIP"
	// Override shows that the ACL has decided to override the connection and proxy it through the specified DstIP and DstPort
	Override Decision = "Override"
)

Jump to

Keyboard shortcuts

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