| Crates.io | networksetup |
| lib.rs | networksetup |
| version | 0.1.1 |
| created_at | 2020-10-29 08:56:39.018277+00 |
| updated_at | 2020-10-29 08:59:22.138892+00 |
| description | Change macos system network settings |
| homepage | https://github.com/wyhaya/networksetup |
| repository | https://github.com/wyhaya/networksetup.git |
| max_upload_size | |
| id | 306566 |
| size | 9,959 |
A rust library for setting up macOS networks by calling networksetup command
Add this in your Cargo.toml:
[dependencies]
networksetup = "*"
use networksetup::{auto_proxy, dns_server, web_proxy, Address, Config, Network};
fn main() {
// Set PAC Automatic Proxy
auto_proxy(
Network::WiFi,
Config::Value("https://example.com/proxy.pac"),
);
// Set HTTP Proxy
let addr = Address::new("0.0.0.0", "80");
web_proxy(Network::WiFi, Config::Value(&addr));
// Set Socks Proxy
let addr = Address::new("127.0.0.1", "1080");
web_proxy(Network::Ethernet, Config::Value(&addr));
// Close
web_proxy(Network::Ethernet, Config::Off);
// Set DNS Server
dns_server(Network::WiFi, &vec!["1.1.1.1", "8.8.8.8"]);
}