API Reference¶
Models¶
-
class
openvpn_status.models.Status[source]¶ The OpenVPN status model.
-
client_list¶ -
The list of connected clients. The dictionary items have form of (client.real_address, client). See also
Client.
-
routing_table¶ Type: OrderedDictThe list of routing table. The dictionary items have form of (routing.virtual_address, routing). See also
Routing.
-
global_stats¶ Type: GlobalStats
-
updated_at¶ Type: datetime.datetimeThe last updated time of log file in UTC.
-
-
class
openvpn_status.models.Client[source]¶ The OpenVPN client model.
-
real_address¶ Type: PeerAddressThe real IP address and port of client.
-
connected_since¶ Type: datetime.datetimeThe time in UTC since last connection established.
-
-
class
openvpn_status.models.Routing[source]¶ The OpenVPN routing model.
-
virtual_address¶ Type: ipaddress.IPv4Addressoripaddress.IPv6Addressfor TUN modenetaddr.EUI(MAC address) for TAP modeipaddress.IPv4Networkoripaddress.IPv6Networkfor client-config-dir and iroute enabled servers.
Read more about TUN and TAP: Bridging vs. routing.
Read more about client-config-dir (CCD) and iroute: Lans behind OpenVPN.
-
common_name¶ Same as
Client.common_name
-
real_address¶ Same as
Client.real_address
-
last_ref¶ Type: datetime.datetime
-
Parser¶
-
class
openvpn_status.parser.LogParser(lines)[source]¶ The parser for parsing OpenVPN status log.
This kind of parser is stateful. So the
LogParser.parse()could be called once in the same instance of parser.-
classmethod
fromstring(content)[source]¶ Creates a parser from content of log.
Parameters: content (str) – The log content. Returns: The parser instance.
-
parse()[source]¶ Parses the status log.
Raises ParsingError: if syntax error found in the log. Returns: The models.Statuswith filled data.
-
classmethod
Shortcuts¶
-
openvpn_status.shortcuts.parse_status(status_log, encoding='utf-8')[source]¶ Parses the status log of OpenVPN.
Parameters: Returns: The instance of
models.Status
Utilties¶
-
class
openvpn_status.utils.PeerAddress[source]¶ The address of peer entity.
Parameters: - host (
IPv4AddressorIPv6Address) – The host address of peer entity. - port (
int) – The port of peer entity.
- host (