Documentation ¶
Overview ¶
Package channels provides a collection of channels for communicating over the Katzenpost mix network.
Index ¶
- Constants
- type NoiseWriterDescriptor
- type SerializedUnreliableSpoolChannel
- type UnreliableDoubleRatchetChannel
- func (r *UnreliableDoubleRatchetChannel) ChannelExchange() ([]byte, error)
- func (r *UnreliableDoubleRatchetChannel) KeyExchange() (*ratchet.SignedKeyExchange, error)
- func (r *UnreliableDoubleRatchetChannel) ProcessChannelExchange(cborExchange []byte) error
- func (r *UnreliableDoubleRatchetChannel) ProcessKeyExchange(kx *ratchet.SignedKeyExchange) error
- func (r *UnreliableDoubleRatchetChannel) Read() ([]byte, error)
- func (r *UnreliableDoubleRatchetChannel) Save() ([]byte, error)
- func (r *UnreliableDoubleRatchetChannel) Write(message []byte) error
- type UnreliableDoubleRatchetChannelExchange
- type UnreliableNoiseChannel
- func (n *UnreliableNoiseChannel) GetRemoteWriter() *NoiseWriterDescriptor
- func (n *UnreliableNoiseChannel) Read() ([]byte, error)
- func (n *UnreliableNoiseChannel) Save() ([]byte, error)
- func (n *UnreliableNoiseChannel) SetSpoolService(spoolService client.SpoolService)
- func (n *UnreliableNoiseChannel) WithRemoteWriter(writerDesc *NoiseWriterDescriptor)
- func (n *UnreliableNoiseChannel) Write(message []byte) error
- type UnreliableSpoolChannel
- func (s *UnreliableSpoolChannel) GetSpoolWriter() *UnreliableSpoolWriterChannel
- func (s *UnreliableSpoolChannel) MarshalBinary() ([]byte, error)
- func (s *UnreliableSpoolChannel) Read() ([]byte, error)
- func (s *UnreliableSpoolChannel) Save() ([]byte, error)
- func (s *UnreliableSpoolChannel) SetSpoolService(spoolService client.SpoolService)
- func (s *UnreliableSpoolChannel) UnmarshalBinary(data []byte) error
- func (s *UnreliableSpoolChannel) WithRemoteWriter(writer *UnreliableSpoolWriterChannel) error
- func (s *UnreliableSpoolChannel) Write(message []byte) error
- type UnreliableSpoolReaderChannel
- type UnreliableSpoolWriterChannel
Constants ¶
const ( // NoiseOverhead is amount of bytes overhead from the noise encryption. NoiseOverhead = keyLength + macLength + keyLength + macLength // e, es, s, ss // NoisePayloadLength is the length of the noise payload. NoisePayloadLength = SpoolPayloadLength - NoiseOverhead )
const ( // SpoolChannelOverhead is the number of bytes overhead from the spool CBOR encoding. SpoolChannelOverhead = common.QueryOverhead // SpoolPayloadLength is the length of the spool payload. SpoolPayloadLength = (constants.UserForwardPayloadLength - 4) - SpoolChannelOverhead )
const ( // DoubleRatchetPayloadLength is the length of the payload encrypted by the ratchet. DoubleRatchetPayloadLength = SpoolPayloadLength - ratchet.DoubleRatchetOverhead )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NoiseWriterDescriptor ¶
type NoiseWriterDescriptor struct { SpoolWriterChan *UnreliableSpoolWriterChannel RemoteNoisePublicKey *ecdh.PublicKey }
NoiseWriterDescriptor contains the information necessary to write to a remote spool.
type SerializedUnreliableSpoolChannel ¶
type SerializedUnreliableSpoolChannel struct { WriterChan *UnreliableSpoolWriterChannel ReaderChan *UnreliableSpoolReaderChannel }
SerializedUnreliableSpoolChannel is a type used to serialize/save the UnreliableSpoolChannel type.
type UnreliableDoubleRatchetChannel ¶
type UnreliableDoubleRatchetChannel struct { SpoolCh *UnreliableSpoolChannel Ratchet *ratchet.Ratchet }
UnreliableDoubleRatchetChannel is an unreliable channel which encrypts using the double ratchet.
func LoadUnreliableDoubleRatchetChannel ¶
func LoadUnreliableDoubleRatchetChannel(data []byte, spoolService client.SpoolService) (*UnreliableDoubleRatchetChannel, error)
LoadUnreliableDoubleRatchetChannel loads the channel given the saved blob and a SpoolService interface.
func NewUnreliableDoubleRatchetChannel ¶
func NewUnreliableDoubleRatchetChannel(spoolCh *UnreliableSpoolChannel) (*UnreliableDoubleRatchetChannel, error)
NewUnreliableDoubleRatchetChannel creates a new UnreliableDoubleRatchetChannel.
func (*UnreliableDoubleRatchetChannel) ChannelExchange ¶
func (r *UnreliableDoubleRatchetChannel) ChannelExchange() ([]byte, error)
ChannelExchange returns a serialized UnreliableDoubleRatchetChannelExchange which is needed to connect channel endpoints.
func (*UnreliableDoubleRatchetChannel) KeyExchange ¶
func (r *UnreliableDoubleRatchetChannel) KeyExchange() (*ratchet.SignedKeyExchange, error)
KeyExchange returns a signed key exchange or an error.
func (*UnreliableDoubleRatchetChannel) ProcessChannelExchange ¶
func (r *UnreliableDoubleRatchetChannel) ProcessChannelExchange(cborExchange []byte) error
ProcessChannelExchange consumes a serialized UnreliableDoubleRatchetChannelExchange and uses it to connection spool channels and ratchet channels so that our UnreliableDoubleRatchetChannel is fully connected.
func (*UnreliableDoubleRatchetChannel) ProcessKeyExchange ¶
func (r *UnreliableDoubleRatchetChannel) ProcessKeyExchange(kx *ratchet.SignedKeyExchange) error
ProcessKeyExchange processes the given signed key exchange.
func (*UnreliableDoubleRatchetChannel) Read ¶
func (r *UnreliableDoubleRatchetChannel) Read() ([]byte, error)
Read reads ciphertext from a remote spool and decypts it with the double ratchet.
func (*UnreliableDoubleRatchetChannel) Save ¶
func (r *UnreliableDoubleRatchetChannel) Save() ([]byte, error)
Save returns the serialization of this channel suitable to be used to "load" this channel and make use of it in the future.
func (*UnreliableDoubleRatchetChannel) Write ¶
func (r *UnreliableDoubleRatchetChannel) Write(message []byte) error
Write writes a message, encrypting it with the double ratchet and sending the ciphertext to the remote spool.
type UnreliableDoubleRatchetChannelExchange ¶
type UnreliableDoubleRatchetChannelExchange struct { SpoolWriter *UnreliableSpoolWriterChannel SignedKeyExchange *ratchet.SignedKeyExchange }
UnreliableDoubleRatchetChannelExchange is exchanged between endpoints to establish a bidirectional channel, the UnreliableDoubleRatchetChannel.
type UnreliableNoiseChannel ¶
type UnreliableNoiseChannel struct { SpoolWriterChan *UnreliableSpoolWriterChannel RemoteNoisePublicKey *ecdh.PublicKey SpoolReaderChan *UnreliableSpoolReaderChannel NoisePrivateKey *ecdh.PrivateKey ReadOffset uint32 // contains filtered or unexported fields }
UnreliableNoiseChannel is an unreliable channel which encrypts using the Noise X one-way pattern.
func LoadUnreliableNoiseChannel ¶
func LoadUnreliableNoiseChannel(data []byte, spoolService client.SpoolService) (*UnreliableNoiseChannel, error)
LoadUnreliableNoiseChannel loads a serialized channel and sets it's spoolService so that it may be used.
func NewUnreliableNoiseChannel ¶
func NewUnreliableNoiseChannel(spoolReceiver, spoolProvider string, spool client.SpoolService) (*UnreliableNoiseChannel, error)
NewUnreliableNoiseChannel creates and returns a new UnreliableNoiseChannel or an error.
func (*UnreliableNoiseChannel) GetRemoteWriter ¶
func (n *UnreliableNoiseChannel) GetRemoteWriter() *NoiseWriterDescriptor
GetRemoteWriter returns a NoiseWriterDescriptor which describes how a writer can write to the spool we are reading.
func (*UnreliableNoiseChannel) Read ¶
func (n *UnreliableNoiseChannel) Read() ([]byte, error)
Read reads from a remote spool and decrypts.
func (*UnreliableNoiseChannel) Save ¶
func (n *UnreliableNoiseChannel) Save() ([]byte, error)
Save returns a serialized form of this channel suitable to be reloaded for later use.
func (*UnreliableNoiseChannel) SetSpoolService ¶
func (n *UnreliableNoiseChannel) SetSpoolService(spoolService client.SpoolService)
SetSpoolService sets this channel's spoolService field.
func (*UnreliableNoiseChannel) WithRemoteWriter ¶
func (n *UnreliableNoiseChannel) WithRemoteWriter(writerDesc *NoiseWriterDescriptor)
WithRemoteWriter allows this channel to write to a remote spool.
func (*UnreliableNoiseChannel) Write ¶
func (n *UnreliableNoiseChannel) Write(message []byte) error
Write encrypts and write to a remote spool.
type UnreliableSpoolChannel ¶
type UnreliableSpoolChannel struct {
// contains filtered or unexported fields
}
UnreliableSpoolChannel is an unreliable channel which reads and writes to a remote spool.
func LoadUnreliableSpoolChannel ¶
func LoadUnreliableSpoolChannel(data []byte, spoolService client.SpoolService) (*UnreliableSpoolChannel, error)
LoadUnreliableSpoolChannel loads an UnreliableSpoolChannel from it's serialized form.
func NewUnreliableSpoolChannel ¶
func NewUnreliableSpoolChannel(spoolReceiver, spoolProvider string, spool client.SpoolService) (*UnreliableSpoolChannel, error)
NewUnreliableSpoolChannel creates and returns a new UnreliableSpoolChannel.
func (*UnreliableSpoolChannel) GetSpoolWriter ¶
func (s *UnreliableSpoolChannel) GetSpoolWriter() *UnreliableSpoolWriterChannel
GetSpoolWriter returns a UnreliableSpoolWriterChannel which writes to the spool that this UnreliableSpoolChannel is reading from.
func (*UnreliableSpoolChannel) MarshalBinary ¶
func (s *UnreliableSpoolChannel) MarshalBinary() ([]byte, error)
MarshalBinary serializes this channel.
func (*UnreliableSpoolChannel) Read ¶
func (s *UnreliableSpoolChannel) Read() ([]byte, error)
Read reads and returns a message from the remote spool.
func (*UnreliableSpoolChannel) Save ¶
func (s *UnreliableSpoolChannel) Save() ([]byte, error)
Save serializes this channel.
func (*UnreliableSpoolChannel) SetSpoolService ¶
func (s *UnreliableSpoolChannel) SetSpoolService(spoolService client.SpoolService)
SetSpoolService sets this channels spoolService.
func (*UnreliableSpoolChannel) UnmarshalBinary ¶
func (s *UnreliableSpoolChannel) UnmarshalBinary(data []byte) error
UnmarshalBinary deserializes this channel.
func (*UnreliableSpoolChannel) WithRemoteWriter ¶
func (s *UnreliableSpoolChannel) WithRemoteWriter(writer *UnreliableSpoolWriterChannel) error
WithRemoteWriter sets this channels writer to the given UnreliableSpoolWriterChannel.
func (*UnreliableSpoolChannel) Write ¶
func (s *UnreliableSpoolChannel) Write(message []byte) error
Write writes a message to the remote spool.
type UnreliableSpoolReaderChannel ¶
type UnreliableSpoolReaderChannel struct { SpoolPrivateKey *eddsa.PrivateKey SpoolID []byte SpoolReceiver string SpoolProvider string ReadOffset uint32 }
UnreliableSpoolReaderChannel is an unreliable channel which reads from a remote spool.
func NewUnreliableSpoolReaderChannel ¶
func NewUnreliableSpoolReaderChannel(spoolReceiver, spoolProvider string, spool client.SpoolService) (*UnreliableSpoolReaderChannel, error)
NewUnreliableSpoolReaderChannel creates and returns a new UnreliableSpoolReaderChannel or an error.
func (*UnreliableSpoolReaderChannel) GetSpoolWriter ¶
func (s *UnreliableSpoolReaderChannel) GetSpoolWriter() *UnreliableSpoolWriterChannel
GetSpoolWriter returns an UnreliableSpoolWriterChannel which writes to the spool that this spool reader channel is reading.
func (*UnreliableSpoolReaderChannel) Read ¶
func (s *UnreliableSpoolReaderChannel) Read(spool client.SpoolService) ([]byte, error)
Read reads and returns a message from a remote spool.
type UnreliableSpoolWriterChannel ¶
type UnreliableSpoolWriterChannel struct { SpoolID []byte SpoolReceiver string SpoolProvider string }
UnreliableSpoolWriterChannel is an unreliable channel which writes to a remote spool.
func (*UnreliableSpoolWriterChannel) Write ¶
func (w *UnreliableSpoolWriterChannel) Write(spool client.SpoolService, message []byte) error
Write writes the given message to a remote spool.