8f7e3803eb
Acknowledge that transports MAY be used in isolation (i.e., outside of a Resolver) and add support for wrapping. Ensure that every factory that creates an unwrapped type is named accordingly to hopefully ensure there are no surprises. Implement DNSTransport wrapping and use a technique similar to the one used by Dialer to customize the DNSTransport while constructing more complex data types (e.g., a specific resolver). Ensure that the stdlib resolver's own "getaddrinfo" transport (1) is wrapped and (2) could be extended during construction. This work is part of my ongoing effort to bring to this repository websteps-illustrated changes relative to netxlite. Ref issue: https://github.com/ooni/probe/issues/2096
53 lines
1.5 KiB
Go
53 lines
1.5 KiB
Go
package netxlite
|
|
|
|
//
|
|
// Names of operations
|
|
//
|
|
|
|
// Operations that we measure. They are the possible values of
|
|
// the ErrWrapper.Operation field.
|
|
const (
|
|
// ResolveOperation is the operation where we resolve a domain name.
|
|
ResolveOperation = "resolve"
|
|
|
|
// ConnectOperation is the operation where we do a TCP connect.
|
|
ConnectOperation = "connect"
|
|
|
|
// DNSRoundTripOperation is the DNS round trip.
|
|
DNSRoundTripOperation = "dns_round_trip"
|
|
|
|
// TLSHandshakeOperation is the TLS handshake.
|
|
TLSHandshakeOperation = "tls_handshake"
|
|
|
|
// QUICHandshakeOperation is the handshake to setup a QUIC connection.
|
|
QUICHandshakeOperation = "quic_handshake"
|
|
|
|
// QUICListenOperation is when we open a listening UDP conn for QUIC.
|
|
QUICListenOperation = "quic_listen"
|
|
|
|
// HTTPRoundTripOperation is the HTTP round trip.
|
|
HTTPRoundTripOperation = "http_round_trip"
|
|
|
|
// CloseOperation is when we close a socket.
|
|
CloseOperation = "close"
|
|
|
|
// ReadOperation is when we read from a socket.
|
|
ReadOperation = "read"
|
|
|
|
// WriteOperation is when we write to a socket.
|
|
WriteOperation = "write"
|
|
|
|
// ReadFromOperation is when we read from an UDP socket.
|
|
ReadFromOperation = "read_from"
|
|
|
|
// WriteToOperation is when we write to an UDP socket.
|
|
WriteToOperation = "write_to"
|
|
|
|
// UnknownOperation is when we cannot determine the operation.
|
|
UnknownOperation = "unknown"
|
|
|
|
// TopLevelOperation is used when the failure happens at top level. This
|
|
// happens for example with urlgetter with a cancelled context.
|
|
TopLevelOperation = "top_level"
|
|
)
|