Documentation ¶
Index ¶
- type Controller
- func (c *Controller) Close() error
- func (c *Controller) FetchHiddenServiceDescriptor(address, server string, ctx context.Context) (*descriptor.HiddenServiceDescriptor, error)
- func (c *Controller) FetchRouterStatusEntries() ([]descriptor.RouterStatusEntry, error)
- func (c *Controller) GetConn() *control.Conn
- func (c *Controller) PostHiddenServiceDescriptor(desc string, servers []string, address string) error
- type HSDirFetcher
- type IController
- type IHSDirFetcher
- type MockController
- func (m *MockController) FetchHiddenServiceDescriptor(address, server string, ctx context.Context) (*descriptor.HiddenServiceDescriptor, error)
- func (m *MockController) FetchRouterStatusEntries() ([]descriptor.RouterStatusEntry, error)
- func (m *MockController) GetConn() *control.Conn
- func (m *MockController) PostHiddenServiceDescriptor(desc string, servers []string, address string) error
- type MockHSDirFetcher
- type Onion
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
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