use nmrs::{EapMethod, EapOptions, NetworkManager, Phase2, WifiSecurity};
#[tokio::main]
async fn main() -> nmrs::Result<()> {
let nm = NetworkManager::new().await?;
let eap_opts = EapOptions::builder()
.identity("user@company.com")
.password(std::env::var("WIFI_PASSWORD").expect("Set WIFI_PASSWORD env var"))
.method(EapMethod::Peap)
.phase2(Phase2::Mschapv2)
.anonymous_identity("anonymous@company.com")
.domain_suffix_match("company.com")
.system_ca_certs(true)
.build();
let security = WifiSecurity::WpaEap { opts: eap_opts };
println!("Connecting to enterprise WiFi network...");
nm.connect("CorpNetwork", security).await?;
println!("Successfully connected to enterprise WiFi!");
Ok(())
}