From 1de5be51f0c941f21d11fe82ba33f85385eb2868 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BA=90=E6=96=87=E9=9B=A8?= <41315874+fumiama@users.noreply.github.com> Date: Tue, 12 Apr 2022 16:45:54 +0800 Subject: [PATCH] add log --- gold/head/packet.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gold/head/packet.go b/gold/head/packet.go index 53a96a7..55b6f34 100644 --- a/gold/head/packet.go +++ b/gold/head/packet.go @@ -2,12 +2,14 @@ package head import ( "encoding/binary" + "encoding/hex" "errors" "net" "unsafe" "github.com/fumiama/WireGold/helper" blake2b "github.com/minio/blake2b-simd" + "github.com/sirupsen/logrus" ) // Packet 是发送和接收的最小单位 @@ -137,5 +139,6 @@ func (p *Packet) FillHash() { // IsVaildHash 验证 packet 合法性 func (p *Packet) IsVaildHash() bool { sum := blake2b.New256().Sum(p.Data) + logrus.Debugln("[packet] sum really:", hex.EncodeToString(sum), "sum in hash:", hex.EncodeToString(p.Hash[:])) return *(*[32]byte)(*(*unsafe.Pointer)(unsafe.Pointer(&sum))) == p.Hash }