MCPcopy Create free account
hub / github.com/facebook/time / Encode

Method Encode

ntp/protocol/extension_fields.go:130–132  ·  view source on GitHub ↗

Encode returns the wire-format bytes of this extension field, padded per RFC 7822.

()

Source from the content-addressed store, hash-verified

128func (ef ExtensionField) EncodedSize() int {
129 total := padTo(ExtensionHeaderSize+len(ef.Body), ExtensionAlignment)
130 return max(total, ExtensionMinSize)
131}
132
133// Encode returns the wire-format bytes of this extension field, padded per RFC 7822.
134func (ef ExtensionField) Encode() ([]byte, error) {
135 return MarshalExtensionFields([]ExtensionField{ef})

Callers 7

TestMarshalSingleFieldFunction · 0.95
TestMarshalEmptyBodyFunction · 0.95
TestMarshalAtMaxBodySizeFunction · 0.95
handleRequestMethod · 0.80
TestParseMultipleFieldsFunction · 0.80

Calls 1

MarshalExtensionFieldsFunction · 0.85

Tested by 6

TestMarshalSingleFieldFunction · 0.76
TestMarshalEmptyBodyFunction · 0.76
TestMarshalAtMaxBodySizeFunction · 0.76
TestParseMultipleFieldsFunction · 0.64