-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* different shape for different devices
* fix: veth pair name not show for unused veth pair * graph represented in ortho * support '-t/--table' table format * colorize plain text tree output * show loopback * rich text output * table: group netns by color Signed-off-by: tianyang ni <tianzong48@gmail.com>
- Loading branch information
Showing
16 changed files
with
587 additions
and
158 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,4 +12,4 @@ | |
*.out | ||
|
||
# Dependency directories (remove the comment below to include it) | ||
# vendor/ | ||
vendor/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,82 @@ | ||
|
||
|
||
<div align="center"> | ||
|
||
# ☘️ iftree | ||
|
||
`iftree` command visulize local network interfaces. | ||
|
||
intent for better understanding container networks :D | ||
|
||
[![golangci-lint](https://github.com/TianZong48/iftree/actions/workflows/golangci-lint.yml/badge.svg?branch=main)](https://github.com/TianZong48/iftree/actions/workflows/golangci-lint.yml) | ||
[![CodeQL](https://github.com/TianZong48/iftree/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/TianZong48/iftree/actions/workflows/codeql-analysis.yml) | ||
[![Go Report](https://goreportcard.com/badge/github.com/TianZong48/iftree)](https://goreportcard.com/badge/github.com/TianZong48/iftree) | ||
</div> | ||
|
||
--- | ||
|
||
# iftree | ||
<img | ||
src="./asset/sample.jpg" | ||
alt="iftree --graph" | ||
width="60%" | ||
align="right" | ||
/> | ||
|
||
CLI, easy way to illustrate local network interface. | ||
<img | ||
src="./asset/sample-term.png" | ||
alt="iftree" | ||
width="60%" | ||
align="right" | ||
/> | ||
|
||
The intent is for understanding container networks :D | ||
**Features** | ||
|
||
- [x] visualize Veth/bridge connections | ||
- [x] support graphviz | ||
- [x] table output | ||
- [x] rich text | ||
- [ ] ascii graph | ||
- [ ] support more networking device | ||
|
||
![networ-devices](./sample.jpg) | ||
## usage | ||
|
||
## example | ||
``` | ||
# sudo go run main.go | ||
---------------------------------------------------- | ||
BRIDGE: cni_br up | ||
netnsName veth peer peerInNetns netnsID | ||
|____321 | ||
|----veth6328d76d enp5s0 eth1 3 | ||
|____123 | ||
|----veth5e41415a enp5s0 eth1 2 | ||
|----veth90c9f5fa wlp4s0 eth2 2 | ||
|----veth385ac3bb docker0 eth3 2 | ||
---------------------------------------------------- | ||
unused veth pairs | ||
veth peer netnsID | ||
veth31bc095b enp5s0 1 | ||
veth12d98148 wlp4s0 1 | ||
veth-tt1 veth-tt -1 | ||
veth-tt veth-tt1 -1 | ||
Usage: | ||
iftree [options] | ||
-d, --debug print debug message | ||
-g, --graph output in graphviz dot language(https://graphviz.org/doc/info/lang.html | ||
-t, --table output in table | ||
--no-color disable color output | ||
Help Options: | ||
-h, --help Show this help message | ||
``` | ||
|
||
## graph output | ||
### text | ||
|
||
```shell | ||
sudo go run cmd/iftree/main.go | ||
``` | ||
# sudo go run cmd/iftree/main.go --graph | dot -Tpng > output.png | ||
or | ||
# sudo go run cmd/iftree/main.go --graph > xx.dot | ||
# dot -Tpng xx.dot > output.png | ||
|
||
### graph | ||
|
||
Create an ouput image with [graphviz](https://www.graphviz.org/) compatible renderer. | ||
e.g: online editor: https://dreampuf.github.io/GraphvizOnline | ||
|
||
```shell | ||
sudo go run cmd/iftree/main.go --graph | ||
``` | ||
example: | ||
![networ-devices](./sample.jpg) | ||
|
||
### prequisite | ||
Create an ouput image with any [graphviz](http://www.graphviz.org/download) compatible renderer | ||
generate image using `dot`(http://www.graphviz.org/download/#executable-packages) | ||
|
||
--- | ||
```shell | ||
sudo go run cmd/iftree/main.go --graph | dot -Tpng > output.png | ||
``` | ||
|
||
### roadmap | ||
### table | ||
|
||
```shell | ||
sudo iftree --table | ||
``` | ||
|
||
![table](./asset/sample-table.png) | ||
|
||
- [x] show peer name in container | ||
- [x] graphviz | ||
- [ ] rich text | ||
- [ ] topo relation in ascii graph | ||
- [ ] support more networking device |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.