Skip to content

Models

airvpn.api.generator.models

Config

A single generated VPN configuration file.

Attributes:

Name Type Description
filename

The filename this config was stored under in the generator's response (e.g. within its zip archive).

buffer

The raw file contents as bytes.

read() -> str

Return this config's contents as text, decoding if necessary.

Attempts to decode buffer as UTF-8 text, normalizing Windows-style line endings ("\r\n") to "\n". If the buffer isn't valid UTF-8 (e.g. a bundled binary), it's returned as a base64-encoded string instead.

Returns:

Type Description
str

The decoded text with normalized line endings, or a base64-encoded string if the contents aren't valid UTF-8 text.

write(output_dir: str = None)

Write this config's contents to disk.

Parameters:

Name Type Description Default
output_dir str

Directory to write the file into. Created (including parents) if it doesn't already exist. If omitted, the file is written to the current working directory using filename as-is.

None

Options

Mutable container for the parameters used to request a VPN config.

Instances are typically constructed from the generator API's own options response payload (via Options(**option_data)) and are reused/mutated to request individual files from a ConfigList (e.g. by setting download before each request).

Attributes:

Name Type Description
protocols

List of protocol strings (split from a comma-separated string if a string was passed in).

servers

List of server names (split from a comma-separated string if a string was passed in).

download

Download/file-index selector used for per-file requests.

system

Target operating system.

openvpn_version

OpenVPN version string, if applicable.

device

Device profile name associated with these configs.

files_binary

Optional bundled binary/executable identifier.

files_prefix

Optional filename prefix for generated files.

openvpn_noembedkeys

Whether to omit embedding keys directly in OpenVPN configs.

openvpn_directives

Additional custom OpenVPN directives.

openvpn_data_ciphers

Custom OpenVPN data cipher list.

resolve

Whether to resolve hostnames instead of using raw IPs.

openvpn_allservers

Whether to include all servers in a single OpenVPN config.

proxy_mode

Proxy mode ("none" or a specific proxy type).

proxy_host

Proxy host address.

proxy_port

Proxy port.

proxy_auth

Proxy authentication method/type.

proxy_login

Proxy authentication username.

proxy_password

Proxy authentication password.

wireguard_mtu

MTU value for WireGuard configs.

wireguard_persistent_keepalive

Persistent keepalive interval, in seconds, for WireGuard configs.

iplayer_entry

IP layer to use for the entry connection.

iplayer_exit

IP layer to use for the exit connection.

__hash__()

Hash based on the integer value of this instance's __str__() bytes.

Note this is derived from __str__, so two Options instances with equal attributes will hash equally.

__str__()

Return the string form of this instance's __dict__.

clone() -> Options

Return a new Options instance with a shallow copy of this instance's attributes.

Since protocols/servers etc. are passed straight through __init__, list-valued attributes are re-referenced rather than deep-copied unless __init__ creates a new list (as it does when given a comma-separated string). Mutating a cloned list in place (e.g. .append()) may still affect the original; prefer reassignment (e.g. slicing) when working with a clone.

Returns:

Type Description
Options

A new, independent Options instance with the same attribute values.

ProtocolType

Bases: StrEnum

Transport protocol used for the VPN connection.

SystemType

Bases: StrEnum

Target operating system for a generated config bundle.

VpnType

Bases: StrEnum

VPN protocol family supported by the config generator.