implement certificate compression using common certificate sets

fixes #47
This commit is contained in:
Lucas Clemente
2016-05-11 15:57:24 +02:00
parent ea83ca8950
commit d17d597ebe
3 changed files with 89 additions and 3 deletions

24
crypto/cert_sets.go Normal file
View File

@@ -0,0 +1,24 @@
package crypto
import (
"bytes"
"github.com/lucas-clemente/quic-go-certificates"
)
type certSet [][]byte
var certSets = map[uint64]certSet{
certsets.CertSet1Hash: certsets.CertSet1,
certsets.CertSet2Hash: certsets.CertSet2,
}
// findCertInSet searches for the cert in the set. Negative return value means not found.
func (s *certSet) findCertInSet(cert []byte) int {
for i, c := range *s {
if bytes.Equal(c, cert) {
return i
}
}
return -1
}