Documentation
¶
Overview ¶
Package acl compiles and evaluates the access lists of nps on top of geomatch: the source lists (who may connect) of the global, client and tunnel or host levels, and the destination list of a proxy tunnel.
Index ¶
- Constants
- func Allows(addr net.Addr, global, client, tunnel *Source) bool
- func AllowsString(addr string, global, client, tunnel *Source) bool
- func Decide(addr net.Addr, names []string, global, client, tunnel *Source) geomatch.Decision
- func DecideString(addr string, names []string, global, client, tunnel *Source) geomatch.Decision
- func GeoFiles() (ipFile, siteFile string)
- func GeoGeneration() uint64
- func NormalizeDest(raw string) (string, error)
- func NormalizePriority(p int) int
- func NormalizeSource(scope Scope, rules []string) ([]string, error)
- func SetGeoData(ipFile, siteFile string)
- func SetMaxRules(n int)
- type Dest
- type RuleError
- type Scope
- type Source
Constants ¶
const ( // DenyFirst denies an address on the blacklist even if the whitelist has // it, and denies addresses on neither list. DenyFirst = int(geomatch.DenyFirst) // AllowFirst allows an address on the whitelist even if the blacklist has // it, and allows addresses on neither list. AllowFirst = int(geomatch.AllowFirst) )
Priorities of a source level that has both lists.
const DefaultMaxRules = 1000
DefaultMaxRules is the default limit on the rules of a list users may write.
Variables ¶
This section is empty.
Functions ¶
func Allows ¶
Allows reports whether every level allows addr. Levels are the global, client and tunnel or host policies; nil levels allow everything.
func AllowsString ¶
AllowsString is Allows for an address given as text, such as host:port.
func Decide ¶
Decide is Allows with the level and rule that decided. names name the global, client and tunnel levels for the decision's text.
func DecideString ¶
DecideString is Decide for an address given as text, such as host:port.
func GeoFiles ¶
func GeoFiles() (ipFile, siteFile string)
GeoFiles returns the geoip and geosite files.
func GeoGeneration ¶
func GeoGeneration() uint64
GeoGeneration checks the geodata files and returns a number that grows whenever one of them changed, so that callers refresh their lists only then.
func NormalizeDest ¶
NormalizeDest returns the canonical form of destination rules, one per line. The error names the rules that were rejected; they are left out.
func NormalizePriority ¶
NormalizePriority maps unknown priorities to DenyFirst.
func NormalizeSource ¶
NormalizeSource returns the canonical form of the source rules, without duplicates. The error names the rules that were rejected; they are left out of the result.
func SetGeoData ¶
func SetGeoData(ipFile, siteFile string)
SetGeoData sets the geoip and geosite files. Lists compiled from other files report stale and are refreshed by Refresh. ext-ip: rules of the global lists resolve relative names next to the geoip file.
func SetMaxRules ¶
func SetMaxRules(n int)
SetMaxRules sets the limit on the rules of each list users may write, the client, tunnel, host and destination lists; 0 means no limit. It must be called before any list is compiled.
Types ¶
type Dest ¶
type Dest struct {
// contains filtered or unexported fields
}
Dest is the compiled destination access policy of a tunnel. A nil Dest allows every destination.
func CompileDest ¶
CompileDest compiles a destination list in mode AclOff, AclWhitelist or AclBlacklist (0, 1, 2). An empty whitelist allows nothing.
type RuleError ¶
type RuleError struct {
// contains filtered or unexported fields
}
RuleError reports the rules of a list that were rejected, by line.
type Source ¶
type Source struct {
// contains filtered or unexported fields
}
Source is the compiled source access policy of one level. A nil Source allows every address.
func CompileSource ¶
CompileSource compiles the source lists of a level. Rules that cannot be used, for example geoip: rules without geodata, are skipped and named by the error; the returned Source applies the others.