isoloom_spec/model/ipv6.rs
1//! A network's IPv6 block: dual-stack beside its IPv4 `cidr`, or IPv6-only.
2
3use schemars::JsonSchema;
4use serde::{Deserialize, Serialize};
5
6/// A network's IPv6 side (see [`super::Network::ipv6`]).
7#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
8#[serde(deny_unknown_fields)]
9pub struct Ipv6 {
10 /// An IPv6 /64 block, unique local (`fd00:20::/64`) or global. A machine at octet 10 of
11 /// the IPv4 block gets `<block>::10`: the octet's digits, read as the address's last group,
12 /// so both addresses read alike.
13 pub cidr: String,
14 /// How machines get their IPv6 address: `static` (default), the one derived from their
15 /// octet, or `auto`, the one the target hands out (Docker's address management, the
16 /// cluster's, Oracle Cloud's). Isoloom's own addresses stay fixed either way.
17 #[serde(default, skip_serializing_if = "super::is_default")]
18 pub addresses: Ipv6Addresses,
19 /// IPv6 only: the network carries no IPv4. Its `cidr` still numbers the machines (their
20 /// octet), but no target puts it on the wire. Such a network has no `reach`, `gateway`,
21 /// `tc` or internet: those go through Isoloom's IPv4 router or NAT.
22 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
23 pub only: bool,
24}
25
26/// How machines get their IPv6 address on a network.
27#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
28#[serde(rename_all = "lowercase")]
29pub enum Ipv6Addresses {
30 /// Derived from the machine's octet, the same on every target.
31 #[default]
32 Static,
33 /// Handed out by the target.
34 Auto,
35}