MCPcopy
hub / github.com/hashicorp/memberlist / AddLabelHeaderToPacket

Function AddLabelHeaderToPacket

label.go:24–33  ·  view source on GitHub ↗

AddLabelHeaderToPacket prefixes outgoing packets with the correct header if the label is not empty.

(buf []byte, label string)

Source from the content-addressed store, hash-verified

22// AddLabelHeaderToPacket prefixes outgoing packets with the correct header if
23// the label is not empty.
24func AddLabelHeaderToPacket(buf []byte, label string) ([]byte, error) {
25 if label == "" {
26 return buf, nil
27 }
28 if len(label) > LabelMaxSize {
29 return nil, fmt.Errorf("label %q is too long", label)
30 }
31
32 return makeLabelHeader(label, buf), nil
33}
34
35// RemoveLabelHeaderFromPacket removes any label header from the provided
36// packet and returns it along with the remaining packet contents.

Callers 3

WriteToAddressMethod · 0.85
WriteToMethod · 0.85

Calls 2

makeLabelHeaderFunction · 0.85
ErrorfMethod · 0.80

Tested by 1

Used in the wild real call sites across dependent graphs

searching dependent graphs…