vmnet

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package vmnet provides Go bindings for the vmnet framework.

Connect with network interfaces to read and write packets on guest operating systems.

The vmnet framework is an API for virtual machines to read and write packets.

Essentials

  • com.apple.vm.networking: A Boolean that indicates whether the app manages virtual network interfaces without escalating privileges to the root user.

Starting and Stopping Interfaces

  • vmnet_start_interface(_:_:_:): Starts host or shared mode on an interface with a specified configuration.
  • vmnet_interface_set_event_callback(_:_:_:_:): Schedules a callback to be executed when events for the specified interface are received.
  • vmnet_stop_interface(_:_:_:): Stops the interface.

Reading and Writing Packets

  • vmnet_read(_:_:_:): Attempts to read a specified number of packets from an interface.
  • vmnet_write(_:_:_:): Attempts to write specified packets to an interface.

Data Types

  • vmnet_return_t: Values returned by functions in the vmnet Framework.
  • vmpktdesc: Describes a packet.
  • interface_ref: A virtual network interface.
  • interface_event_t: Interface event types.
  • operating_modes_t: The operating modes for an interface.

Constants

  • interface_desc XPC Dictionary Keys: XPC dictionary keys supported by the parameter passed to the function to describe the parameters of the network interface.
  • interface_param XPC Dictionary Keys: XPC dictionary keys used by the argument returned by the completion handler of the function that describes the parameters that should be used to configure the network interface.
  • event XPC Dictionary: XPC dictionary keys used by the value returned to the client in the callback specified by the function that provides information about the callback event.

Variables

  • vmnet_enable_virtio_header_key
  • vmnet_read_max_packets_key
  • vmnet_write_max_packets_key

Functions

  • vmnet_interface_start_with_network(_:_:_:_:)
  • vmnet_network_configuration_add_dhcp_reservation(_:_:_:)
  • vmnet_network_configuration_add_port_forwarding_rule(_:_:_:_:_:_:)
  • vmnet_network_configuration_create(_:_:)
  • vmnet_network_configuration_disable_dhcp(_:)
  • vmnet_network_configuration_disable_dns_proxy(_:)
  • vmnet_network_configuration_disable_nat44(_:)
  • vmnet_network_configuration_disable_nat66(_:)
  • vmnet_network_configuration_disable_router_advertisement(_:)
  • vmnet_network_configuration_set_external_interface(_:_:)
  • vmnet_network_configuration_set_ipv4_subnet(_:_:_:)
  • vmnet_network_configuration_set_ipv6_prefix(_:_:_:)
  • vmnet_network_configuration_set_mtu(_:_:)
  • vmnet_network_copy_serialization(_:_:)
  • vmnet_network_create(_:_:)
  • vmnet_network_create_with_serialization(_:_:)
  • vmnet_network_get_ipv4_subnet(_:_:_:)
  • vmnet_network_get_ipv6_prefix(_:_:_:)

Type Aliases

  • vmnet_mode_t
  • vmnet_network_configuration_ref
  • vmnet_network_ref

Code generated from Apple documentation. DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Vmnet_copy_shared_interface_list

func Vmnet_copy_shared_interface_list() unsafe.Pointer

Vmnet_copy_shared_interface_list.

See: https://developer.apple.com/documentation/vmnet/vmnet_copy_shared_interface_list()

func Vmnet_network_configuration_disable_dhcp

func Vmnet_network_configuration_disable_dhcp(config Vmnet_network_configuration_ref)

Vmnet_network_configuration_disable_dhcp.

See: https://developer.apple.com/documentation/vmnet/vmnet_network_configuration_disable_dhcp(_:)

func Vmnet_network_configuration_disable_dns_proxy

func Vmnet_network_configuration_disable_dns_proxy(config Vmnet_network_configuration_ref)

Vmnet_network_configuration_disable_dns_proxy.

See: https://developer.apple.com/documentation/vmnet/vmnet_network_configuration_disable_dns_proxy(_:)

func Vmnet_network_configuration_disable_nat44

func Vmnet_network_configuration_disable_nat44(config Vmnet_network_configuration_ref)

Vmnet_network_configuration_disable_nat44.

See: https://developer.apple.com/documentation/vmnet/vmnet_network_configuration_disable_nat44(_:)

func Vmnet_network_configuration_disable_nat66

func Vmnet_network_configuration_disable_nat66(config Vmnet_network_configuration_ref)

Vmnet_network_configuration_disable_nat66.

See: https://developer.apple.com/documentation/vmnet/vmnet_network_configuration_disable_nat66(_:)

func Vmnet_network_configuration_disable_router_advertisement

func Vmnet_network_configuration_disable_router_advertisement(config Vmnet_network_configuration_ref)

Vmnet_network_configuration_disable_router_advertisement.

See: https://developer.apple.com/documentation/vmnet/vmnet_network_configuration_disable_router_advertisement(_:)

func Vmnet_network_get_ipv4_subnet

func Vmnet_network_get_ipv4_subnet(network Vmnet_network_ref, subnet uintptr, mask uintptr)

Vmnet_network_get_ipv4_subnet.

See: https://developer.apple.com/documentation/vmnet/vmnet_network_get_ipv4_subnet(_:_:_:)

func Vmnet_network_get_ipv6_prefix

func Vmnet_network_get_ipv6_prefix(network Vmnet_network_ref, prefix uintptr, prefix_len *uint8)

Vmnet_network_get_ipv6_prefix.

See: https://developer.apple.com/documentation/vmnet/vmnet_network_get_ipv6_prefix(_:_:_:)

Types

type Interface_event_t

type Interface_event_t int

See: https://developer.apple.com/documentation/vmnet/interface_event_t

const (
	// VMNET_INTERFACE_PACKETS_AVAILABLE: # Discussion
	VMNET_INTERFACE_PACKETS_AVAILABLE Interface_event_t = 1
)

func (Interface_event_t) String

func (e Interface_event_t) String() string

type Interface_ref

type Interface_ref = uintptr

Interface_ref is a virtual network interface.

See: https://developer.apple.com/documentation/vmnet/interface_ref

func Vmnet_start_interface

func Vmnet_start_interface(interface_desc unsafe.Pointer, queue dispatch.Queue, handler Vmnet_start_interface_completion_handler_t) Interface_ref

Vmnet_start_interface starts host or shared mode on an interface with a specified configuration.

See: https://developer.apple.com/documentation/vmnet/vmnet_start_interface(_:_:_:)

type Vmpktdesc

type Vmpktdesc struct {
	Vm_pkt_size   uintptr             // The size of the packet, in bytes.
	Vm_pkt_iovcnt uint32              // The number of packet buffers in `vm_pkt_iov`.
	Vm_flags      uint32              // Option flags. Should be set to `0` on read.
	Vm_pkt_iov    *objectivec.IObject // An array of packet buffers.

}

C struct types Vmpktdesc - Describes a packet.

[Full Topic] [Full Topic]: https://developer.apple.com/documentation/vmnet/vmpktdesc

Jump to

Keyboard shortcuts

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