MCPcopy
hub / github.com/google/gopacket / packetString

Method packetString

packet.go:400–417  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

398}
399
400func (p *packet) packetString() string {
401 var b bytes.Buffer
402 fmt.Fprintf(&b, "PACKET: %d bytes", len(p.Data()))
403 if p.metadata.Truncated {
404 b.WriteString(", truncated")
405 }
406 if p.metadata.Length > 0 {
407 fmt.Fprintf(&b, ", wire length %d cap length %d", p.metadata.Length, p.metadata.CaptureLength)
408 }
409 if !p.metadata.Timestamp.IsZero() {
410 fmt.Fprintf(&b, " @ %v", p.metadata.Timestamp)
411 }
412 b.WriteByte('\n')
413 for i, l := range p.layers {
414 fmt.Fprintf(&b, "- Layer %d (%02d bytes) = %s\n", i+1, len(l.LayerContents()), LayerString(l))
415 }
416 return b.String()
417}
418
419func (p *packet) packetDump() string {
420 var b bytes.Buffer

Callers 2

StringMethod · 0.80
StringMethod · 0.80

Calls 4

DataMethod · 0.95
LayerStringFunction · 0.85
LayerContentsMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected