Documentation ¶
Overview ¶
Package enginenetx contains engine-specific network-extensions.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Network ¶
type Network struct {
// contains filtered or unexported fields
}
Network is the network abstraction used by the OONI engine.
The zero value is invalid; construct using the NewNetwork func.
func NewNetwork ¶
func NewNetwork( counter *bytecounter.Counter, kvStore model.KeyValueStore, logger model.Logger, proxyURL *url.URL, resolver model.Resolver, ) *Network
NewNetwork creates a new *Network for the engine. This network MUST NOT be used for measuring because it implements engine-specific policies.
You MUST call the Close method when done using the network. This method ensures that (i) we close idle connections and (ii) persist statistics.
Arguments:
- counter is the *bytecounter.Counter to use;
- kvStore is a model.KeyValueStore for persisting stats;
- logger is the model.Logger to use;
- proxyURL is the OPTIONAL proxy URL;
- resolver is the model.Resolver to use.
The presence of the proxyURL MAY cause this function to possibly build a network with different behavior with respect to circumvention. If there is an upstream proxy we're going to trust it is doing circumvention for us.
func (*Network) HTTPTransport ¶
func (n *Network) HTTPTransport() model.HTTPTransport
HTTPTransport returns the underlying model.HTTPTransport.
func (*Network) NewHTTPClient ¶
NewHTTPClient is a convenience function for building an *http.Client using the underlying model.HTTPTransport and the correct cookies configuration.