Documentation ¶
Index ¶
- func RandomFingerprint(rng csprng.Source) format.Fingerprint
- type Bundle
- type FingerprintsManager
- type Handler
- type MeteredCmixMessageBuffer
- func LoadMeteredCmixMessageBuffer(kv *versioned.KV, key string) (*MeteredCmixMessageBuffer, error)
- func NewMeteredCmixMessageBuffer(kv *versioned.KV, key string) (*MeteredCmixMessageBuffer, error)
- func NewOrLoadMeteredCmixMessageBuffer(kv *versioned.KV, key string) (*MeteredCmixMessageBuffer, error)
- func (mcmb *MeteredCmixMessageBuffer) Add(m format.Message, ri *pb.RoundInfo, identity receptionID.EphemeralIdentity) (uint, time.Time)
- func (mcmb *MeteredCmixMessageBuffer) AddProcessing(m format.Message, ri *pb.RoundInfo, identity receptionID.EphemeralIdentity) (uint, time.Time)
- func (mcmb *MeteredCmixMessageBuffer) Failed(m format.Message, ri *pb.RoundInfo, identity receptionID.EphemeralIdentity)
- func (mcmb *MeteredCmixMessageBuffer) Next() (format.Message, *pb.RoundInfo, receptionID.EphemeralIdentity, bool)
- func (mcmb *MeteredCmixMessageBuffer) Remove(m format.Message, ri *pb.RoundInfo, identity receptionID.EphemeralIdentity)
- type Params
- type Processor
- type Service
- type ServiceList
- type ServicesManager
- func (sm *ServicesManager) AddService(clientID *id.ID, newService Service, response Processor)
- func (sm *ServicesManager) DeleteClientService(clientID *id.ID)
- func (sm *ServicesManager) DeleteService(clientID *id.ID, toDelete Service, processor Processor)
- func (sm *ServicesManager) TrackServices(tracker ServicesTracker)
- type ServicesTracker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RandomFingerprint ¶
func RandomFingerprint(rng csprng.Source) format.Fingerprint
Types ¶
type Bundle ¶
type Bundle struct { Round id.Round RoundInfo rounds.Round Messages []format.Message Finish func() Identity receptionID.EphemeralIdentity }
type FingerprintsManager ¶
FingerprintsManager is a thread-safe map, mapping format.Fingerprint's to a Handler object.
func (*FingerprintsManager) AddFingerprint ¶
func (f *FingerprintsManager) AddFingerprint(clientID *id.ID, fingerprint format.Fingerprint, mp Processor) error
AddFingerprint is a thread-safe setter for the FingerprintsManager map. AddFingerprint maps the given fingerprint key to the handler value. If there is already an entry for this fingerprint, the method returns with no write operation. If a nil identity is passed, it will automatically use the default identity in the session
func (*FingerprintsManager) DeleteClientFingerprints ¶
func (f *FingerprintsManager) DeleteClientFingerprints(clientID *id.ID)
DeleteClientFingerprints is a thread-safe deletion operation on the fingerprints map. It will remove all entries for the given clientID from the map.
func (*FingerprintsManager) DeleteFingerprint ¶
func (f *FingerprintsManager) DeleteFingerprint(clientID *id.ID, fingerprint format.Fingerprint)
DeleteFingerprint is a thread-safe deletion operation on the Fingerprints map. It will remove the entry for the given fingerprint from the map.
type Handler ¶
type Handler interface { GetMessageReceptionChannel() chan<- Bundle StartProcesses() stoppable.Stoppable CheckInProgressMessages() // Fingerprints AddFingerprint(clientID *id.ID, fingerprint format.Fingerprint, mp Processor) error DeleteFingerprint(clientID *id.ID, fingerprint format.Fingerprint) DeleteClientFingerprints(clientID *id.ID) // Triggers AddService(clientID *id.ID, newService Service, response Processor) DeleteService(clientID *id.ID, toDelete Service, response Processor) DeleteClientService(clientID *id.ID) TrackServices(triggerTracker ServicesTracker) }
type MeteredCmixMessageBuffer ¶
type MeteredCmixMessageBuffer struct {
// contains filtered or unexported fields
}
MeteredCmixMessageBuffer wraps the message buffer to store and load raw cMix messages.
func LoadMeteredCmixMessageBuffer ¶
func LoadMeteredCmixMessageBuffer(kv *versioned.KV, key string) ( *MeteredCmixMessageBuffer, error)
func NewMeteredCmixMessageBuffer ¶
func NewMeteredCmixMessageBuffer(kv *versioned.KV, key string) ( *MeteredCmixMessageBuffer, error)
func NewOrLoadMeteredCmixMessageBuffer ¶
func NewOrLoadMeteredCmixMessageBuffer(kv *versioned.KV, key string) ( *MeteredCmixMessageBuffer, error)
func (*MeteredCmixMessageBuffer) Add ¶
func (mcmb *MeteredCmixMessageBuffer) Add(m format.Message, ri *pb.RoundInfo, identity receptionID.EphemeralIdentity) (uint, time.Time)
func (*MeteredCmixMessageBuffer) AddProcessing ¶
func (mcmb *MeteredCmixMessageBuffer) AddProcessing(m format.Message, ri *pb.RoundInfo, identity receptionID.EphemeralIdentity) (uint, time.Time)
func (*MeteredCmixMessageBuffer) Failed ¶
func (mcmb *MeteredCmixMessageBuffer) Failed(m format.Message, ri *pb.RoundInfo, identity receptionID.EphemeralIdentity)
func (*MeteredCmixMessageBuffer) Next ¶
func (mcmb *MeteredCmixMessageBuffer) Next() (format.Message, *pb.RoundInfo, receptionID.EphemeralIdentity, bool)
func (*MeteredCmixMessageBuffer) Remove ¶
func (mcmb *MeteredCmixMessageBuffer) Remove(m format.Message, ri *pb.RoundInfo, identity receptionID.EphemeralIdentity)
type Params ¶
type Params struct { MessageReceptionBuffLen uint MessageReceptionWorkerPoolSize uint MaxChecksInProcessMessage uint InProcessMessageWait time.Duration RealtimeOnly bool }
Params contains the parameters for the message package.
func GetDefaultParams ¶
func GetDefaultParams() Params
GetDefaultParams returns a Params object containing the default parameters.
func GetParameters ¶
GetParameters returns the default Params, or override with given parameters, if set.
func (Params) MarshalJSON ¶
MarshalJSON adheres to the json.Marshaler interface.
func (*Params) UnmarshalJSON ¶
UnmarshalJSON adheres to the json.Unmarshaler interface.
type Processor ¶
type Processor interface { // Process decrypts and hands off the message to its internal down stream // message processing system. // CRITICAL: Fingerprints should never be used twice. Process must denote, // in long term storage, usage of a fingerprint and that fingerprint must // not be added again during application load. // It is a security vulnerability to reuse a fingerprint. It leaks privacy // and can lead to compromise of message contents and integrity. Process(message format.Message, receptionID receptionID.EphemeralIdentity, round rounds.Round) // Stringer interface for debugging fmt.Stringer }
type Service ¶
type Service struct { Identifier []byte Tag string Metadata []byte // Optional metadata field, only used on reception // contains filtered or unexported fields }
func GetDefaultService ¶
GetDefaultService is used to generate a default service. All identities will respond to their default service, but it lacks privacy because it uses the public ID as the key. Used for initial reach out in some protocols, otherwise should not be used.
func GetRandomService ¶
GetRandomService is used to make a service for cMix sending when no service is needed. It fills the Identifier with random, bits in order to preserve privacy.
func (Service) ForMeFromMessageHash ¶
func (Service) HashFromMessageHash ¶
type ServiceList ¶
The ServiceList holds all services.
func (ServiceList) MarshalJSON ¶
func (sl ServiceList) MarshalJSON() ([]byte, error)
func (ServiceList) UnmarshalJSON ¶
func (sl ServiceList) UnmarshalJSON(b []byte) error
type ServicesManager ¶
func NewServices ¶
func NewServices() *ServicesManager
func (*ServicesManager) AddService ¶
func (sm *ServicesManager) AddService(clientID *id.ID, newService Service, response Processor)
AddService adds a service which can call a message handing function or be used for notifications. In general a single service can only be registered for the same identifier/tag pair.
preimage - the preimage which is triggered on type - a descriptive string of the service. Generally used in notifications source - a byte buffer of related data. Mostly used in notifications. Example: Sender ID
There can be multiple "default" services, they must use the "default" tag and the identifier must be the client reception ID. A service may have a nil response unless it is default.
func (*ServicesManager) DeleteClientService ¶
func (sm *ServicesManager) DeleteClientService(clientID *id.ID)
DeleteClientService deletes the mapping associated with an ID.
func (*ServicesManager) DeleteService ¶
func (sm *ServicesManager) DeleteService(clientID *id.ID, toDelete Service, processor Processor)
DeleteService - If only a single response is associated with the preimage, the entire preimage is removed. If there is more than one response, only the given response is removed. If nil is passed in for response, all triggers for the preimage will be removed.
func (*ServicesManager) TrackServices ¶
func (sm *ServicesManager) TrackServices(tracker ServicesTracker)
TrackServices adds a service tracker to be triggered when a new service is added. Generally used for notification to use this system to identify a received message.
type ServicesTracker ¶
type ServicesTracker func(ServiceList)