MCPcopy Create free account
hub / github.com/XTLS/Go / addBytesWithLength

Function addBytesWithLength

handshake_messages.go:24–32  ·  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

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

Callers 2

marshalMethod · 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…