Documentation ¶
Index ¶
- func GetFinishRealtimeStreamHeader(stream pb.Node_FinishRealtimeServer) (*pb.RoundInfo, error)
- func GetPostPhaseStreamHeader(stream pb.Node_StreamPostPhaseServer) (*pb.BatchInfo, error)
- func GetPrecompTestBatchStreamHeader(stream pb.Node_PrecompTestBatchServer) (*pb.RoundInfo, error)
- func GetUnmixedBatchStreamHeader(stream pb.Node_UploadUnmixedBatchServer) (*pb.BatchInfo, error)
- type Comms
- func (s *Comms) AskOnline(ctx context.Context, msg *messages.AuthenticatedMessage) (*messages.Ack, error)
- func (s *Comms) AuthenticateToken(ctx context.Context, msg *messages.AuthenticatedMessage) (*messages.Ack, error)
- func (s *Comms) CreateNewRound(ctx context.Context, msg *messages.AuthenticatedMessage) (*messages.Ack, error)
- func (s *Comms) DownloadMixedBatch(authMsg *messages.AuthenticatedMessage, ...) error
- func (s *Comms) FinishRealtime(stream pb.Node_FinishRealtimeServer) error
- func (s *Comms) GetMeasure(ctx context.Context, msg *messages.AuthenticatedMessage) (*pb.RoundMetrics, error)
- func (s *Comms) GetPermissioningAddress(context.Context, *messages.Ping) (*pb.StrAddress, error)
- func (s *Comms) GetPostPhaseStreamClient(host *connect.Host, header pb.BatchInfo) (pb.Node_StreamPostPhaseClient, context.CancelFunc, error)
- func (s *Comms) GetRoundBufferInfo(ctx context.Context, msg *messages.AuthenticatedMessage) (*pb.RoundBufferInfo, error)
- func (s *Comms) Poll(ctx context.Context, msg *messages.AuthenticatedMessage) (*pb.ServerPollResponse, error)
- func (s *Comms) PostPhase(ctx context.Context, msg *messages.AuthenticatedMessage) (*messages.Ack, error)
- func (s *Comms) PostPrecompResult(ctx context.Context, msg *messages.AuthenticatedMessage) (*messages.Ack, error)
- func (s *Comms) PrecompTestBatch(stream pb.Node_PrecompTestBatchServer) error
- func (s *Comms) RequestClientKey(ctx context.Context, msg *messages.AuthenticatedMessage) (*pb.SignedKeyResponse, error)
- func (s *Comms) RequestToken(context.Context, *messages.Ping) (*messages.AssignToken, error)
- func (s *Comms) RoundError(ctx context.Context, msg *messages.AuthenticatedMessage) (*messages.Ack, error)
- func (s *Comms) RoundTripPing(host *connect.Host, rtPing *pb.RoundTripPing) (*messages.Ack, error)
- func (s *Comms) SendAskOnline(host *connect.Host) (*messages.Ack, error)
- func (s *Comms) SendAuthorizerAuth(host *connect.Host, message *pb.AuthorizerAuth) (*messages.Ack, error)
- func (s *Comms) SendFinalKey(host *connect.Host, sharedPiece *pb.SharePiece) (*messages.Ack, error)
- func (s *Comms) SendFinishRealtime(host *connect.Host, roundInfo *pb.RoundInfo, batch *pb.CompletedBatch) (*messages.Ack, error)
- func (s *Comms) SendGetMeasure(host *connect.Host, message *pb.RoundInfo) (*pb.RoundMetrics, error)
- func (s *Comms) SendNewRound(host *connect.Host, message *pb.RoundInfo) (*messages.Ack, error)
- func (s *Comms) SendNodeRegistration(host *connect.Host, message *pb.NodeRegistration) error
- func (s *Comms) SendPoll(host *connect.Host, message *pb.PermissioningPoll) (*pb.PermissionPollResponse, error)
- func (s *Comms) SendPostPhase(host *connect.Host, message *pb.Batch) (*messages.Ack, error)
- func (s *Comms) SendPostPrecompResult(host *connect.Host, roundID uint64, numSlots uint32) (*messages.Ack, error)
- func (s *Comms) SendRegistrationCheck(host *connect.Host, message *pb.RegisteredNodeCheck) (*pb.RegisteredNodeConfirmation, error)
- func (s *Comms) SendRoundError(host *connect.Host, message *pb.RoundError) (*messages.Ack, error)
- func (s *Comms) SendRoundTripPing(ctx context.Context, msg *messages.AuthenticatedMessage) (*messages.Ack, error)
- func (s *Comms) SendSharePhase(host *connect.Host, sharedPiece *pb.SharePiece) (*messages.Ack, error)
- func (s *Comms) SendStartSharePhase(host *connect.Host, ri *pb.RoundInfo) (*messages.Ack, error)
- func (s *Comms) ShareFinalKey(ctx context.Context, msg *messages.AuthenticatedMessage) (*messages.Ack, error)
- func (s *Comms) SharePhaseRound(ctx context.Context, msg *messages.AuthenticatedMessage) (*messages.Ack, error)
- func (s *Comms) StartSharePhase(ctx context.Context, msg *messages.AuthenticatedMessage) (*messages.Ack, error)
- func (s *Comms) StreamPostPhase(server pb.Node_StreamPostPhaseServer) error
- func (s *Comms) StreamPrecompTestBatch(host *connect.Host, info *pb.RoundInfo, mockBatch *pb.CompletedBatch) error
- func (s *Comms) UploadUnmixedBatch(server pb.Node_UploadUnmixedBatchServer) error
- type Handler
- type Implementation
- func (s *Implementation) AskOnline() error
- func (s *Implementation) CreateNewRound(msg *mixmessages.RoundInfo, auth *connect.Auth) error
- func (s *Implementation) DownloadMixedBatch(stream mixmessages.Node_DownloadMixedBatchServer, ...) error
- func (s *Implementation) FinishRealtime(message *mixmessages.RoundInfo, ...) error
- func (s *Implementation) GetMeasure(message *mixmessages.RoundInfo, auth *connect.Auth) (*mixmessages.RoundMetrics, error)
- func (s *Implementation) GetNDF() (*interconnect.NDF, error)
- func (s *Implementation) GetPermissioningAddress() (string, error)
- func (s *Implementation) GetRoundBufferInfo(auth *connect.Auth) (int, error)
- func (s *Implementation) Poll(msg *mixmessages.ServerPoll, auth *connect.Auth) (*mixmessages.ServerPollResponse, error)
- func (s *Implementation) PostPhase(m *mixmessages.Batch, auth *connect.Auth) error
- func (s *Implementation) PostPrecompResult(roundID uint64, numSlots uint32, auth *connect.Auth) error
- func (s *Implementation) PrecompTestBatch(stream mixmessages.Node_PrecompTestBatchServer, message *mixmessages.RoundInfo, ...) error
- func (s *Implementation) RequestClientKey(nonceRequest *mixmessages.SignedClientKeyRequest, auth *connect.Auth) (*mixmessages.SignedKeyResponse, error)
- func (s *Implementation) RoundError(err *mixmessages.RoundError, auth *connect.Auth) error
- func (s *Implementation) SendRoundTripPing(ping *mixmessages.RoundTripPing, auth *connect.Auth) error
- func (s *Implementation) ShareFinalKey(sharedPiece *mixmessages.SharePiece, auth *connect.Auth) error
- func (s *Implementation) SharePhaseRound(sharedPiece *mixmessages.SharePiece, auth *connect.Auth) error
- func (s *Implementation) StartSharePhase(ri *mixmessages.RoundInfo, auth *connect.Auth) error
- func (s *Implementation) StreamPostPhase(m mixmessages.Node_StreamPostPhaseServer, auth *connect.Auth) error
- func (s *Implementation) UploadUnmixedBatch(stream mixmessages.Node_UploadUnmixedBatchServer, auth *connect.Auth) error
- type MessageInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetFinishRealtimeStreamHeader ¶
func GetFinishRealtimeStreamHeader(stream pb.Node_FinishRealtimeServer) (*pb.RoundInfo, error)
GetFinishRealtimeStreamHeader gets the header in the metadata from the server stream and converts it to a mixmessages.RoundInfo message.
func GetPostPhaseStreamHeader ¶
func GetPostPhaseStreamHeader(stream pb.Node_StreamPostPhaseServer) (*pb.BatchInfo, error)
Gets the header in the metadata from the server stream and returns it or an error if it fails.
func GetPrecompTestBatchStreamHeader ¶
func GetPrecompTestBatchStreamHeader(stream pb.Node_PrecompTestBatchServer) (*pb.RoundInfo, error)
GetPrecompTestBatchStreamHeader gets the header in the metadata from the server stream and converts it to a mixmessages.RoundInfo message.
func GetUnmixedBatchStreamHeader ¶
func GetUnmixedBatchStreamHeader(stream pb.Node_UploadUnmixedBatchServer) (*pb.BatchInfo, error)
GetUnmixedBatchStreamHeader gets the header in the metadata from the server stream and returns it or an error if it fails.
Types ¶
type Comms ¶
type Comms struct { *connect.ProtoComms *mixmessages.UnimplementedNodeServer *messages.UnimplementedGenericServer // contains filtered or unexported fields }
Server object used to implement endpoints and top-level comms functionality
func StartNode ¶
func StartNode(id *id.ID, localServer string, interconnectPort int, handler Handler, certPEMblock, keyPEMblock []byte) *Comms
Starts a new server on the address:port specified by listeningAddr and a callback interface for server operations with given path to public and private key for TLS connection
func (*Comms) AskOnline ¶
func (s *Comms) AskOnline(ctx context.Context, msg *messages.AuthenticatedMessage) (*messages.Ack, error)
Handle a Broadcasted Ask Online event
func (*Comms) AuthenticateToken ¶
func (s *Comms) AuthenticateToken(ctx context.Context, msg *messages.AuthenticatedMessage) (*messages.Ack, error)
Handles validation of reverse-authentication tokens
func (*Comms) CreateNewRound ¶
func (s *Comms) CreateNewRound(ctx context.Context, msg *messages.AuthenticatedMessage) (*messages.Ack, error)
Handle a NewRound event
func (*Comms) DownloadMixedBatch ¶
func (s *Comms) DownloadMixedBatch(authMsg *messages.AuthenticatedMessage, stream pb.Node_DownloadMixedBatchServer) error
DownloadMixedBatch streams the slots in the completed batch to the gateway
func (*Comms) FinishRealtime ¶
func (s *Comms) FinishRealtime(stream pb.Node_FinishRealtimeServer) error
FinishRealtime broadcasts to all nodes when the realtime is completed
func (*Comms) GetMeasure ¶
func (s *Comms) GetMeasure(ctx context.Context, msg *messages.AuthenticatedMessage) (*pb.RoundMetrics, error)
func (*Comms) GetPermissioningAddress ¶
Server -> Gateway permissioning address
func (*Comms) GetPostPhaseStreamClient ¶
func (s *Comms) GetPostPhaseStreamClient(host *connect.Host, header pb.BatchInfo) (pb.Node_StreamPostPhaseClient, context.CancelFunc, error)
GetPostPhaseStreamClient gets the streaming client using a header and returns the stream and the cancel context if there are no connection errors
func (*Comms) GetRoundBufferInfo ¶
func (s *Comms) GetRoundBufferInfo(ctx context.Context, msg *messages.AuthenticatedMessage) ( *pb.RoundBufferInfo, error)
GetBufferInfo returns buffer size (number of completed precomputations)
func (*Comms) Poll ¶
func (s *Comms) Poll(ctx context.Context, msg *messages.AuthenticatedMessage) (*pb.ServerPollResponse, error)
Gateway -> Server unified polling
func (*Comms) PostPhase ¶
func (s *Comms) PostPhase(ctx context.Context, msg *messages.AuthenticatedMessage) (*messages.Ack, error)
Handle a Phase event
func (*Comms) PostPrecompResult ¶
func (s *Comms) PostPrecompResult(ctx context.Context, msg *messages.AuthenticatedMessage) (*messages.Ack, error)
PostPrecompResult sends final Message and AD precomputations.
func (*Comms) PrecompTestBatch ¶
func (s *Comms) PrecompTestBatch(stream pb.Node_PrecompTestBatchServer) error
PrecompTestBatch is the reception handler for StreamPrecompTestBatch.
func (*Comms) RequestClientKey ¶
func (s *Comms) RequestClientKey(ctx context.Context, msg *messages.AuthenticatedMessage) (*pb.SignedKeyResponse, error)
Handles Registration Nonce Communication
func (*Comms) RequestToken ¶
Handles reception of reverse-authentication token requests
func (*Comms) RoundError ¶
func (*Comms) RoundTripPing ¶
Server -> Server Send Function
func (*Comms) SendAskOnline ¶
Server -> Server Send Function
func (*Comms) SendAuthorizerAuth ¶
func (s *Comms) SendAuthorizerAuth(host *connect.Host, message *pb.AuthorizerAuth) (*messages.Ack, error)
Server -> Authorizer Send Function
func (*Comms) SendFinalKey ¶
Server -> Server sending multi-party round DH final key
func (*Comms) SendFinishRealtime ¶
func (s *Comms) SendFinishRealtime(host *connect.Host, roundInfo *pb.RoundInfo, batch *pb.CompletedBatch) (*messages.Ack, error)
SendFinishRealtime is a node to node comm which streams a completed batch to all nodes within a round.
func (*Comms) SendGetMeasure ¶
Server -> Server Send Function
func (*Comms) SendNewRound ¶
Server -> Server Send Function
func (*Comms) SendNodeRegistration ¶
Server -> Registration Send Function
func (*Comms) SendPoll ¶
func (s *Comms) SendPoll(host *connect.Host, message *pb.PermissioningPoll) (*pb.PermissionPollResponse, error)
Server -> Registration Send Function
func (*Comms) SendPostPhase ¶
Server -> Server Send Function
func (*Comms) SendPostPrecompResult ¶
func (s *Comms) SendPostPrecompResult(host *connect.Host, roundID uint64, numSlots uint32) (*messages.Ack, error)
Server -> Server Send Function
func (*Comms) SendRegistrationCheck ¶
func (s *Comms) SendRegistrationCheck(host *connect.Host, message *pb.RegisteredNodeCheck) (*pb.RegisteredNodeConfirmation, error)
Server -> Registration Send Function
func (*Comms) SendRoundError ¶
Server -> Server error function
func (*Comms) SendRoundTripPing ¶
func (*Comms) SendSharePhase ¶
func (s *Comms) SendSharePhase(host *connect.Host, sharedPiece *pb.SharePiece) (*messages.Ack, error)
Server -> Server sending multi-party round DH key piece
func (*Comms) SendStartSharePhase ¶
Server -> Server initiating multi-party round DH key generation
func (*Comms) ShareFinalKey ¶
func (s *Comms) ShareFinalKey(ctx context.Context, msg *messages.AuthenticatedMessage) (*messages.Ack, error)
Server -> Server sending multi-party round DH final key
func (*Comms) SharePhaseRound ¶
func (s *Comms) SharePhaseRound(ctx context.Context, msg *messages.AuthenticatedMessage) (*messages.Ack, error)
Server -> Server passing state of multi-party round DH key generation
func (*Comms) StartSharePhase ¶
func (s *Comms) StartSharePhase(ctx context.Context, msg *messages.AuthenticatedMessage) (*messages.Ack, error)
Server -> Server initiating multi-party round DH key generation
func (*Comms) StreamPostPhase ¶
func (s *Comms) StreamPostPhase(server pb.Node_StreamPostPhaseServer) error
Handle a phase event using a stream server
func (*Comms) StreamPrecompTestBatch ¶
func (s *Comms) StreamPrecompTestBatch(host *connect.Host, info *pb.RoundInfo, mockBatch *pb.CompletedBatch) error
StreamPrecompTestBatch is a server to server broadcast. It simulates sending the completed batch of PrecompTestBatch, testing for connectivity.
func (*Comms) UploadUnmixedBatch ¶
func (s *Comms) UploadUnmixedBatch(server pb.Node_UploadUnmixedBatchServer) error
UploadUnmixedBatch is the handler for gateway sending a batch to its node
type Handler ¶
type Handler interface { // Server interface for starting New Rounds CreateNewRound(message *mixmessages.RoundInfo, auth *connect.Auth) error // Server interface for sending a new batch UploadUnmixedBatch(server mixmessages.Node_UploadUnmixedBatchServer, auth *connect.Auth) error // Server interface for handling a mixed batch request DownloadMixedBatch(stream mixmessages.Node_DownloadMixedBatchServer, batchInfo *mixmessages.BatchReady, auth *connect.Auth) error // Server interface for broadcasting when realtime is complete FinishRealtime(message *mixmessages.RoundInfo, streamServer mixmessages.Node_FinishRealtimeServer, auth *connect.Auth) error // GetRoundBufferInfo returns # of available precomputations GetRoundBufferInfo(auth *connect.Auth) (int, error) PrecompTestBatch(stream mixmessages.Node_PrecompTestBatchServer, info *mixmessages.RoundInfo, auth *connect.Auth) error GetMeasure(message *mixmessages.RoundInfo, auth *connect.Auth) (*mixmessages.RoundMetrics, error) // Server Interface for all Internode Comms PostPhase(message *mixmessages.Batch, auth *connect.Auth) error StreamPostPhase(server mixmessages.Node_StreamPostPhaseServer, auth *connect.Auth) error // PostPrecompResult interface to finalize both payloads' precomps PostPrecompResult(roundID uint64, numSlots uint32, auth *connect.Auth) error Poll(msg *mixmessages.ServerPoll, auth *connect.Auth) (*mixmessages.ServerPollResponse, error) SendRoundTripPing(ping *mixmessages.RoundTripPing, auth *connect.Auth) error AskOnline() error RoundError(error *mixmessages.RoundError, auth *connect.Auth) error // Consensus node -> cMix node NDF request // NOTE: For now cMix nodes serve the NDF to the // consensus nodes, but this will be reversed // once consensus generates the NDF GetNDF() (*interconnect.NDF, error) // GetPermissioningAddress gets gateway the permissioning server's address // from server. GetPermissioningAddress() (string, error) StartSharePhase(ri *mixmessages.RoundInfo, auth *connect.Auth) error SharePhaseRound(sharedPiece *mixmessages.SharePiece, auth *connect.Auth) error ShareFinalKey(sharedPiece *mixmessages.SharePiece, auth *connect.Auth) error // Server interface for RequestNonceMessage RequestClientKey(nonceRequest *mixmessages.SignedClientKeyRequest, auth *connect.Auth) (*mixmessages.SignedKeyResponse, error) }
type Implementation ¶
type Implementation struct {
Functions implementationFunctions
}
Implementation allows users of the client library to set the functions that implement the node functions
func NewImplementation ¶
func NewImplementation() *Implementation
NewImplementation returns a Implementation struct with all of the function pointers returning nothing and printing an error.
func (*Implementation) AskOnline ¶
func (s *Implementation) AskOnline() error
AskOnline blocks until the server is online, or returns an error
func (*Implementation) CreateNewRound ¶
func (s *Implementation) CreateNewRound(msg *mixmessages.RoundInfo, auth *connect.Auth) error
Server Interface for starting New Rounds
func (*Implementation) DownloadMixedBatch ¶
func (s *Implementation) DownloadMixedBatch(stream mixmessages.Node_DownloadMixedBatchServer, batchInfo *mixmessages.BatchReady, auth *connect.Auth) error
func (*Implementation) FinishRealtime ¶
func (s *Implementation) FinishRealtime(message *mixmessages.RoundInfo, streamServer mixmessages.Node_FinishRealtimeServer, auth *connect.Auth) error
func (*Implementation) GetMeasure ¶
func (s *Implementation) GetMeasure(message *mixmessages.RoundInfo, auth *connect.Auth) (*mixmessages.RoundMetrics, error)
func (*Implementation) GetNDF ¶
func (s *Implementation) GetNDF() (*interconnect.NDF, error)
Consensus node -> cMix node NDF request NOTE: For now cMix nodes serve the NDF to the
consensus nodes, but this will be reversed once consensus generates the NDF
func (*Implementation) GetPermissioningAddress ¶
func (s *Implementation) GetPermissioningAddress() (string, error)
GetPermissioningAddress gets gateway the permissioning server's address from server.
func (*Implementation) GetRoundBufferInfo ¶
func (s *Implementation) GetRoundBufferInfo(auth *connect.Auth) (int, error)
GetRoundBufferInfo returns # of completed precomputations
func (*Implementation) Poll ¶
func (s *Implementation) Poll(msg *mixmessages.ServerPoll, auth *connect.Auth) (*mixmessages.ServerPollResponse, error)
func (*Implementation) PostPhase ¶
func (s *Implementation) PostPhase(m *mixmessages.Batch, auth *connect.Auth) error
Server Interface for the phase messages
func (*Implementation) PostPrecompResult ¶
func (s *Implementation) PostPrecompResult(roundID uint64, numSlots uint32, auth *connect.Auth) error
PostPrecompResult interface to finalize both payloads' precomputations
func (*Implementation) PrecompTestBatch ¶
func (s *Implementation) PrecompTestBatch(stream mixmessages.Node_PrecompTestBatchServer, message *mixmessages.RoundInfo, auth *connect.Auth) error
func (*Implementation) RequestClientKey ¶
func (s *Implementation) RequestClientKey(nonceRequest *mixmessages.SignedClientKeyRequest, auth *connect.Auth) (*mixmessages.SignedKeyResponse, error)
Server interface for RequestNonceMessage
func (*Implementation) RoundError ¶
func (s *Implementation) RoundError(err *mixmessages.RoundError, auth *connect.Auth) error
func (*Implementation) SendRoundTripPing ¶
func (s *Implementation) SendRoundTripPing(ping *mixmessages.RoundTripPing, auth *connect.Auth) error
func (*Implementation) ShareFinalKey ¶
func (s *Implementation) ShareFinalKey(sharedPiece *mixmessages.SharePiece, auth *connect.Auth) error
Server -> Server sending multi-party round DH final key
func (*Implementation) SharePhaseRound ¶
func (s *Implementation) SharePhaseRound(sharedPiece *mixmessages.SharePiece, auth *connect.Auth) error
Server -> Server passing state of multi-party round DH key generation
func (*Implementation) StartSharePhase ¶
func (s *Implementation) StartSharePhase(ri *mixmessages.RoundInfo, auth *connect.Auth) error
Server -> Server initiating multi-party round DH key generation
func (*Implementation) StreamPostPhase ¶
func (s *Implementation) StreamPostPhase(m mixmessages.Node_StreamPostPhaseServer, auth *connect.Auth) error
Server Interface for streaming phase messages
func (*Implementation) UploadUnmixedBatch ¶
func (s *Implementation) UploadUnmixedBatch(stream mixmessages.Node_UploadUnmixedBatchServer, auth *connect.Auth) error