]> Cypherpunks.ru repositories - govpn.git/blobdiff - src/govpn/peer.go
Move cprCycleCalculate to peer.go, as it is the only user of it
[govpn.git] / src / govpn / peer.go
index 58dbc715080d0e1774439a20d0251ee10a0d71e9..f4e04b0126aaa464cb3dd015940373b21220ed7e 100644 (file)
@@ -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