mirror of
https://github.com/slackhq/nebula.git
synced 2026-05-16 12:57:38 +02:00
ReadBatch
This commit is contained in:
@@ -7,12 +7,26 @@ import (
|
||||
"github.com/slackhq/nebula/routing"
|
||||
)
|
||||
|
||||
type Device interface {
|
||||
// defaultBatchBufSize is the per-Queue scratch size for ReadBatch on backends
|
||||
// that don't do TSO segmentation. 65535 covers any single IP packet.
|
||||
const defaultBatchBufSize = 65535
|
||||
|
||||
// Queue is a readable/writable tun queue. ReadBatch returns one or more
|
||||
// packets; the returned slices are borrowed from the queue's internal buffer
|
||||
// and are only valid until the next ReadBatch / Read / Close on this Queue.
|
||||
// Callers must encrypt or copy each slice before the next call. Not safe for
|
||||
// concurrent use — one goroutine per Queue.
|
||||
type Queue interface {
|
||||
io.ReadWriteCloser
|
||||
ReadBatch() ([][]byte, error)
|
||||
}
|
||||
|
||||
type Device interface {
|
||||
Queue
|
||||
Activate() error
|
||||
Networks() []netip.Prefix
|
||||
Name() string
|
||||
RoutesFor(netip.Addr) routing.Gateways
|
||||
SupportsMultiqueue() bool
|
||||
NewMultiQueueReader() (io.ReadWriteCloser, error)
|
||||
NewMultiQueueReader() (Queue, error)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user