pub struct AsPath {
pub segments: Vec<AsPathSegment>,
}
Fields§
§segments: Vec<AsPathSegment>
Implementations§
Source§impl AsPath
impl AsPath
pub fn new() -> AsPath
pub fn from_segments(segments: Vec<AsPathSegment>) -> AsPath
pub fn add_segment(&mut self, segment: AsPathSegment)
pub fn segments(&self) -> &Vec<AsPathSegment>
pub fn count_asns(&self) -> usize
Sourcepub fn merge_aspath_as4path(aspath: &AsPath, as4path: &AsPath) -> Option<AsPath>
pub fn merge_aspath_as4path(aspath: &AsPath, as4path: &AsPath) -> Option<AsPath>
Construct AsPath from AS_PATH and AS4_PATH
https://datatracker.ietf.org/doc/html/rfc6793#section-4.2.3 If the number of AS numbers in the AS_PATH attribute is less than the number of AS numbers in the AS4_PATH attribute, then the AS4_PATH attribute SHALL be ignored, and the AS_PATH attribute SHALL be taken as the AS path information.
If the number of AS numbers in the AS_PATH attribute is larger than or equal to the number of AS numbers in the AS4_PATH attribute, then the AS path information SHALL be constructed by taking as many AS numbers and path segments as necessary from the leading part of the AS_PATH attribute, and then prepending them to the AS4_PATH attribute so that the AS path information has a number of AS numbers identical to that of the AS_PATH attribute. Note that a valid AS_CONFED_SEQUENCE or AS_CONFED_SET path segment SHALL be prepended if it is either the leading path segment or is adjacent to a path segment that is prepended.
pub fn get_origin(&self) -> Option<Vec<Asn>>
pub fn to_u32_vec(&self) -> Option<Vec<u32>>
Trait Implementations§
impl Eq for AsPath
impl StructuralPartialEq for AsPath
Auto Trait Implementations§
impl Freeze for AsPath
impl RefUnwindSafe for AsPath
impl Send for AsPath
impl Sync for AsPath
impl Unpin for AsPath
impl UnwindSafe for AsPath
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more