Skip to content

Commit 0c1f2d8

Browse files
committed
netstat-nat: add --version
1 parent ed71bed commit 0c1f2d8

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

netstat-nat.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ import (
1616
// -x: extended hostnames view
1717
// -r src | dst | src-port | dst-port | state : sort connections
1818
// -N: display NAT box connection information (only valid with SNAT & DNAT)
19-
// -v: print version
19+
20+
var Version = "0.1.0"
2021

2122
var onlySNAT = flag.BoolP("snat", "S", false, "Display only SNAT connections")
2223
var onlyDNAT = flag.BoolP("dnat", "D", false, "Display only DNAT connections")
@@ -27,10 +28,16 @@ var noHeader = flag.BoolP("no-header", "o", false, "Strip output header")
2728
var protocol = flag.StringP("protocol", "p", "", "Filter connections by protocol")
2829
var sourceHost = flag.StringP("source", "s", "", "Filter by source IP")
2930
var destinationHost = flag.StringP("destination", "d", "", "Filter by destination IP")
31+
var displayVersion = flag.BoolP("version", "v", false, "Print version")
3032

3133
func main() {
3234
flag.Parse()
3335

36+
if *displayVersion {
37+
fmt.Println("Version " + Version)
38+
os.Exit(0)
39+
}
40+
3441
which := conntrack.SNATFilter | conntrack.DNATFilter
3542

3643
if *onlySNAT {

0 commit comments

Comments
 (0)