commands

package
v0.0.33 Latest Latest
Warning

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

Go to latest
Published: May 16, 2024 License: AGPL-3.0, AGPL-3.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

View Source
const (

	// ConsensusOk signifies that the GetConsensus request has completed
	// successfully.
	ConsensusOk = 0

	// ConsensusNotFound signifies that the document document corresponding
	// to the epoch in the GetConsensus was not found, but retrying later
	// may be successful.
	ConsensusNotFound = 1

	// ConsensusGone signifies that the document corresponding to the epoch
	// in the GetConsensus was not found, and that retrying later will
	// not be successful.
	ConsensusGone = 2

	// DescriptorOk signifies that the PostDescriptor request has completed
	// succcessfully.
	DescriptorOk = 0

	// DescriptorInvalid signifies that the PostDescriptor request has failed
	// due to an unspecified error.
	DescriptorInvalid = 1

	// DescriptorConflict signifies that the PostDescriptor request has
	// failed due to the uploaded descriptor conflicting with a previously
	// uploaded descriptor.
	DescriptorConflict = 2

	// DescriptorForbidden signifies that the PostDescriptor request has
	// failed due to an authentication error.
	DescriptorForbidden = 3

	// VoteOk signifies that the vote was accepted by the peer.
	VoteOk = 0

	// VoteTooLate signifies that the vote was too late.
	VoteTooLate = 1

	// VoteTooEarly signifies that the vote was too late.
	VoteTooEarly = 2

	// VoteNotAuthorized signifies that the voting entity's key is not authorized.
	VoteNotAuthorized = 3

	// VoteNotSigned signifies that the vote payload failed signature verification.
	VoteNotSigned = 4

	// VoteMalformed signifies that the vote payload was invalid.
	VoteMalformed = 5

	// VoteAlreadyReceived signifies that the vote from that peer was already received.
	VoteAlreadyReceived = 6

	// VoteNotFound signifies that the vote was not found.
	VoteNotFound = 7

	// RevealOk signifies that the reveal was accepted by the peer.
	RevealOk = 8

	// RevealTooEarly signifies that the peer is breaking protocol.
	RevealTooEarly = 9

	// RevealNotAuthorized signifies that the revealing entity's key is not authorized.
	RevealNotAuthorized = 10

	// RevealNotSigned signifies that the reveal payload failed signature verification.
	RevealNotSigned = 11

	// RevealAlreadyReceived signifies that the reveal from that peer was already received.
	RevealAlreadyReceived = 12

	// RevealTooLate signifies that the reveal from that peer arrived too late.
	RevealTooLate = 13

	// CertOk signifies that the certificate was accepted by the peer.
	CertOk = 14

	// CertTooEarly signifies that the peer is breaking protocol.
	CertTooEarly = 15

	// CertNotAuthorized signifies that the certifying entity's key is not
	CertNotAuthorized = 16

	// CertNotSigned signifies that the certficiate payload failed signature verification.
	CertNotSigned = 17

	// CertAlreadyReceived signifies that the certificate from that peer was already received.
	CertAlreadyReceived = 18

	// CertTooLate signifies that the certificate from that peer arrived too late.
	CertTooLate = 19

	// SigOK signifies that the signature was accepted by the peer.
	SigOk = 20

	// SigNotAuthorized signifies that the entity's key is not authorized.
	SigNotAuthorized = 21

	// SigNotSigned signifies that the signature command failed signature verification.
	SigNotSigned = 22

	// SigTooEarly signifies that the peer is breaking protocol.
	SigTooEarly = 23

	// SigTooLate signifies that the signature from that peer arrived too late.
	SigTooLate = 24

	// SigAlreadyReceived signifies that the signature from that peer was already received.
	SigAlreadyReceived = 25

	// SigInvalid signifies that the signature failed to deserialiez.
	SigInvalid = 26
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Cert

type Cert struct {
	Epoch     uint64
	PublicKey sign.PublicKey
	Payload   []byte
}

Cert is a potential consensus which is exchanged by Directory Authorities.

func (*Cert) ToBytes

func (c *Cert) ToBytes() []byte

ToBytes serializes the Cert and returns the resulting slice.

type CertStatus

type CertStatus struct {
	ErrorCode uint8
}

CertStatus is a resonse status for a Cert command.

func (*CertStatus) ToBytes

func (c *CertStatus) ToBytes() []byte

ToBytes serializes the CertStatus and returns the resulting slice.

type Command

type Command interface {
	// ToBytes serializes the command and returns the resulting slice.
	ToBytes() []byte
}

Command is the common interface exposed by all message command structures.

type Commands

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

Commands encapsulates all of the wire protocol commands so that it can pass around a sphinx geometry where needed.

func NewCommands

func NewCommands(geo *geo.Geometry) *Commands

NewCommands returns a Commands given a sphinx geometry.

func NewPKICommands

func NewPKICommands() *Commands

NewPKICommands returns a Commands without a given sphinx geometry.

func (*Commands) FromBytes

func (c *Commands) FromBytes(b []byte) (Command, error)

FromBytes de-serializes the command in the buffer b, returning a Command or an error.

type Consensus

type Consensus struct {
	ErrorCode uint8
	Payload   []byte
}

Consensus is a de-serialized consensus command.

func (*Consensus) ToBytes

func (c *Consensus) ToBytes() []byte

ToBytes serializes the Consensus and returns the resulting byte slice.

type Disconnect

type Disconnect struct {
	Cmds *Commands
}

Disconnect is a de-serialized disconnect command.

func (*Disconnect) ToBytes

func (c *Disconnect) ToBytes() []byte

ToBytes serializes the Disconnect and returns the resulting slice.

type GetConsensus

type GetConsensus struct {
	Epoch              uint64
	Cmds               *Commands
	MixnetTransmission bool // if GetConsensus is sent over the mixnet, if true we need to pad the message
}

GetConsensus is a de-serialized get_consensus command.

func (*GetConsensus) ToBytes

func (c *GetConsensus) ToBytes() []byte

ToBytes serializes the GetConsensus and returns the resulting byte slice.

type GetVote

type GetVote struct {
	Epoch     uint64
	PublicKey sign.PublicKey
}

GetVote is a de-serialized get_vote command.

func (*GetVote) ToBytes

func (v *GetVote) ToBytes() []byte

ToBytes serializes the GetVote and returns the resulting slice.

type Message

type Message struct {
	Geo  *geo.Geometry
	Cmds *Commands

	QueueSizeHint uint8
	Sequence      uint32
	Payload       []byte
}

Message is a de-serialized message command containing a message.

func (*Message) ToBytes

func (c *Message) ToBytes() []byte

ToBytes serializes the Message and returns the resulting slice.

type MessageACK

type MessageACK struct {
	Geo  *geo.Geometry
	Cmds *Commands

	QueueSizeHint uint8
	Sequence      uint32
	ID            [constants.SURBIDLength]byte
	Payload       []byte
}

MessageACK is a de-serialized message command containing an ACK.

func (*MessageACK) ToBytes

func (c *MessageACK) ToBytes() []byte

ToBytes serializes the MessageACK and returns the resulting slice.

type MessageEmpty

type MessageEmpty struct {
	Cmds *Commands

	Sequence uint32
}

MessageEmpty is a de-serialized message command signifying a empty queue.

func (*MessageEmpty) ToBytes

func (c *MessageEmpty) ToBytes() []byte

ToBytes serializes the MessageEmpty and returns the resulting slice.

type NoOp

type NoOp struct {
	Cmds *Commands
}

NoOp is a de-serialized noop command.

func (*NoOp) ToBytes

func (c *NoOp) ToBytes() []byte

ToBytes serializes the NoOp and returns the resulting slice.

type PostDescriptor

type PostDescriptor struct {
	Epoch   uint64
	Payload []byte
}

PostDescriptor is a de-serialized post_descriptor command.

func (*PostDescriptor) ToBytes

func (c *PostDescriptor) ToBytes() []byte

ToBytes serializes the PostDescriptor and returns the resulting byte slice.

type PostDescriptorStatus

type PostDescriptorStatus struct {
	ErrorCode uint8
}

PostDescriptorStatus is a de-serialized post_descriptor_status command.

func (*PostDescriptorStatus) ToBytes

func (c *PostDescriptorStatus) ToBytes() []byte

ToBytes serializes the PostDescriptorStatus and returns the resulting byte slice.

type RetrieveMessage

type RetrieveMessage struct {
	Sequence uint32
	Cmds     *Commands
}

RetrieveMessage is a de-serialized retrieve_message command.

func (*RetrieveMessage) ToBytes

func (c *RetrieveMessage) ToBytes() []byte

ToBytes serializes the RetrieveMessage and returns the resulting slice.

type Reveal

type Reveal struct {
	Epoch     uint64
	PublicKey sign.PublicKey
	Payload   []byte
}

Reveal is a de-serialized reveal command exchanged by authorities.

func (*Reveal) ToBytes

func (r *Reveal) ToBytes() []byte

ToBytes serializes the Reveal and returns the resulting byte slice.

type RevealStatus

type RevealStatus struct {
	ErrorCode uint8
}

RevealStatus is a de-serialized revealStatus command.

func (*RevealStatus) ToBytes

func (r *RevealStatus) ToBytes() []byte

ToBytes serializes the RevealStatus and returns the resulting byte slice.

type SendPacket

type SendPacket struct {
	SphinxPacket []byte
	Cmds         *Commands
}

SendPacket is a de-serialized send_packet command.

func (*SendPacket) ToBytes

func (c *SendPacket) ToBytes() []byte

ToBytes serializes the SendPacket and returns the resulting slice.

type Sig

type Sig struct {
	Epoch     uint64
	PublicKey sign.PublicKey
	Payload   []byte
}

Sig is a signature which is exchanged by Directory Authorities.

func (*Sig) ToBytes

func (c *Sig) ToBytes() []byte

ToBytes serializes the Sig and returns the resulting slice.

type SigStatus

type SigStatus struct {
	ErrorCode uint8
}

SigStatus is a resonse status for a Sig command.

func (*SigStatus) ToBytes

func (c *SigStatus) ToBytes() []byte

ToBytes serializes the Status and returns the resulting slice.

type Vote

type Vote struct {
	Epoch     uint64
	PublicKey sign.PublicKey
	Payload   []byte
}

Vote is a vote which is exchanged by Directory Authorities.

func (*Vote) ToBytes

func (c *Vote) ToBytes() []byte

ToBytes serializes the Vote and returns the resulting slice.

type VoteStatus

type VoteStatus struct {
	ErrorCode uint8
}

VoteStatus is a resonse status for a Vote command.

func (*VoteStatus) ToBytes

func (c *VoteStatus) ToBytes() []byte

ToBytes serializes the VoteStatus and returns the resulting slice.

Jump to

Keyboard shortcuts

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