services

package
v0.0.0-...-465a192 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2024 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Package prifi-sda-service contains the SDA service responsible for starting the SDA protocols required to enable PriFi communications.

Index

Constants

View Source
const DELAY_BEFORE_CONNECT_TO_RELAY = 5 * time.Second

Delay before each host re-tried to connect to the relay

View Source
const DELAY_BEFORE_CONNECT_TO_TRUSTEES = 30 * time.Second

Delay before the relay re-tried to connect to the trustees

View Source
const ServiceName = "PriFiService"

The name of the service, used by SDA's internals

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnectionRequest

type ConnectionRequest struct {
	ProtocolVersion string
}

ConnectionRequest messages are sent to the relay by nodes that want to join the protocol.

type DisconnectionRequest

type DisconnectionRequest struct{}

DisconnectionRequest messages are sent to the relay by nodes that want to leave the protocol.

type HelloMsg

type HelloMsg struct{}

HelloMsg messages are sent by the relay to the trustee; if they are up, they answer with a ConnectionRequest

type ServiceState

type ServiceState struct {
	// We need to embed the ServiceProcessor, so that incoming messages
	// are correctly handled.
	*onet.ServiceProcessor

	Storage *Storage

	//If true, when the number of participants is reached, the protocol starts without calling StartPriFiCommunicateProtocol
	AutoStart bool

	//this hold the running protocol (when it runs)
	PriFiSDAProtocol *prifi_protocol.PriFiSDAProtocol
	// contains filtered or unexported fields
}

Service contains the state of the service

func (*ServiceState) CountParticipants

func (s *ServiceState) CountParticipants() (int, int)

CountParticipants returns ntrustees, nclients already connected

func (*ServiceState) GlobalShutDownSocks

func (s *ServiceState) GlobalShutDownSocks() error

CleanResources kill all goroutines on all services

func (*ServiceState) HandleConnection

func (s *ServiceState) HandleConnection(msg *network.Envelope) error

Packet received by relay when some node connects

func (*ServiceState) HandleDisconnection

func (s *ServiceState) HandleDisconnection(msg *network.Envelope) error

Packet send by relay when some node disconnected

func (*ServiceState) HandleHelloMsg

func (s *ServiceState) HandleHelloMsg(msg *network.Envelope) error

Packet send by relay to trustees at start

func (*ServiceState) HandleStop

func (s *ServiceState) HandleStop(msg *network.Envelope) error

Packet send by relay; when we get it, we stop the protocol

func (*ServiceState) HandleStopSOCKS

func (s *ServiceState) HandleStopSOCKS(msg *network.Envelope) error

Packet send by relay when some node disconnected

func (*ServiceState) HasEnoughParticipants

func (s *ServiceState) HasEnoughParticipants() bool

HasEnoughParticipants returns true iff nTrustees >= 1 & nClients >= 1

func (*ServiceState) IsPriFiProtocolRunning

func (s *ServiceState) IsPriFiProtocolRunning() bool

returns true if the PriFi SDA protocol is running (in any state : init, communicate, etc)

func (*ServiceState) NetworkErrorHappened

func (s *ServiceState) NetworkErrorHappened(si *network.ServerIdentity)

This is a handler passed to the SDA when starting a host. The SDA usually handle all the network by itself, but in our case it is useful to know when a network RESET occurred, so we can kill protocols (otherwise they remain in some weird state)

func (*ServiceState) NewProtocol

func (s *ServiceState) NewProtocol(tn *onet.TreeNodeInstance, conf *onet.GenericConfig) (onet.ProtocolInstance, error)

NewProtocol is called on all nodes of a Tree (except the root, since it is the one starting the protocol) so it's the Service that will be called to generate the PI on all others node. If you use CreateProtocolSDA, this will not be called, as the SDA will instantiate the protocol on its own. If you need more control at the instantiation of the protocol, use CreateProtocolService, and you can give some extra-configuration to your protocol in here.

func (*ServiceState) RelayAllowAutoStart

func (s *ServiceState) RelayAllowAutoStart()

Give the churnHandler the capacity to start the protocol by itself

func (*ServiceState) SetConfigFromToml

func (s *ServiceState) SetConfigFromToml(config *prifi_protocol.PrifiTomlConfig)

Set the config, from the prifi.toml. Is called by sda/app.

func (*ServiceState) ShutdownSocks

func (s *ServiceState) ShutdownSocks() error

CleanResources kill all goroutines related to SOCKS on this service

func (*ServiceState) StartClient

func (s *ServiceState) StartClient(group *app.Group, delay time.Duration) error

StartClient starts the necessary protocols to enable the client-mode.

func (*ServiceState) StartPriFiCommunicateProtocol

func (s *ServiceState) StartPriFiCommunicateProtocol()

startPriFi starts a PriFi protocol. It is called by the relay as soon as enough participants are ready (one trustee and two clients).

func (*ServiceState) StartRelay

func (s *ServiceState) StartRelay(group *app.Group) error

StartRelay starts the necessary protocols to enable the relay-mode. In this example it simply starts the demo protocol

func (*ServiceState) StartSocksTunnelOnly

func (s *ServiceState) StartSocksTunnelOnly() error

StartClient starts the necessary protocols to enable the client-mode.

func (*ServiceState) StartTrustee

func (s *ServiceState) StartTrustee(group *app.Group) error

StartTrustee starts the necessary protocols to enable the trustee-mode.

func (*ServiceState) StopPriFiCommunicateProtocol

func (s *ServiceState) StopPriFiCommunicateProtocol()

stopPriFi stops the PriFi protocol currently running.

type StopProtocol

type StopProtocol struct{}

Packet send by relay when some node disconnected

type StopSOCKS

type StopSOCKS struct{}

Packet send by relay doing simulations to stop the SOCKS stuff

type Storage

type Storage struct {
}

Storage will be saved, on the contrary of the 'Service'-structure which has per-service information stored.

Jump to

Keyboard shortcuts

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