usernet

package
v2.0.0-alpha.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2025 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FDSock       = "fd"
	QEMUSock     = "qemu"
	EndpointSock = "ep"
)

Variables

This section is empty.

Functions

func DNSIP

func DNSIP(subnet net.IP) string

DNSIP returns the 3rd IP for the given subnet.

func GatewayIP

func GatewayIP(subnet net.IP) string

GatewayIP returns the 2nd IP for the given subnet.

func Leases

func Leases(name string) (string, error)

Leases returns a leases file based on network name.

func PIDFile

func PIDFile(name string) (string, error)

PIDFile returns a path for usernet PID file.

func Sock

func Sock(name string, sockType SockType) (string, error)

Sock returns a usernet socket based on name and sockType.

func SockWithDirectory

func SockWithDirectory(dir, name string, sockType SockType) (string, error)

SockWithDirectory return a usernet socket based on dir, name and sockType.

func Start

func Start(ctx context.Context, name string) error

Start starts a instance a usernet network with the given name. The name parameter must point to a valid network configuration name under <LIMA_HOME>/_config/networks.yaml with `mode: user-v2`.

func StartGVisorNetstack

func StartGVisorNetstack(ctx context.Context, gVisorOpts *GVisorNetstackOpts) error

func Stop

func Stop(ctx context.Context, name string) error

Stop stops running instance a usernet network with the given name. The name parameter must point to a valid network configuration name under <LIMA_HOME>/_config/networks.yaml with `mode: user-v2`.

func Subnet

func Subnet(name string) (net.IP, error)

Subnet returns a subnet net.IP for the given network name.

func SubnetCIDR

func SubnetCIDR(name string) (*net.IPNet, error)

SubnetCIDR returns a subnet in form of net.IPNet for the given network name.

Types

type Client

type Client struct {
	Directory string
	// contains filtered or unexported fields
}

func NewClient

func NewClient(endpointSock string, subnet net.IP) *Client

func NewClientByName

func NewClientByName(nwName string) *Client

func (*Client) AddDNSHosts

func (c *Client) AddDNSHosts(hosts map[string]string) error

func (*Client) ConfigureDriver

func (c *Client) ConfigureDriver(ctx context.Context, inst *limatype.Instance, sshLocalPort int) error

func (*Client) Leases

func (c *Client) Leases(ctx context.Context) (map[string]string, error)

func (*Client) ResolveAndForwardSSH

func (c *Client) ResolveAndForwardSSH(ipAddr string, sshPort int) error

func (*Client) ResolveIPAddress

func (c *Client) ResolveIPAddress(ctx context.Context, vmMacAddr string) (string, error)

func (*Client) UnExposeSSH

func (c *Client) UnExposeSSH(sshPort int) error

type GVisorNetstackOpts

type GVisorNetstackOpts struct {
	MTU int

	QemuSocket string
	FdSocket   string
	Endpoint   string

	Subnet string

	Async bool

	DefaultLeases map[string]string
}

type SockType

type SockType = string

type UDPFileConn

type UDPFileConn struct {
	net.Conn
}

func (*UDPFileConn) Read

func (conn *UDPFileConn) Read(b []byte) (n int, err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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