X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=src%2Fcypherpunks.ru%2Fgovpn%2Fpeer.go;h=78881e33e5e95201dd42e81609b023cb82ce4708;hb=c259296effa4a44103dcac563c6f7e30e436bb34;hp=46d8bc09744cd5779c689b21dd2cd65745eedca9;hpb=9f7abcad309afd709a1f16cdf961837bb9510036;p=govpn.git diff --git a/src/cypherpunks.ru/govpn/peer.go b/src/cypherpunks.ru/govpn/peer.go index 46d8bc0..78881e3 100644 --- a/src/cypherpunks.ru/govpn/peer.go +++ b/src/cypherpunks.ru/govpn/peer.go @@ -34,17 +34,17 @@ import ( ) const ( - // NonceSize is nounce size + // NonceSize is nonce size NonceSize = 8 NonceBucketSize = 256 TagSize = poly1305.TagSize // S20BS is ChaCha20's internal blocksize in bytes S20BS = 64 - // MaxBytesPerKey maximal amount of bytes transfered with single key (4 GiB) + // MaxBytesPerKey is maximal amount of bytes transferred with single key (4 GiB) MaxBytesPerKey uint64 = 1 << 32 // Heartbeat rate, relative to Timeout TimeoutHeartbeat = 4 - // MinPktLength minimal valid packet length + // MinPktLength is minimal valid packet length MinPktLength = 1 + 16 + 8 // Padding byte PadByte = byte(0x80) @@ -246,7 +246,7 @@ func newPeer(isClient bool, addr string, conn io.Writer, conf *PeerConf, key *[S return &peer } -// EthProcess process incoming Ethernet packet. +// EthProcess processes 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. @@ -304,7 +304,7 @@ func (p *Peer) EthProcess(data []byte) { p.BusyT.Unlock() } -// PktProcess process data of a single packet +// PktProcess processes data of a single packet func (p *Peer) PktProcess(data []byte, tap io.Writer, reorderable bool) bool { if len(data) < MinPktLength { return false @@ -412,7 +412,7 @@ func (p *Peer) PktProcess(data []byte, tap io.Writer, reorderable bool) bool { return true } -// PeerTapProcessor process a TUN/TAP peer +// PeerTapProcessor processes a TUN/TAP peer func PeerTapProcessor(peer *Peer, tap *TAP, terminator chan struct{}) { var data []byte var now time.Time