vnet

package
v0.62.0 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2025 License: Apache-2.0 Imports: 16 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseRoutes

func ParseRoutes(routeStrings []string) ([]net.IPNet, error)

ParseRoutes Convert route strings to IPNet objects

func ReadMessage

func ReadMessage(r io.Reader) ([]byte, error)

ReadMessage reads a framed message from the reader

func WriteMessage

func WriteMessage(w io.Writer, data []byte) error

WriteMessage writes a framed message to the writer

Types

type Controller

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

func NewController

func NewController(cfg v1.VirtualNetConfig) *Controller

func (*Controller) Init

func (c *Controller) Init() error

func (*Controller) RegisterClientRoute

func (c *Controller) RegisterClientRoute(ctx context.Context, name string, routes []net.IPNet, conn io.ReadWriteCloser) error

RegisterClientRoute Register client route (based on destination IP CIDR)

func (*Controller) RegisterServerConn

func (c *Controller) RegisterServerConn(ctx context.Context, name string, conn io.ReadWriteCloser) error

RegisterServerConn Register server connection (dynamically associates with source IPs)

func (*Controller) Run

func (c *Controller) Run() error

func (*Controller) Stop

func (c *Controller) Stop() error

func (*Controller) UnregisterClientRoute

func (c *Controller) UnregisterClientRoute(name string)

UnregisterClientRoute Remove client route from routing table

func (*Controller) UnregisterServerConn

func (c *Controller) UnregisterServerConn(name string)

UnregisterServerConn Remove server connection from routing table

type TunDevice

type TunDevice interface {
	io.ReadWriteCloser
}

func OpenTun

func OpenTun(ctx context.Context, addr string) (TunDevice, error)

Jump to

Keyboard shortcuts

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