# hyper-connector-mullvad
A Hyper connector backed by local Mullvad WireGuard credentials.
The connector discovers downloaded Mullvad `.conf` files or native Mullvad
device credentials, optionally filters relays by country or continent, and
maintains a pool of userspace WireGuard tunnels. It defaults to four tunnels;
Mullvad's account maximum of five is enforced.
```rust,no_run
use http_body_util::Empty;
use hyper::body::Bytes;
use hyper_connector_mullvad::{LocationFilter, MullvadConnector};
use hyper_util::{client::legacy::Client, rt::TokioExecutor};
# async fn example() -> Result<(), Box<dyn std::error::Error>> {
let connector = MullvadConnector::builder()
.location_filter(LocationFilter::parse("Sweden")?)
.build()
.await?;
let client = Client::builder(TokioExecutor::new())
.build::<_, Empty<Bytes>>(connector.clone());
let response = client.get("https://example.com/".parse()?).await?;
println!("{}", response.status());
drop(client);
connector.shutdown().await;
# Ok(())
# }
```
Connection failures are returned to Hyper without replay. The affected tunnel
is repaired or replaced for future connections.
## Configuration discovery
Downloaded WireGuard configurations are read from `/etc/wireguard` by default.
If none are available, the connector tries:
1. `/etc/mullvad-vpn/device.json`
2. `$HOME/.config/Mullvad VPN/device.json`
Both the configuration directory and `device.json` path can be overridden on
`MullvadConnectorBuilder`.
## License
The original code in this crate is licensed under either Apache-2.0 or MIT, at
your option. Its `wireguard-hyper-connector` and `wireguard-netstack`
dependencies are GPL-3.0, which may impose additional obligations on downstream
distribution.