feat(webconnectivity@v0.5): record late DNS replies (#883)
Part of https://github.com/ooni/probe/issues/2237
This commit is contained in:
parent
1a1d3126ae
commit
c3964e43b3
|
@ -249,6 +249,21 @@ func (t *DNSResolvers) lookupHostUDP(parentCtx context.Context, udpAddress strin
|
||||||
|
|
||||||
ol.Stop(err)
|
ol.Stop(err)
|
||||||
out <- addrs
|
out <- addrs
|
||||||
|
|
||||||
|
// wait for late DNS replies
|
||||||
|
t.WaitGroup.Add(1)
|
||||||
|
go t.waitForLateReplies(parentCtx, trace)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Waits for late DNS replies.
|
||||||
|
func (t *DNSResolvers) waitForLateReplies(parentCtx context.Context, trace *measurexlite.Trace) {
|
||||||
|
defer t.WaitGroup.Done()
|
||||||
|
const lateTimeout = 500 * time.Millisecond
|
||||||
|
events := trace.DelayedDNSResponseWithTimeout(parentCtx, lateTimeout)
|
||||||
|
if length := len(events); length > 0 {
|
||||||
|
t.Logger.Warnf("got %d late DNS replies", length)
|
||||||
|
}
|
||||||
|
t.TestKeys.AppendDNSLateReplies(events...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Divides queries generated by Do53 in Do53-proper queries and other queries.
|
// Divides queries generated by Do53 in Do53-proper queries and other queries.
|
||||||
|
|
|
@ -36,7 +36,7 @@ func (m *Measurer) ExperimentName() string {
|
||||||
|
|
||||||
// ExperimentVersion implements model.ExperimentMeasurer.
|
// ExperimentVersion implements model.ExperimentMeasurer.
|
||||||
func (m *Measurer) ExperimentVersion() string {
|
func (m *Measurer) ExperimentVersion() string {
|
||||||
return "0.5.0"
|
return "0.5.1"
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run implements model.ExperimentMeasurer.
|
// Run implements model.ExperimentMeasurer.
|
||||||
|
|
|
@ -30,6 +30,10 @@ type TestKeys struct {
|
||||||
// Do53 contains ancillary observations collected by Do53 resolvers.
|
// Do53 contains ancillary observations collected by Do53 resolvers.
|
||||||
Do53 *TestKeysDo53 `json:"x_do53"`
|
Do53 *TestKeysDo53 `json:"x_do53"`
|
||||||
|
|
||||||
|
// DNSLateReplies contains late replies we didn't expect to receive from
|
||||||
|
// a resolver (which may raise eyebrows if they're different).
|
||||||
|
DNSLateReplies []*model.ArchivalDNSLookupResult `json:"x_dns_late_replies"`
|
||||||
|
|
||||||
// Queries contains DNS queries.
|
// Queries contains DNS queries.
|
||||||
Queries []*model.ArchivalDNSLookupResult `json:"queries"`
|
Queries []*model.ArchivalDNSLookupResult `json:"queries"`
|
||||||
|
|
||||||
|
@ -161,6 +165,13 @@ func (tk *TestKeys) AppendNetworkEvents(v ...*model.ArchivalNetworkEvent) {
|
||||||
tk.mu.Unlock()
|
tk.mu.Unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AppendDNSLateReplies appends to DNSLateReplies.
|
||||||
|
func (tk *TestKeys) AppendDNSLateReplies(v ...*model.ArchivalDNSLookupResult) {
|
||||||
|
tk.mu.Lock()
|
||||||
|
tk.DNSLateReplies = append(tk.DNSLateReplies, v...)
|
||||||
|
tk.mu.Unlock()
|
||||||
|
}
|
||||||
|
|
||||||
// AppendQueries appends to Queries.
|
// AppendQueries appends to Queries.
|
||||||
func (tk *TestKeys) AppendQueries(v ...*model.ArchivalDNSLookupResult) {
|
func (tk *TestKeys) AppendQueries(v ...*model.ArchivalDNSLookupResult) {
|
||||||
tk.mu.Lock()
|
tk.mu.Lock()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user