reunion: github.com/katzenpost/reunion/server Index | Files

package server

import "github.com/katzenpost/reunion/server"

Package server provides the Reunion protocol server.

Package server provides the Reunion protocol server.

Index

Package Files

server.go state.go

type LockedList Uses

type LockedList struct {
    sync.RWMutex
    // contains filtered or unexported fields
}

LockedList is used to coordinate access to it's linked list of T2 and T3 messages via the T2Message and T3Message types.

func NewLockedList Uses

func NewLockedList() *LockedList

NewLockedList creates a new LockedList.

func (*LockedList) Append Uses

func (l *LockedList) Append(item interface{})

Append to linked list after taking mutex.

func (*LockedList) Marshal Uses

func (l *LockedList) Marshal() ([]byte, error)

Marshal returns a CBOR serialization of an consistent snapshot.

func (*LockedList) Range Uses

func (l *LockedList) Range(f func(item interface{}) bool)

Range calls f sequentially for each item in the list. If f returns false, Range stops the iteration.

func (*LockedList) Serializable Uses

func (l *LockedList) Serializable() ([]*T2T3Message, error)

Serializable returns a serializable type representing our list.

type RequestedReunionState Uses

type RequestedReunionState struct {
    // T1Map maps T1 hashes to T1 messages.
    T1Map map[[32]byte][]byte

    // Messages is a slice of *T2T3Message.
    Messages []*T2T3Message
}

RequestedReunionState is the serialized struct type which is sent to the client in response to their fetch state command.

func (*RequestedReunionState) Marshal Uses

func (s *RequestedReunionState) Marshal() ([]byte, error)

Marshal returns a CBOR serialization of the state.

func (*RequestedReunionState) Unmarshal Uses

func (s *RequestedReunionState) Unmarshal(data []byte) error

Unmarshal deserializes the state CBOR blob.

type ReunionDatabase Uses

type ReunionDatabase interface {
    // Query sends a query command to the Reunion DB and returns the
    // response command or an error.
    Query(command commands.Command) (commands.Command, error)
    CurrentSharedRandoms() ([][]byte, error)
    CurrentEpochs() ([]uint64, error)
}

ReunionDatabase is an interface which represents the Reunion DB that protocol clients interact with.

type ReunionState Uses

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

ReunionState is the state of the Reunion DB. This is the type which is fetched by the FetchState command.

func NewReunionState Uses

func NewReunionState() *ReunionState

NewReunionState creates a new ReunionState.

func (*ReunionState) AppendMessage Uses

func (s *ReunionState) AppendMessage(message commands.Command) error

AppendMessage receives a message which can be one of these types: *commands.SendT1 *commands.SendT2 *commands.SendT3

func (*ReunionState) Marshal Uses

func (s *ReunionState) Marshal() ([]byte, error)

Marshal returns a CBOR serialization of an inconsistent snapshot.

func (*ReunionState) Serializable Uses

func (s *ReunionState) Serializable() (*SerializableReunionState, error)

Serializable returns a *SerializableReunionState copy of the data encapsulated in *ReunionState.

func (*ReunionState) SerializableT1Map Uses

func (s *ReunionState) SerializableT1Map() (map[[32]byte][]byte, error)

SerializableT1Map returns a serializable map representing a inconsistent snapshot of our T1 sync.Map.

func (*ReunionState) Unmarshal Uses

func (s *ReunionState) Unmarshal(data []byte) error

Unmarshal deserializes the state CBOR blob.

type ReunionStates Uses

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

ReunionStates is a type encapsulating sync.Map of uint64 -> *ReunionState.

func NewReunionStates Uses

func NewReunionStates() *ReunionStates

NewReunionStates creates a new ReunionStates.

func (*ReunionStates) AppendMessage Uses

func (s *ReunionStates) AppendMessage(message commands.Command) error

AppendMessage receives a message which can be one of these types: *commands.SendT1 *commands.SendT2 *commands.SendT3

func (*ReunionStates) AtomicWriteToFile Uses

func (s *ReunionStates) AtomicWriteToFile(filePath string) error

AtomicWriteToFile atomically writes our state to the file.

func (*ReunionStates) GarbageCollectOldEpochs Uses

func (s *ReunionStates) GarbageCollectOldEpochs(epochClock epochtime.EpochClock)

GarbageCollectOldEpochs remove old epochs from our epochs sync.Map.

func (*ReunionStates) GetStateFromEpoch Uses

func (s *ReunionStates) GetStateFromEpoch(epoch uint64) (*ReunionState, error)

GetStateFromEpoch returns a state given an epoch if such an entry if found in the sync.Map.

func (*ReunionStates) LoadFromFile Uses

func (s *ReunionStates) LoadFromFile(filePath string) error

LoadFromFile loads a ReunionStates from then given file if it exists.

func (*ReunionStates) Marshal Uses

func (s *ReunionStates) Marshal() ([]byte, error)

Marshal returns a CBOR serialization of the state.

func (*ReunionStates) MaybeAddEpochs Uses

func (s *ReunionStates) MaybeAddEpochs(epochClock epochtime.EpochClock)

MaybeAddEpochs adds sync.Map entries for the currenlty valid epochs.

func (*ReunionStates) Unmarshal Uses

func (s *ReunionStates) Unmarshal(data []byte) error

Marshal returns a CBOR serialization of the state.

type SerializableReunionState Uses

type SerializableReunionState struct {
    // T1Map is a slice of the SendT1 command received from a client.
    // t1 hash -> t1
    T1Map map[[32]byte][]byte

    // MessageMap: dst t1 hash -> slice of t2/t3 messages
    MessageMap map[[32]byte][]*T2T3Message
}

SerializableReunionState represents the ReunionState in a serializable struct type.

func (*SerializableReunionState) Marshal Uses

func (s *SerializableReunionState) Marshal() ([]byte, error)

Marshal returns a CBOR serialization of the state.

func (*SerializableReunionState) Unmarshal Uses

func (s *SerializableReunionState) Unmarshal(data []byte) error

Unmarshal deserializes the state CBOR blob.

type SerializableReunionStates Uses

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

SerializableReunionStates represents the serializable form of the ReunionStates type.

func (*SerializableReunionStates) Marshal Uses

func (s *SerializableReunionStates) Marshal() ([]byte, error)

Marshal returns a CBOR serialization of the state.

func (*SerializableReunionStates) Unmarshal Uses

func (s *SerializableReunionStates) Unmarshal(data []byte) error

Unmarshal deserializes the state CBOR blob.

type Server Uses

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

Server is a reunion server.

func NewServer Uses

func NewServer(epochClock epochtime.EpochClock, stateFilePath, logPath, logLevel string) (*Server, error)

NewServer returns a new Server with a new ReunionState.

func NewServerFromStatefile Uses

func NewServerFromStatefile(epochClock epochtime.EpochClock, stateFilePath, logPath, logLevel string) (*Server, error)

NewServerFromStatefile loads the state from a file.

func (*Server) GetNewLogger Uses

func (s *Server) GetNewLogger(name string) *logging.Logger

GetNewLogger returns a logger for the given subsystem name.

func (*Server) ProcessQuery Uses

func (s *Server) ProcessQuery(command commands.Command) (commands.Command, error)

ProcessQuery processes the given query command and returns a response command or an error.

type T1Message Uses

type T1Message struct {
    // Payload contains the T1 message.
    Payload []byte
}

T1Message is used for serializing ReunionState.

type T2Message Uses

type T2Message struct {
    // SrcT1Hash is the hash of the T1 message which the sender of
    // this t2 has sent.
    SrcT1Hash [sha256.Size]byte

    // Payload contains the T2 message.
    Payload []byte
}

T2Message is used for serializing ReunionState.

type T2T3Message Uses

type T2T3Message struct {
    // SrcT1Hash is the hash of the T1 message which the sender of the
    // t2 or t3 has sent.
    SrcT1Hash [sha256.Size]byte

    // T2Payload contains the T2 message.
    T2Payload []byte

    // T3Payload contains the T3 message.
    T3Payload []byte
}

T2T3Message is used for serializing ReunionState.

type T3Message Uses

type T3Message struct {
    // SrcT1Hash is the hash of the T1 message which the sender of
    // this t3 has sent.
    SrcT1Hash [sha256.Size]byte

    // T2Hash is the hash of the T2 message which this T3 message is replying.
    T2Hash [sha256.Size]byte

    // Payload contains the T3 message.
    Payload []byte
}

T3Message is used for serializing ReunionState.

Package server imports 15 packages (graph) and is imported by 1 packages. Updated 2020-10-25. Refresh now. Tools for package owners.