-
Notifications
You must be signed in to change notification settings - Fork 15
/
trace.go
74 lines (56 loc) · 3.01 KB
/
trace.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package dslvm
import (
"time"
"github.com/ooni/probe-engine/pkg/model"
)
// Trace collects [*Observations] using tracing. Specific implementations
// of this interface may be engineered to collect no [*Observations] for
// efficiency (i.e., when you don't care about collecting [*Observations]
// but you still want to use this package).
type Trace interface {
// CloneBytesReceivedMap returns a clone of the internal bytes received map. The key of the
// map is a string following the "EPNT_ADDRESS PROTO" pattern where the "EPNT_ADDRESS" contains
// the endpoint address and "PROTO" is "tcp" or "udp".
CloneBytesReceivedMap() (out map[string]int64)
// DNSLookupsFromRoundTrip returns all the DNS lookup results collected so far.
DNSLookupsFromRoundTrip() (out []*model.ArchivalDNSLookupResult)
// Index returns the unique index used by this trace.
Index() int64
// NewDialerWithoutResolver is equivalent to netxlite.Netx.NewDialerWithoutResolver
// except that it returns a model.Dialer that uses this trace.
//
// Caveat: the dialer wrappers are there to implement the
// model.MeasuringNetwork interface, but they're not used by this function.
NewDialerWithoutResolver(dl model.DebugLogger, wrappers ...model.DialerWrapper) model.Dialer
// NewParallelUDPResolver returns a possibly-trace-ware parallel UDP resolver
NewParallelUDPResolver(logger model.DebugLogger, dialer model.Dialer, address string) model.Resolver
// NewQUICDialerWithoutResolver is equivalent to
// netxlite.Netx.NewQUICDialerWithoutResolver except that it returns a
// model.QUICDialer that uses this trace.
//
// Caveat: the dialer wrappers are there to implement the
// model.MeasuringNetwork interface, but they're not used by this function.
NewQUICDialerWithoutResolver(listener model.UDPListener,
dl model.DebugLogger, wrappers ...model.QUICDialerWrapper) model.QUICDialer
// NewTLSHandshakerStdlib is equivalent to netxlite.Netx.NewTLSHandshakerStdlib
// except that it returns a model.TLSHandshaker that uses this trace.
NewTLSHandshakerStdlib(dl model.DebugLogger) model.TLSHandshaker
// NetworkEvents returns all the network events collected so far.
NetworkEvents() (out []*model.ArchivalNetworkEvent)
// NewStdlibResolver returns a possibly-trace-ware system resolver.
NewStdlibResolver(logger model.DebugLogger) model.Resolver
// NewUDPListener implements model.MeasuringNetwork.
NewUDPListener() model.UDPListener
// QUICHandshakes collects all the QUIC handshake results collected so far.
QUICHandshakes() (out []*model.ArchivalTLSOrQUICHandshakeResult)
// TCPConnects collects all the TCP connect results collected so far.
TCPConnects() (out []*model.ArchivalTCPConnectResult)
// TLSHandshakes collects all the TLS handshake results collected so far.
TLSHandshakes() (out []*model.ArchivalTLSOrQUICHandshakeResult)
// Tags returns the trace tags.
Tags() []string
// TimeSince is equivalent to Trace.TimeNow().Sub(t0).
TimeSince(t0 time.Time) time.Duration
// ZeroTime returns the "zero" time of this trace.
ZeroTime() time.Time
}