mirror of
https://github.com/lwch/natpass.git
synced 2024-04-21 12:41:54 +00:00
修正golint问题
This commit is contained in:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user