Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Interface ¶
type Interface struct {
Name string
// contains filtered or unexported fields
}
Interface is a network interface that puts a machine onto a network via a link. To attach an interface to a node, use node.Attach(). To link two interfaces together, use if.Link(other).
type Link ¶
type Link struct {
// contains filtered or unexported fields
}
Link binds two interfaces together.
type Network ¶
Network is a set of interfaces (bound together by links). Currently, its role is to dynamically allocate IP addresses for interfaces.
type Node ¶
type Node struct {
// Name contains the name of the node in the network
Name string
Interfaces []*Interface
HandleIngress PacketHandler
HandleLocalDelivery PacketHandler
HandleEgress PacketHandler
}
Node represents a node in one or more networks. Depending on how it manages traffic, it may be a router, switch, or perhaps a PC.
When a packet arrives on an attached interface,
type NodePacket ¶
type NodePacket struct {
// Packet contains a decoded Packet.
// Layers of the packet can be manipulated (e.g. in the case of NAT), but be
// wary of modification order.
Packet packet.Packet
// SourceIF points to the source interface.
SourceIF *Interface
// DestIF points to the destination interface.
// If DestIF is nil at the end of ingress, then HandleLocalDelivery() is
// called.
DestIF *Interface
}
NodePacket describes a packet flowing through a node's routing system. It is roughly equivalent to sk_buffer in Linux.
type PacketHandler ¶
type PacketHandler func(p *NodePacket) Verdict
PacketHandler is called on ingress, local delivery, and egress.