MCPcopy Create free account
hub / github.com/google/gopacket / String

Method String

layers/icmp6.go:134–156  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

132}
133
134func (a ICMPv6TypeCode) String() string {
135 t, c := a.Type(), a.Code()
136 strInfo, ok := icmpv6TypeCodeInfo[t]
137 if !ok {
138 // Unknown ICMPv6 type field
139 return fmt.Sprintf("%d(%d)", t, c)
140 }
141 typeStr := strInfo.typeStr
142 if strInfo.codeStr == nil && c == 0 {
143 // The ICMPv6 type does not make use of the code field
144 return fmt.Sprintf("%s", strInfo.typeStr)
145 }
146 if strInfo.codeStr == nil && c != 0 {
147 // The ICMPv6 type does not make use of the code field, but it is present anyway
148 return fmt.Sprintf("%s(Code: %d)", typeStr, c)
149 }
150 codeStr, ok := (*strInfo.codeStr)[c]
151 if !ok {
152 // We don't know this ICMPv6 code; print the numerical value
153 return fmt.Sprintf("%s(Code: %d)", typeStr, c)
154 }
155 return fmt.Sprintf("%s(%s)", typeStr, codeStr)
156}
157
158func (a ICMPv6TypeCode) GoString() string {
159 t := reflect.TypeOf(a)

Callers

nothing calls this directly

Calls 2

TypeMethod · 0.95
CodeMethod · 0.95

Tested by

no test coverage detected