Expand description
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 byvmnet_start_interface. - A high-level [
Vmnet] interface for creating shared (NAT), host-only, and bridged virtual network interfaces. - A [
VmnetRelay] that bridges vmnet to asocketpairconsumed byVZFileHandleNetworkDeviceAttachment: reads are event-driven viavmnet_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.networkingentitlement, or root, is required to start a vmnet interface.
§Feature flags
vmnet— Enable the proper Objective-C completion-handler ABI forvmnet_start_interface. Without it, the interface starts with a NULL handler and falls back to default packet-size / generated MAC.