)
const (
+ // NonceSize is nounce size
NonceSize = 8
NonceBucketSize = 256
TagSize = poly1305.TagSize
// S20BS is ChaCha20's internal blocksize in bytes
S20BS = 64
- // Maximal amount of bytes transfered with single key (4 GiB)
+ // MaxBytesPerKey maximal amount of bytes transfered with single key (4 GiB)
MaxBytesPerKey uint64 = 1 << 32
// Heartbeat rate, relative to Timeout
TimeoutHeartbeat = 4
- // Minimal valid packet length
+ // MinPktLength minimal valid packet length
MinPktLength = 1 + 16 + 8
// Padding byte
PadByte = byte(0x80)
return nonces
}
+// Peer is a GoVPN peer (client)
type Peer struct {
// Statistics (they are at the beginning for correct int64 alignment)
BytesIn uint64
return &peer
}
-// Process incoming Ethernet packet.
+// EthProcess process incoming Ethernet packet.
// ready channel is TAPListen's synchronization channel used to tell him
// that he is free to receive new packets. Encrypted and authenticated
// packets will be sent to remote Peer side immediately.
p.BusyT.Unlock()
}
+// PktProcess process data of a single packet
func (p *Peer) PktProcess(data []byte, tap io.Writer, reorderable bool) bool {
if len(data) < MinPktLength {
return false
return true
}
+// PeerTapProcessor process a TUN/TAP peer
func PeerTapProcessor(peer *Peer, tap *TAP, terminator chan struct{}) {
var data []byte
var now time.Time