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

Function sliceForAppend

conn.go:474–483  ·  view source on GitHub ↗

sliceForAppend extends the input slice by n bytes. head is the full extended slice, while tail is the appended part. If the original slice has sufficient capacity no allocation is performed.

(in []byte, n int)

Source from the content-addressed store, hash-verified

472// slice, while tail is the appended part. If the original slice has sufficient
473// capacity no allocation is performed.
474func sliceForAppend(in []byte, n int) (head, tail []byte) {
475 if total := len(in) + n; cap(in) >= total {
476 head = in[:total]
477 } else {
478 head = make([]byte, total)
479 copy(head, in)
480 }
481 tail = head[len(in):]
482 return
483}
484
485// encrypt encrypts payload, adding the appropriate nonce and/or MAC, and
486// appends it to record, which must already contain the record header.

Callers 2

encryptMethod · 0.85
writeRecordLockedMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…