Feat(Linux): Integrate Linux Connectivity Feature
This commit is contained in:
+14
-6
@@ -7,14 +7,20 @@ use std::{fmt, io};
|
||||
|
||||
pub trait Network: fmt::Debug {
|
||||
/// Makes an attempt to connect to a selected wireless network with password specified.
|
||||
fn connect(&self, password: &str) -> bool;
|
||||
fn connect(&self, password: &str) -> Result<bool, NetworkError>;
|
||||
fn disconnect(&self) -> Result<bool, NetworkError>;
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum NetworkType {
|
||||
WEP,
|
||||
WPA,
|
||||
WPA2,
|
||||
// #[derive(Debug)]
|
||||
// pub enum NetworkType {
|
||||
// WEP,
|
||||
// WPA,
|
||||
// WPA2,
|
||||
// }
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Config<'a> {
|
||||
pub interface: Option<&'a str>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
@@ -23,8 +29,10 @@ pub enum NetworkError {
|
||||
SsidNotFound,
|
||||
OsNotSupported,
|
||||
IpAssignFailed,
|
||||
AddNetworkProfileFailed,
|
||||
IoError(io::Error),
|
||||
FailedToConnect(String),
|
||||
FailedToDisconnect(String),
|
||||
}
|
||||
|
||||
impl From<io::Error> for NetworkError {
|
||||
|
||||
Reference in New Issue
Block a user