feat(oohelperd): follow (and record) TH and probe endpoints (#890)
This diff introduces the following `oohelperd` enhancements: 1. measure both IP addresses resolved by the TH and IP addresses resolved by the probe; 2. when the URL scheme is http and there's no explicit port, measure both 80 and 443 (which will pay off big once we introduce support for optionally performing TLS handshakes); 3. include information about the probe and TH IP addresses into the results: who resolved each IP address, whether an address is a bogon, the ASN associated to an address. This diff is part of https://github.com/ooni/probe/issues/2237
This commit is contained in:
parent
867a243fef
commit
df0e099b73
7 changed files with 401 additions and 21 deletions
|
|
@ -47,7 +47,7 @@ func measure(ctx context.Context, config *handler, creq *ctrlRequest) (*ctrlResp
|
|||
wg.Wait()
|
||||
|
||||
// start assembling the response
|
||||
cresp := new(ctrlResponse)
|
||||
cresp := &ctrlResponse{}
|
||||
select {
|
||||
case cresp.DNS = <-dnsch:
|
||||
default:
|
||||
|
|
@ -59,12 +59,17 @@ func measure(ctx context.Context, config *handler, creq *ctrlRequest) (*ctrlResp
|
|||
}
|
||||
}
|
||||
|
||||
// tcpconnect: start
|
||||
tcpconnch := make(chan tcpResultPair, len(creq.TCPConnect))
|
||||
for _, endpoint := range creq.TCPConnect {
|
||||
// obtain IP info and figure out the endpoints measurement plan
|
||||
cresp.IPInfo = newIPInfo(creq, cresp.DNS.Addrs)
|
||||
endpoints := ipInfoToEndpoints(URL, cresp.IPInfo)
|
||||
|
||||
// tcpconnect: start over all the endpoints
|
||||
tcpconnch := make(chan *tcpResultPair, len(endpoints))
|
||||
for _, endpoint := range endpoints {
|
||||
wg.Add(1)
|
||||
go tcpDo(ctx, &tcpConfig{
|
||||
Endpoint: endpoint,
|
||||
Address: endpoint.Addr,
|
||||
Endpoint: endpoint.Epnt,
|
||||
NewDialer: config.NewDialer,
|
||||
Out: tcpconnch,
|
||||
Wg: wg,
|
||||
|
|
@ -93,7 +98,7 @@ Loop:
|
|||
for {
|
||||
select {
|
||||
case tcpconn := <-tcpconnch:
|
||||
cresp.TCPConnect[tcpconn.Endpoint] = tcpconn.Result
|
||||
cresp.TCPConnect[tcpconn.Endpoint] = tcpconn.TCP
|
||||
default:
|
||||
break Loop
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue