Documentation
¶
Index ¶
Constants ¶
const PublishingOverhead = box.Overhead + ed25519.SignatureSize
PublishingOverhead represents the number of additional bytes used by encryption and signing.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// for debugging / testing
Verbose bool
Rand io.Reader
// contains filtered or unexported fields
}
Client represents a connection to the Talek system. Typically created with NewClient, the object manages requests, both reads an writes.
func NewClient ¶
func NewClient(name string, config ClientConfig, leader common.FrontendInterface) *Client
NewClient creates a Talek client for reading and writing metadata-protected messages.
func (*Client) Flush ¶
func (c *Client) Flush()
Flush blocks until the the client has finished in-progress reads and writes.
func (*Client) Kill ¶
func (c *Client) Kill()
Kill stops client processing. This allows for graceful shutdown or suspension of requests.
func (*Client) MaxLength ¶
MaxLength returns the maximum allowed message the client can Publish. TODO: support messages spanning multiple data items.
func (*Client) Poll ¶
Poll handles to updates on a given log. When done reading messages, the channel can be closed via the Done method.
func (*Client) SetConfig ¶
func (c *Client) SetConfig(config ClientConfig)
SetConfig allows updating the configuration of a Client, e.g. if server memebership or speed characteristics for the system are changed.
type ClientConfig ¶
type ClientConfig struct {
*common.Config
// How often should Writes be made to the server
WriteInterval time.Duration `json:",string"`
// How often should reads be made to the server
ReadInterval time.Duration `json:",string"`
// Where are the different servers?
TrustDomains []*common.TrustDomainConfig
// Where should the client connect?
FrontendAddr string
}
ClientConfig represents the configuration parameters to Talek needed by the client.
func ClientConfigFromFile ¶
func ClientConfigFromFile(file string) *ClientConfig
ClientConfigFromFile restores a client configuration from on-disk form.
type Handle ¶
type Handle struct {
// For learning log positions
Seed1 *drbg.Seed
Seed2 *drbg.Seed
// For decrypting messages
SigningPublicKey *[32]byte
// Current log position
Seqno uint64
// contains filtered or unexported fields
}
Handle is the readable component of a Talek Log. Handles are created by making a NewTopic, but can be independently shared, and restored from a serialized state. A Handle is read by calling Client.Poll(handle) to receive a channel with new messages read from the Handle.
func (*Handle) Decrypt ¶
Decrypt attempts decryption of a message for a topic using a specific nonce.
func (*Handle) MarshalText ¶
MarshalText is a compact textual representation of a handle
func (*Handle) OnResponse ¶
OnResponse processes a response for a request generated by generatePoll, sending it to the handle's updates channel if valid.
func (*Handle) UnmarshalText ¶
UnmarshalText restores a handle from its compact textual representation
type Topic ¶
type Topic struct {
// For updates?
ID uint64
// For authenticity
// TODO: this should ratchet.
SigningPrivateKey *[64]byte `json:",omitempty"`
Handle
}
Topic is a writiable Talek log. A topic is created by calling NewTopic(). New items are published with a client via client.Publish(&topic, "Msg"). Messages can be read from the topic through its contained handle.
func NewTopic ¶
NewTopic creates a new Topic, or fails if the system randomness isn't appropriately configured.
func (*Topic) GeneratePublish ¶
func (t *Topic) GeneratePublish(commonConfig *common.Config, message []byte) (*common.WriteArgs, error)
GeneratePublish creates a set of write args for writing message as the next entry in this topic log.
func (*Topic) MarshalText ¶
MarshalText is a compact textual representation of a topic
func (*Topic) UnmarshalText ¶
UnmarshalText restores a topic from its compact textual representation