trust

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2019 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Untrusted means we should ignore the fact, as if we never received it
	Untrusted = iota
	// Endpoint means we should trust it enough to try endpoints we may have received
	Endpoint
	// AllowedIPs means we should trust it enough to add AllowedIPs to our local
	// configuration for the peer, if we can make a direct connection to it
	AllowedIPs
	// AddPeer means we should trust it enough to add it as a new peer in the
	// local configuration if we don't have it
	AddPeer
)

Variables

This section is empty.

Functions

func IsRouter

func IsRouter(peer *wgtypes.Peer) bool

IsRouter considers a router to be a peer that has a global unicast allowed IP with a CIDR mask less than the full IP

func ShouldAccept

func ShouldAccept(attr fact.Attribute, known bool, level Level) bool

ShouldAccept checks whether a fact Atribute should be accepted at a given trust level

Types

type Evaluator

type Evaluator interface {
	// TrustLevel evaluates the trust level that should be applied to a fact given its source
	TrustLevel(fact *fact.Fact, source net.IP) Level
	// IsKnown checks whether the subject of a fact is already known to us
	IsKnown(subject fact.Subject) bool
}

Evaluator is an interface for implementations that can answer whether a fact received from a remote source should be trusted and accepted into the set of locally known facts

func CreateRouteBasedTrust

func CreateRouteBasedTrust(peers []wgtypes.Peer) Evaluator

CreateRouteBasedTrust factories a TrustEvaluator for the given set of peers, using the "routers are trusted" model, wherein peers are allowed to provide endpoint information, "routers" (peers with an AllowedIP whose CIDR mask is shorter than the IP length) are allowed to provide AllowedIPs for other peers, and nobody is allowed to provide new peers (peer public keys must be added by the administrator)

type Level

type Level int

Level is how much we should trust a fact received from a remote source

Jump to

Keyboard shortcuts

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