MCPcopy
hub / github.com/XTLS/REALITY / addBytesWithLength

Function addBytesWithLength

handshake_messages.go:26–34  ·  view source on GitHub ↗

addBytesWithLength appends a sequence of bytes to the cryptobyte.Builder. If the length of the sequence is not the value specified, it produces an error.

(b *cryptobyte.Builder, v []byte, n int)

Source from the content-addressed store, hash-verified

24// addBytesWithLength appends a sequence of bytes to the cryptobyte.Builder. If
25// the length of the sequence is not the value specified, it produces an error.
26func addBytesWithLength(b *cryptobyte.Builder, v []byte, n int) {
27 b.AddValue(marshalingFunction(func(b *cryptobyte.Builder) error {
28 if len(v) != n {
29 return fmt.Errorf("invalid value length: expected %d, got %d", n, len(v))
30 }
31 b.AddBytes(v)
32 return nil
33 }))
34}
35
36// addUint64 appends a big-endian, 64-bit value to the cryptobyte.Builder.
37func addUint64(b *cryptobyte.Builder, v uint64) {

Callers 2

marshalMsgMethod · 0.85
marshalMethod · 0.85

Calls 1

marshalingFunctionFuncType · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…