channels: github.com/katzenpost/channels Index | Files

package channels

import "github.com/katzenpost/channels"

Package channels provides a collection of channels for communicating over the Katzenpost mix network.

Index

Package Files

channels.go doubleratchet_channel.go noise_channel.go spool_channel.go

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
)

type NoiseWriterDescriptor Uses

type NoiseWriterDescriptor struct {
    SpoolWriterChan      *UnreliableSpoolWriterChannel
    RemoteNoisePublicKey *ecdh.PublicKey
}

NoiseWriterDescriptor contains the information necessary to write to a remote spool.

type SerializedUnreliableSpoolChannel Uses

type SerializedUnreliableSpoolChannel struct {
    WriterChan *UnreliableSpoolWriterChannel
    ReaderChan *UnreliableSpoolReaderChannel
}

SerializedUnreliableSpoolChannel is a type used to serialize/save the UnreliableSpoolChannel type.

type UnreliableDoubleRatchetChannel Uses

type UnreliableDoubleRatchetChannel struct {
    SpoolCh *UnreliableSpoolChannel
    Ratchet *ratchet.Ratchet
}

UnreliableDoubleRatchetChannel is an unreliable channel which encrypts using the double ratchet.

func LoadUnreliableDoubleRatchetChannel Uses

func LoadUnreliableDoubleRatchetChannel(data []byte, spoolService client.SpoolService) (*UnreliableDoubleRatchetChannel, error)

LoadUnreliableDoubleRatchetChannel loads the channel given the saved blob and a SpoolService interface.

func NewUnreliableDoubleRatchetChannel Uses

func NewUnreliableDoubleRatchetChannel(spoolCh *UnreliableSpoolChannel) (*UnreliableDoubleRatchetChannel, error)

NewUnreliableDoubleRatchetChannel creates a new UnreliableDoubleRatchetChannel.

func (*UnreliableDoubleRatchetChannel) ChannelExchange Uses

func (r *UnreliableDoubleRatchetChannel) ChannelExchange() ([]byte, error)

ChannelExchange returns a serialized UnreliableDoubleRatchetChannelExchange which is needed to connect channel endpoints.

func (*UnreliableDoubleRatchetChannel) KeyExchange Uses

func (r *UnreliableDoubleRatchetChannel) KeyExchange() (*ratchet.SignedKeyExchange, error)

KeyExchange returns a signed key exchange or an error.

func (*UnreliableDoubleRatchetChannel) ProcessChannelExchange Uses

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 Uses

func (r *UnreliableDoubleRatchetChannel) ProcessKeyExchange(kx *ratchet.SignedKeyExchange) error

ProcessKeyExchange processes the given signed key exchange.

func (*UnreliableDoubleRatchetChannel) Read Uses

func (r *UnreliableDoubleRatchetChannel) Read() ([]byte, error)

Read reads ciphertext from a remote spool and decypts it with the double ratchet.

func (*UnreliableDoubleRatchetChannel) Save Uses

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 Uses

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 Uses

type UnreliableDoubleRatchetChannelExchange struct {
    SpoolWriter       *UnreliableSpoolWriterChannel
    SignedKeyExchange *ratchet.SignedKeyExchange
}

UnreliableDoubleRatchetChannelExchange is exchanged between endpoints to establish a bidirectional channel, the UnreliableDoubleRatchetChannel.

type UnreliableNoiseChannel Uses

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 Uses

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 Uses

func NewUnreliableNoiseChannel(spoolReceiver, spoolProvider string, spool client.SpoolService) (*UnreliableNoiseChannel, error)

NewUnreliableNoiseChannel creates and returns a new UnreliableNoiseChannel or an error.

func (*UnreliableNoiseChannel) GetRemoteWriter Uses

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 Uses

func (n *UnreliableNoiseChannel) Read() ([]byte, error)

Read reads from a remote spool and decrypts.

func (*UnreliableNoiseChannel) Save Uses

func (n *UnreliableNoiseChannel) Save() ([]byte, error)

Save returns a serialized form of this channel suitable to be reloaded for later use.

func (*UnreliableNoiseChannel) SetSpoolService Uses

func (n *UnreliableNoiseChannel) SetSpoolService(spoolService client.SpoolService)

SetSpoolService sets this channel's spoolService field.

func (*UnreliableNoiseChannel) WithRemoteWriter Uses

func (n *UnreliableNoiseChannel) WithRemoteWriter(writerDesc *NoiseWriterDescriptor)

WithRemoteWriter allows this channel to write to a remote spool.

func (*UnreliableNoiseChannel) Write Uses

func (n *UnreliableNoiseChannel) Write(message []byte) error

Write encrypts and write to a remote spool.

type UnreliableSpoolChannel Uses

type UnreliableSpoolChannel struct {
    // contains filtered or unexported fields
}

UnreliableSpoolChannel is an unreliable channel which reads and writes to a remote spool.

func LoadUnreliableSpoolChannel Uses

func LoadUnreliableSpoolChannel(data []byte, spoolService client.SpoolService) (*UnreliableSpoolChannel, error)

LoadUnreliableSpoolChannel loads an UnreliableSpoolChannel from it's serialized form.

func NewUnreliableSpoolChannel Uses

func NewUnreliableSpoolChannel(spoolReceiver, spoolProvider string, spool client.SpoolService) (*UnreliableSpoolChannel, error)

NewUnreliableSpoolChannel creates and returns a new UnreliableSpoolChannel.

func (*UnreliableSpoolChannel) GetSpoolWriter Uses

func (s *UnreliableSpoolChannel) GetSpoolWriter() *UnreliableSpoolWriterChannel

GetSpoolWriter returns a UnreliableSpoolWriterChannel which writes to the spool that this UnreliableSpoolChannel is reading from.

func (*UnreliableSpoolChannel) MarshalBinary Uses

func (s *UnreliableSpoolChannel) MarshalBinary() ([]byte, error)

MarshalBinary serializes this channel.

func (*UnreliableSpoolChannel) Read Uses

func (s *UnreliableSpoolChannel) Read() ([]byte, error)

Read reads and returns a message from the remote spool.

func (*UnreliableSpoolChannel) Save Uses

func (s *UnreliableSpoolChannel) Save() ([]byte, error)

Save serializes this channel.

func (*UnreliableSpoolChannel) SetSpoolService Uses

func (s *UnreliableSpoolChannel) SetSpoolService(spoolService client.SpoolService)

SetSpoolService sets this channels spoolService.

func (*UnreliableSpoolChannel) UnmarshalBinary Uses

func (s *UnreliableSpoolChannel) UnmarshalBinary(data []byte) error

UnmarshalBinary deserializes this channel.

func (*UnreliableSpoolChannel) WithRemoteWriter Uses

func (s *UnreliableSpoolChannel) WithRemoteWriter(writer *UnreliableSpoolWriterChannel) error

WithRemoteWriter sets this channels writer to the given UnreliableSpoolWriterChannel.

func (*UnreliableSpoolChannel) Write Uses

func (s *UnreliableSpoolChannel) Write(message []byte) error

Write writes a message to the remote spool.

type UnreliableSpoolReaderChannel Uses

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 Uses

func NewUnreliableSpoolReaderChannel(spoolReceiver, spoolProvider string, spool client.SpoolService) (*UnreliableSpoolReaderChannel, error)

NewUnreliableSpoolReaderChannel creates and returns a new UnreliableSpoolReaderChannel or an error.

func (*UnreliableSpoolReaderChannel) GetSpoolWriter Uses

func (s *UnreliableSpoolReaderChannel) GetSpoolWriter() *UnreliableSpoolWriterChannel

GetSpoolWriter returns an UnreliableSpoolWriterChannel which writes to the spool that this spool reader channel is reading.

func (*UnreliableSpoolReaderChannel) Read Uses

func (s *UnreliableSpoolReaderChannel) Read(spool client.SpoolService) ([]byte, error)

Read reads and returns a message from a remote spool.

type UnreliableSpoolWriterChannel Uses

type UnreliableSpoolWriterChannel struct {
    SpoolID       []byte
    SpoolReceiver string
    SpoolProvider string
}

UnreliableSpoolWriterChannel is an unreliable channel which writes to a remote spool.

func (*UnreliableSpoolWriterChannel) Write Uses

func (w *UnreliableSpoolWriterChannel) Write(spool client.SpoolService, message []byte) error

Write writes the given message to a remote spool.

Package channels imports 12 packages (graph) and is imported by 1 packages. Updated 2019-10-29. Refresh now. Tools for package owners.