l2

package
v0.0.0-...-a9890c3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 11, 2020 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateNIC

func CreateNIC(stack *Stack, id string, subnetVlan uint16) (netlink.Link, error)

CreateNIC creates a new tap device attached to a VPC bridge

func DeleteNIC

func DeleteNIC(stack *Stack, id string) error

DeleteNIC deletes the tap from

func GetNIC

func GetNIC(stack *Stack, id string) (netlink.Link, error)

GetNIC finds a tap interface given a stack and expected id

func HasNIC

func HasNIC(stack *Stack, id string) (bool, error)

HasNIC checks if a nic exists by trying to get it

func Serve

func Serve(port uint)

Serve start the GRPC server

func StartPProf

func StartPProf(port int)

StartPProf opens the http pprof handler to desired port

Types

type Server

type Server struct {
	l2API.UnimplementedL2ServiceServer
	// contains filtered or unexported fields
}

Server l2 API server

func NewServer

func NewServer() (*Server, error)

NewServer creates a new server instance

func (*Server) AddNIC

func (s *Server) AddNIC(ctx context.Context, req *l2API.NicRequest) (*l2API.Nic, error)

AddNIC Add a new NIC to a VPC linux bridge

func (*Server) AddStack

func (s *Server) AddStack(ctx context.Context, req *l2API.StackRequest) (*l2API.StackResponse, error)

AddStack creates a new VPC stack

func (*Server) DeleteNIC

func (s *Server) DeleteNIC(ctx context.Context, req *l2API.Nic) (*l2API.Empty, error)

DeleteNIC Delete a NIC from a VPC linux bridge

func (*Server) DeleteStack

func (s *Server) DeleteStack(ctx context.Context, req *l2API.StackRequest) (*l2API.Empty, error)

DeleteStack deletes all devices in the stack

func (*Server) Gc

func (s *Server) Gc()

Gc watches for vpcs which have no nics anymore and closes them off

func (*Server) GetStack

func (s *Server) GetStack(ctx context.Context, req *l2API.StackRequest) (*l2API.StackResponse, error)

GetStack finds and returns an existing VPC stack

func (*Server) HandleMisses

func (s *Server) HandleMisses(vpcID uint32, miss <-chan transport.ForwardingMiss)

HandleMisses monitors for subscription errors

func (*Server) NICStatus

func (s *Server) NICStatus(ctx context.Context, req *l2API.Nic) (*l2API.NicStatusResponse, error)

NICStatus Get netlink status of NIC

func (*Server) SDN

func (s *Server) SDN()

SDN starts the SDN controller to advertise type-2 and type-3 routes

func (*Server) StackStatus

func (s *Server) StackStatus(ctx context.Context, req *l2API.StackRequest) (*l2API.StackStatusResponse, error)

StackStatus returns just the current status of devices in stack

func (*Server) WatchStacks

func (s *Server) WatchStacks(_ *l2API.Empty, stream l2API.L2Service_WatchStacksServer) error

WatchStacks monitors for changes in the stacks

type Stack

type Stack struct {
	VPCID  int32
	Bridge *netlink.Bridge
	Nics   map[string]*VNic
}

Stack stores references to the various devices for VPC connectivity

type VNic

type VNic struct {
	// contains filtered or unexported fields
}

VNic holds the state of known NICs

Directories

Path Synopsis
bgp
tap
Package xdp allows to use XDP sockets from Go.
Package xdp allows to use XDP sockets from Go.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL