mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-04-22 15:06:54 +02:00
Move some stuff around in prep for a VL2 rework and identity rework.
This commit is contained in:
parent
c4beedcd73
commit
6f9aedb747
10 changed files with 33 additions and 25 deletions
|
@ -12,8 +12,9 @@ use zerotier_network_hypervisor::protocol::{PacketBuffer, DEFAULT_MULTICAST_LIMI
|
|||
use zerotier_network_hypervisor::vl1::*;
|
||||
use zerotier_network_hypervisor::vl2;
|
||||
use zerotier_network_hypervisor::vl2::multicastauthority::MulticastAuthority;
|
||||
use zerotier_network_hypervisor::vl2::networkconfig::*;
|
||||
use zerotier_network_hypervisor::vl2::{NetworkId, Revocation};
|
||||
use zerotier_network_hypervisor::vl2::v1::networkconfig::*;
|
||||
use zerotier_network_hypervisor::vl2::v1::Revocation;
|
||||
use zerotier_network_hypervisor::vl2::NetworkId;
|
||||
use zerotier_utils::blob::Blob;
|
||||
use zerotier_utils::buffer::OutOfBoundsError;
|
||||
use zerotier_utils::error::InvalidParameterError;
|
||||
|
|
|
@ -11,7 +11,7 @@ use std::collections::HashMap;
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use zerotier_network_hypervisor::vl1::{Address, Endpoint};
|
||||
use zerotier_network_hypervisor::vl2::networkconfig::NetworkConfig;
|
||||
use zerotier_network_hypervisor::vl2::v1::networkconfig::NetworkConfig;
|
||||
use zerotier_network_hypervisor::vl2::NetworkId;
|
||||
use zerotier_utils::blob::Blob;
|
||||
|
||||
|
|
|
@ -6,9 +6,8 @@ use std::hash::Hash;
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use zerotier_network_hypervisor::vl1::InetAddress;
|
||||
use zerotier_network_hypervisor::vl2::networkconfig::IpRoute;
|
||||
use zerotier_network_hypervisor::vl2::rule::Rule;
|
||||
use zerotier_network_hypervisor::vl2::NetworkId;
|
||||
use zerotier_network_hypervisor::vl2::{IpRoute, NetworkId};
|
||||
|
||||
use crate::database::Database;
|
||||
use crate::model::Member;
|
||||
|
|
|
@ -13,9 +13,8 @@ use zerotier_crypto::secure_eq;
|
|||
use zerotier_crypto::typestate::Valid;
|
||||
|
||||
use zerotier_network_hypervisor::vl1::{Address, Identity, InetAddress};
|
||||
use zerotier_network_hypervisor::vl2::networkconfig::IpRoute;
|
||||
use zerotier_network_hypervisor::vl2::rule::Rule;
|
||||
use zerotier_network_hypervisor::vl2::NetworkId;
|
||||
use zerotier_network_hypervisor::vl2::{IpRoute, NetworkId};
|
||||
|
||||
use zerotier_utils::futures_util::{Stream, StreamExt};
|
||||
use zerotier_utils::tokio;
|
||||
|
|
17
network-hypervisor/src/vl2/iproute.rs
Normal file
17
network-hypervisor/src/vl2/iproute.rs
Normal file
|
@ -0,0 +1,17 @@
|
|||
use crate::vl1::InetAddress;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// ZeroTier-managed L3 route on a virtual network.
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||
pub struct IpRoute {
|
||||
pub target: InetAddress,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
#[serde(default)]
|
||||
pub via: Option<InetAddress>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
#[serde(default)]
|
||||
pub flags: Option<u16>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
#[serde(default)]
|
||||
pub metric: Option<u16>,
|
||||
}
|
|
@ -1,16 +1,16 @@
|
|||
// (c) 2020-2022 ZeroTier, Inc. -- currently proprietary pending actual release and licensing. See LICENSE.md.
|
||||
|
||||
mod iproute;
|
||||
mod multicastgroup;
|
||||
mod networkid;
|
||||
mod revocation;
|
||||
mod switch;
|
||||
mod topology;
|
||||
|
||||
pub mod multicastauthority;
|
||||
pub mod networkconfig;
|
||||
pub mod rule;
|
||||
pub mod v1;
|
||||
|
||||
pub use iproute::IpRoute;
|
||||
pub use multicastgroup::MulticastGroup;
|
||||
pub use networkid::NetworkId;
|
||||
pub use revocation::Revocation;
|
||||
pub use switch::{Switch, SwitchInterface};
|
||||
|
|
3
network-hypervisor/src/vl2/topology.rs
Normal file
3
network-hypervisor/src/vl2/topology.rs
Normal file
|
@ -0,0 +1,3 @@
|
|||
pub struct Member {}
|
||||
|
||||
pub struct Topology {}
|
|
@ -1,5 +1,7 @@
|
|||
mod certificateofmembership;
|
||||
mod certificateofownership;
|
||||
pub mod networkconfig;
|
||||
mod revocation;
|
||||
mod tag;
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
|
@ -15,4 +17,5 @@ pub enum CredentialType {
|
|||
|
||||
pub use certificateofmembership::CertificateOfMembership;
|
||||
pub use certificateofownership::{CertificateOfOwnership, Thing};
|
||||
pub use revocation::Revocation;
|
||||
pub use tag::Tag;
|
||||
|
|
|
@ -7,6 +7,7 @@ use std::str::FromStr;
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::vl1::{Address, Identity, InetAddress};
|
||||
use crate::vl2::iproute::IpRoute;
|
||||
use crate::vl2::rule::Rule;
|
||||
use crate::vl2::v1::{CertificateOfMembership, CertificateOfOwnership, Tag};
|
||||
use crate::vl2::NetworkId;
|
||||
|
@ -436,21 +437,6 @@ pub struct V1Credentials {
|
|||
pub tags: HashMap<u32, Tag>,
|
||||
}
|
||||
|
||||
/// Statically pushed L3 IP routes included with a network configuration.
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||
pub struct IpRoute {
|
||||
pub target: InetAddress,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
#[serde(default)]
|
||||
pub via: Option<InetAddress>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
#[serde(default)]
|
||||
pub flags: Option<u16>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
#[serde(default)]
|
||||
pub metric: Option<u16>,
|
||||
}
|
||||
|
||||
impl Marshalable for IpRoute {
|
||||
const MAX_MARSHAL_SIZE: usize = (InetAddress::MAX_MARSHAL_SIZE * 2) + 2 + 2;
|
||||
|
Loading…
Add table
Reference in a new issue