Documentation
¶
Overview ¶
Package trust holds the server's peer allow-list and the two things built on it: a connection gater for enable_authentication, and the forwarding check for enable_forwarding.
The list is one list on purpose. "Peers this server trusts" means the same thing whichever feature consults it: with authentication on they are the only peers that may connect at all; with it off anyone may connect, and they are the only peers that may submit mail on someone else's behalf.
Index ¶
- Constants
- type Gater
- func (g *Gater) InterceptAccept(network.ConnMultiaddrs) bool
- func (g *Gater) InterceptAddrDial(peer.ID, multiaddr.Multiaddr) bool
- func (g *Gater) InterceptPeerDial(peer.ID) bool
- func (g *Gater) InterceptSecured(dir network.Direction, id peer.ID, addrs network.ConnMultiaddrs) bool
- func (g *Gater) InterceptUpgraded(network.Conn) (bool, control.DisconnectReason)
- type Peers
Constants ¶
const RegistryKey = "trust"
RegistryKey is the forge registry key under which the Peers are provided.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Gater ¶
type Gater struct {
// contains filtered or unexported fields
}
Gater refuses inbound connections from peers outside the trusted set.
It decides at InterceptSecured, the first point at which the remote identity is authenticated by the Noise handshake, so an untrusted peer costs one handshake and never reaches the multiplexer. Outbound connections are not gated: the server dials on its own initiative — DHT, relay, push notifications — and a peer it chose to dial is not the exposure this guards against.
func (*Gater) InterceptAccept ¶
func (g *Gater) InterceptAccept(network.ConnMultiaddrs) bool
func (*Gater) InterceptAddrDial ¶
func (*Gater) InterceptSecured ¶
func (*Gater) InterceptUpgraded ¶
type Peers ¶
type Peers struct {
// contains filtered or unexported fields
}
Peers is an immutable set of trusted peer identities.
func FromRegistry ¶
FromRegistry retrieves the configured set, or nil when none was provided.
func Parse ¶
Parse builds the set from encoded peer IDs. A malformed entry is an error rather than a skipped line: an operator who mistyped the one peer they meant to admit should find out at startup, not from a client that cannot connect.