Documentation
¶
Overview ¶
Package netx contains OONI's net extensions.
This package provides a replacement for net.Dialer that can Dial, DialContext, and DialTLS. During its lifecycle this modified Dialer will emit network level events on a channel.
⚠️: This package is not maintained anymore. Use github.com/ooni/probe-engine/netx as a drop-in replacement for github.com/ooni/netx.
Index ¶
- func ChainResolvers(primary, secondary modelx.DNSResolver) modelx.DNSResolver
- func NewResolver(handler modelx.Handler, network, address string) (modelx.DNSResolver, error)
- func NewResolverWithoutHandler(network, address string) (modelx.DNSResolver, error)
- type Dialer
- func (d *Dialer) ConfigureDNS(network, address string) error
- func (d *Dialer) Dial(network, address string) (net.Conn, error)
- func (d *Dialer) DialContext(ctx context.Context, network, address string) (net.Conn, error)
- func (d *Dialer) DialTLS(network, address string) (conn net.Conn, err error)
- func (d *Dialer) DialTLSContext(ctx context.Context, network, address string) (net.Conn, error)
- func (d *Dialer) ForceSkipVerify() error
- func (d *Dialer) ForceSpecificSNI(sni string) error
- func (d *Dialer) NewResolver(network, address string) (modelx.DNSResolver, error)
- func (d *Dialer) SetCABundle(path string) error
- func (d *Dialer) SetResolver(r modelx.DNSResolver)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ChainResolvers ¶
func ChainResolvers(primary, secondary modelx.DNSResolver) modelx.DNSResolver
ChainResolvers chains a primary and a secondary resolver such that we can fallback to the secondary if primary is broken.
func NewResolver ¶
NewResolver is a standalone Dialer.NewResolver
func NewResolverWithoutHandler ¶
func NewResolverWithoutHandler(network, address string) (modelx.DNSResolver, error)
NewResolverWithoutHandler creates a standalone Resolver
Types ¶
type Dialer ¶
type Dialer struct {
// contains filtered or unexported fields
}
Dialer performs measurements while dialing.
func NewDialerWithoutHandler ¶
func NewDialerWithoutHandler() *Dialer
NewDialerWithoutHandler returns a new Dialer instance.
func (*Dialer) ConfigureDNS ¶
ConfigureDNS configures the DNS resolver. The network argument selects the type of resolver. The address argument indicates the resolver address and depends on the network.
This functionality is not goroutine safe. You should only change the DNS settings before starting to use the Dialer.
The following is a list of all the possible network values:
- "": behaves exactly like "system"
- "system": this indicates that Go should use the system resolver and prevents us from seeing any DNS packet. The value of the address parameter is ignored when using "system". If you do not ConfigureDNS, this is the default resolver used.
- "udp": indicates that we should send queries using UDP. In this case the address is a host, port UDP endpoint.
- "tcp": like "udp" but we use TCP.
- "dot": we use DNS over TLS (DoT). In this case the address is the domain name of the DoT server.
- "doh": we use DNS over HTTPS (DoH). In this case the address is the URL of the DoH server.
For example:
d.ConfigureDNS("system", "")
d.ConfigureDNS("udp", "8.8.8.8:53")
d.ConfigureDNS("tcp", "8.8.8.8:53")
d.ConfigureDNS("dot", "dns.quad9.net")
d.ConfigureDNS("doh", "https://cloudflare-dns.com/dns-query")
func (*Dialer) DialContext ¶
DialContext is like Dial but the context allows to interrupt a pending connection attempt at any time.
func (*Dialer) DialTLSContext ¶
DialTLSContext is like DialTLS, but with context
func (*Dialer) ForceSkipVerify ¶
ForceSkipVerify forces to skip certificate verification
func (*Dialer) ForceSpecificSNI ¶
ForceSpecificSNI forces using a specific SNI.
func (*Dialer) NewResolver ¶
func (d *Dialer) NewResolver(network, address string) (modelx.DNSResolver, error)
NewResolver returns a new resolver using the same handler of this Dialer. The arguments have the same meaning of ConfigureDNS. The returned resolver will not be used by this Dialer, and will not use this Dialer as well. The fact that it's a method of Dialer rather than an independent method is an historical oddity. There is also a standalone NewResolver factory and you should probably use it.
func (*Dialer) SetCABundle ¶
SetCABundle configures the dialer to use a specific CA bundle. This function is not goroutine safe. Make sure you call it before starting to use this specific dialer.
func (*Dialer) SetResolver ¶
func (d *Dialer) SetResolver(r modelx.DNSResolver)
SetResolver is a more flexible way of configuring a resolver that should perhaps be used instead of ConfigureDNS.
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
dnslookup
command
dnslookup performs a DNS lookup.
|
dnslookup performs a DNS lookup. |
|
httpdo
command
httpdo performs a HTTP request
|
httpdo performs a HTTP request |
|
tlsconnect
command
tlsconnect performs a TLS connect.
|
tlsconnect performs a TLS connect. |
|
Package handlers contains default modelx.Handler handlers.
|
Package handlers contains default modelx.Handler handlers. |
|
Package httpx contains OONI's net/http extensions.
|
Package httpx contains OONI's net/http extensions. |
|
Package internal contains internal code.
|
Package internal contains internal code. |
|
connid
Package connid contains code to generate the connectionID
|
Package connid contains code to generate the connectionID |
|
dialer
Package dialer contains the dialer's API.
|
Package dialer contains the dialer's API. |
|
dialer/connx
Package connx contains net.Conn extensions
|
Package connx contains net.Conn extensions |
|
dialer/dialerbase
Package dialerbase contains the base dialer functionality.
|
Package dialerbase contains the base dialer functionality. |
|
dialer/dnsdialer
Package dnsdialer contains a dialer with DNS lookups.
|
Package dnsdialer contains a dialer with DNS lookups. |
|
dialer/tlsdialer
Package tlsdialer contains the TLS dialer
|
Package tlsdialer contains the TLS dialer |
|
errwrapper
Package errwrapper contains our error wrapper
|
Package errwrapper contains our error wrapper |
|
httptransport
Package httptransport contains HTTP transport extensions.
|
Package httptransport contains HTTP transport extensions. |
|
httptransport/bodytracer
Package bodytracer contains the HTTP body tracer.
|
Package bodytracer contains the HTTP body tracer. |
|
httptransport/tracetripper
Package tracetripper contains the tracing round tripper
|
Package tracetripper contains the tracing round tripper |
|
httptransport/transactioner
Package transactioner contains the transaction assigning round tripper
|
Package transactioner contains the transaction assigning round tripper |
|
resolver
Package resolver contains code to create a resolver
|
Package resolver contains code to create a resolver |
|
resolver/bogondetector
Package bogondetector contains code to determine if an IP is private/bogon.
|
Package bogondetector contains code to determine if an IP is private/bogon. |
|
resolver/brokenresolver
Package brokenresolver is a broken resolver
|
Package brokenresolver is a broken resolver |
|
resolver/chainresolver
Package chainresolver allows to chain two resolvers
|
Package chainresolver allows to chain two resolvers |
|
resolver/dnstransport/dnsoverhttps
Package dnsoverhttps implements DNS over HTTPS.
|
Package dnsoverhttps implements DNS over HTTPS. |
|
resolver/dnstransport/dnsovertcp
Package dnsovertcp implements DNS over TCP.
|
Package dnsovertcp implements DNS over TCP. |
|
resolver/dnstransport/dnsoverudp
Package dnsoverudp implements DNS over UDP.
|
Package dnsoverudp implements DNS over UDP. |
|
resolver/ooniresolver
Package ooniresolver is OONI's DNS resolver.
|
Package ooniresolver is OONI's DNS resolver. |
|
resolver/parentresolver
Package parentresolver contains the parent resolver
|
Package parentresolver contains the parent resolver |
|
resolver/systemresolver
Package systemresolver contains the system resolver
|
Package systemresolver contains the system resolver |
|
transactionid
Package transactionid contains code to share the transactionID
|
Package transactionid contains code to share the transactionID |
|
Package modelx contains the data modelx.
|
Package modelx contains the data modelx. |
|
x
|
|
|
logger
Package logger is a handler that emits logs.
|
Package logger is a handler that emits logs. |
|
porcelain
Package porcelain contains useful high level functionality.
|
Package porcelain contains useful high level functionality. |