vmnet

package
v0.0.0-...-0a45832 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2023 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

nolint:gocritic,exhaustivestruct,exhaustruct,nosnakecase

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventType

type EventType uint32

type IsolationMode

type IsolationMode bool
const (
	// NOTE: might want to let the user define it via flags
	Enabled  IsolationMode = true
	Disabled IsolationMode = false
)

If enabled, no VM <-> VM communication allowed https://developer.apple.com/documentation/vmnet/vmnet_enable_isolation_key

type OperationMode

type OperationMode C.uint32_t
const (
	// Host: not implemented
	Host OperationMode = 1000
	// Shared good old NAT
	Shared OperationMode = 1001
	// Bridged: not implemented
	Bridged OperationMode = 1002
)

https://developer.apple.com/documentation/vmnet/operating_modes_t

type Params

type Params struct {
	StartAddr  netaddr.IP
	EndAddr    netaddr.IP
	SubnetMask netaddr.IP
	Debug      bool
}

type VMNet

type VMNet struct {
	// vmnet params
	Params

	// The maximum size of the packet that can be written to the interface.
	// This also defines the minimum size of the packet that needs to be passed
	// to the vmnet function for a successful read.
	MaxPacketSize int
	// The MTU to be configured on the virtual interface in the guest operating system.
	MTU int
	// By listening on VMNET_INTERFACE_PACKETS_AVAILABLE events, the registered callback
	// notifes us that the interface is readable. The read packes are being passed to the Even chan.
	// See packetsAvailable for more.
	Event chan []byte
	// contains filtered or unexported fields
}

func New

func New(p Params) *VMNet

func (*VMNet) Start

func (v *VMNet) Start() error

func (*VMNet) Stop

func (v *VMNet) Stop() error

func (*VMNet) Write

func (v *VMNet) Write(p []byte) (int, error)

Jump to

Keyboard shortcuts

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