refactor: move TH structs and definitions to model (#894)

This commit moves the TH structs and definitions to model. We don't want
oohelperd to depend on web_connectivity@v0.4.

Part of https://github.com/ooni/probe/issues/2240
This commit is contained in:
Simone Basso 2022-08-28 20:20:12 +02:00 committed by GitHub
commit bb6563f363
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 161 additions and 157 deletions

View file

@ -10,15 +10,15 @@ import (
"net/url"
"sync"
"github.com/ooni/probe-cli/v3/internal/engine/experiment/webconnectivity"
"github.com/ooni/probe-cli/v3/internal/model"
)
type (
// ctrlRequest is the request sent to the test helper
ctrlRequest = webconnectivity.ControlRequest
ctrlRequest = model.THRequest
// ctrlResponse is the response from the test helper
ctrlResponse = webconnectivity.ControlResponse
ctrlResponse = model.THResponse
)
// measure performs the measurement described by the request and
@ -48,11 +48,11 @@ func measure(ctx context.Context, config *handler, creq *ctrlRequest) (*ctrlResp
// start assembling the response
cresp := &ctrlResponse{
TCPConnect: map[string]webconnectivity.ControlTCPConnectResult{},
TLSHandshake: map[string]webconnectivity.ControlTLSHandshakeResult{},
HTTPRequest: webconnectivity.ControlHTTPRequestResult{},
DNS: webconnectivity.ControlDNSResult{},
IPInfo: map[string]*webconnectivity.ControlIPInfo{},
TCPConnect: map[string]model.THTCPConnectResult{},
TLSHandshake: map[string]model.THTLSHandshakeResult{},
HTTPRequest: model.THHTTPRequestResult{},
DNS: model.THDNSResult{},
IPInfo: map[string]*model.THIPInfo{},
}
select {
case cresp.DNS = <-dnsch:
@ -111,7 +111,7 @@ Loop:
if tcpconn.TLS != nil {
cresp.TLSHandshake[tcpconn.Endpoint] = *tcpconn.TLS
if info := cresp.IPInfo[tcpconn.Address]; info != nil && tcpconn.TLS.Failure == nil {
info.Flags |= webconnectivity.ControlIPInfoFlagValidForDomain
info.Flags |= model.THIPInfoFlagValidForDomain
}
}
default: