enginenetx

package
v3.23.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 8, 2024 License: GPL-3.0 Imports: 24 Imported by: 0

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) Close

func (n *Network) Close() error

Close ensures that we close idle connections and persist statistics.

func (*Network) HTTPTransport

func (n *Network) HTTPTransport() model.HTTPTransport

HTTPTransport returns the underlying model.HTTPTransport.

func (*Network) NewHTTPClient

func (n *Network) NewHTTPClient() *http.Client

NewHTTPClient is a convenience function for building an *http.Client using the underlying model.HTTPTransport and the correct cookies configuration.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL