process

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 31, 2021 License: MIT Imports: 8 Imported by: 46

Documentation

Overview

Package process is the low-level abstraction for a Tor instance.

The standard use is to create a Creator with NewCreator and the path to the Tor executable. The child package 'embedded' can be used if Tor is statically linked in the binary. Most developers will prefer the tor package adjacent to this one for a higher level abstraction over the process and control port connection.

Index

Constants

This section is empty.

Variables

View Source
var ErrControlConnUnsupported = fmt.Errorf("Control conn not supported")

ErrControlConnUnsupported is returned by Process.EmbeddedControlConn when it is unsupported.

Functions

func ControlPortFromFileContents

func ControlPortFromFileContents(contents string) (int, error)

ControlPortFromFileContents reads a control port file that is written by Tor when ControlPortWriteToFile is set.

Types

type CmdCreatorFunc added in v0.2.0

type CmdCreatorFunc func(ctx context.Context, args ...string) (*exec.Cmd, error)

func (CmdCreatorFunc) New added in v0.2.0

func (c CmdCreatorFunc) New(ctx context.Context, args ...string) (Process, error)

type Creator

type Creator interface {
	New(ctx context.Context, args ...string) (Process, error)
}

Creator is the interface for process creation.

func NewCreator

func NewCreator(exePath string) Creator

NewCreator creates a Creator for external Tor process execution based on the given exe path.

type Process

type Process interface {
	// Start starts the Tor process in the background and returns. It is
	// analagous to os/exec.Cmd.Start.
	Start() error
	// Wait waits for the Tor process to exit and returns error if it was not a
	// successful exit. It is analagous to os/exec.Cmd.Wait.
	Wait() error
	// ControlConn is used for statically linked, embedded processes to create
	// a controller connection. For non-embedded processes or Tor versions that
	// don't support embedded control connections, ErrControlConnUnsupported is
	// returned. Note, this should only be called once per process before
	// Start, and the connection does not need to be closed.
	EmbeddedControlConn() (net.Conn, error)
}

Process is the interface implemented by Tor processes.

Directories

Path Synopsis
Package embedded implements process interfaces for statically linked, embedded Tor.
Package embedded implements process interfaces for statically linked, embedded Tor.
tor-0.3.3
Package tor033 implements process interfaces for statically linked Tor 0.3.3.x versions.
Package tor033 implements process interfaces for statically linked Tor 0.3.3.x versions.
tor-0.3.5
Package tor035 implements process interfaces for statically linked Tor 0.3.5.x versions.
Package tor035 implements process interfaces for statically linked Tor 0.3.5.x versions.

Jump to

Keyboard shortcuts

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