From b7f63365bcb20d2fc2ccb4c0261a3fa8c2c836c6 Mon Sep 17 00:00:00 2001 From: lwch Date: Mon, 19 Sep 2022 13:33:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3golint=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- code/hash/hash.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/code/hash/hash.go b/code/hash/hash.go index 64136ee..6313d70 100644 --- a/code/hash/hash.go +++ b/code/hash/hash.go @@ -10,12 +10,14 @@ import ( "time" ) +// Hasher hasher for handshake type Hasher struct { sync.Mutex period uint h hash.Hash } +// New create hasher func New(secret string, period uint) *Hasher { if period == 0 { period = 30 @@ -26,6 +28,7 @@ func New(secret string, period uint) *Hasher { } } +// Hash hash func func (h *Hasher) Hash() []byte { now := time.Now() i := math.Floor(float64(now.Unix()) / float64(h.period))