openvpn

package
v3.24.0-alpha Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Overview

Package openvpn contains a generic openvpn experiment.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInputRequired = targetloading.ErrInputRequired
	ErrInvalidInput  = targetloading.ErrInvalidInput
)
View Source
var (
	// AuthCertificate is used for providers that authenticate clients via certificates.
	AuthCertificate = AuthMethod("cert")

	// AuthUserPass is used for providers that authenticate clients via username (or token) and password.
	AuthUserPass = AuthMethod("userpass")
)
View Source
var APIEnabledProviders = []string{
	"riseupvpn",
	"oonivpn",
}

APIEnabledProviders is the list of providers that the stable API Endpoint and/or this experiment knows about.

View Source
var (
	ErrInvalidInputType = targetloading.ErrInvalidInputType
)

Functions

func NewExperimentMeasurer

func NewExperimentMeasurer() model.ExperimentMeasurer

NewExperimentMeasurer creates a new ExperimentMeasurer.

func NewLoader

func NewLoader(loader *targetloading.Loader, gopts any) model.ExperimentTargetLoader

NewLoader constructs a new model.ExperimentTargerLoader instance.

This function PANICS if options is not an instance of *openvpn.Config.

func TimestampsFromHandshake

func TimestampsFromHandshake(events []*vpntracex.Event) (float64, float64, float64)

TimestampsFromHandshake returns the t0, t and duration of the handshake events. If the passed events are a zero-len array, all of the results will be zero.

Types

type AuthMethod

type AuthMethod string

AuthMethod is the authentication method used by a provider.

type Config

type Config struct {
	Auth        string `ooni:"OpenVPN authentication to use"`
	Cipher      string `ooni:"OpenVPN cipher to use"`
	Compress    string `ooni:"OpenVPN compression to use"`
	Provider    string `ooni:"VPN provider"`
	Obfuscation string `ooni:"Obfuscation to use (obfs4, none)"`
	SafeKey     string `ooni:"key to connect to the OpenVPN endpoint"`
	SafeCert    string `ooni:"cert to connect to the OpenVPN endpoint"`
	SafeCA      string `ooni:"ca to connect to the OpenVPN endpoint"`
}

Config contains the experiment config.

This contains all the settings that user can set to modify the behaviour of this experiment. By tagging these variables with `ooni:"..."`, we allow miniooni's -O flag to find them and set them. TODO(ainghazal): do pass Auth, Cipher and Compress to OpenVPN config options.

type Measurer

type Measurer struct{}

Measurer performs the measurement.

func (*Measurer) ExperimentName

func (m *Measurer) ExperimentName() string

ExperimentName implements model.ExperimentMeasurer.ExperimentName.

func (*Measurer) ExperimentVersion

func (m *Measurer) ExperimentVersion() string

ExperimentVersion implements model.ExperimentMeasurer.ExperimentVersion.

func (*Measurer) Run

func (m *Measurer) Run(ctx context.Context, args *model.ExperimentArgs) error

Run implements model.ExperimentMeasurer.Run. A single run expects exactly ONE input (endpoint), but we can modify whether to test different transports by settings options.

type SingleConnection

type SingleConnection struct {
	BootstrapTime    float64
	TCPConnect       *model.ArchivalTCPConnectResult       `json:"tcp_connect,omitempty"`
	OpenVPNHandshake *model.ArchivalOpenVPNHandshakeResult `json:"openvpn_handshake"`
	NetworkEvents    []*vpntracex.Event                    `json:"network_events"`
}

SingleConnection contains the results of a single handshake.

type Target

type Target struct {
	// Config contains the configuration.
	Config *Config

	// URL is the input URL.
	URL string
}

Target is a richer-input target that this experiment should measure.

func (*Target) Category

func (t *Target) Category() string

Category implements model.ExperimentTarget.

func (*Target) Country

func (t *Target) Country() string

Country implements model.ExperimentTarget.

func (*Target) Input

func (t *Target) Input() string

Input implements model.ExperimentTarget.

func (*Target) Options

func (t *Target) Options() (options []string)

Options implements model.ExperimentTarget.

func (*Target) String

func (t *Target) String() string

String implements model.ExperimentTarget.

type TestKeys

type TestKeys struct {
	Success          bool                                    `json:"success"`
	NetworkEvents    []*vpntracex.Event                      `json:"network_events"`
	TCPConnect       []*model.ArchivalTCPConnectResult       `json:"tcp_connect,omitempty"`
	OpenVPNHandshake []*model.ArchivalOpenVPNHandshakeResult `json:"openvpn_handshake"`
	BootstrapTime    float64                                 `json:"bootstrap_time"`
	Tunnel           string                                  `json:"tunnel"`
	Failure          *string                                 `json:"failure"`
}

TestKeys contains the experiment's result.

func NewTestKeys

func NewTestKeys() *TestKeys

NewTestKeys creates new openvpn TestKeys.

func (*TestKeys) AddConnectionTestKeys

func (tk *TestKeys) AddConnectionTestKeys(result *SingleConnection)

AddConnectionTestKeys adds the result of a single OpenVPN connection attempt to the corresponding array in the TestKeys object.

func (*TestKeys) AllConnectionsSuccessful

func (tk *TestKeys) AllConnectionsSuccessful() bool

AllConnectionsSuccessful returns true if all the registered handshakes have nil failures.

Jump to

Keyboard shortcuts

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