Documentation ¶
Index ¶
- Constants
- func InitDefaultConfig(home string) (*config.Config, error)
- func MaybeInitializeHome(home string) error
- type Probe
- func (p *Probe) Config() *config.Config
- func (p *Probe) DB() db.Session
- func (p *Probe) Home() string
- func (p *Probe) Init(softwareName, softwareVersion string) error
- func (p *Probe) IsBatch() bool
- func (p *Probe) IsTerminated() bool
- func (p *Probe) ListenForSignals()
- func (p *Probe) MaybeListenForStdinClosed()
- func (p *Probe) NewProbeEngine(ctx context.Context, runType model.RunType) (ProbeEngine, error)
- func (p *Probe) NewSession(ctx context.Context, runType model.RunType) (*engine.Session, error)
- func (p *Probe) SetIsBatch(v bool)
- func (p *Probe) TempDir() string
- func (p *Probe) Terminate()
- type ProbeCLI
- type ProbeEngine
Constants ¶
const DefaultSoftwareName = "ooniprobe-cli"
DefaultSoftwareName is the default software name.
Variables ¶
This section is empty.
Functions ¶
func InitDefaultConfig ¶
InitDefaultConfig reads the config from common locations or creates it if missing.
func MaybeInitializeHome ¶
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 (*Probe) IsTerminated ¶
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 ¶
NewProbeEngine creates a new ProbeEngine instance.
func (*Probe) NewSession ¶
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().