feat(netxlite): implement DNSTransport wrapping (#776)
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
This commit is contained in:
parent
923d81cdee
commit
8f7e3803eb
20 changed files with 369 additions and 91 deletions
|
|
@ -51,7 +51,8 @@ type DNSOverUDPTransport struct {
|
|||
IOTimeout time.Duration
|
||||
}
|
||||
|
||||
// NewDNSOverUDPTransport creates a DNSOverUDPTransport instance.
|
||||
// NewUnwrappedDNSOverUDPTransport creates a DNSOverUDPTransport instance
|
||||
// that has not been wrapped yet.
|
||||
//
|
||||
// Arguments:
|
||||
//
|
||||
|
|
@ -64,7 +65,7 @@ type DNSOverUDPTransport struct {
|
|||
// IP addresses returned by the underlying DNS lookup performed using
|
||||
// the dialer. This usage pattern is NOT RECOMMENDED because we'll
|
||||
// have less control over which IP address is being used.
|
||||
func NewDNSOverUDPTransport(dialer model.Dialer, address string) *DNSOverUDPTransport {
|
||||
func NewUnwrappedDNSOverUDPTransport(dialer model.Dialer, address string) *DNSOverUDPTransport {
|
||||
return &DNSOverUDPTransport{
|
||||
Decoder: &DNSDecoderMiekg{},
|
||||
Dialer: dialer,
|
||||
|
|
|
|||
Loading…
Reference in a new issue