Documentation ¶
Index ¶
- func ContextExperimentByteCounter(ctx context.Context) *bytecounter.Counter
- func ContextProxyURL(ctx context.Context) *url.URL
- func ContextSessionByteCounter(ctx context.Context) *bytecounter.Counter
- func ReduceErrors(errorslist []error) error
- func WithExperimentByteCounter(ctx context.Context, counter *bytecounter.Counter) context.Context
- func WithProxyURL(ctx context.Context, url *url.URL) context.Context
- func WithSessionByteCounter(ctx context.Context, counter *bytecounter.Counter) context.Context
- type ByteCounterDialer
- type DNSDialer
- type Dialer
- type EmitterConn
- type EmitterDialer
- type EmitterTLSHandshaker
- type ErrorWrapperConn
- type ErrorWrapperDialer
- type ErrorWrapperTLSHandshaker
- type Logger
- type LoggingDialer
- type LoggingTLSHandshaker
- type ProxyDialer
- type Resolver
- type SaverConnDialer
- type SaverDialer
- type SaverTLSHandshaker
- type ShapingDialer
- type SystemTLSHandshaker
- type TLSDialer
- type TLSHandshaker
- type TimeoutDialer
- type TimeoutTLSHandshaker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContextExperimentByteCounter ¶
func ContextExperimentByteCounter(ctx context.Context) *bytecounter.Counter
ContextExperimentByteCounter retrieves the experiment byte counter from the context
func ContextProxyURL ¶
ContextProxyURL retrieves the proxy URL from the context. This is mainly used to force a tunnel when we fail contacting OONI probe services otherwise.
func ContextSessionByteCounter ¶
func ContextSessionByteCounter(ctx context.Context) *bytecounter.Counter
ContextSessionByteCounter retrieves the session byte counter from the context
func ReduceErrors ¶
ReduceErrors finds a known error in a list of errors since it's probably most relevant
func WithExperimentByteCounter ¶
WithExperimentByteCounter assigns the experiment byte counter to the context
func WithProxyURL ¶
WithProxyURL assigns the proxy URL to the context
func WithSessionByteCounter ¶
WithSessionByteCounter assigns the session byte counter to the context
Types ¶
type ByteCounterDialer ¶
type ByteCounterDialer struct {
Dialer
}
ByteCounterDialer is a byte-counting-aware dialer. To perform byte counting, you should make sure that you insert this dialer in the dialing chain.
Bug ¶
This implementation cannot properly account for the bytes that are sent by persistent connections, because they strick to the counters set when the connection was established. This typically means we miss the bytes sent and received when submitting a measurement. Such bytes are specifically not see by the experiment specific byte counter.
For this reason, this implementation may be heavily changed/removed.
func (ByteCounterDialer) DialContext ¶
func (d ByteCounterDialer) DialContext( ctx context.Context, network, address string) (net.Conn, error)
DialContext implements Dialer.DialContext
type DNSDialer ¶
DNSDialer is a dialer that uses the configured Resolver to resolver a domain name to IP addresses, and the configured Dialer to connect.
func (DNSDialer) DialContext ¶
DialContext implements Dialer.DialContext.
type Dialer ¶
type Dialer interface {
DialContext(ctx context.Context, network, address string) (net.Conn, error)
}
Dialer is the interface we expect from a dialer
type EmitterConn ¶
EmitterConn is a net.Conn used to emit events
type EmitterDialer ¶
type EmitterDialer struct {
Dialer
}
EmitterDialer is a Dialer that emits events
func (EmitterDialer) DialContext ¶
DialContext implements Dialer.DialContext
type EmitterTLSHandshaker ¶
type EmitterTLSHandshaker struct {
TLSHandshaker
}
EmitterTLSHandshaker emits events using the MeasurementRoot
type ErrorWrapperConn ¶
ErrorWrapperConn is a net.Conn that performs error wrapping.
func (ErrorWrapperConn) Close ¶
func (c ErrorWrapperConn) Close() (err error)
Close implements net.Conn.Close
type ErrorWrapperDialer ¶
type ErrorWrapperDialer struct {
Dialer
}
ErrorWrapperDialer is a dialer that performs err wrapping
func (ErrorWrapperDialer) DialContext ¶
func (d ErrorWrapperDialer) DialContext(ctx context.Context, network, address string) (net.Conn, error)
DialContext implements Dialer.DialContext
type ErrorWrapperTLSHandshaker ¶
type ErrorWrapperTLSHandshaker struct {
TLSHandshaker
}
ErrorWrapperTLSHandshaker wraps the returned error to be an OONI error
type LoggingDialer ¶
LoggingDialer is a Dialer with logging
func (LoggingDialer) DialContext ¶
DialContext implements Dialer.DialContext
type LoggingTLSHandshaker ¶
type LoggingTLSHandshaker struct { TLSHandshaker Logger Logger }
LoggingTLSHandshaker is a TLSHandshaker with logging
type ProxyDialer ¶
ProxyDialer is a dialer that uses a proxy. If the ProxyURL is not configured, this dialer is a passthrough for the next Dialer in chain. Otherwise, it will internally create a SOCKS5 dialer that will connect to the proxy using the underlying Dialer.
As a special case, you can force a proxy to be used only extemporarily. To this end, you can use the WithProxyURL function, to store the proxy URL in the context. This will take precedence over any otherwise configured proxy. The use case for this functionality is when you need a tunnel to contact OONI probe services.
func (ProxyDialer) DialContext ¶
DialContext implements Dialer.DialContext
type Resolver ¶
type Resolver interface {
LookupHost(ctx context.Context, hostname string) (addrs []string, err error)
}
Resolver is the interface we expect from a resolver
type SaverConnDialer ¶
SaverConnDialer wraps the returned connection such that we collect all the read/write events that occur.
func (SaverConnDialer) DialContext ¶
func (d SaverConnDialer) DialContext(ctx context.Context, network, address string) (net.Conn, error)
DialContext implements Dialer.DialContext
type SaverDialer ¶
SaverDialer saves events occurring during the dial
func (SaverDialer) DialContext ¶
DialContext implements Dialer.DialContext
type SaverTLSHandshaker ¶
type SaverTLSHandshaker struct { TLSHandshaker Saver *trace.Saver }
SaverTLSHandshaker saves events occurring during the handshake
type ShapingDialer ¶
type ShapingDialer struct {
Dialer
}
ShapingDialer ensures we don't use too much bandwidth when using integration tests at GitHub. To select the implementation with shaping use `-tags shaping`.
func (ShapingDialer) DialContext ¶
DialContext implements Dialer.DialContext
type SystemTLSHandshaker ¶
type SystemTLSHandshaker struct{}
SystemTLSHandshaker is the system TLS handshaker.
type TLSDialer ¶
type TLSDialer struct { Config *tls.Config Dialer Dialer TLSHandshaker TLSHandshaker }
TLSDialer is the TLS dialer
type TLSHandshaker ¶
type TLSHandshaker interface { Handshake(ctx context.Context, conn net.Conn, config *tls.Config) ( net.Conn, tls.ConnectionState, error) }
TLSHandshaker is the generic TLS handshaker
type TimeoutDialer ¶
TimeoutDialer is a Dialer that enforces a timeout
func (TimeoutDialer) DialContext ¶
DialContext implements Dialer.DialContext
type TimeoutTLSHandshaker ¶
type TimeoutTLSHandshaker struct { TLSHandshaker HandshakeTimeout time.Duration // default: 10 second }
TimeoutTLSHandshaker is a TLSHandshaker with timeout