Documentation ¶
Index ¶
- type BaseOnionService
- func (s *BaseOnionService) Broadcast(message []byte, capability tapir.Capability) error
- func (s *BaseOnionService) Connect(hostname string, app tapir.Application) (bool, error)
- func (s *BaseOnionService) GetConnection(hostname string) (tapir.Connection, error)
- func (s *BaseOnionService) Init(acn connectivity.ACN, sk ed25519.PrivateKey, id *primitives.Identity)
- func (s *BaseOnionService) Listen(app tapir.Application) error
- func (s *BaseOnionService) Metrics() tapir.ServiceMetrics
- func (s *BaseOnionService) SetPort(port int)
- func (s *BaseOnionService) Shutdown()
- func (s *BaseOnionService) WaitForCapabilityOrClose(cid string, name tapir.Capability) (tapir.Connection, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseOnionService ¶
type BaseOnionService struct {
// contains filtered or unexported fields
}
BaseOnionService is a concrete implementation of the service interface over Tor onion services.
func (*BaseOnionService) Broadcast ¶
func (s *BaseOnionService) Broadcast(message []byte, capability tapir.Capability) error
Broadcast sends a message to all connections who possess the given capability
func (*BaseOnionService) Connect ¶
func (s *BaseOnionService) Connect(hostname string, app tapir.Application) (bool, error)
Connect initializes a new outbound connection to the given peer, using the defined Application
func (*BaseOnionService) GetConnection ¶
func (s *BaseOnionService) GetConnection(hostname string) (tapir.Connection, error)
GetConnection returns a connection for a given hostname.
func (*BaseOnionService) Init ¶
func (s *BaseOnionService) Init(acn connectivity.ACN, sk ed25519.PrivateKey, id *primitives.Identity)
Init initializes a BaseOnionService with a given private key and identity The private key is needed to initialize the Onion listen socket, ideally we could just pass an Identity in here.
func (*BaseOnionService) Listen ¶
func (s *BaseOnionService) Listen(app tapir.Application) error
Listen starts a blocking routine that waits for incoming connections and initializes connections with them based on the given Application.
func (*BaseOnionService) Metrics ¶
func (s *BaseOnionService) Metrics() tapir.ServiceMetrics
Metrics provides a report of useful information about the status of the service e.g. the number of active connections
func (*BaseOnionService) SetPort ¶ added in v0.3.2
func (s *BaseOnionService) SetPort(port int)
SetPort configures the port that the service uses.
func (*BaseOnionService) Shutdown ¶
func (s *BaseOnionService) Shutdown()
Shutdown closes the service and ensures that any connections are closed.
func (*BaseOnionService) WaitForCapabilityOrClose ¶
func (s *BaseOnionService) WaitForCapabilityOrClose(cid string, name tapir.Capability) (tapir.Connection, error)
WaitForCapabilityOrClose blocks until the connection has the given capability or the underlying connection is closed (through error or user action)