onion

package
v0.0.0-...-a096643 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2020 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

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

Controller represents a tor controller, it is essentially a wrapper over Bine

func NewController

func NewController(address, controlPortPassword string) (*Controller, error)

NewController constructs a new controller

func (*Controller) Close

func (c *Controller) Close() error

Close closes the underlining controller connection

func (*Controller) FetchHiddenServiceDescriptor

func (c *Controller) FetchHiddenServiceDescriptor(address, server string, ctx context.Context) (*descriptor.HiddenServiceDescriptor, error)

FetchHiddenServiceDescriptor returns a hidden service descriptor for the requested address

func (*Controller) FetchRouterStatusEntries

func (c *Controller) FetchRouterStatusEntries() ([]descriptor.RouterStatusEntry, error)

FetchRouterStatusEntries requests the router status info from the controller

func (*Controller) GetConn

func (c *Controller) GetConn() *control.Conn

GetConn returns the underlining controller connection

func (*Controller) PostHiddenServiceDescriptor

func (c *Controller) PostHiddenServiceDescriptor(desc string, servers []string, address string) error

PostHiddenServiceDescriptor posts a hidden service descriptor.

type HSDirFetcher

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

HSDirFetcher maintains a list of HSDirs which it gets from the consensus, the list is updated every time the controller returns an status_general event. It is used to calculate the responsible hsdirs for a given service and is safe for concurrent use.

func NewHSDirFetcher

func NewHSDirFetcher(controller IController, logger *zap.SugaredLogger) *HSDirFetcher

NewHSDirFetcher returns a new HSDirFetcher

func (*HSDirFetcher) CalculateResponsibleHSDirs

func (f *HSDirFetcher) CalculateResponsibleHSDirs(descriptorID string) ([]descriptor.RouterStatusEntry, error)

CalculateResponsibleHSDirs returns the responsible hsdirs given a descriptor ID

func (*HSDirFetcher) Start

func (f *HSDirFetcher) Start() error

Start starts the HSDirFetcher

func (*HSDirFetcher) Stop

func (f *HSDirFetcher) Stop()

Stop stops the HSDirFetcher

type IController

type IController interface {
	FetchHiddenServiceDescriptor(string, string, context.Context) (*descriptor.HiddenServiceDescriptor, error)
	PostHiddenServiceDescriptor(string, []string, string) error
	FetchRouterStatusEntries() ([]descriptor.RouterStatusEntry, error)
	GetConn() *control.Conn
}

IController is a interface for Controller

type IHSDirFetcher

type IHSDirFetcher interface {
	CalculateResponsibleHSDirs(string) ([]descriptor.RouterStatusEntry, error)
}

IHSDirFetcher is the interface for HSDirFetcher

type MockController

type MockController struct {
	ReturnedHiddenServiceDescriptor    *descriptor.HiddenServiceDescriptor
	ReturnedRouterStatusEntries        []descriptor.RouterStatusEntry
	ReturnedHiddenServiceDescriptorRaw string
	ReturnedErr                        error
	PostedDescriptors                  map[string]string
	FetchedDescriptors                 map[string]*descriptor.HiddenServiceDescriptor
	PostedDescriptor                   string
}

func (*MockController) FetchHiddenServiceDescriptor

func (m *MockController) FetchHiddenServiceDescriptor(address, server string, ctx context.Context) (
	*descriptor.HiddenServiceDescriptor, error)

func (*MockController) FetchRouterStatusEntries

func (m *MockController) FetchRouterStatusEntries() ([]descriptor.RouterStatusEntry, error)

func (*MockController) GetConn

func (m *MockController) GetConn() *control.Conn

func (*MockController) PostHiddenServiceDescriptor

func (m *MockController) PostHiddenServiceDescriptor(desc string, servers []string, address string) error

type MockHSDirFetcher

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

func (*MockHSDirFetcher) CalculateResponsibleHSDirs

func (m *MockHSDirFetcher) CalculateResponsibleHSDirs(descriptorID string) ([]descriptor.RouterStatusEntry, error)

type Onion

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

Onion represents a hidden service that will balance a number of backend services

func NewOnion

func NewOnion(controller IController, backendAddresses []string, publicKey *rsa.PublicKey, privateKey *rsa.PrivateKey, fetcher IHSDirFetcher, logger *zap.SugaredLogger, time common.ITimeProvider, publishInterval time.Duration) (*Onion, error)

NewOnion constructs a new master hidden service that will balance a set of backend services

func (*Onion) Start

func (o *Onion) Start(interval time.Duration) error

Start starts the onion service ticker

func (*Onion) Stop

func (o *Onion) Stop()

Stop stops the onion service ticker

Jump to

Keyboard shortcuts

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