Skip to content

Commit

Permalink
Merge pull request #123 from jamesmcm/airvpn
Browse files Browse the repository at this point in the history
Update docs for AirVPN support
  • Loading branch information
jamesmcm authored Dec 20, 2021
2 parents 9336b78 + 74a17bb commit ce0f725
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 10 deletions.
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[package]
name = "vopono"
description = "Launch applications via VPN tunnels using temporary network namespaces"
version = "0.8.9"
version = "0.8.10"
authors = ["James McMurray <[email protected]>"]
edition = "2018"
edition = "2021"
license = "GPL-3.0-or-later"
repository = "https://github.com/jamesmcm/vopono"
homepage = "https://github.com/jamesmcm/vopono"
Expand Down Expand Up @@ -45,7 +45,7 @@ webbrowser = "0.5"
basic_tcp_proxy = "0.3"
signal-hook = "0.3"
config = "0.11"
serde_json = "1.0"
serde_json = "1"
bs58 = "0.4"

[package.metadata.rpm]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ lynx all running through different VPN connections:
| MozillaVPN |||
| NordVPN |||
| HMA (HideMyAss) |||
| airVPN |||
| AirVPN |||

## Usage

Expand Down
9 changes: 9 additions & 0 deletions USERGUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,12 @@ For Mullvad your OpenVPN credentials are your account code as your username, and
For ProtonVPN you can view your OpenVPN credentials [online on your account dashboard](https://account.protonvpn.com/account#openvpn).
The OpenVPN credentials are **not** the same as your ProtonVPN account credentials.

For AirVPN the OpenVPN connection uses a key embedded in the config
files, however you will need to provide your AirVPN API key and enable
API access in [the client area webpage](https://airvpn.org/apisettings/) when running `vopono sync`.
Note that ports for forwarding must also be added in [the client area webpage](https://airvpn.org/ports/),
and it is also possible to configure the VPN tunnel [DNS settings there](https://airvpn.org/dns/).

#### TCP support and custom ports

By default vopono uses the UDP configuration of the VPN providers.
Expand Down Expand Up @@ -386,6 +392,9 @@ supported for OpenVPN** on iVPN's side. So remember to pass
`--protocol openvpn -o PORTNUMBER` when trying it! Enable port
forwarding in the [Port Forwarding page in the iVPN client area](https://www.ivpn.net/clientarea/vpn/273887).

For AirVPN you must enable the port in [the client area webpage](https://airvpn.org/ports/),
and then use `--protocol openvpn -o PORTNUMBER` as for iVPN.

## Dependencies

At the moment, either iptables or nftables is required (the firewall
Expand Down
2 changes: 1 addition & 1 deletion src/providers/airvpn/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pub struct AirVPN {}

impl Provider for AirVPN {
fn alias(&self) -> String {
"AirVPN".to_string()
"air".to_string()
}

fn default_protocol(&self) -> Protocol {
Expand Down
15 changes: 10 additions & 5 deletions src/providers/airvpn/openvpn.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use super::AirVPN;
use super::{ConfigurationChoice, OpenVpnProvider};
use crate::util::delete_all_files_in_dir;
use anyhow::anyhow;
use log::debug;
use serde_json::Value;
use std::collections::HashMap;
Expand Down Expand Up @@ -67,13 +68,17 @@ impl OpenVpnProvider for AirVPN {
let generator_url = config_choice
.url()?
.replace("{servers}", request_server_names.as_str());

// TODO: Add validator that it is lower case, hexadecimal, 40-character string
let api_key = env::var("AIRVPN_API_KEY").or_else(|_|
dialoguer::Input::<String>::new()
.with_prompt("Enter your AirVPN API key (see https://airvpn.org/apisettings/ )")
.interact() ).map_err(|_| {
anyhow!("Cannot generate AirVPN OpenVPN config files: AIRVPN_API_KEY is not defined in your environment variables. Get your key by activating API access in the Client Area at https://airvpn.org/apisettings/")
})?.trim().to_string();
let zipfile = client
.get(generator_url)
.header(
"API-KEY",
env::var("AIRVPN_API_KEY")
.expect("AIRVPN_API_KEY is not defined in your environment variables"),
)
.header("API-KEY", api_key)
.send()?;
let mut zip = ZipArchive::new(Cursor::new(zipfile.bytes()?))?;
let openvpn_dir = self.openvpn_dir()?;
Expand Down

0 comments on commit ce0f725

Please sign in to comment.