brent saner 4ab83c9069
v0.2.3
ADDED:
* Additional diagram under table subcommand for the IPv6 CIDR segments
2025-04-07 16:03:20 -04:00

330 lines
7.7 KiB
Smarty

{{- /*gotype: r00t2.io/subnetter/cmd/subnetter.TableArgs*/ -}}
{{- $opts := . -}}
{{- $numRows := 0 -}}
{{- if not $opts.NoIpv4 }}
{{- if $opts.Plain }}
IPV4:
{{- else }}
{{- bold "IPv4:" }}
{{- end }}
{{- if $opts.Legacy }}
{{- if $opts.Plain }}
LEGACY:
{{- else }}
{{ bold "Legacy:" }}
{{- end }}
{{ legacy4 "\t" $opts.Plain }}
{{- end }}
{{- if not $opts.NoV4Mask }}
{{- if $opts.Plain }}
NETMASKS:
{{- else }}
{{ bold "Netmasks:" }}
{{- end }}
{{ mask4 "\t" $opts.Plain }}
{{- end }}
{{- if $opts.Plain }}
CIDR:
{{- else }}
{{ bold "CIDR:" }}
{{- end }}
{{ prefixes 4 "\t" $opts.Plain }}
{{- if $opts.Notes }}
{{- if $opts.Plain }}
NOTES:
{{- else }}
{{ bold "Notes:" }}
{{- end }}
{{ notes 4 "\t" $opts.Plain }}
{{- end }}
{{- end }}
{{- if not $opts.NoIpv6 }}
{{- if $opts.Plain }}
IPV6:
{{- else }}
{{ bold "IPv6:"}}
{{- end }}
{{- if not $opts.NoIpv6Seg }}
{{- if $opts.Plain }}
IPv6 Segment Reference Diagram:
{{- if $opts.VertSeg }}
Example: 2001:0db8:0123:4567:89ab:cdef:1234:5678
{{- if not $opts.VertInvert }}
2 4
0 8
0 12
1 16
:
0 20
d 24
b 28
8 32
:
0 36
1 40
2 44
3 48
:
4 52
5 56
6 60
7 64
:
8 68
9 72
a 76
b 80
:
c 84
d 88
e 92
f 96
:
1 100
2 104
3 108
4 112
:
5 116
6 120
7 124
8 127 or 128
{{- else }}
4 ____ 2
8 ____ 0
12 ___ 0
16 ___ 1
___ :
20 _____ 0
24 _____ d
28 _____ b
32 _____ 8
_____ :
36 _______ 0
40 _______ 1
44 _______ 2
48 _______ 3
_______ :
52 _________ 4
56 _________ 5
60 _________ 6
64 _________ 7
_________ :
68 ___________ 8
72 ___________ 9
76 ___________ a
80 ___________ b
___________ :
84 _____________ c
88 _____________ d
92 _____________ e
96 _____________ f
_____________ :
100 ______________ 1
104 ______________ 2
108 ______________ 3
112 ______________ 4
______________ :
116 ________________ 5
120 ________________ 6
124 ________________ 7
127 ________________ (8)
128 ________________ (8)
{{- end }}
{{- else }}
2001:0db8:0123:4567:89ab:cdef:1234:5678
|||| |||| |||| |||| |||| |||| |||| ||||
|||| |||| |||| |||| |||| |||| |||| |||128
|||| |||| |||| |||| |||| |||| |||| |||127
|||| |||| |||| |||| |||| |||| |||| ||124
|||| |||| |||| |||| |||| |||| |||| |120
|||| |||| |||| |||| |||| |||| |||| 116
|||| |||| |||| |||| |||| |||| |||112
|||| |||| |||| |||| |||| |||| ||108
|||| |||| |||| |||| |||| |||| |104
|||| |||| |||| |||| |||| |||| 100
|||| |||| |||| |||| |||| |||96
|||| |||| |||| |||| |||| ||92
|||| |||| |||| |||| |||| |88
|||| |||| |||| |||| |||| 84
|||| |||| |||| |||| |||80
|||| |||| |||| |||| ||76
|||| |||| |||| |||| |72
|||| |||| |||| |||| 68
|||| |||| |||| |||64
|||| |||| |||| ||60
|||| |||| |||| |56
|||| |||| |||| 52
|||| |||| |||48
|||| |||| ||44
|||| |||| |40
|||| |||| 36
|||| |||32
|||| ||28
|||| |24
|||| 20
|||16
||12
|8
4
{{- end }}
{{- else }}
{{ bold "IPv6 Segment Reference Diagram:" }}
{{- if $opts.VertSeg }}
{{ bold "Example:"}} 2001:0db8:0123:4567:89ab:cdef:1234:5678
{{- if not $opts.VertInvert }}
2 4
0 8
0 12
1 16
:
0 20
d 24
b 28
8 32
:
0 36
1 40
2 44
3 48
:
4 52
5 56
6 60
7 64
:
8 68
9 72
a 76
b 80
:
c 84
d 88
e 92
f 96
:
1 100
2 104
3 108
4 112
:
5 116
6 120
7 124
8 127 or 128
{{- else }}
4 ━━━━ 2
8 ━━━━ 0
12 ━━━ 0
16 ━━━ 1
━━━ :
20 ━━━━━ 0
24 ━━━━━ d
28 ━━━━━ b
32 ━━━━━ 8
━━━━━ :
36 ━━━━━━━ 0
40 ━━━━━━━ 1
44 ━━━━━━━ 2
48 ━━━━━━━ 3
━━━━━━━ :
52 ━━━━━━━━━ 4
56 ━━━━━━━━━ 5
60 ━━━━━━━━━ 6
64 ━━━━━━━━━ 7
━━━━━━━━━ :
68 ━━━━━━━━━━━ 8
72 ━━━━━━━━━━━ 9
76 ━━━━━━━━━━━ a
80 ━━━━━━━━━━━ b
━━━━━━━━━━━ :
84 ━━━━━━━━━━━━━ c
88 ━━━━━━━━━━━━━ d
92 ━━━━━━━━━━━━━ e
96 ━━━━━━━━━━━━━ f
━━━━━━━━━━━━━ :
100 ━━━━━━━━━━━━━━ 1
104 ━━━━━━━━━━━━━━ 2
108 ━━━━━━━━━━━━━━ 3
112 ━━━━━━━━━━━━━━ 4
━━━━━━━━━━━━━━ :
116 ━━━━━━━━━━━━━━━━ 5
120 ━━━━━━━━━━━━━━━━ 6
124 ━━━━━━━━━━━━━━━━ 7
127 ━━━━━━━━━━━━━━━━ (8)
128 ━━━━━━━━━━━━━━━━ (8)
{{- end }}
{{- else }}
{{ bold "2001:0db8:0123:4567:89ab:cdef:1234:5678" }}
┃┃┃┃ ┃┃┃┃ ┃┃┃┃ ┃┃┃┃ ┃┃┃┃ ┃┃┃┃ ┃┃┃┃ ┃┃┃┃
┃┃┃┃ ┃┃┃┃ ┃┃┃┃ ┃┃┃┃ ┃┃┃┃ ┃┃┃┃ ┃┃┃┃ ┃┃┃128
┃┃┃┃ ┃┃┃┃ ┃┃┃┃ ┃┃┃┃ ┃┃┃┃ ┃┃┃┃ ┃┃┃┃ ┃┃┃127
┃┃┃┃ ┃┃┃┃ ┃┃┃┃ ┃┃┃┃ ┃┃┃┃ ┃┃┃┃ ┃┃┃┃ ┃┃124
┃┃┃┃ ┃┃┃┃ ┃┃┃┃ ┃┃┃┃ ┃┃┃┃ ┃┃┃┃ ┃┃┃┃ ┃120
┃┃┃┃ ┃┃┃┃ ┃┃┃┃ ┃┃┃┃ ┃┃┃┃ ┃┃┃┃ ┃┃┃┃ 116
┃┃┃┃ ┃┃┃┃ ┃┃┃┃ ┃┃┃┃ ┃┃┃┃ ┃┃┃┃ ┃┃┃112
┃┃┃┃ ┃┃┃┃ ┃┃┃┃ ┃┃┃┃ ┃┃┃┃ ┃┃┃┃ ┃┃108
┃┃┃┃ ┃┃┃┃ ┃┃┃┃ ┃┃┃┃ ┃┃┃┃ ┃┃┃┃ ┃104
┃┃┃┃ ┃┃┃┃ ┃┃┃┃ ┃┃┃┃ ┃┃┃┃ ┃┃┃┃ 100
┃┃┃┃ ┃┃┃┃ ┃┃┃┃ ┃┃┃┃ ┃┃┃┃ ┃┃┃96
┃┃┃┃ ┃┃┃┃ ┃┃┃┃ ┃┃┃┃ ┃┃┃┃ ┃┃92
┃┃┃┃ ┃┃┃┃ ┃┃┃┃ ┃┃┃┃ ┃┃┃┃ ┃88
┃┃┃┃ ┃┃┃┃ ┃┃┃┃ ┃┃┃┃ ┃┃┃┃ 84
┃┃┃┃ ┃┃┃┃ ┃┃┃┃ ┃┃┃┃ ┃┃┃80
┃┃┃┃ ┃┃┃┃ ┃┃┃┃ ┃┃┃┃ ┃┃76
┃┃┃┃ ┃┃┃┃ ┃┃┃┃ ┃┃┃┃ ┃72
┃┃┃┃ ┃┃┃┃ ┃┃┃┃ ┃┃┃┃ 68
┃┃┃┃ ┃┃┃┃ ┃┃┃┃ ┃┃┃64
┃┃┃┃ ┃┃┃┃ ┃┃┃┃ ┃┃60
┃┃┃┃ ┃┃┃┃ ┃┃┃┃ ┃56
┃┃┃┃ ┃┃┃┃ ┃┃┃┃ 52
┃┃┃┃ ┃┃┃┃ ┃┃┃48
┃┃┃┃ ┃┃┃┃ ┃┃44
┃┃┃┃ ┃┃┃┃ ┃40
┃┃┃┃ ┃┃┃┃ 36
┃┃┃┃ ┃┃┃32
┃┃┃┃ ┃┃28
┃┃┃┃ ┃24
┃┃┃┃ 20
┃┃┃16
┃┃12
┃8
4
{{- end }}
{{- end }}
{{- end }}
{{- if $opts.Plain }}
CIDR:
{{- else }}
{{ bold "CIDR:" }}
{{- end }}
{{ prefixes 6 "\t" $opts.Plain }}
{{- if $opts.Notes }}
{{- if $opts.Plain }}
NOTES:
{{- else }}
{{ bold "Notes:" }}
{{- end }}
{{ notes 6 "\t" $opts.Plain }}
{{- end }}
{{- end }}