浏览代码

Increase the timestamp resolution for handshakes (#453)

Nate Brown 4 年之前
父节点
当前提交
9ff73cb02f
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      handshake_ix.go

+ 2 - 2
handshake_ix.go

@@ -31,7 +31,7 @@ func ixHandshakeStage0(f *Interface, vpnIp uint32, hostinfo *HostInfo) {
 
 
 	hsProto := &NebulaHandshakeDetails{
 	hsProto := &NebulaHandshakeDetails{
 		InitiatorIndex: hostinfo.localIndexId,
 		InitiatorIndex: hostinfo.localIndexId,
-		Time:           uint64(time.Now().Unix()),
+		Time:           uint64(time.Now().UnixNano()),
 		Cert:           ci.certState.rawCertificateNoKey,
 		Cert:           ci.certState.rawCertificateNoKey,
 	}
 	}
 
 
@@ -140,7 +140,7 @@ func ixHandshakeStage1(f *Interface, addr *udpAddr, packet []byte, h *Header) {
 	hs.Details.ResponderIndex = myIndex
 	hs.Details.ResponderIndex = myIndex
 	hs.Details.Cert = ci.certState.rawCertificateNoKey
 	hs.Details.Cert = ci.certState.rawCertificateNoKey
 	// Update the time in case their clock is way off from ours
 	// Update the time in case their clock is way off from ours
-	hs.Details.Time = uint64(time.Now().Unix())
+	hs.Details.Time = uint64(time.Now().UnixNano())
 
 
 	hsBytes, err := proto.Marshal(hs)
 	hsBytes, err := proto.Marshal(hs)
 	if err != nil {
 	if err != nil {