arcbox-vmnet 0.6.9

Safe Rust bindings for Apple's vmnet.framework
Documentation

Safe Rust bindings for Apple's vmnet.framework.

This crate exposes:

  • Low-level FFI declarations for vmnet, Core Foundation, GCD dispatch, XPC, and the Objective-C block ABI required by vmnet_start_interface.
  • A high-level [Vmnet] interface for creating shared (NAT), host-only, and bridged virtual network interfaces.
  • A [VmnetRelay] that bridges vmnet to a socketpair consumed by VZFileHandleNetworkDeviceAttachment: reads are event-driven via vmnet_interface_set_event_callback, writes are async on the fd.

Operating modes

  • Shared (NAT) — VMs share the host's network connection via NAT, with vmnet providing DHCP and DNS.
  • Host-only — Isolated network between VMs and host, optionally with per-interface isolation via UUID.
  • Bridged — VMs appear as separate L2 devices on a physical network.

Requirements

  • macOS 11.0 or later.
  • The com.apple.vm.networking entitlement, or root, is required to start a vmnet interface.

Feature flags

  • vmnet — Enable the proper Objective-C completion-handler ABI for vmnet_start_interface. Without it, the interface starts with a NULL handler and falls back to default packet-size / generated MAC.