Skip to content

Commit

Permalink
Add create_hotspot, activate, and deactivate methods
Browse files Browse the repository at this point in the history
  • Loading branch information
josephrhobbs committed Aug 6, 2024
1 parent ac8a435 commit b090dbe
Show file tree
Hide file tree
Showing 6 changed files with 279 additions and 115 deletions.
162 changes: 158 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions proton_err/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,24 @@ pub enum ProtonError {
/// Netlink gave no response.
NoResponseFromNetlink,

/// Could not activate hotspot after creation.
CouldNotActivateHotspot,

/// Could not deauthenticate device by MAC address.
CouldNotDeauthenticateDevice (MacAddr),

/// Could not parse into CIDR range.
CouldNotParseAsCidr (String),

/// CIDR range must contain network gateway.
CidrMustContainGateway {
/// Provided CIDR network range.
cidr: String,

/// Provided gateway IPv4 address.
gateway: String,
},

/// An error that could not be converted to a native error.
Other (String),
}
Expand All @@ -47,6 +59,11 @@ impl Display for ProtonError {
NoResponseFromNetlink => "no response from Netlink",
CouldNotParseAsCidr (cidr) => &format!("could not parse '{}' into a valid CIDR range", cidr),
CouldNotDeauthenticateDevice (mac) => &format!("could not deauthenticate device with MAC address {}", mac),
CouldNotActivateHotspot => "could not activate hotspot",
CidrMustContainGateway {
cidr,
gateway,
} => &format!("provided CIDR range {} does not contain gateway IPv4 {}", cidr, gateway),
Other (t) => t.as_str(),
};

Expand Down
8 changes: 7 additions & 1 deletion proton_wap/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ name = "proton_wap"
path = "src/lib.rs"

[dependencies]
cidr = "0.2.3"

[dependencies.network-manager]
# TODO: this repo is a fork of an existing repo, once PR is approved we will change this to the existing repo
git = "https://github.com/adom-inc/network-manager"

[dependencies.pnet]
version = "0.35.0"
Expand All @@ -17,6 +20,9 @@ version = "0.35.0"
version = "1"
features = ["full"]

[dependencies.proton_cfg]
path = "../proton_cfg"

[dependencies.proton_dev]
path = "../proton_dev"

Expand Down
Loading

0 comments on commit b090dbe

Please sign in to comment.