Start refactoring protocol code into sub package. Move Packet Encoding and list of Commands. Change SetSelfReportedPorts parameters.

More related commits to follow!
This commit is contained in:
Kleissner
2021-10-17 16:28:19 +02:00
parent 2476146949
commit 0c7b1e0e03
18 changed files with 149 additions and 115 deletions

18
protocol/Hash.go Normal file
View File

@@ -0,0 +1,18 @@
/*
File Name: Hash.go
Copyright: 2021 Peernet s.r.o.
Author: Peter Kleissner
*/
package protocol
import "lukechampine.com/blake3"
// HashData abstracts the hash function.
func HashData(data []byte) (hash []byte) {
hash32 := blake3.Sum256(data)
return hash32[:]
}
// HashSize is blake3 hash digest size = 256 bits
const HashSize = 32