Reference¶
Python asyncio traceroute library.
Attributes:
Name | Type | Description |
---|---|---|
__version__ |
str
|
Current version. |
Hop
dataclass
¶
Bases: object
Single hop information.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
addr |
str
|
Hop address. |
required |
rtt |
float
|
Round-trip time in seconds. |
required |
asn |
int
|
Autonoumous System number, if as resolution is enabled. |
required |
HopInfo
dataclass
¶
Bases: object
Path hop information.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ttl |
int
|
Current TTL. |
required |
hops |
List[Optional[Hop]]
|
List of hops. Items are either Hop or None in case of timeout. |
required |
Traceroute
¶
Bases: object
Asynchronous traceroute.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
max_hops |
int
|
Limit of the hops to trace. |
30
|
src_addr |
Optional[str]
|
Source address of the UDP packet. Detect automatically if not set. |
None
|
src_port |
int
|
Source port for UDP packet.
|
0
|
dst_port |
int
|
Destination UDP port. |
33434
|
timeout |
float
|
Hop timeout. |
1.0
|
tos |
int
|
DSCP/ToS mark for egress packets. |
0
|
min_ttl |
int
|
Minimum TTL to start with. |
1
|
whois_addr |
str
|
Whois server address or FQDN for authonomous system resolution. |
'whois.radb.net'
|
whois_port |
int
|
Whois server port. |
43
|
resolve_as |
bool
|
Fill Hop.asn with the hop's autonomuous system number. |
False
|
Note
resolve_as
option implies the requests to the
external whois server. Requests may take additional
time or may be blocked in closed environments.
__aenter__()
async
¶
Asynchronous context manager entry.
__aexit__(exc_type, exc, traceback)
async
¶
Asynchronous context manager exit.
traceroute(addr, tries=3, min_ttl=None)
async
¶
Perform traceroute to address.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
addr |
str
|
Destination address. |
required |
tries |
int
|
Number of tries. |
3
|
min_ttl |
Optional[int]
|
Minimum TTL to start with. |
None
|
Returns:
Type | Description |
---|---|
AsyncIterable[HopInfo]
|
Iterable of HopInfo. |