ooni

package
v0.0.0-...-bd88772 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2021 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitDefaultConfig

func InitDefaultConfig(home string) (*config.Config, error)

InitDefaultConfig reads the config from common locations or creates it if missing.

func MaybeInitializeHome

func MaybeInitializeHome(home string) error

MaybeInitializeHome does the setup for a new OONI Home

Types

type Probe

type Probe struct {
	// contains filtered or unexported fields
}

Probe contains the ooniprobe CLI context.

func NewProbe

func NewProbe(configPath string, homePath string) *Probe

NewProbe creates a new probe instance.

func (*Probe) Config

func (p *Probe) Config() *config.Config

Config returns the configuration

func (*Probe) DB

func (p *Probe) DB() sqlbuilder.Database

DB returns the database we're using

func (*Probe) Home

func (p *Probe) Home() string

Home returns the home directory.

func (*Probe) Init

func (p *Probe) Init(softwareName, softwareVersion string) error

Init the OONI manager

func (*Probe) IsBatch

func (p *Probe) IsBatch() bool

IsBatch returns whether we're running in batch mode.

func (*Probe) IsTerminated

func (p *Probe) IsTerminated() bool

IsTerminated checks to see if the isTerminatedAtomicInt is set to a non zero value and therefore we have received the signal to shutdown the running test

func (*Probe) ListenForSignals

func (p *Probe) ListenForSignals()

ListenForSignals will listen for SIGINT and SIGTERM. When it receives those signals it will set isTerminatedAtomicInt to non-zero, which will cleanly shutdown the test logic.

TODO refactor this to use a cancellable context.Context instead of a bool flag, probably as part of: https://github.com/ooni/probe-cli/issues/45

func (*Probe) MaybeListenForStdinClosed

func (p *Probe) MaybeListenForStdinClosed()

MaybeListenForStdinClosed will treat any error on stdin just like SIGTERM if and only if

os.Getenv("OONI_STDIN_EOF_IMPLIES_SIGTERM") == "true"

When this feature is enabled, a collateral effect is that we swallow whatever is passed to us on the standard input.

See https://github.com/ooni/probe-cli/pull/111 for more info regarding the design of this functionality.

TODO refactor this to use a cancellable context.Context instead of a bool flag, probably as part of: https://github.com/ooni/probe-cli/issues/45

func (*Probe) NewProbeEngine

func (p *Probe) NewProbeEngine(ctx context.Context) (ProbeEngine, error)

NewProbeEngine creates a new ProbeEngine instance.

func (*Probe) NewSession

func (p *Probe) NewSession(ctx context.Context) (*engine.Session, error)

NewSession creates a new ooni/probe-engine session using the current configuration inside the context. The caller must close the session when done using it, by calling sess.Close().

func (*Probe) SetIsBatch

func (p *Probe) SetIsBatch(v bool)

SetIsBatch sets the value of isBatch.

func (*Probe) TempDir

func (p *Probe) TempDir() string

TempDir returns the temporary directory.

func (*Probe) Terminate

func (p *Probe) Terminate()

Terminate interrupts the running context

type ProbeCLI

type ProbeCLI interface {
	Config() *config.Config
	DB() sqlbuilder.Database
	IsBatch() bool
	Home() string
	TempDir() string
	NewProbeEngine(ctx context.Context) (ProbeEngine, error)
}

ProbeCLI is the OONI Probe CLI context.

type ProbeEngine

type ProbeEngine interface {
	Close() error
	MaybeLookupLocation() error
	ProbeASNString() string
	ProbeCC() string
	ProbeIP() string
	ProbeNetworkName() string
}

ProbeEngine is an instance of the OONI Probe engine.

Jump to

Keyboard shortcuts

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