Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Channel ¶
type Channel interface { // MaxPayloadSize returns the maximum size for a symmetric broadcast // payload. MaxPayloadSize() int // MaxRSAToPublicPayloadSize returns the maximum size for an asymmetric // broadcast payload. MaxRSAToPublicPayloadSize() int // Get returns the underlying [broadcast.Channel] object. Get() *crypto.Channel // Broadcast broadcasts a payload to the channel. The payload must be of the // size [Channel.MaxPayloadSize] or smaller. // // The network must be healthy to send. Broadcast(payload []byte, cMixParams cmix.CMIXParams) ( rounds.Round, ephemeral.Id, error) // BroadcastWithAssembler broadcasts a payload over a channel with a payload // assembled after the round is selected, allowing the round info to be // included in the payload. // // The payload must be of the size [Channel.MaxPayloadSize] or smaller. // // The network must be healthy to send. BroadcastWithAssembler(assembler Assembler, cMixParams cmix.CMIXParams) ( rounds.Round, ephemeral.Id, error) // BroadcastRSAtoPublic broadcasts the payload to the channel. // // The payload must be of the size [Channel.MaxRSAToPublicPayloadSize] or // smaller and the channel [rsa.PrivateKey] must be passed in. // // The network must be healthy to send. BroadcastRSAtoPublic(pk rsa.PrivateKey, payload []byte, cMixParams cmix.CMIXParams) (rounds.Round, ephemeral.Id, error) // BroadcastRSAToPublicWithAssembler broadcasts the payload to the channel // with a function that builds the payload based upon the ID of the selected // round. // // The payload must be of the size [Channel.MaxRSAToPublicPayloadSize] or // smaller and the channel [rsa.PrivateKey] must be passed in. // // The network must be healthy to send. BroadcastRSAToPublicWithAssembler( pk rsa.PrivateKey, assembler Assembler, cMixParams cmix.CMIXParams) (rounds.Round, ephemeral.Id, error) // RegisterListener registers a listener for broadcast messages. RegisterListener(listenerCb ListenerFunc, method Method) error // Stop unregisters the listener callback and stops the channel's identity // from being tracked. Stop() }
Channel is the public-facing interface to interact with broadcast channels.
func NewBroadcastChannel ¶
func NewBroadcastChannel(channel *crypto.Channel, net Client, rng *fastRNG.StreamGenerator) (Channel, error)
NewBroadcastChannel creates a channel interface based on broadcast.Channel. It accepts a Cmix client connection.
type Client ¶
type Client interface { SendWithAssembler(recipient *id.ID, assembler cmix.MessageAssembler, cmixParams cmix.CMIXParams) (rounds.Round, ephemeral.Id, error) IsHealthy() bool AddIdentityWithHistory( id *id.ID, validUntil, beginning time.Time, persistent bool) AddService(clientID *id.ID, newService message.Service, response message.Processor) DeleteClientService(clientID *id.ID) RemoveIdentity(id *id.ID) GetMaxMessageLength() int }
Client contains the methods from cmix.Client that are required by broadcastClient.
type ListenerFunc ¶
type ListenerFunc func(payload []byte, receptionID receptionID.EphemeralIdentity, round rounds.Round)
ListenerFunc is registered when creating a new broadcasting channel and receives all new broadcast messages for the channel.
type NewBroadcastChannelFunc ¶
type NewBroadcastChannelFunc func(channel *crypto.Channel, net Client, rng *fastRNG.StreamGenerator) (Channel, error)
NewBroadcastChannelFunc creates a broadcast Channel. Used so that it can be replaced in tests.
Click to show internal directories.
Click to hide internal directories.