Documentation ¶
Index ¶
- Variables
- func ParseCIDR(s string) (IP, Subnet, error)
- type ConfigUpdater
- type ExternalRouter
- type IP
- type InitMsg
- type KeepaliveMsg
- type KeepaliveReplyMsg
- type MarshalablePublicKey
- func (mpk MarshalablePublicKey) MarshalJSON() ([]byte, error)
- func (mpk MarshalablePublicKey) MarshalYAML() (interface{}, error)
- func (mpk *MarshalablePublicKey) String() string
- func (mpk *MarshalablePublicKey) UnmarshalJSON(data []byte) error
- func (mpk *MarshalablePublicKey) UnmarshalYAML(unmarshal func(interface{}) error) error
- type Mask
- type Msg
- type MsgType
- type NameService
- type Netopus
- type OOBAddr
- type OOBConnector
- type OOBMessage
- type RouteOOBMessage
- type RoutingConns
- type RoutingNodes
- type RoutingPolicy
- type RoutingUpdate
- type SessionStatus
- type Status
- type Subnet
- func (s Subnet) AsIPNet() *net.IPNet
- func (s Subnet) Contains(a IP) bool
- func (s Subnet) DebugString() string
- func (s Subnet) IP() IP
- func (s Subnet) MarshalJSON() ([]byte, error)
- func (s Subnet) MarshalYAML() (interface{}, error)
- func (s Subnet) Mask() Mask
- func (s Subnet) Prefix() int
- func (s Subnet) String() string
- func (s *Subnet) UnmarshalJSON(data []byte) error
- func (s *Subnet) UnmarshalYAML(unmarshal func(interface{}) error) error
Constants ¶
This section is empty.
Variables ¶
var ErrUnknownMessageType = fmt.Errorf("unknown message type")
Functions ¶
Types ¶
type ConfigUpdater ¶
type ConfigUpdater interface { UpdateConfig([]byte, []byte, time.Time) WaitForConfigConvergence(context.Context) error }
ConfigUpdater is a service that can update configurations
type ExternalRouter ¶
type ExternalRouter interface { // AddExternalRoute adds an external route. When packets arrive for this destination, outgoingPacketFunc will be called. AddExternalRoute(string, Subnet, float32, func([]byte) error) // DelExternalRoute removes a previously added external route. If the route does not exist, this has no effect. DelExternalRoute(string) // SendPacket routes and sends a packet SendPacket(packet []byte) error // SubscribeUpdates returns a channel that will be sent to whenever the routing policy changes SubscribeUpdates() <-chan RoutingPolicy // UnsubscribeUpdates unsubscribes a previously subscribed updates channel UnsubscribeUpdates(<-chan RoutingPolicy) }
ExternalRouter is a device that can accept and send packets to external routes
type IP ¶
type IP string
IP represents an IP address (IPv4 or IPv6)
func ParseIP ¶
ParseIP parses a human-readable address and returns an IP. Unlike net.IP, if the address is ipv4, the returned IP will be in ipv4 format (as if .To4() had been called on it).
func (IP) DebugString ¶
DebugString returns a representation to show in debuggers. Gor compatibility with GoLand this function must be able to be statically evaluated, so it cannot call other functions.
func (IP) Equal ¶
Equal returns true if the two IPs are equivalent, including IPv6 address equivalencies to IPv4.
func (IP) MarshalJSON ¶
MarshalJSON marshals an IP address to JSON.
func (IP) MarshalYAML ¶
MarshalYAML marshals an IP address to YAML.
func (*IP) UnmarshalJSON ¶
UnmarshalJSON unmarshals an IP address from JSON.
func (*IP) UnmarshalYAML ¶
UnmarshalYAML unmarshals an IP address from YAML.
type InitMsg ¶
type InitMsg struct {
MyAddr IP
}
InitMsg is a message type sent at connection initialization time
type KeepaliveMsg ¶
type KeepaliveMsg struct{}
func (*KeepaliveMsg) Marshal ¶
func (m *KeepaliveMsg) Marshal() ([]byte, error)
Marshal marshals a KeepaliveMsg to a []byte
type KeepaliveReplyMsg ¶
type KeepaliveReplyMsg struct{}
func (*KeepaliveReplyMsg) Marshal ¶
func (m *KeepaliveReplyMsg) Marshal() ([]byte, error)
Marshal marshals a KeepaliveReplyMsg to a []byte
type MarshalablePublicKey ¶
func ParseAuthorizedKey ¶
func ParseAuthorizedKey(key string) (*MarshalablePublicKey, error)
func (MarshalablePublicKey) MarshalJSON ¶
func (mpk MarshalablePublicKey) MarshalJSON() ([]byte, error)
MarshalJSON marshals an SSH public key to JSON.
func (MarshalablePublicKey) MarshalYAML ¶
func (mpk MarshalablePublicKey) MarshalYAML() (interface{}, error)
MarshalYAML marshals an SSH public key to YAML.
func (*MarshalablePublicKey) String ¶
func (mpk *MarshalablePublicKey) String() string
String returns the SSH authorized_keys formatted string of the public key.
func (*MarshalablePublicKey) UnmarshalJSON ¶
func (mpk *MarshalablePublicKey) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals an SSH public key from JSON.
func (*MarshalablePublicKey) UnmarshalYAML ¶
func (mpk *MarshalablePublicKey) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML unmarshals an SSH public key from YAML.
type Mask ¶
type Mask string
Mask represents a netmask (IPv4 or IPv6)
func (Mask) DebugString ¶
DebugString returns a representation to show in debuggers. Gor compatibility with GoLand this function must be able to be statically evaluated, so it cannot call other functions.
type NameService ¶
type NameService interface { // LookupName returns the IP for a name, with the IP being zero length if it is unknown. LookupName(string) IP // LookupIP returns the name for an IP, or the empty string if it is unknown. LookupIP(IP) string // AddExternalName adds an external name and associated IP address. AddExternalName(string, IP) // DelExternalName deletes a previous added external name. DelExternalName(string) }
NameService is a service that can map names to IP addresses
type Netopus ¶
type Netopus interface { backends.ProtocolRunner netstack.UserStack ExternalRouter OOBConnector NameService ConfigUpdater Status() *Status MTU() uint16 Addr() IP }
Netopus is the aggregate interface providing all the functionality of a netopus instance
type OOBConnector ¶
type OOBMessage ¶
type OOBMessage struct { Hops byte SourceAddr IP SourcePort uint16 DestAddr IP DestPort uint16 Data []byte }
OOBMessage is an out-of-band message
func (*OOBMessage) Marshal ¶
func (oob *OOBMessage) Marshal() ([]byte, error)
Marshal marshals an OOBMessage to a []byte
func (*OOBMessage) String ¶
func (oob *OOBMessage) String() string
String produces a string representation of an OOBMessage
type RouteOOBMessage ¶
type RouteOOBMessage OOBMessage
func (*RouteOOBMessage) Marshal ¶
func (rm *RouteOOBMessage) Marshal() ([]byte, error)
Marshal marshals a RouteOOBMessage to a []byte
func (*RouteOOBMessage) String ¶
func (rm *RouteOOBMessage) String() string
String produces a string representation of a RouteOOBMessage
type RoutingConns ¶
RoutingConns stores the known connections and costs directly connected to a node
func (RoutingConns) MarshalJSON ¶
func (rc RoutingConns) MarshalJSON() ([]byte, error)
func (*RoutingConns) UnmarshalJSON ¶
func (rc *RoutingConns) UnmarshalJSON(data []byte) error
type RoutingNodes ¶
type RoutingNodes map[IP]RoutingConns
RoutingNodes stores the known connection information for a network of nodes
type RoutingPolicy ¶
RoutingPolicy is a routing table giving the next hop for a list of subnets
type RoutingUpdate ¶
type RoutingUpdate struct { Origin IP NodeName string UpdateEpoch uint64 UpdateSequence uint64 Connections RoutingConns Names map[string]IP ConfigVersion time.Time ConfigData []byte ConfigSignature []byte }
RoutingUpdate is a message type carrying routing information
func (*RoutingUpdate) String ¶
func (ru *RoutingUpdate) String() string
type SessionStatus ¶
SessionStatus represents the status of a single session
type Status ¶
type Status struct { Name string Addr IP NameToAddr map[string]string AddrToName map[string]string RouterNodes map[string]map[string]float32 Sessions map[string]SessionStatus }
Status is returned by netopus.Status()
type Subnet ¶
type Subnet string
Subnet represents an IP subnet (IPv4 or IPv6)
func NewHostOnlySubnet ¶
NewHostOnlySubnet creates a subnet containing only a single IP address (ie, a /32 for IPv4 or a /128 for IPv6).
func NewSubnet ¶
NewSubnet creates a subnet from an address and mask, masking the host bits of the address. It is up to the caller to ensure a and m are the same length - if they are not, an invalid subnet will be returned.
func RandomSubnet ¶
RandomSubnet returns a subnet with an address starting with keepBits bits of IP and random for the rest of prefixBits
func (Subnet) DebugString ¶
DebugString returns a representation to show in debuggers. Gor compatibility with GoLand this function must be able to be statically evaluated, so it cannot call other functions.
func (Subnet) MarshalJSON ¶
MarshalJSON marshals an IP subnet to JSON.
func (Subnet) MarshalYAML ¶
MarshalYAML marshals an IP subnet to YAML.
func (*Subnet) UnmarshalJSON ¶
UnmarshalJSON unmarshals an IP subnet from JSON.
func (*Subnet) UnmarshalYAML ¶
UnmarshalYAML unmarshals a subnet from YAML.