RTR server
This commit is contained in:
@@ -2,5 +2,5 @@ pub mod crl;
|
||||
mod rc;
|
||||
mod tal;
|
||||
mod ta;
|
||||
mod resources;
|
||||
pub mod resources;
|
||||
mod oids;
|
||||
|
||||
1278
src/data_model/rc.rs
1278
src/data_model/rc.rs
File diff suppressed because it is too large
Load Diff
@@ -54,7 +54,7 @@ impl ASRange {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
|
||||
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, Default)]
|
||||
pub struct Asn(u32);
|
||||
|
||||
impl Asn {
|
||||
|
||||
@@ -42,6 +42,30 @@ pub struct IPAddressRange {
|
||||
pub max: IPAddress,
|
||||
}
|
||||
|
||||
use std::net::{Ipv4Addr, Ipv6Addr};
|
||||
|
||||
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
|
||||
pub struct IPAddress(u128);
|
||||
|
||||
impl IPAddress {
|
||||
pub fn to_ipv4(self) -> Option<Ipv4Addr> {
|
||||
if self.0 <= u32::MAX as u128 {
|
||||
Some(Ipv4Addr::from(self.0 as u32))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
pub fn to_ipv6(self) -> Ipv6Addr {
|
||||
Ipv6Addr::from(self.0)
|
||||
}
|
||||
|
||||
pub fn is_ipv4(self) -> bool {
|
||||
self.0 <= u32::MAX as u128
|
||||
}
|
||||
|
||||
pub fn as_u128(self) -> u128 {
|
||||
self.0
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user