X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=src%2Fgovpn%2Fpeer.go;h=f4e04b0126aaa464cb3dd015940373b21220ed7e;hb=6c5634826119ef03b594c92fb09b1b0d4ca35888;hp=58dbc715080d0e1774439a20d0251ee10a0d71e9;hpb=269e5134ad67851b6984bf0d677495c863799a45;p=govpn.git diff --git a/src/govpn/peer.go b/src/govpn/peer.go index 58dbc71..f4e04b0 100644 --- a/src/govpn/peer.go +++ b/src/govpn/peer.go @@ -145,6 +145,13 @@ func (p *Peer) NonceExpectation(buf []byte) { p.NonceCipher.Encrypt(buf, buf) } +func cprCycleCalculate(rate int) time.Duration { + if rate == 0 { + return time.Duration(0) + } + return time.Second / time.Duration(rate*(1<<10)/MTUMax) +} + func newPeer(isClient bool, addr string, conn io.Writer, conf *PeerConf, key *[SSize]byte) *Peer { now := time.Now() timeout := conf.Timeout