Documentation ¶
Index ¶
- func LoadStateWriter(log *logging.Logger, stateFile string, passphrase []byte) (*StateWriter, *State, error)
- func NewContactExchangeBytes(spoolWriter *channels.UnreliableSpoolWriterChannel, ...) ([]byte, error)
- type Client
- func (c *Client) CreateRemoteSpool() error
- func (c *Client) GetInbox() []*Message
- func (c *Client) NewContact(nickname string, sharedSecret []byte)
- func (c *Client) RemoveContact(nickname string)
- func (c *Client) SendMessage(nickname string, message []byte)
- func (c *Client) Shutdown()
- func (c *Client) Start()
- type Contact
- type Message
- type State
- type StateWriter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadStateWriter ¶
func LoadStateWriter(log *logging.Logger, stateFile string, passphrase []byte) (*StateWriter, *State, error)
LoadStateWriter decrypts the given stateFile and returns the State as well as a new StateWriter.
func NewContactExchangeBytes ¶
func NewContactExchangeBytes(spoolWriter *channels.UnreliableSpoolWriterChannel, signedKeyExchange *ratchet.SignedKeyExchange) ([]byte, error)
NewContactExchangeBytes returns serialized contact exchange information.
Types ¶
type Client ¶
Client is the mixnet client which interacts with other clients and services on the network.
func New ¶
func New(logBackend *log.Backend, mixnetClient *client.Client, stateWorker *StateWriter, state *State) (*Client, error)
New creates a new Client instance given a mixnetClient, stateWorker and state. This constructor is used to load the previously saved state of a Client.
func NewClientAndRemoteSpool ¶
func NewClientAndRemoteSpool(logBackend *log.Backend, mixnetClient *client.Client, stateWorker *StateWriter, linkKey *ecdh.PrivateKey) (*Client, error)
NewClientAndRemoteSpool creates a new Client and creates a new remote spool for collecting messages destined to this Client. The Client is associated with this remote spool and this state is preserved in the encrypted statefile, of course. This constructor of Client is used when creating a new Client as opposed to loading the previously saved state for an existing Client.
func (*Client) CreateRemoteSpool ¶
CreateRemoteSpool creates a remote spool for collecting messages destined to this Client.
func (*Client) NewContact ¶
NewContact adds a new contact to the Client's state. This starts the PANDA protocol instance for this contact where intermediate states will be preserved in the encrypted statefile such that progress on the PANDA key exchange can be continued at a later time after program shutdown or restart.
func (*Client) RemoveContact ¶
RemoveContact removes a contact from the Client's state.
func (*Client) SendMessage ¶
SendMessage sends a message to the Client contact with the given nickname.
type Contact ¶
type Contact struct {
// contains filtered or unexported fields
}
Contact is a communications contact that we have bidirectional communication with.
func NewContact ¶
func NewContact(nickname string, id uint64, spoolReaderChan *channels.UnreliableSpoolReaderChannel, session *session.Session) (*Contact, error)
NewContact creates a new Contact or returns an error.
func (*Contact) MarshalBinary ¶
MarshalBinary does what you expect and returns a serialized Contact.
func (*Contact) UnmarshalBinary ¶
UnmarshalBinary does what you expect and initializes the given Contact with deserialized Contact fields from the given binary blob.
type Message ¶
Message encapsulates a decrypted message and two metadata fields, sender nickname and received time.
type State ¶
type State struct { SpoolReaderChan *channels.UnreliableSpoolReaderChannel Contacts []*Contact LinkKey *ecdh.PrivateKey Inbox []*Message }
State is the struct type representing the Client's state which is encrypted and persisted to disk.
type StateWriter ¶
StateWriter takes ownership of the Client's encrypted statefile and has a worker goroutine which writes updates to disk.
func NewStateWriter ¶
func NewStateWriter(log *logging.Logger, stateFile string, passphrase []byte) (*StateWriter, error)
NewStateWriter is a constructor for StateWriter which is to be used when creating the statefile for the first time.
func (*StateWriter) Start ¶
func (w *StateWriter) Start()
Start starts the StateWriter's worker goroutine.