mirror of
https://github.com/slackhq/nebula.git
synced 2026-05-16 04:47:38 +02:00
checkpt
This commit is contained in:
@@ -3,16 +3,11 @@ package batch
|
||||
import (
|
||||
"net/netip"
|
||||
|
||||
"github.com/slackhq/nebula/udp"
|
||||
"github.com/slackhq/nebula/util"
|
||||
)
|
||||
|
||||
const SendBatchCap = 128
|
||||
|
||||
// DefaultSendBatchArenaCap is the recommended arena capacity for a
|
||||
// standalone SendBatch: 128 slots × (udp.MTU + 32) ≈ 1.1 MiB. The +32 covers
|
||||
// the nebula header + AEAD tag tacked onto each plaintext segment.
|
||||
const DefaultSendBatchArenaCap = SendBatchCap * (udp.MTU + 32)
|
||||
|
||||
// batchWriter is the minimal subset of udp.Conn needed by SendBatch to flush.
|
||||
type batchWriter interface {
|
||||
WriteBatch(bufs [][]byte, addrs []netip.AddrPort, outerECNs []byte) error
|
||||
@@ -27,11 +22,11 @@ type SendBatch struct {
|
||||
bufs [][]byte
|
||||
dsts []netip.AddrPort
|
||||
ecns []byte
|
||||
arena *Arena
|
||||
arena *util.Arena
|
||||
}
|
||||
|
||||
// NewSendBatch makes a SendBatch with batchCap slots backed by arena.
|
||||
func NewSendBatch(out batchWriter, batchCap int, arena *Arena) *SendBatch {
|
||||
func NewSendBatch(out batchWriter, batchCap int, arena *util.Arena) *SendBatch {
|
||||
return &SendBatch{
|
||||
out: out,
|
||||
bufs: make([][]byte, 0, batchCap),
|
||||
|
||||
Reference in New Issue
Block a user