router

package
v0.0.0-...-77652f2 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Gateway

type Gateway interface {
	Table() *Routes
}

Gateway interfaces to router

type NextHop

type NextHop struct {
	IP net.IP
}

NextHop represents nexthop / gateway

type Route

type Route struct {
	NextHop   NextHop
	NetworkID *net.IPNet
}

Route represents a route

type Router

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

Router represents router

func New

func New(ctx context.Context) *Router

New constructs a new router

func (*Router) Table

func (r *Router) Table() *Routes

Table returns touting table

type Routes

type Routes struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Routes represents array of routes

func (*Routes) Add

func (r *Routes) Add(networkid *net.IPNet, nexthop net.IP) error

Add appends a new route to table and operating system

func (*Routes) Delete

func (r *Routes) Delete(networkid *net.IPNet, nexthop net.IP) error

Delete removes a route from table and operating system

func (*Routes) Dump

func (r *Routes) Dump()

Dump prints out all routing table

func (*Routes) Get

func (r *Routes) Get(dst net.IP) net.IP

Get returns nexthop for a specific dest.

Jump to

Keyboard shortcuts

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