Documentation
¶
Index ¶
- func L2APIToStack(l2Stack *l2API.Stack) (*l2.Stack, error)
- func NewID() string
- type Router
- func (r *Router) AddSubnet(ip net.IP, cidr *net.IPNet, vlan uint16, dhcp bool) error
- func (r *Router) AddSubnetIFace(addr net.IP, ipnet *net.IPNet, innerVlan uint16) (*Subnet, error)
- func (r *Router) CreateVeth(bridge *netlink.Bridge, name string, peerName string, hwaddr string) (netlink.Link, error)
- func (r *Router) Delete() error
- func (r *Router) EnableForwarding() error
- func (r *Router) EnableNATOn(iface string) error
- func (r *Router) Exec(fn func() error) error
- func (r *Router) Ifup(iface string) error
- func (r *Router) SetDefaultFWRules() error
- type RouterBGP
- type RouterDHCP
- type Subnet
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func L2APIToStack ¶
L2APIToStack converts the l2-agent API stack into the more useful stack
Types ¶
type Router ¶
type Router struct { ID string VPCID int32 NetNS *ns.NetNS Veths map[string]netlink.Link ExtBr *netlink.Bridge // contains filtered or unexported fields }
Router provides a iso layer 3 router using networknamespaces
func CreateRouter ¶
CreateRouter inits a router given a VPC stack
func (*Router) AddSubnet ¶
AddSubnet attaches a new interface listening to a cidr and optionally enables DHCP
func (*Router) AddSubnetIFace ¶
AddSubnetIFace creates a new veth pair and adds a specific subnet to it The veth will come up with a specific mac address based on the number of subnets already created - see subnetMacs()
func (*Router) CreateVeth ¶
func (r *Router) CreateVeth(bridge *netlink.Bridge, name string, peerName string, hwaddr string) (netlink.Link, error)
CreateVeth creates a new veth pair attaching one side to a bridge and the other into the network namespace
func (*Router) EnableForwarding ¶
EnableForwarding turns on ip forwarding via sysctl for packet routing
func (*Router) EnableNATOn ¶
EnableNATOn adds iptable rules to enable natting on a specific interface
func (*Router) SetDefaultFWRules ¶
SetDefaultFWRules sets the DROP policy on input and output, allows forwarding
type RouterBGP ¶
type RouterBGP struct {
// contains filtered or unexported fields
}
RouterBGP contains a small gobgp server to advertise communities and routes between subnets
func NewRouterBGP ¶
NewRouterBGP inits a new BGP server
func (*RouterBGP) AdvertSubnet ¶
AdvertSubnet adds a subnet to the bgp server within the vpc community
type RouterDHCP ¶
type RouterDHCP struct {
// contains filtered or unexported fields
}
RouterDHCP provides DHCP capabilities to routers
func NewDHCPv4Server ¶
NewDHCPv4Server consturcts a new DHCPv4 server
func (*RouterDHCP) DHCPV4OnSubnet ¶
func (rd *RouterDHCP) DHCPV4OnSubnet() error
DHCPV4OnSubnet starts a DHCPv4 Server on a particular subnet
func (*RouterDHCP) HandleV4 ¶
func (rd *RouterDHCP) HandleV4(conn net.PacketConn, peer net.Addr, m *dhcpv4.DHCPv4)
HandleV4 handles DHCP v4