code: func (l *listenContext) isCookieValid(id stack.TransportEndpointID, cookie seqnum.Value, seq seqnum.Value) (uint32, bool) {
  	ts := timeStamp()
  	v := uint32(cookie) - l.cookieHash(id, 0, 0) - uint32(seq)
  	cookieTS := v >> tsOffset
  	if ((ts - cookieTS) & tsMask) > maxTSDiff {
  		return 0, false
  	}
  
  	return (v - l.cookieHash(id, cookieTS, 1)) & hashMask, true
  }
docs: // isCookieValid checks if the supplied cookie is valid for the given id and
  // sequence number. If it is, it also returns the data originally encoded in the
  // cookie when createCookie was called.