1
0
mirror of https://github.com/fumiama/WireGold.git synced 2026-06-23 20:16:27 +08:00

完善密钥分发

This commit is contained in:
fumiama
2021-10-25 21:20:28 +08:00
parent 34d48859d9
commit 51b557f06f
7 changed files with 62 additions and 12 deletions

View File

@@ -1,6 +1,9 @@
package head
import "encoding/json"
import (
"crypto/rand"
"encoding/json"
)
// Packet 是发送和接收的最小单位
type Packet struct {
@@ -49,5 +52,6 @@ func (p *Packet) Mashal(src string, dst string) ([]byte, error) {
p.DataSZ = uint32(len(p.Data))
p.Src = src
p.Dst = dst
rand.Reader.Read(p.Hash[:])
return json.Marshal(p)
}