Skip to content
Snippets Groups Projects
Select Git revision
  • 415238851c461c6ec5f637fc579ae90e9ba91ff0
  • release default protected
  • 11-22-implement-kv-interface-defined-in-collectiveversionedkvgo
  • hotfix/TestHostPool_UpdateNdf_AddFilter
  • XX-4719/announcementChannels
  • xx-4717/logLevel
  • jonah/noob-channel
  • master protected
  • XX-4707/tagDiskJson
  • xx-4698/notification-retry
  • hotfix/notifylockup
  • syncNodes
  • hotfix/localCB
  • XX-4677/NewChanManagerMobile
  • XX-4689/DmSync
  • duplicatePrefix
  • XX-4601/HavenInvites
  • finalizedUICallbacks
  • XX-4673/AdminKeySync
  • debugNotifID
  • anne/test
  • v4.7.5
  • v4.7.4
  • v4.7.3
  • v4.7.2
  • v4.7.1
  • v4.6.3
  • v4.6.1
  • v4.5.0
  • v4.4.4
  • v4.3.11
  • v4.3.8
  • v4.3.7
  • v4.3.6
  • v4.3.5
  • v4.2.0
  • v4.3.0
  • v4.3.4
  • v4.3.3
  • v4.3.2
  • v4.3.1
41 results

interface.go

  • interface.go 17.56 KiB
    ////////////////////////////////////////////////////////////////////////////////
    // Copyright © 2022 xx foundation                                             //
    //                                                                            //
    // Use of this source code is governed by a license that can be found in the  //
    // LICENSE file.                                                              //
    ////////////////////////////////////////////////////////////////////////////////
    
    package cmix
    
    import (
    	"time"
    
    	"gitlab.com/elixxir/client/v4/cmix/gateway"
    	"gitlab.com/elixxir/client/v4/cmix/identity"
    	"gitlab.com/elixxir/client/v4/cmix/message"
    	"gitlab.com/elixxir/client/v4/cmix/nodes"
    	"gitlab.com/elixxir/client/v4/cmix/rounds"
    	"gitlab.com/elixxir/client/v4/stoppable"
    	"gitlab.com/elixxir/comms/network"
    	"gitlab.com/elixxir/primitives/format"
    	"gitlab.com/xx_network/comms/connect"
    	"gitlab.com/xx_network/primitives/id"
    	"gitlab.com/xx_network/primitives/id/ephemeral"
    )
    
    type Client interface {
    	// Follow starts the tracking of the network in a new thread.
    	// Errors that occur are reported on the ClientErrorReport function if
    	// passed. The returned stoppable can be used to stop the follower.
    	// Only one follower may run at a time.
    	Follow(report ClientErrorReport) (stoppable.Stoppable, error)
    
    	/* === Sending ========================================================== */
    
    	// GetMaxMessageLength returns the max message size for the current network.
    	GetMaxMessageLength() int
    
    	// Send sends a "raw" cMix message payload to the provided recipient.
    	// Returns the round ID of the round the payload was sent or an error if it
    	// fails.
    	// This does not have end-to-end encryption on it and is used exclusively as
    	// a send for higher order cryptographic protocols. Do not use unless
    	// implementing a protocol on top.
    	//   recipient - cMix ID of the recipient.
    	//   fingerprint - Key Fingerprint. 256-bit field to store a 255-bit
    	//      fingerprint, highest order bit must be 0 (panic otherwise). If your
    	//      system does not use key fingerprints, this must be random bits.
    	//   service - Reception Service. The backup way for a client to identify
    	//      messages on receipt via trial hashing and to identify notifications.
    	//      If unused, use message.GetRandomService to fill the field with
    	//      random data.
    	//   payload - Contents of the message. Cannot exceed the payload size for a
    	//      cMix message (panic otherwise).
    	//   mac - 256-bit field to store a 255-bit mac, highest order bit must be 0
    	//      (panic otherwise). If used, fill with random bits.
    	// Will return an error if the network is unhealthy or if it fails to send
    	// (along with the reason). Blocks until successful sends or errors.
    	// WARNING: Do not roll your own crypto.
    	Send(recipient *id.ID, fingerprint format.Fingerprint,
    		service message.Service, payload, mac []byte, cmixParams CMIXParams) (
    		rounds.Round, ephemeral.Id, error)
    
    	// SendMany sends many "raw" cMix message payloads to the provided
    	// recipients all in the same round.
    	// Returns the round ID of the round the payloads was sent or an error if it
    	// fails.
    	// This does not have end-to-end encryption on it and is used exclusively as
    	// a send for higher order cryptographic protocols. Do not use unless
    	// implementing a protocol on top.
    	// Due to sending multiple payloads, this leaks more metadata than a