diff options
Diffstat (limited to 'device/cookie.go')
-rw-r--r-- | device/cookie.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/device/cookie.go b/device/cookie.go index 3a88a0c..f134128 100644 --- a/device/cookie.go +++ b/device/cookie.go @@ -87,7 +87,7 @@ func (st *CookieChecker) CheckMAC2(msg []byte, src []byte) bool { st.RLock() defer st.RUnlock() - if time.Now().Sub(st.mac2.secretSet) > CookieRefreshTime { + if time.Since(st.mac2.secretSet) > CookieRefreshTime { return false } @@ -124,7 +124,7 @@ func (st *CookieChecker) CreateReply( // refresh cookie secret - if time.Now().Sub(st.mac2.secretSet) > CookieRefreshTime { + if time.Since(st.mac2.secretSet) > CookieRefreshTime { st.RUnlock() st.Lock() _, err := rand.Read(st.mac2.secret[:]) @@ -239,7 +239,7 @@ func (st *CookieGenerator) AddMacs(msg []byte) { // set mac2 - if time.Now().Sub(st.mac2.cookieSet) > CookieRefreshTime { + if time.Since(st.mac2.cookieSet) > CookieRefreshTime { return } |