init
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
package faketls
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/hex"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestBuildTdesktopClientHello_shape(t *testing.T) {
|
||||
key, err := hex.DecodeString("5ba9cf5cf84698032e5300c864544dd0")
|
||||
if err != nil || len(key) != 16 {
|
||||
t.Fatalf("key: %v len %d", err, len(key))
|
||||
}
|
||||
domain, err := hex.DecodeString("632e6170692e73746570612e6f6e65")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
ch, err := BuildTdesktopClientHello(key, domain)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(ch.Record) < 5 || len(ch.Record) > kClientHelloLimit {
|
||||
t.Fatalf("record len %d", len(ch.Record))
|
||||
}
|
||||
if !bytes.HasPrefix(ch.Record, []byte{0x16, 0x03, 0x01}) {
|
||||
t.Fatal("bad record header")
|
||||
}
|
||||
if len(ch.RandomField) != 32 {
|
||||
t.Fatalf("random/digest field len %d", len(ch.RandomField))
|
||||
}
|
||||
if len(ch.SessionID) != 32 {
|
||||
t.Fatalf("session id len %d", len(ch.SessionID))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user