vnet

package
v0.65.0 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2025 License: Apache-2.0 Imports: 20 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)

RegisterClientRoute registers a client route (based on destination IP CIDR) and starts the read loop

func (*Controller) Run

func (c *Controller) Run() error

func (*Controller) StartServerConnReadLoop added in v0.62.1

func (c *Controller) StartServerConnReadLoop(ctx context.Context, conn io.ReadWriteCloser, onClose func())

StartServerConnReadLoop starts the read loop for a server connection (dynamically associates with source IPs)

func (*Controller) Stop

func (c *Controller) Stop() error

func (*Controller) UnregisterClientRoute

func (c *Controller) UnregisterClientRoute(name string)

UnregisterClientRoute Remove client route 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