import (
"bytes"
- "encoding/binary"
"log"
"net"
"sync/atomic"
}
nonceExpectation := make([]byte, govpn.NonceSize)
- binary.BigEndian.PutUint64(nonceExpectation, peer.NonceExpect)
- peer.NonceCipher.Encrypt(nonceExpectation, nonceExpectation)
+ peer.NonceExpectation(nonceExpectation)
prev = 0
var i int
TransportCycle:
rehandshaking <- struct{}{}
break TransportCycle
}
- binary.BigEndian.PutUint64(nonceExpectation, peer.NonceExpect)
- peer.NonceCipher.Encrypt(nonceExpectation, nonceExpectation)
+ peer.NonceExpectation(nonceExpectation)
copy(buf, buf[i+govpn.NonceSize:prev])
prev = prev - i - govpn.NonceSize
goto CheckMore
import (
"bytes"
- "encoding/binary"
"log"
"net"
"time"
}
nonceExpectation := make([]byte, govpn.NonceSize)
- binary.BigEndian.PutUint64(nonceExpectation, peer.NonceExpect)
- peer.NonceCipher.Encrypt(nonceExpectation, nonceExpectation)
+ peer.NonceExpectation(nonceExpectation)
prev = 0
var i int
for {
)
break
}
- binary.BigEndian.PutUint64(nonceExpectation, peer.NonceExpect)
- peer.NonceCipher.Encrypt(nonceExpectation, nonceExpectation)
+ peer.NonceExpectation(nonceExpectation)
copy(buf, buf[i+govpn.NonceSize:prev])
prev = prev - i - govpn.NonceSize
goto CheckMore
p.BusyR.Unlock()
}
+func (p *Peer) NonceExpectation(buf []byte) {
+ binary.BigEndian.PutUint64(buf, p.NonceExpect)
+ p.NonceCipher.Encrypt(buf, buf)
+}
+
func newPeer(isClient bool, addr string, conn io.Writer, conf *PeerConf, key *[SSize]byte) *Peer {
now := time.Now()
timeout := conf.Timeout