diff --git a/frontend/src/components/NetworkSettings/NetworkSettings.jsx b/frontend/src/components/NetworkSettings/NetworkSettings.jsx index 9b948e7..becb16f 100644 --- a/frontend/src/components/NetworkSettings/NetworkSettings.jsx +++ b/frontend/src/components/NetworkSettings/NetworkSettings.jsx @@ -13,6 +13,7 @@ import ExpandMoreIcon from "@material-ui/icons/ExpandMore"; import ManagedRoutes from "./components/ManagedRoutes"; import IPv4AutoAssign from "./components/IPv4AutoAssign"; +import IPv6AutoAssign from "./components/IPv6AutoAssign"; import API from "utils/API"; import { parseValue, replaceValue, setValue } from "utils/ChangeHelper"; @@ -107,10 +108,13 @@ function NetworkSettings({ network, setNetwork }) { handleChange={handleChange} /> - {/* TODO: */} - {/* - IPv6 Auto-Assign - */} + + + + IPv6 Auto-Assign + + + { + handleChange("config", "v6AssignMode", "custom", { + "rfc4193": e.target.checked, + "6plane": v6AssignMode["6plane"], + "zt": v6AssignMode["zt"], + })(null) + }} + /> + ZeroTier RFC4193 (/128 for each device) + {v6AssignMode["rfc4193"] && ( +
+ + fd + {id.slice(0, 2)} + : + {id.slice(2, 6)} + : + {id.slice(6, 10)} + : + {id.slice(10, 14)} + : + {id.slice(14, 16)} + 99:93 + __ + : + ____ + : + ____ + +
+ )} +
+ + + + { + handleChange("config", "v6AssignMode", "custom", { + "rfc4193": v6AssignMode["rfc4193"], + "6plane": e.target.checked, + "zt": v6AssignMode["zt"], + })(null) + }} + /> + ZeroTier 6PLANE (/80 routable for each device) + {v6AssignMode["6plane"] && ( +
+ + fc + { + (() => { + const sixPlaneID = id.match(/.{1,2}/g) + .map((substr, idx, arr) => parseInt(substr, 16) ^ parseInt(arr[idx + 4], 16)) + .map((byte) => byte.toString(16).toLowerCase()) + .map((byte) => (byte.length === 2) ? byte : '0' + byte) + .slice(0, 4) + .join('') + return ( + <> + {sixPlaneID.slice(0, 2)} + : + {sixPlaneID.slice(2, 6)} + : + {sixPlaneID.slice(6, 8)} + + ) + })() + } + __ + : + ____ + : + ____ + :0000:0000:0001 + +
+ )} +
+ + {/* TODO: Implement v6 ipAssignmentPools, might break ipv4 pool settings */} + {/* + { + handleChange("config", "v6AssignMode", "custom", { + "rfc4193": v6AssignMode["rfc4193"], + "6plane": v6AssignMode["6plane"], + "zt": e.target.checked, + })(null) + }} + /> + Auto-Assign from Range + */} +
+ + ); +} + +export default IPv6AutoAssign; diff --git a/frontend/src/components/NetworkSettings/components/IPv6AutoAssign/index.jsx b/frontend/src/components/NetworkSettings/components/IPv6AutoAssign/index.jsx new file mode 100644 index 0000000..0ae1ee0 --- /dev/null +++ b/frontend/src/components/NetworkSettings/components/IPv6AutoAssign/index.jsx @@ -0,0 +1 @@ +export { default } from "./IPv6AutoAssign";