diff options
author | HimbeerserverDE <himbeerserverde@gmail.com> | 2023-11-14 19:02:43 +0100 |
---|---|---|
committer | HimbeerserverDE <himbeerserverde@gmail.com> | 2023-11-14 19:02:43 +0100 |
commit | ec284b5f1543e54c64ac4c812370c35c1ce345d5 (patch) | |
tree | 4f9b1019a38907ec24c74d21f993fd88784e9c92 /src/link.rs | |
parent | 64702d5bb846660a3df6556192828daee286cb1b (diff) |
allow granular control of functionality using features
Diffstat (limited to 'src/link.rs')
-rw-r--r-- | src/link.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/link.rs b/src/link.rs index 20c319e..a881527 100644 --- a/src/link.rs +++ b/src/link.rs @@ -7,12 +7,14 @@ use tokio::time::sleep; use futures::TryStreamExt; use netlink_packet_route::rtnl::IFF_UP; +#[cfg(feature = "link")] #[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] pub enum LinkState { Up, Down, } +#[cfg(feature = "link")] pub async fn set(link: String, state: LinkState) -> Result<()> { let (conn, handle, _) = rtnetlink::new_connection()?; tokio::spawn(conn); @@ -55,6 +57,7 @@ pub async fn is_up(link: String) -> Result<bool> { Ok(is_up) } +#[cfg(feature = "link")] pub async fn set_mtu(link: String, mtu: u32) -> Result<()> { let (conn, handle, _) = rtnetlink::new_connection()?; tokio::spawn(conn); @@ -74,6 +77,7 @@ pub async fn set_mtu(link: String, mtu: u32) -> Result<()> { Ok(()) } +#[cfg(feature = "link")] pub async fn add_vlan(link: String, parent: String, vlan_id: u16) -> Result<()> { let (conn, handle, _) = rtnetlink::new_connection()?; tokio::spawn(conn); |