net

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: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ALL_ALL_PARAMETERS

type ALL_ALL_PARAMETERS struct {
	TrusteesPks []kyber.Point // only filled when the relay sends this to the clients
	ForceParams bool
	ParamsInt   map[string]int
	ParamsStr   map[string]string
	ParamsBool  map[string]bool
}

ALL_ALL_PARAMETERS message contains all the parameters used by the protocol.

func (*ALL_ALL_PARAMETERS) Add

func (m *ALL_ALL_PARAMETERS) Add(key string, val interface{})

*

  • Adds a (key, val) to the ALL_ALL_PARAMS message

func (*ALL_ALL_PARAMETERS) BoolValueOrElse

func (m *ALL_ALL_PARAMETERS) BoolValueOrElse(key string, elseVal bool) bool

*

  • From the message, returns the "data[key]" if it exists, or "elseVal"

func (*ALL_ALL_PARAMETERS) IntValueOrElse

func (m *ALL_ALL_PARAMETERS) IntValueOrElse(key string, elseVal int) int

*

  • From the message, returns the "data[key]" if it exists, or "elseVal"

func (*ALL_ALL_PARAMETERS) StringValueOrElse

func (m *ALL_ALL_PARAMETERS) StringValueOrElse(key string, elseVal string) string

*

  • From the message, returns the "data[key]" if it exists, or "elseVal"

type ALL_ALL_SHUTDOWN

type ALL_ALL_SHUTDOWN struct {
}

ALL_ALL_SHUTDOWN message tells the participants to stop the protocol.

type ByteArray

type ByteArray struct {
	Bytes []byte
}

protobuf can't handle [][]byte, so we do []ByteArray

type CLI_REL_DISRUPTION_BLAME

type CLI_REL_DISRUPTION_BLAME struct {
	RoundID int32
	NIZK    []byte
	BitPos  int
	Pval    map[string]kyber.Point
}

CLI_REL_DISRUPTION_BLAME contains a disrupted roundID and the position where a bit was flipped, and is sent to the relay

type CLI_REL_DISRUPTION_REVEAL

type CLI_REL_DISRUPTION_REVEAL struct {
	ClientID int
	Bits     map[int]int
	NIZK     []byte
	Pval     map[string]kyber.Point
}

CLI_REL_DISRUPTION_REVEAL contains a map with individual bits to find a disruptor, and is sent to the relay

type CLI_REL_OPENCLOSED_DATA

type CLI_REL_OPENCLOSED_DATA struct {
	ClientID       int
	RoundID        int32
	OpenClosedData []byte
}

CLI_REL_OPENCLOSED_DATA message contains whether slots are gonna be Open or Closed in the next round

type CLI_REL_SHARED_SECRET

type CLI_REL_SHARED_SECRET struct {
	ClientID  int
	TrusteeID int
	Secret    kyber.Point
	NIZK      []byte
	Pub       map[string]kyber.Point
}

CLI_REL_SHARED_SECRET contains the shared secret requested by the relay, with a proof we computed it correctly

type CLI_REL_TELL_PK_AND_EPH_PK

type CLI_REL_TELL_PK_AND_EPH_PK struct {
	ClientID int
	Pk       kyber.Point
	EphPk    kyber.Point
}

CLI_REL_TELL_PK_AND_EPH_PK message contains the public key and ephemeral key of a client and is sent to the relay.

type CLI_REL_UPSTREAM_DATA

type CLI_REL_UPSTREAM_DATA struct {
	ClientID int
	RoundID  int32 // rounds increase 1 by 1, only represent ciphers
	Data     []byte
}

CLI_REL_UPSTREAM_DATA message contains the upstream data of a client for a given round and is sent to the relay.

type MessageSender

type MessageSender interface {
	// SendToClient tries to deliver the message "msg" to the client i.
	SendToClient(i int, msg interface{}) error

	// SendToTrustee tries to deliver the message "msg" to the trustee i.
	SendToTrustee(i int, msg interface{}) error

	// SendToRelay tries to deliver the message "msg" to the relay.
	SendToRelay(msg interface{}) error

	// BroadcastToAllClients tries to deliver the message "msg" to every client, possibly using broadcast.
	BroadcastToAllClients(msg interface{}) error

	// ClientSubscribeToBroadcast should be called by the Clients in order to receive the Broadcast messages.
	// Calling the function starts the handler but does not actually listen for broadcast messages.
	// Sending true to startStopChan starts receiving the broadcasts.
	// Sending false to startStopChan stops receiving the broadcasts.
	ClientSubscribeToBroadcast(clientID int, messageReceived func(interface{}) error, startStopChan chan bool) error
}

MessageSender is the interface that abstracts the network interactions.

type MessageSenderWrapper

type MessageSenderWrapper struct {
	MessageSender
	// contains filtered or unexported fields
}

*

  • A wrapper around a messageSender. will automatically print what it does (logFunction) if loggingEnabled, and
  • will call networkErrorHappened on error

func NewMessageSenderWrapper

func NewMessageSenderWrapper(logging bool, logSuccessFunction func(interface{}), logErrorFunction func(interface{}), networkErrorHappened func(error), ms MessageSender) (*MessageSenderWrapper, error)

*

  • Creates a wrapper around a messageSender. will automatically print what it does (logFunction) if loggingEnabled, and
  • will call networkErrorHappened on error

func (*MessageSenderWrapper) BroadcastToAllClientsWithLog

func (m *MessageSenderWrapper) BroadcastToAllClientsWithLog(msg interface{}, extraInfos string) bool

*

  • Send a message to client i. will automatically print what it does (Lvl3) if loggingenabled, and
  • will call networkErrorHappened on error

func (*MessageSenderWrapper) SendToClientWithLog

func (m *MessageSenderWrapper) SendToClientWithLog(i int, msg interface{}, extraInfos string) bool

*

  • Send a message to client i. will automatically print what it does (Lvl3) if loggingenabled, and
  • will call networkErrorHappened on error

func (*MessageSenderWrapper) SendToRelayWithLog

func (m *MessageSenderWrapper) SendToRelayWithLog(msg interface{}, extraInfos string) bool

*

  • Send a message to the relay. will automatically print what it does (Lvl3) if loggingenabled, and
  • will call networkErrorHappened on error

func (*MessageSenderWrapper) SendToTrusteeWithLog

func (m *MessageSenderWrapper) SendToTrusteeWithLog(i int, msg interface{}, extraInfos string) bool

*

  • Send a message to trustee i. will automatically print what it does (Lvl3) if loggingenabled, and
  • will call networkErrorHappened on error

func (*MessageSenderWrapper) SetEntity

func (m *MessageSenderWrapper) SetEntity(e string)

*

  • Sets the sending entity, for debugging purposes

type PublicKeyArray

type PublicKeyArray struct {
	Keys []kyber.Point
}

protobuf can't handle [][]abstract.Point, so we do []PublicKeyArray

type REL_ALL_DISRUPTION_REVEAL

type REL_ALL_DISRUPTION_REVEAL struct {
	RoundID int32
	BitPos  int
	NIZK    []byte
	Pval    map[string]kyber.Point
}

REL_ALL_DISRUPTION_REVEAL contains a disrupted roundID and the position where a bit was flipped, and is sent by the relay

type REL_ALL_REVEAL_SHARED_SECRETS

type REL_ALL_REVEAL_SHARED_SECRETS struct {
	EntityID int
}

REL_ALL_REVEAL_SHARED_SECRETS contains request ro reveal the shared secret with the specified recipient, and is sent by the relay

type REL_CLI_DISRUPTED_ROUND

type REL_CLI_DISRUPTED_ROUND struct {
	RoundID int32
	Data    []byte
}

REL_CLI_DISRUPTED_ROUND is when the relay detects a disruption, and sends it back to the client

type REL_CLI_DOWNSTREAM_DATA

type REL_CLI_DOWNSTREAM_DATA struct {
	RoundID                    int32
	OwnershipID                int // ownership may vary with open or closed slots
	HashOfPreviousUpstreamData []byte
	Data                       []byte
	FlagResync                 bool
	FlagOpenClosedRequest      bool
}

REL_CLI_DOWNSTREAM_DATA message contains the downstream data for a client for a given round and is sent by the relay to the clients.

type REL_CLI_DOWNSTREAM_DATA_UDP

type REL_CLI_DOWNSTREAM_DATA_UDP struct {
	REL_CLI_DOWNSTREAM_DATA
}

REL_CLI_DOWNSTREAM_DATA_UDP message is a bit special. It's a REL_CLI_DOWNSTREAM_DATA, simply named with _UDP postfix to be able to distinguish them from type, and theoretically that should be it. But since it doesn't go through SDA (which does not support UDP yet), we have to manually convert it to bytes. For that purpose, this message implements MarshallableMessage, defined in prifi-sda-wrapper/udp.go. Hence, it has methods Print(), used for debug, ToBytes(), that converts it to a raw byte array, SetByte(), which simply store a byte array in the structure (but does not decode it), and FromBytes(), which decodes the REL_CLI_DOWNSTREAM_DATA from the inner buffer set by SetBytes()

func (*REL_CLI_DOWNSTREAM_DATA_UDP) FromBytes

func (m *REL_CLI_DOWNSTREAM_DATA_UDP) FromBytes(buffer []byte) (interface{}, error)

FromBytes decodes the message contained in the message's byteEncoded field.

func (REL_CLI_DOWNSTREAM_DATA_UDP) Print

func (m REL_CLI_DOWNSTREAM_DATA_UDP) Print()

Print prints the raw value of this message.

func (*REL_CLI_DOWNSTREAM_DATA_UDP) SetContent

SetBytes sets the bytes contained in this message.

func (*REL_CLI_DOWNSTREAM_DATA_UDP) ToBytes

func (m *REL_CLI_DOWNSTREAM_DATA_UDP) ToBytes() ([]byte, error)

ToBytes encodes a message into a slice of bytes.

type REL_CLI_TELL_EPH_PKS_AND_TRUSTEES_SIG

type REL_CLI_TELL_EPH_PKS_AND_TRUSTEES_SIG struct {
	Base         kyber.Point
	EphPks       []kyber.Point
	TrusteesSigs []ByteArray
}

REL_CLI_TELL_EPH_PKS_AND_TRUSTEES_SIG message contains the ephemeral public keys and the signatures of the trustees and is sent by the relay to the client.

func (*REL_CLI_TELL_EPH_PKS_AND_TRUSTEES_SIG) GetSignatures

func (m *REL_CLI_TELL_EPH_PKS_AND_TRUSTEES_SIG) GetSignatures() [][]byte

Converts []ByteArray -> [][]byte and returns it

type REL_TRU_TELL_CLIENTS_PKS_AND_EPH_PKS_AND_BASE

type REL_TRU_TELL_CLIENTS_PKS_AND_EPH_PKS_AND_BASE struct {
	Pks    []kyber.Point
	EphPks []kyber.Point
	Base   kyber.Point
}

REL_TRU_TELL_CLIENTS_PKS_AND_EPH_PKS_AND_BASE message contains the public keys and ephemeral keys of the clients and is sent by the relay to the trustees.

type REL_TRU_TELL_RATE_CHANGE

type REL_TRU_TELL_RATE_CHANGE struct {
	WindowCapacity int
}

REL_TRU_TELL_RATE_CHANGE message asks the trustees to update their window capacity to adapt their sending rate and is sent by the relay.

type REL_TRU_TELL_TRANSCRIPT

type REL_TRU_TELL_TRANSCRIPT struct {
	Bases  []kyber.Point
	EphPks []PublicKeyArray
	Proofs []ByteArray
}

REL_TRU_TELL_TRANSCRIPT message contains all the shuffles perfomrmed in a Neff shuffle round. It is sent by the relay to the trustees to be verified.

func (*REL_TRU_TELL_TRANSCRIPT) GetKeys

func (m *REL_TRU_TELL_TRANSCRIPT) GetKeys() [][]kyber.Point

Converts []PublicKeyArray -> [][]abstract.Point and returns it

func (*REL_TRU_TELL_TRANSCRIPT) GetProofs

func (m *REL_TRU_TELL_TRANSCRIPT) GetProofs() [][]byte

Converts []ByteArray -> [][]byte and returns it

type TRU_REL_DC_CIPHER

type TRU_REL_DC_CIPHER struct {
	RoundID   int32
	TrusteeID int
	Data      []byte
}

TRU_REL_DC_CIPHER message contains the DC-net cipher of a trustee for a given round and is sent to the relay.

type TRU_REL_DISRUPTION_REVEAL

type TRU_REL_DISRUPTION_REVEAL struct {
	TrusteeID int
	Bits      map[int]int
	NIZK      []byte
	Pval      map[string]kyber.Point
}

TRU_REL_DISRUPTION_REVEAL contains a map with individual bits to find a disruptor, and is sent to the relay

type TRU_REL_SHARED_SECRET

type TRU_REL_SHARED_SECRET struct {
	TrusteeID int
	ClientID  int
	Secret    kyber.Point
	NIZK      []byte
	Pub       map[string]kyber.Point
}

TRU_REL_SHARED_SECRET contains the shared secret requested by the relay, with a proof we computed it correctly

type TRU_REL_SHUFFLE_SIG

type TRU_REL_SHUFFLE_SIG struct {
	TrusteeID int
	Sig       []byte
}

TRU_REL_SHUFFLE_SIG contains the signatures shuffled by a trustee and is sent to the relay.

type TRU_REL_TELL_NEW_BASE_AND_EPH_PKS

type TRU_REL_TELL_NEW_BASE_AND_EPH_PKS struct {
	NewBase            kyber.Point
	NewEphPks          []kyber.Point
	Proof              []byte
	VerifiableDCNetKey []byte
}

TRU_REL_TELL_NEW_BASE_AND_EPH_PKS message contains the new ephemeral key of a trustee and is sent to the relay.

type TRU_REL_TELL_PK

type TRU_REL_TELL_PK struct {
	TrusteeID int
	Pk        kyber.Point
}

TRU_REL_TELL_PK message contains the public key of a trustee and is sent to the relay.

Jump to

Keyboard shortcuts

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