torconfig

package
v0.0.0-...-15325b8 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2020 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package torconfig manages tor configuration options and serialization.

Index

Constants

This section is empty.

Variables

View Source
var ErrTorrcMissingArguments = errors.New("expected arguments in torrc config line")

ErrTorrcMissingArguments occurs if the parser finds a config line without arguments. Expect to see a keyword followed by one or more arguments.

Functions

This section is empty.

Types

type Config

type Config struct {
	Nickname         string
	IP               net.IP // Relay public IP
	ORBindIP         net.IP // OR bind address
	ORPort           uint16
	Platform         string
	Contact          string
	BandwidthAverage int
	BandwidthBurst   int
	Keys             *Keys
	Data             Data
}

Config encapsulates configuration options for a Tor relay.

func ParseTorrc

func ParseTorrc(r io.Reader) (*Config, error)

ParseTorrc parses Config from the given reader (in torrc format).

func ParseTorrcFile

func ParseTorrcFile(path string) (*Config, error)

ParseTorrcFile parses config from the given torrc file.

func (Config) ORBindAddr

func (c Config) ORBindAddr() string

ORBindAddr returns the address the relay should bind to.

type Data

type Data interface {
	Keys() (*Keys, error)
	SetKeys(*Keys) error
	SetServerDescriptor(*tordir.ServerDescriptor) error
}

Data is an interface to router data storage.

func NewDataDirectory

func NewDataDirectory(dir string) Data

NewDataDirectory constructs a new data directory at dir.

type Keys

type Keys struct {
	Identity *rsa.PrivateKey
	Onion    *rsa.PrivateKey
	Ntor     *torcrypto.Curve25519KeyPair
}

func GenerateKeys

func GenerateKeys() (*Keys, error)

func LoadKeysFromDirectory

func LoadKeysFromDirectory(path string) (*Keys, error)

func (*Keys) SaveToDirectory

func (k *Keys) SaveToDirectory(path string) error

type Platform

type Platform struct {
	Software string
	Version  string
	OS       string
}

Platform encapsulates a standard specification of the platform a router is using. This specifies which software it is running, the version of that software and the host OS.

func NewOfficialPlatform

func NewOfficialPlatform(version string) Platform

NewOfficialPlatform constructs a new Platform object for official Tor of the given version.

func NewPlatform

func NewPlatform(software, version, os string) Platform

NewPlatform constructs a new Platform specification.

func NewPlatformHostOS

func NewPlatformHostOS(software, version string) Platform

NewPlatformHostOS constructs a new Platform object with the operating system field set to the current host OS.

func (Platform) String

func (p Platform) String() string

String converts Platform to the standard string representation seen in server descriptors.

Jump to

Keyboard shortcuts

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