tor

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2023 License: MIT Imports: 29 Imported by: 15

Documentation

Index

Constants

View Source
const V3HostnameLength = 56

V3HostnameLength is the length of a Tor V3 Onion Address (without the .onion suffix)

Variables

This section is empty.

Functions

func GetTorV3Hostname

func GetTorV3Hostname(pub ed25519.PublicKey) string

GetTorV3Hostname converts an ed25519 public key to a valid tor onion hostname

func IsValidHostname added in v1.1.1

func IsValidHostname(address string) bool

IsValidHostname returns true if the given address is a valid onion v3 address

func NewHashedPasswordAuthenticator added in v1.2.0

func NewHashedPasswordAuthenticator(password string) tor.Authenticator

NewHashedPasswordAuthenticator creates a new hashed password authenticator

func NewTorACNWithAuth added in v1.2.0

func NewTorACNWithAuth(appDirectory string, bundledTorPath string, dataDir string, controlPort int, authenticator tor.Authenticator) (connectivity.ACN, error)

NewTorACNWithAuth creates/starts a Tor ACN and returns a usable ACN object

Types

type HashedPasswordAuthenticator added in v1.2.0

type HashedPasswordAuthenticator struct {
	Password string
}

HashedPasswordAuthenticator authenticates to a Tor control port using a hashed password. Note: This method is vulnerable to replay attacks by the host system (but so is cookie auth)

func (HashedPasswordAuthenticator) Authenticate added in v1.2.0

func (h HashedPasswordAuthenticator) Authenticate(controlport *control.Conn) error

Authenticate uses the given hashed password to authenticate to the control port

type NoTorrcError added in v1.2.1

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

NoTorrcError is a typed error thrown to indicate start could not complete due to lack of a torrc file

func (*NoTorrcError) Error added in v1.2.1

func (e *NoTorrcError) Error() string

type NullAuthenticator added in v1.2.0

type NullAuthenticator struct {
}

NullAuthenticator exists to force always authenticating to a system tor.

func (NullAuthenticator) Authenticate added in v1.2.0

func (n NullAuthenticator) Authenticate(controlport *control.Conn) error

Authenticate on a NullAuthenticator always results in failure.

type TorLogLevel added in v1.8.7

type TorLogLevel string
const TorLogLevelDebug TorLogLevel = "debug"
const TorLogLevelErr TorLogLevel = "err"
const TorLogLevelInfo TorLogLevel = "info"
const TorLogLevelNotice TorLogLevel = "notice"
const TorLogLevelWarn TorLogLevel = "warn"

type TorrcBuilder added in v1.2.2

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

TorrcBuilder is a a helper for building torrc files

func NewTorrc added in v1.2.2

func NewTorrc() *TorrcBuilder

NewTorrc creates a new torrc builder

func (*TorrcBuilder) Build added in v1.2.2

func (tb *TorrcBuilder) Build(path string) error

Build finalizes the torrc contents and write a file

func (*TorrcBuilder) Preview added in v1.6.0

func (tb *TorrcBuilder) Preview() string

Preview provides a string representation of the torrc file without writing it to a file location.

func (*TorrcBuilder) UseCustom added in v1.8.7

func (tb *TorrcBuilder) UseCustom(lines []string) *TorrcBuilder

UseCustom clobbers the torrc builder and allows the client to set any option they want, while benefiting from other configuration options.

func (*TorrcBuilder) WithControlPort added in v1.2.2

func (tb *TorrcBuilder) WithControlPort(port int) *TorrcBuilder

WithControlPort sets the control port of the tor process

func (*TorrcBuilder) WithCustom added in v1.6.0

func (tb *TorrcBuilder) WithCustom(lines []string) *TorrcBuilder

WithCustom appends to the torrc builder and allows the client to set any option they want, while benefiting from other configuration options.

func (*TorrcBuilder) WithHashedPassword added in v1.2.2

func (tb *TorrcBuilder) WithHashedPassword(password string) *TorrcBuilder

WithHashedPassword sets a password for the control port.

func (*TorrcBuilder) WithLog added in v1.8.7

func (tb *TorrcBuilder) WithLog(logfile string, level TorLogLevel) *TorrcBuilder

WithLog sets the Log to file directive to the specified file with the specified log level

func (*TorrcBuilder) WithOnionTrafficOnly added in v1.2.2

func (tb *TorrcBuilder) WithOnionTrafficOnly() *TorrcBuilder

WithOnionTrafficOnly ensures that the tor process only routes tor onion traffic.

func (*TorrcBuilder) WithOwningPid added in v1.8.7

func (tb *TorrcBuilder) WithOwningPid(pid int) *TorrcBuilder

WithOwningPid adds a __OwningControllerProcess line to the config that will attempt to have tor monitor parent PID health and die when parent dies

func (*TorrcBuilder) WithSocksPort added in v1.2.2

func (tb *TorrcBuilder) WithSocksPort(port int) *TorrcBuilder

WithSocksPort sets the SOCKS port of the tor process

func (*TorrcBuilder) WithSocksTimeout added in v1.8.7

func (tb *TorrcBuilder) WithSocksTimeout(timeOutSecs int) *TorrcBuilder

WithSocksTimeout adjusts how long before a timeout error is generated trying to connect to the SOCKS port

Jump to

Keyboard shortcuts

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