add feature flag to ospf route

This commit is contained in:
sijie.sun
2024-09-21 18:15:47 +08:00
committed by Sijie.Sun
parent 06afd221d5
commit bd60cfc2a0
12 changed files with 124 additions and 43 deletions
+13
View File
@@ -5,6 +5,7 @@ use std::{
};
use crate::proto::cli::PeerConnInfo;
use crate::proto::common::PeerFeatureFlag;
use crossbeam::atomic::AtomicCell;
use super::{
@@ -68,6 +69,8 @@ pub struct GlobalCtx {
enable_exit_node: bool,
no_tun: bool,
feature_flags: AtomicCell<PeerFeatureFlag>,
}
impl std::fmt::Debug for GlobalCtx {
@@ -119,6 +122,8 @@ impl GlobalCtx {
enable_exit_node,
no_tun,
feature_flags: AtomicCell::new(PeerFeatureFlag::default()),
}
}
@@ -246,6 +251,14 @@ impl GlobalCtx {
pub fn no_tun(&self) -> bool {
self.no_tun
}
pub fn get_feature_flags(&self) -> PeerFeatureFlag {
self.feature_flags.load()
}
pub fn set_feature_flags(&self, flags: PeerFeatureFlag) {
self.feature_flags.store(flags);
}
}
#[cfg(test)]