mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-10-08 23:22:21 +02:00
try new markdown conversion
This commit is contained in:
@@ -1,162 +1,174 @@
|
||||
[Home](https://kellyjonbrazil.github.io/jc/)
|
||||
<a id="jc.parsers.tracepath"></a>
|
||||
|
||||
# jc.parsers.tracepath
|
||||
|
||||
jc - JSON CLI output utility `tracepath` command output parser
|
||||
|
||||
Supports `tracepath` and `tracepath6` output.
|
||||
|
||||
Usage (cli):
|
||||
|
||||
$ tracepath 1.2.3.4 | jc --tracepath
|
||||
$ tracepath 1.2.3.4 | jc --tracepath
|
||||
|
||||
or
|
||||
or
|
||||
|
||||
$ jc tracepath 1.2.3.4
|
||||
$ jc tracepath 1.2.3.4
|
||||
|
||||
Usage (module):
|
||||
|
||||
import jc
|
||||
result = jc.parse('tracepath', tracepath_command_output)
|
||||
import jc
|
||||
result = jc.parse('tracepath', tracepath_command_output)
|
||||
|
||||
or
|
||||
or
|
||||
|
||||
import jc.parsers.tracepath
|
||||
result = jc.parsers.tracepath.parse(tracepath_command_output)
|
||||
import jc.parsers.tracepath
|
||||
result = jc.parsers.tracepath.parse(tracepath_command_output)
|
||||
|
||||
Schema:
|
||||
|
||||
{
|
||||
"pmtu": integer,
|
||||
"forward_hops": integer,
|
||||
"return_hops": integer,
|
||||
"hops": [
|
||||
{
|
||||
"ttl": integer,
|
||||
"guess": boolean,
|
||||
"host": string,
|
||||
"reply_ms": float,
|
||||
"pmtu": integer,
|
||||
"asymmetric_difference": integer,
|
||||
"reached": boolean
|
||||
}
|
||||
]
|
||||
}
|
||||
{
|
||||
"pmtu": integer,
|
||||
"forward_hops": integer,
|
||||
"return_hops": integer,
|
||||
"hops": [
|
||||
{
|
||||
"ttl": integer,
|
||||
"guess": boolean,
|
||||
"host": string,
|
||||
"reply_ms": float,
|
||||
"pmtu": integer,
|
||||
"asymmetric_difference": integer,
|
||||
"reached": boolean
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Examples:
|
||||
**Examples**:
|
||||
|
||||
$ tracepath6 3ffe:2400:0:109::2 | jc --tracepath -p
|
||||
{
|
||||
"pmtu": 1480,
|
||||
"forward_hops": 2,
|
||||
"return_hops": 2,
|
||||
"hops": [
|
||||
{
|
||||
"ttl": 1,
|
||||
"guess": true,
|
||||
"host": "[LOCALHOST]",
|
||||
"reply_ms": null,
|
||||
"pmtu": 1500,
|
||||
"asymmetric_difference": null,
|
||||
"reached": false
|
||||
},
|
||||
{
|
||||
"ttl": 1,
|
||||
"guess": false,
|
||||
"host": "dust.inr.ac.ru",
|
||||
"reply_ms": 0.411,
|
||||
"pmtu": null,
|
||||
"asymmetric_difference": null,
|
||||
"reached": false
|
||||
},
|
||||
{
|
||||
"ttl": 2,
|
||||
"guess": false,
|
||||
"host": "dust.inr.ac.ru",
|
||||
"reply_ms": 0.39,
|
||||
"pmtu": 1480,
|
||||
"asymmetric_difference": 1,
|
||||
"reached": false
|
||||
},
|
||||
{
|
||||
"ttl": 2,
|
||||
"guess": false,
|
||||
"host": "3ffe:2400:0:109::2",
|
||||
"reply_ms": 463.514,
|
||||
"pmtu": null,
|
||||
"asymmetric_difference": null,
|
||||
"reached": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
$ tracepath6 3ffe:2400:0:109::2 | jc --tracepath -p
|
||||
{
|
||||
- `"pmtu"` - 1480,
|
||||
- `"forward_hops"` - 2,
|
||||
- `"return_hops"` - 2,
|
||||
- `"hops"` - [
|
||||
{
|
||||
- `"ttl"` - 1,
|
||||
- `"guess"` - true,
|
||||
- `"host"` - "[LOCALHOST]",
|
||||
- `"reply_ms"` - null,
|
||||
- `"pmtu"` - 1500,
|
||||
- `"asymmetric_difference"` - null,
|
||||
- `"reached"` - false
|
||||
},
|
||||
{
|
||||
- `"ttl"` - 1,
|
||||
- `"guess"` - false,
|
||||
- `"host"` - "dust.inr.ac.ru",
|
||||
- `"reply_ms"` - 0.411,
|
||||
- `"pmtu"` - null,
|
||||
- `"asymmetric_difference"` - null,
|
||||
- `"reached"` - false
|
||||
},
|
||||
{
|
||||
- `"ttl"` - 2,
|
||||
- `"guess"` - false,
|
||||
- `"host"` - "dust.inr.ac.ru",
|
||||
- `"reply_ms"` - 0.39,
|
||||
- `"pmtu"` - 1480,
|
||||
- `"asymmetric_difference"` - 1,
|
||||
- `"reached"` - false
|
||||
},
|
||||
{
|
||||
- `"ttl"` - 2,
|
||||
- `"guess"` - false,
|
||||
- `"host"` - "3ffe:2400:0:109::2",
|
||||
- `"reply_ms"` - 463.514,
|
||||
- `"pmtu"` - null,
|
||||
- `"asymmetric_difference"` - null,
|
||||
- `"reached"` - true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
$ tracepath6 3ffe:2400:0:109::2 | jc --tracepath -p -r
|
||||
{
|
||||
- `"pmtu"` - "1480",
|
||||
- `"forward_hops"` - "2",
|
||||
- `"return_hops"` - "2",
|
||||
- `"hops"` - [
|
||||
{
|
||||
- `"ttl"` - "1",
|
||||
- `"guess"` - true,
|
||||
- `"host"` - "[LOCALHOST]",
|
||||
- `"reply_ms"` - null,
|
||||
- `"pmtu"` - "1500",
|
||||
- `"asymmetric_difference"` - null,
|
||||
- `"reached"` - false
|
||||
},
|
||||
{
|
||||
- `"ttl"` - "1",
|
||||
- `"guess"` - false,
|
||||
- `"host"` - "dust.inr.ac.ru",
|
||||
- `"reply_ms"` - "0.411",
|
||||
- `"pmtu"` - null,
|
||||
- `"asymmetric_difference"` - null,
|
||||
- `"reached"` - false
|
||||
},
|
||||
{
|
||||
- `"ttl"` - "2",
|
||||
- `"guess"` - false,
|
||||
- `"host"` - "dust.inr.ac.ru",
|
||||
- `"reply_ms"` - "0.390",
|
||||
- `"pmtu"` - "1480",
|
||||
- `"asymmetric_difference"` - "1",
|
||||
- `"reached"` - false
|
||||
},
|
||||
{
|
||||
- `"ttl"` - "2",
|
||||
- `"guess"` - false,
|
||||
- `"host"` - "3ffe:2400:0:109::2",
|
||||
- `"reply_ms"` - "463.514",
|
||||
- `"pmtu"` - null,
|
||||
- `"asymmetric_difference"` - null,
|
||||
- `"reached"` - true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
$ tracepath6 3ffe:2400:0:109::2 | jc --tracepath -p -r
|
||||
{
|
||||
"pmtu": "1480",
|
||||
"forward_hops": "2",
|
||||
"return_hops": "2",
|
||||
"hops": [
|
||||
{
|
||||
"ttl": "1",
|
||||
"guess": true,
|
||||
"host": "[LOCALHOST]",
|
||||
"reply_ms": null,
|
||||
"pmtu": "1500",
|
||||
"asymmetric_difference": null,
|
||||
"reached": false
|
||||
},
|
||||
{
|
||||
"ttl": "1",
|
||||
"guess": false,
|
||||
"host": "dust.inr.ac.ru",
|
||||
"reply_ms": "0.411",
|
||||
"pmtu": null,
|
||||
"asymmetric_difference": null,
|
||||
"reached": false
|
||||
},
|
||||
{
|
||||
"ttl": "2",
|
||||
"guess": false,
|
||||
"host": "dust.inr.ac.ru",
|
||||
"reply_ms": "0.390",
|
||||
"pmtu": "1480",
|
||||
"asymmetric_difference": "1",
|
||||
"reached": false
|
||||
},
|
||||
{
|
||||
"ttl": "2",
|
||||
"guess": false,
|
||||
"host": "3ffe:2400:0:109::2",
|
||||
"reply_ms": "463.514",
|
||||
"pmtu": null,
|
||||
"asymmetric_difference": null,
|
||||
"reached": true
|
||||
}
|
||||
]
|
||||
}
|
||||
<a id="jc.parsers.tracepath.info"></a>
|
||||
|
||||
## info Objects
|
||||
|
||||
## info
|
||||
```python
|
||||
info()
|
||||
class info()
|
||||
```
|
||||
|
||||
Provides parser metadata (version, author, etc.)
|
||||
|
||||
## parse
|
||||
<a id="jc.parsers.tracepath.parse"></a>
|
||||
|
||||
#### parse
|
||||
|
||||
```python
|
||||
parse(data, raw=False, quiet=False)
|
||||
def parse(data, raw=False, quiet=False)
|
||||
```
|
||||
|
||||
Main text parsing function
|
||||
|
||||
Parameters:
|
||||
**Arguments**:
|
||||
|
||||
data: (string) text data to parse
|
||||
raw: (boolean) unprocessed output if True
|
||||
quiet: (boolean) suppress warning messages if True
|
||||
|
||||
- `data` - (string) text data to parse
|
||||
- `raw` - (boolean) unprocessed output if True
|
||||
- `quiet` - (boolean) suppress warning messages if True
|
||||
|
||||
|
||||
Returns:
|
||||
**Returns**:
|
||||
|
||||
Dictionary. Raw or processed structured data.
|
||||
|
||||
Dictionary. Raw or processed structured data.
|
||||
|
||||
## Parser Information
|
||||
Compatibility: linux
|
||||
|
Reference in New Issue
Block a user