vmnet

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 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_interface_add_ip_port_forwarding_rule

func Vmnet_interface_add_ip_port_forwarding_rule(interface_ uintptr, protocol_ uint8, external_port uint16, address_family uint8, internal_address unsafe.Pointer, internal_port uint16, handler uintptr) objectivec.IObject

Vmnet_interface_add_ip_port_forwarding_rule.

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

func Vmnet_interface_add_port_forwarding_rule

func Vmnet_interface_add_port_forwarding_rule(interface_ uintptr, protocol_ uint8, external_port uint16, internal_address uintptr, internal_port uint16, handler uintptr) objectivec.IObject

Vmnet_interface_add_port_forwarding_rule.

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

func Vmnet_interface_get_ip_port_forwarding_rules

func Vmnet_interface_get_ip_port_forwarding_rules(interface_ uintptr, address_family uintptr, handler uintptr) objectivec.IObject

Vmnet_interface_get_ip_port_forwarding_rules.

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

func Vmnet_interface_get_port_forwarding_rules

func Vmnet_interface_get_port_forwarding_rules(interface_ uintptr, handler uintptr) objectivec.IObject

Vmnet_interface_get_port_forwarding_rules.

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

func Vmnet_interface_remove_ip_port_forwarding_rule

func Vmnet_interface_remove_ip_port_forwarding_rule(interface_ uintptr, protocol_ uint8, external_port uint16, address_family uint8, handler uintptr) objectivec.IObject

Vmnet_interface_remove_ip_port_forwarding_rule.

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

func Vmnet_interface_remove_port_forwarding_rule

func Vmnet_interface_remove_port_forwarding_rule(interface_ uintptr, protocol_ uint8, external_port uint16, handler uintptr) objectivec.IObject

Vmnet_interface_remove_port_forwarding_rule.

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

func Vmnet_interface_set_event_callback

func Vmnet_interface_set_event_callback(interface_ uintptr, event_mask uintptr, queue dispatch.Queue, callback uintptr) objectivec.IObject

Vmnet_interface_set_event_callback schedules a callback to be executed when events for the specified interface are received.

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

func Vmnet_interface_start_with_network

func Vmnet_interface_start_with_network(network uintptr, interface_desc unsafe.Pointer, queue dispatch.Queue, start_block uintptr) objectivec.IObject

Vmnet_interface_start_with_network.

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

func Vmnet_ip_port_forwarding_rule_get_details

func Vmnet_ip_port_forwarding_rule_get_details(rule unsafe.Pointer, protocol_ *uint8, external_port *uint16, address_family uint8, internal_address unsafe.Pointer, internal_port *uint16) objectivec.IObject

Vmnet_ip_port_forwarding_rule_get_details.

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

func Vmnet_network_configuration_add_port_forwarding_rule

func Vmnet_network_configuration_add_port_forwarding_rule(config uintptr, protocol_ uint8, address_family uint8, internal_port uint16, external_port uint16, internal_address unsafe.Pointer) objectivec.IObject

Vmnet_network_configuration_add_port_forwarding_rule.

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

func Vmnet_network_configuration_create

func Vmnet_network_configuration_create(mode uintptr, status uintptr) objectivec.IObject

Vmnet_network_configuration_create.

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

func Vmnet_network_configuration_disable_dhcp

func Vmnet_network_configuration_disable_dhcp(config uintptr)

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 uintptr)

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 uintptr)

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 uintptr)

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 uintptr)

Vmnet_network_configuration_disable_router_advertisement.

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

func Vmnet_network_configuration_set_external_interface

func Vmnet_network_configuration_set_external_interface(config uintptr, interface_name *byte) objectivec.IObject

Vmnet_network_configuration_set_external_interface.

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

func Vmnet_network_configuration_set_ipv4_subnet

func Vmnet_network_configuration_set_ipv4_subnet(config uintptr, subnet_addr uintptr, subnet_mask uintptr) objectivec.IObject

Vmnet_network_configuration_set_ipv4_subnet.

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

func Vmnet_network_configuration_set_ipv6_prefix

func Vmnet_network_configuration_set_ipv6_prefix(config uintptr, prefix uintptr, len_ uint8) objectivec.IObject

Vmnet_network_configuration_set_ipv6_prefix.

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

func Vmnet_network_configuration_set_mtu

func Vmnet_network_configuration_set_mtu(config uintptr, mtu uint32) objectivec.IObject

Vmnet_network_configuration_set_mtu.

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

func Vmnet_network_copy_serialization

func Vmnet_network_copy_serialization(network uintptr, status uintptr) unsafe.Pointer

Vmnet_network_copy_serialization.

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

func Vmnet_network_create

func Vmnet_network_create(configuration uintptr, status uintptr) objectivec.IObject

Vmnet_network_create.

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

func Vmnet_network_create_with_serialization

func Vmnet_network_create_with_serialization(network unsafe.Pointer, status uintptr) objectivec.IObject

Vmnet_network_create_with_serialization.

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

func Vmnet_network_get_ipv4_subnet

func Vmnet_network_get_ipv4_subnet(network uintptr, 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 uintptr, prefix uintptr, prefix_len *uint8)

Vmnet_network_get_ipv6_prefix.

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

func Vmnet_port_forwarding_rule_get_details

func Vmnet_port_forwarding_rule_get_details(rule unsafe.Pointer, protocol_ *uint8, external_port *uint16, internal_address uintptr, internal_port *uint16) objectivec.IObject

Vmnet_port_forwarding_rule_get_details.

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

func Vmnet_read

func Vmnet_read(interface_ uintptr, packets *Vmpktdesc, pktcnt []int) objectivec.IObject

Vmnet_read attempts to read a specified number of packets from an interface.

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

func Vmnet_start_interface

func Vmnet_start_interface(interface_desc unsafe.Pointer, queue dispatch.Queue, handler uintptr) objectivec.IObject

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(_:_:_:)

func Vmnet_stop_interface

func Vmnet_stop_interface(interface_ uintptr, queue dispatch.Queue, handler uintptr) objectivec.IObject

Vmnet_stop_interface stops the interface.

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

func Vmnet_write

func Vmnet_write(interface_ uintptr, packets *Vmpktdesc, pktcnt []int) objectivec.IObject

Vmnet_write attempts to write specified packets to an interface.

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

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

type Vmnet_interface_completion_handler_t

type Vmnet_interface_completion_handler_t = func(objectivec.IObject)

type Vmnet_interface_event_callback_t

type Vmnet_interface_event_callback_t = func(objectivec.IObject, objectivec.Object)

type Vmnet_interface_get_ip_port_forwarding_rules_handler_t

type Vmnet_interface_get_ip_port_forwarding_rules_handler_t = func(objectivec.Object)

type Vmnet_interface_get_port_forwarding_rules_handler_t

type Vmnet_interface_get_port_forwarding_rules_handler_t = func(objectivec.Object)

type Vmnet_mode_t

type Vmnet_mode_t = objectivec.IObject

type Vmnet_network_configuration_ref

type Vmnet_network_configuration_ref = uintptr

type Vmnet_network_ref

type Vmnet_network_ref = uintptr

type Vmnet_start_interface_completion_handler_t

type Vmnet_start_interface_completion_handler_t = func(objectivec.IObject, objectivec.Object)

type Vmpktdesc

type Vmpktdesc struct {
	Vm_pkt_size   int                // 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