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.common_name, client). See also
Client
.
-
routing_table
¶ Type: OrderedDict
The list of routing table. The dictionary items have form of (routing.common_name, 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: IPv4Address
orIPv6Address
-
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=u'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 (