mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-07-12 22:22:36 +02:00
buffer+pool: add buffer.Read and pool.ReadBuffer
This commit is contained in:
19
buffer/read.go
Normal file
19
buffer/read.go
Normal file
@ -0,0 +1,19 @@
|
||||
package buffer
|
||||
|
||||
import (
|
||||
"github.com/lightningnetwork/lnd/lnwire"
|
||||
)
|
||||
|
||||
// ReadSize represents the size of the maximum message that can be read off the
|
||||
// wire by brontide. The buffer is used to hold the ciphertext while the
|
||||
// brontide state machine decrypts the message.
|
||||
const ReadSize = lnwire.MaxMessagePayload + 16
|
||||
|
||||
// Read is a static byte array sized to the maximum-allowed Lightning message
|
||||
// size, plus 16 bytes for the MAC.
|
||||
type Read [ReadSize]byte
|
||||
|
||||
// Recycle zeroes the Read, making it fresh for another use.
|
||||
func (b *Read) Recycle() {
|
||||
RecycleSlice(b[:])
|
||||
}
|
Reference in New Issue
Block a user