feat: add uTLS support in measurexlite (#918)
Closes https://github.com/ooni/probe/issues/2253 Co-authored-by: decfox <decfox@github.com>
This commit is contained in:
parent
9e8ad551aa
commit
59d8b6ecef
4 changed files with 136 additions and 1 deletions
29
internal/measurexlite/utls_test.go
Normal file
29
internal/measurexlite/utls_test.go
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
package measurexlite
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/ooni/probe-cli/v3/internal/model"
|
||||
"github.com/ooni/probe-cli/v3/internal/model/mocks"
|
||||
utls "gitlab.com/yawning/utls.git"
|
||||
)
|
||||
|
||||
func TestNewTLSHandshakerUTLS(t *testing.T) {
|
||||
t.Run("NewTLSHandshakerUTLS creates a wrapped TLSHandshaker", func(t *testing.T) {
|
||||
underlying := &mocks.TLSHandshaker{}
|
||||
zeroTime := time.Now()
|
||||
trace := NewTrace(0, zeroTime)
|
||||
trace.NewTLSHandshakerUTLSFn = func(dl model.DebugLogger, id *utls.ClientHelloID) model.TLSHandshaker {
|
||||
return underlying
|
||||
}
|
||||
thx := trace.NewTLSHandshakerUTLS(model.DiscardLogger, &utls.HelloGolang)
|
||||
thxt := thx.(*tlsHandshakerTrace)
|
||||
if thxt.thx != underlying {
|
||||
t.Fatal("invalid TLS handshaker")
|
||||
}
|
||||
if thxt.tx != trace {
|
||||
t.Fatal("invalid trace")
|
||||
}
|
||||
})
|
||||
}
|
||||
Loading…
Reference in a new issue