diff options
author | HimbeerserverDE <himbeerserverde@gmail.com> | 2023-03-19 19:40:29 +0100 |
---|---|---|
committer | HimbeerserverDE <himbeerserverde@gmail.com> | 2023-03-19 19:41:43 +0100 |
commit | 25c72e68ccecafd4f3d86f4440313dada6255ffe (patch) | |
tree | 0930794ba268cc6c44bb02e18181a09ae0752327 |
initial commit
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | Cargo.toml | 9 | ||||
-rw-r--r-- | LICENSE | 21 | ||||
-rw-r--r-- | README.md | 3 | ||||
-rw-r--r-- | src/lib.rs | 22 |
5 files changed, 57 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4fffb2f --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/target +/Cargo.lock diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..eab2ae5 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "ip_config" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +serde = { version = "1.0", features = ["derive"] } @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 The rsdsl Authors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..f7b2bba --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# ip_config + +Common IpConfig struct for netlinkd and pppoe. diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..c4808fe --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,22 @@ +use std::net::Ipv4Addr; + +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)] +pub struct IpConfig { + pub addr: Ipv4Addr, + pub dns1: Ipv4Addr, + pub dns2: Ipv4Addr, + pub rtr: Ipv4Addr, +} + +impl Default for IpConfig { + fn default() -> Self { + Self { + addr: Ipv4Addr::UNSPECIFIED, + dns1: Ipv4Addr::UNSPECIFIED, + dns2: Ipv4Addr::UNSPECIFIED, + rtr: Ipv4Addr::UNSPECIFIED, + } + } +} |