Source File
stateless_reset.go
Belonging Package
github.com/quic-go/quic-go
package quicimport ()type statelessResetter struct {mx sync.Mutexh hash.Hash}// newStatelessRetter creates a new stateless reset generator.// It is valid to use a nil key. In that case, a random key will be used.// This makes is impossible for on-path attackers to shut down established connections.func newStatelessResetter( *StatelessResetKey) *statelessResetter {var hash.Hashif != nil {= hmac.New(sha256.New, [:])} else {:= make([]byte, 32)_, _ = rand.Read()= hmac.New(sha256.New, )}return &statelessResetter{h: }}func ( *statelessResetter) ( protocol.ConnectionID) protocol.StatelessResetToken {.mx.Lock()defer .mx.Unlock()var protocol.StatelessResetToken.h.Write(.Bytes())copy([:], .h.Sum(nil)).h.Reset()return}
![]() |
The pages are generated with Golds v0.8.4. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |