client: github.com/katzenpost/client/session Index | Files

package session

import "github.com/katzenpost/client/session"

Index

Package Files

event.go message.go queue.go send.go session.go timer_queue.go worker.go

Constants

const MaxQueueSize = 40

MaxQueueSize is the maximum queue size.

Variables

var ErrQueueEmpty = errors.New("Error, queue is empty.")

ErrQueueEmpty is the error issued when the queue is empty.

var ErrQueueFull = errors.New("queue full error")

ErrQueueFull is the error issued when the queue is full.

var ReplyTimeoutError = errors.New("Failure waiting for reply, timeout reached")

type ConnectionStatusEvent Uses

type ConnectionStatusEvent struct {
    // IsConnected is true iff the account is connected to the provider.
    IsConnected bool

    // Err is the error encountered when connecting or by the connection if any.
    Err error
}

ConnectionStatusEvent is the event sent when an account's connection status changes.

func (*ConnectionStatusEvent) String Uses

func (e *ConnectionStatusEvent) String() string

String returns a string representation of the ConnectionStatusEvent.

type EgressQueue Uses

type EgressQueue interface {

    // Peek returns the next queue item without modifying the queue.
    Peek() (Item, error)

    // Pop pops the next item off the queue.
    Pop() (Item, error)

    // Push pushes the item onto the queue.
    Push(Item) error
}

EgressQueue is the egress queue interface.

type Event Uses

type Event interface {
    // String returns a string representation of the Event.
    String() string
}

Event is the generic event sent over the event listener channel.

type Item Uses

type Item interface {
    Priority() uint64
}

type Message Uses

type Message struct {
    // ID is the message identifier
    ID  *[cConstants.MessageIDLength]byte

    // Recipient is the message recipient
    Recipient string

    // Provider is the recipient Provider
    Provider string

    // Payload is the message payload
    Payload []byte

    // SentAt contains the time the message was sent.
    SentAt time.Time

    // Sent is set to true if the message was sent on the network.
    Sent bool

    // ReplyETA is the expected round trip time to receive a response.
    ReplyETA time.Duration

    // SURBID is the SURB identifier.
    SURBID *[sConstants.SURBIDLength]byte

    // Key is the SURB decryption keys
    Key []byte

    // Reply is the SURB reply
    Reply []byte

    // SURBType is the SURB type.
    SURBType int

    // WithSURB specified if a SURB should be bundled with the forward payload.
    WithSURB bool

    // Specifies if this message is a decoy.
    IsDecoy bool

    // Priority controls the dwell time in the current AQM.
    QueuePriority uint64
}

Message is a message reference which is used to match future received SURB replies.

func (*Message) Priority Uses

func (m *Message) Priority() uint64

type MessageID Uses

type MessageID *[cConstants.MessageIDLength]byte

MessageID is a message identity byte array.

type MessageReplyEvent Uses

type MessageReplyEvent struct {
    // MessageID is the unique identifier for the request associated with the
    // reply.
    MessageID *[cConstants.MessageIDLength]byte

    // Payload is the reply payload if any.
    Payload []byte

    // Err is the error encountered when servicing the request if any.
    Err error
}

MessageReplyEvent is the event sent when a new message is received.

func (*MessageReplyEvent) String Uses

func (e *MessageReplyEvent) String() string

String returns a string representation of the MessageReplyEvent.

type MessageSentEvent Uses

type MessageSentEvent struct {
    // MessageID is the local unique identifier for the message, generated
    // when the message was enqueued.
    MessageID *[cConstants.MessageIDLength]byte

    // Err is the error encountered when sending the message if any.
    Err error
}

MessageSentEvent is the event sent when a message has been fully transmitted.

func (*MessageSentEvent) String Uses

func (e *MessageSentEvent) String() string

String returns a string representation of a MessageSentEvent.

type Queue Uses

type Queue struct {
    sync.Mutex
    // contains filtered or unexported fields
}

Queue is our in-memory queue implementation used as our egress FIFO queue for messages sent by the client.

func (*Queue) Peek Uses

func (q *Queue) Peek() (Item, error)

Peek returns the next message ref from the queue without modifying the queue.

func (*Queue) Pop Uses

func (q *Queue) Pop() (Item, error)

Pop pops the next message ref off the queue and returns nil upon success, otherwise an error is returned.

func (*Queue) Push Uses

func (q *Queue) Push(e Item) error

Push pushes the given message ref onto the queue and returns nil on success, otherwise an error is returned.

type Session Uses

type Session struct {
    worker.Worker
    // contains filtered or unexported fields
}

Session is the struct type that keeps state for a given session.

func New Uses

func New(ctx context.Context, fatalErrCh chan error, logBackend *log.Backend, cfg *config.Config, linkKey *ecdh.PrivateKey) (*Session, error)

New establishes a session with provider using key. This method will block until session is connected to the Provider.

func (*Session) GetPandaConfig Uses

func (s *Session) GetPandaConfig() *config.Panda

func (*Session) GetService Uses

func (s *Session) GetService(serviceName string) (*utils.ServiceDescriptor, error)

GetService returns a randomly selected service matching the specified service name

func (*Session) SendUnreliableMessage Uses

func (s *Session) SendUnreliableMessage(recipient, provider string, message []byte) ([]byte, error)

SendUnreliableMessage sends message without any automatic retransmissions.

type TimerQueue Uses

type TimerQueue struct {
    sync.Mutex
    sync.Cond
    worker.Worker
    // contains filtered or unexported fields
}

TimerQueue is a queue that delays messages before forwarding to another queue

func NewTimerQueue Uses

func NewTimerQueue(nextQueue nqueue) *TimerQueue

NewTimerQueue intantiates a new TimerQueue and starts the worker routine

func (*TimerQueue) Push Uses

func (a *TimerQueue) Push(i Item)

Push adds a message to the TimerQueue

func (*TimerQueue) Remove Uses

func (a *TimerQueue) Remove(i Item) error

Remove removes a Message from the TimerQueue

Package session imports 26 packages (graph) and is imported by 5 packages. Updated 2019-09-13. Refresh now. Tools for package owners.