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: OrderedDict
The 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.datetime
The last updated time of log file in UTC.
-
-
class
openvpn_status.models.
Client
[source]¶ The OpenVPN client model.
-
real_address
¶ Type: PeerAddress
The real IP address and port of client.
-
connected_since
¶ Type: datetime.datetime
The time in UTC since last connection established.
-
-
class
openvpn_status.models.
Routing
[source]¶ The OpenVPN routing model.
-
virtual_address
¶ Type: ipaddress.IPv4Address
oripaddress.IPv6Address
for TUN modenetaddr.EUI
(MAC address) for TAP modeipaddress.IPv4Network
oripaddress.IPv6Network
for 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.Status
with 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 (
IPv4Address
orIPv6Address
) – The host address of peer entity. - port (
int
) – The port of peer entity.
- host (