buffer

package
v0.15.10001 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 16, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const ReadSize = lnwire.MaxSliceLength + 16

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.

View Source
const WriteSize = lnwire.MaxSliceLength

WriteSize represents the size of the maximum plaintext message than can be sent using brontide. The buffer does not include extra space for the MAC, as that is applied by the Noise protocol after encrypting the plaintext.

Variables

This section is empty.

Functions

func RecycleSlice

func RecycleSlice(b []byte)

RecycleSlice zeroes byte slice, making it fresh for another use. Zeroing the buffer using a logarithmic number of calls to the optimized copy method. Benchmarking shows this to be ~30 times faster than a for loop that sets each index to 0 for ~65KB buffers use for wire messages. Inspired by: https://stackoverflow.com/questions/30614165/is-there-analog-of-memset-in-go

Types

type Read

type Read [ReadSize]byte

Read is a static byte array sized to the maximum-allowed Lightning message size, plus 16 bytes for the MAC.

func (*Read) Recycle

func (b *Read) Recycle()

Recycle zeroes the Read, making it fresh for another use.

type Write

type Write [WriteSize]byte

Write is static byte array occupying to maximum-allowed plaintext-message size.

func (*Write) Recycle

func (b *Write) Recycle()

Recycle zeroes the Write, making it fresh for another use.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL