Documentation ¶
Index ¶
- type AARPMachine
- func (a *AARPMachine) Address() (aarp.AddrPair, bool)
- func (a *AARPMachine) Assigned() <-chan struct{}
- func (t AARPMachine) Dump() map[ddp.Addr]AMTEntry
- func (t AARPMachine) Learn(ddpAddr ddp.Addr, hwAddr ethernet.Addr)
- func (a *AARPMachine) Resolve(ctx context.Context, ddpAddr ddp.Addr) (ethernet.Addr, error)
- func (a *AARPMachine) Run(ctx context.Context, incomingCh <-chan *ethertalk.Packet) error
- type AMTEntry
- type AURPPeer
- type Config
- type EtherTalkPeer
- type RTMPMachine
- type ReceiverState
- type Route
- type Router
- func (rtr *Router) BroadcastEtherTalkDDP(pkt *ddp.ExtPacket) error
- func (rtr *Router) HandleAEP(src ethernet.Addr, ddpkt *ddp.ExtPacket) error
- func (rtr *Router) HandleNBP(srcHWAddr ethernet.Addr, ddpkt *ddp.ExtPacket) error
- func (rtr *Router) HandleNBPInAURP(peer *AURPPeer, ddpkt *ddp.ExtPacket) error
- func (rtr *Router) HandleZIP(ctx context.Context, srcHWAddr ethernet.Addr, ddpkt *ddp.ExtPacket) error
- func (rtr *Router) SendEtherTalkDDP(ctx context.Context, pkt *ddp.ExtPacket) error
- func (rtr *Router) ZoneMulticastEtherTalkDDP(zone string, pkt *ddp.ExtPacket) error
- type RoutingTable
- func (rt *RoutingTable) DeleteAURPPeer(peer *AURPPeer)
- func (rt *RoutingTable) DeleteAURPPeerNetwork(peer *AURPPeer, network ddp.Network)
- func (rt *RoutingTable) Dump() []Route
- func (rt *RoutingTable) InsertAURPRoute(peer *AURPPeer, extended bool, netStart, netEnd ddp.Network, metric uint8) error
- func (rt *RoutingTable) LookupRoute(network ddp.Network) *Route
- func (rt *RoutingTable) UpdateAURPRouteDistance(peer *AURPPeer, network ddp.Network, distance uint8)
- func (rt *RoutingTable) UpsertEthRoute(peer *EtherTalkPeer, extended bool, netStart, netEnd ddp.Network, metric uint8) error
- func (rt *RoutingTable) ValidRoutes() []*Route
- type SenderState
- type Zone
- type ZoneTable
- func (zt *ZoneTable) AllNames() []string
- func (zt *ZoneTable) Dump() []Zone
- func (zt *ZoneTable) LocalNames() []string
- func (zt *ZoneTable) LookupName(name string) []*Zone
- func (zt *ZoneTable) Query(ns []ddp.Network) map[ddp.Network][]string
- func (zt *ZoneTable) Upsert(network ddp.Network, name string, local bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AARPMachine ¶
type AARPMachine struct {
// contains filtered or unexported fields
}
AARPMachine maintains both an Address Mapping Table and handles AARP packets (sending and receiving requests, responses, and probes). This process assumes a particular network range rather than using the startup range, since this program is a seed router.
func NewAARPMachine ¶
NewAARPMachine creates a new AARPMachine.
func (*AARPMachine) Address ¶
func (a *AARPMachine) Address() (aarp.AddrPair, bool)
Address returns the address of this node, and reports if the address is valid (i.e. not tentative).
func (*AARPMachine) Assigned ¶
func (a *AARPMachine) Assigned() <-chan struct{}
Assigned returns a channel that is closed when the local address is valid.
type AMTEntry ¶
type AMTEntry struct { // The hardware address that the entry maps to. HWAddr ethernet.Addr // The last time this entry was updated. LastUpdated time.Time // Whether the address is being resolved. Resolving bool // contains filtered or unexported fields }
AMTEntry is an entry in an address mapping table.
func (AMTEntry) LastUpdatedAgo ¶
LastUpdatedAgo is a friendly string reporting how long ago the entry was updated/resolved.
type AURPPeer ¶
type AURPPeer struct { // Whole router config. Config *Config // AURP-Tr state for producing packets. Transport *aurp.Transport // Connection to reply to packets on. UDPConn *net.UDPConn // The string that appeared in the config file / peer list file (with a // ":387" appended as necessary). // May be empty if this peer was not configured (it connected to us). ConfiguredAddr string // The resolved address of the peer. RemoteAddr *net.UDPAddr // Incoming packet channel. ReceiveCh chan aurp.Packet // Routing table (the peer will add/remove/update routes) RoutingTable *RoutingTable // Zone table (the peer will add/remove/update zones) ZoneTable *ZoneTable // contains filtered or unexported fields }
AURPPeer handles the peering with a peer AURP router.
func (*AURPPeer) ReceiverState ¶
func (p *AURPPeer) ReceiverState() ReceiverState
func (*AURPPeer) SenderState ¶
func (p *AURPPeer) SenderState() SenderState
type Config ¶
type Config struct { // Optional: default is 387. ListenPort uint16 `yaml:"listen_port"` // Sets the Domain Identifier used by this router. // Note: this does not "bind" the IP side of the router to a particular // interface; it will listen on all interfaces with IP addresses. // Optional: defaults to the first global unicast address on any local // network interface. LocalIP string `yaml:"local_ip"` // Required for routing a local EtherTalk network. EtherTalk struct { EthAddr string `yaml:"ethernet_addr"` Device string `yaml:"device"` ZoneName string `yaml:"zone_name"` NetStart ddp.Network `yaml:"net_start"` NetEnd ddp.Network `yaml:"net_end"` } `yaml:"ethertalk"` // Allow routers other than those listed under peers? OpenPeering bool `yaml:"open_peering"` // List of peer routers. Peers []string `yaml:"peers"` // Or a URL to fetch a list of peers from. PeerListURL string `yaml:"peerlist_url"` }
func LoadConfig ¶
type EtherTalkPeer ¶
type EtherTalkPeer struct { PcapHandle *pcap.Handle MyHWAddr ethernet.Addr AARP *AARPMachine PeerAddr ddp.Addr }
EtherTalkPeer holds data needed to exchange routes and zones with another router on the EtherTalk network.
type RTMPMachine ¶
type RTMPMachine struct { AARP *AARPMachine Config *Config PcapHandle *pcap.Handle RoutingTable *RoutingTable }
RTMPMachine implements RTMP on an AppleTalk network attached to the router.
type ReceiverState ¶
type ReceiverState int
const ( ReceiverUnconnected ReceiverState = iota ReceiverConnected ReceiverWaitForOpenRsp ReceiverWaitForRIRsp ReceiverWaitForTickleAck )
func (ReceiverState) String ¶
func (rs ReceiverState) String() string
type Route ¶
type Route struct { Extended bool NetStart ddp.Network NetEnd ddp.Network Distance uint8 LastSeen time.Time // Exactly one of the following should be set AURPPeer *AURPPeer EtherTalkPeer *EtherTalkPeer }
func (Route) LastSeenAgo ¶
type Router ¶
type Router struct { Config *Config PcapHandle *pcap.Handle MyHWAddr ethernet.Addr MyDDPAddr ddp.Addr AARPMachine *AARPMachine RouteTable *RoutingTable ZoneTable *ZoneTable }
func (*Router) BroadcastEtherTalkDDP ¶
func (*Router) HandleNBPInAURP ¶
func (*Router) SendEtherTalkDDP ¶
type RoutingTable ¶
type RoutingTable struct {
// contains filtered or unexported fields
}
func NewRoutingTable ¶
func NewRoutingTable() *RoutingTable
func (*RoutingTable) DeleteAURPPeer ¶
func (rt *RoutingTable) DeleteAURPPeer(peer *AURPPeer)
func (*RoutingTable) DeleteAURPPeerNetwork ¶
func (rt *RoutingTable) DeleteAURPPeerNetwork(peer *AURPPeer, network ddp.Network)
func (*RoutingTable) Dump ¶
func (rt *RoutingTable) Dump() []Route
func (*RoutingTable) InsertAURPRoute ¶
func (*RoutingTable) LookupRoute ¶
func (rt *RoutingTable) LookupRoute(network ddp.Network) *Route
func (*RoutingTable) UpdateAURPRouteDistance ¶
func (rt *RoutingTable) UpdateAURPRouteDistance(peer *AURPPeer, network ddp.Network, distance uint8)
func (*RoutingTable) UpsertEthRoute ¶
func (rt *RoutingTable) UpsertEthRoute(peer *EtherTalkPeer, extended bool, netStart, netEnd ddp.Network, metric uint8) error
func (*RoutingTable) ValidRoutes ¶
func (rt *RoutingTable) ValidRoutes() []*Route
type SenderState ¶
type SenderState int
const ( SenderUnconnected SenderState = iota SenderConnected SenderWaitForRIRspAck SenderWaitForRIUpdAck SenderWaitForRDAck )
func (SenderState) String ¶
func (ss SenderState) String() string
type Zone ¶
func (Zone) LastSeenAgo ¶
type ZoneTable ¶
type ZoneTable struct {
// contains filtered or unexported fields
}
func NewZoneTable ¶
func NewZoneTable() *ZoneTable