mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-01 19:27:35 +03:00
46 lines
895 B
Go
46 lines
895 B
Go
package handshake
|
|
|
|
import (
|
|
"encoding/hex"
|
|
"strings"
|
|
"testing"
|
|
|
|
tls "github.com/refraction-networking/utls"
|
|
|
|
. "github.com/onsi/ginkgo/v2"
|
|
. "github.com/onsi/gomega"
|
|
"go.uber.org/mock/gomock"
|
|
)
|
|
|
|
func TestHandshake(t *testing.T) {
|
|
RegisterFailHandler(Fail)
|
|
RunSpecs(t, "Handshake Suite")
|
|
}
|
|
|
|
var mockCtrl *gomock.Controller
|
|
|
|
var _ = BeforeEach(func() {
|
|
mockCtrl = gomock.NewController(GinkgoT())
|
|
})
|
|
|
|
var _ = AfterEach(func() {
|
|
mockCtrl.Finish()
|
|
})
|
|
|
|
func splitHexString(s string) (slice []byte) {
|
|
for _, ss := range strings.Split(s, " ") {
|
|
if ss[0:2] == "0x" {
|
|
ss = ss[2:]
|
|
}
|
|
d, err := hex.DecodeString(ss)
|
|
ExpectWithOffset(1, err).ToNot(HaveOccurred())
|
|
slice = append(slice, d...)
|
|
}
|
|
return
|
|
}
|
|
|
|
var cipherSuites = []*cipherSuite{
|
|
getCipherSuite(tls.TLS_AES_128_GCM_SHA256),
|
|
getCipherSuite(tls.TLS_AES_256_GCM_SHA384),
|
|
getCipherSuite(tls.TLS_CHACHA20_POLY1305_SHA256),
|
|
}
|