server

package
v0.0.72 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2026 License: AGPL-3.0 Imports: 41 Imported by: 0

Documentation

Index

Constants

View Source
const KeepAliveInterval = 3 * time.Minute
View Source
const NumPKIDocsToFetch = 3

Variables

View Source
var (
	PublishDeadline = vServer.PublishConsensusDeadline
)

Functions

This section is empty.

Types

type Connector

type Connector struct {
	sync.RWMutex
	worker.Worker
	// contains filtered or unexported fields
}

func (*Connector) CloseAllCh

func (co *Connector) CloseAllCh() chan interface{}

func (*Connector) DispatchMessage

func (co *Connector) DispatchMessage(dest uint8, message *commands.ReplicaMessage) error

func (*Connector) ForceUpdate

func (co *Connector) ForceUpdate()

func (*Connector) Halt

func (co *Connector) Halt()

func (*Connector) OnClosedConn

func (co *Connector) OnClosedConn(c *outgoingConn)

func (*Connector) Server

func (co *Connector) Server() *Server

type Courier

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

Courier handles the CBOR plugin interface for our courier service.

func NewCourier

func NewCourier(s *Server, cmds *commands.Commands, scheme nike.Scheme) *Courier

NewCourier returns a new Courier type.

func (*Courier) CacheReply

func (e *Courier) CacheReply(reply *commands.ReplicaMessageReply)

func (*Courier) HandleReply

func (e *Courier) HandleReply(reply *commands.ReplicaMessageReply)

func (*Courier) OnCommand

func (e *Courier) OnCommand(cmd cborplugin.Command) error

OnCommand is only called when we receive queries from the client via the mixnet

func (*Courier) RegisterConsumer

func (e *Courier) RegisterConsumer(s *cborplugin.Server)

func (*Courier) SetWriteFunc

func (e *Courier) SetWriteFunc(writeFunc func(cborplugin.Command))

type CourierBookKeeping

type CourierBookKeeping struct {
	Epoch                uint64
	QueryType            uint8
	IntermediateReplicas [2]uint8 // Store the replica IDs that were contacted
	EnvelopeReplies      [2]*commands.ReplicaMessageReply
}

CourierBookKeeping is used for: 1. deduping writes 2. deduping reads 3. caching replica replies

type GenericConnector

type GenericConnector interface {
	Halt()
	Server() *Server
	OnClosedConn(conn *outgoingConn)
	CloseAllCh() chan interface{}
	ForceUpdate()

	DispatchMessage(dest uint8, message *commands.ReplicaMessage) error
}

type PKIWorker

type PKIWorker struct {
	worker.Worker

	*pki.WorkerBase
	// contains filtered or unexported fields
}

func (*PKIWorker) AuthenticateReplicaConnection

func (p *PKIWorker) AuthenticateReplicaConnection(c *wire.PeerCredentials) (*pki.ReplicaDescriptor, bool)

func (*PKIWorker) ForceFetchPKI

func (p *PKIWorker) ForceFetchPKI() error

ForceFetchPKI forces the PKI worker to fetch a new PKI document for the current epoch. This is useful for integration tests where you want to ensure the courier has the latest PKI document without waiting for the normal fetch cycle.

func (*PKIWorker) HasCurrentPKIDocument

func (p *PKIWorker) HasCurrentPKIDocument() bool

HasCurrentPKIDocument returns true if the courier has a PKI document for the current epoch. This is useful for integration tests to check if the courier is ready.

func (*PKIWorker) ReplicasCopy

func (p *PKIWorker) ReplicasCopy() map[[32]byte]*pki.ReplicaDescriptor

func (*PKIWorker) SetDocumentForEpoch

func (p *PKIWorker) SetDocumentForEpoch(epoch uint64, doc *pki.Document, rawDoc []byte)

SetDocumentForEpoch sets a PKI document for a specific epoch; for testing only.

type PendingReadRequest

type PendingReadRequest struct {
	RequestID uint64
	SURB      []byte
	Timeout   time.Time
}

PendingReadRequest stores information about a read request waiting for immediate reply

type Server

type Server struct {
	Courier *Courier

	PKI *PKIWorker
	// contains filtered or unexported fields
}

func New

func New(cfg *config.Config, pkiClient pki.Client) (*Server, error)

func NewWithDefaultPKI

func NewWithDefaultPKI(cfg *config.Config) (*Server, error)

NewWithDefaultPKI creates a new Server with the default voting PKI client

func NewWithPKI

func NewWithPKI(cfg *config.Config, pkiClient pki.Client) (*Server, error)

NewWithPKI creates a new Server with a custom PKI client for testing

func (*Server) ForceConnectorUpdate

func (s *Server) ForceConnectorUpdate()

func (*Server) IdentityPublicKey

func (s *Server) IdentityPublicKey() sign.PublicKey

IdentityPublicKey returns the server's identity public key

func (*Server) LinkPublicKey

func (s *Server) LinkPublicKey() kem.PublicKey

LinkPublicKey returns the server's link public key

func (*Server) LogBackend

func (s *Server) LogBackend() *log.Backend

func (*Server) SendMessage

func (s *Server) SendMessage(dest uint8, mesg *commands.ReplicaMessage) error

func (*Server) StartPlugin

func (s *Server) StartPlugin()

StartPlugin starts the CBOR plugin service which listens for socket connections from the service node.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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