usernet

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2024 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 added in v0.18.0

func DNSIP(subnet net.IP) string

DNSIP returns the 3rd IP for the given subnet.

func GatewayIP added in v0.18.0

func GatewayIP(subnet net.IP) string

GatewayIP returns the 2nd IP for the given subnet.

func Leases added in v0.18.0

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 added in v0.18.0

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

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

func SubnetCIDR added in v0.18.0

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 added in v0.18.0

func NewClientByName(nwName string) *Client

func (*Client) AddDNSHosts added in v0.18.0

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

func (*Client) ConfigureDriver added in v0.18.0

func (c *Client) ConfigureDriver(ctx context.Context, driver *driver.BaseDriver) error

func (*Client) Leases added in v0.18.0

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 added in v0.18.0

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