isoloom_spec/model/bridged.rs
1//! A network bridged to an interface of the host: the machines join the host's own LAN.
2
3use schemars::JsonSchema;
4use serde::{Deserialize, Serialize};
5
6/// How a network is bridged to the host (see [`super::Network::bridged`]).
7#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
8#[serde(deny_unknown_fields)]
9pub struct Bridged {
10 /// The host interface, as the target names it (VirtualBox: `en0: Wi-Fi`; Proxmox: a bridge
11 /// like `vmbr0`; ESXi: a physical NIC like `vmnic1` that no vSwitch holds, which gets a
12 /// vSwitch of its own). Without it, Vagrant asks when several interfaces could do, Proxmox
13 /// uses its uplink bridge, and ESXi its LAN vSwitch (`uplink_vswitch`).
14 #[serde(default, skip_serializing_if = "Option::is_none")]
15 pub interface: Option<String>,
16 /// The machines take their address from the LAN's DHCP server instead of a fixed one in
17 /// `cidr`; each machine lists the network with `0` (`networks: { home: 0 }`).
18 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
19 pub dhcp: bool,
20 /// With `dhcp`: the machines' default route goes through the LAN's own router (the one its
21 /// DHCP server gives) instead of the environment's.
22 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
23 pub default_route: bool,
24 /// The VLAN tag on the bridge (1-4094), where the target tags a VM's interface (Proxmox; on
25 /// ESXi, the port group's).
26 #[serde(default, skip_serializing_if = "Option::is_none")]
27 pub vlan: Option<u16>,
28}