Documentation ¶
Overview ¶
Package client provides a Katzenpost client library.
Index ¶
- Variables
- func AutoRegisterRandomClient(cfg *config.Config) (*config.Config, *ecdh.PrivateKey, error)
- func NewRescheduler(s *Session) *rescheduler
- func RegisterClient(cfg *config.Config, linkKey *ecdh.PublicKey) error
- type Client
- type ConnectionStatusEvent
- type EgressQueue
- type Event
- type Item
- type Message
- type MessageIDGarbageCollected
- type MessageReplyEvent
- type MessageSentEvent
- type NewDocumentEvent
- type Queue
- type Session
- func (s *Session) BlockingSendReliableMessage(recipient, provider string, message []byte) ([]byte, error)
- func (s *Session) BlockingSendUnreliableMessage(recipient, provider string, message []byte) ([]byte, error)
- func (s *Session) CurrentDocument() *pki.Document
- func (s *Session) GetPandaConfig() *config.Panda
- func (s *Session) GetReunionConfig() *config.Reunion
- func (s *Session) GetService(serviceName string) (*utils.ServiceDescriptor, error)
- func (s *Session) SendReliableMessage(recipient, provider string, message []byte) (*[cConstants.MessageIDLength]byte, error)
- func (s *Session) SendUnreliableMessage(recipient, provider string, message []byte) (*[cConstants.MessageIDLength]byte, error)
- func (s *Session) Shutdown()
- type TimerQueue
Constants ¶
This section is empty.
Variables ¶
var ErrMessageNotSent = errors.New("failure sending message")
var ErrQueueEmpty = errors.New("queue is empty")
ErrQueueEmpty is the error issued when the queue is empty.
var ErrQueueFull = errors.New("queue is full")
ErrQueueFull is the error issued when the queue is full.
var ErrReplyTimeout = errors.New("failure waiting for reply, timeout reached")
Functions ¶
func AutoRegisterRandomClient ¶ added in v0.0.3
func NewRescheduler ¶ added in v0.0.27
func NewRescheduler(s *Session) *rescheduler
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client handles sending and receiving messages over the mix network
func (*Client) GetBackendLog ¶
func (*Client) NewSession ¶
func (c *Client) NewSession(linkKey *ecdh.PrivateKey) (*Session, error)
NewSession creates and returns a new session or an error.
type ConnectionStatusEvent ¶ added in v0.0.3
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 ¶ added in v0.0.3
func (e *ConnectionStatusEvent) String() string
String returns a string representation of the ConnectionStatusEvent.
type EgressQueue ¶ added in v0.0.3
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 ¶ added in v0.0.3
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 Message ¶ added in v0.0.3
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 // ReplyETA is the expected round trip time to receive a response. ReplyETA time.Duration // IsBlocking indicates whether or not the client is blocking on the // sending of the query and the receiving of it's reply. IsBlocking bool // SURBID is the SURB identifier. SURBID *[sConstants.SURBIDLength]byte // Key is the SURB decryption keys Key []byte // Reply is the SURB reply Reply []byte // 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 // Reliable indicate whether automatic retransmissions should be used. Reliable bool // Retransmissions counts the number of times the message has been retransmitted. Retransmissions uint32 }
Message is a message reference which is used to match future received SURB replies.
type MessageIDGarbageCollected ¶ added in v0.0.3
type MessageIDGarbageCollected struct { // MessageID is the local unique identifier for the message. MessageID *[cConstants.MessageIDLength]byte }
MessageIDGarbageCollected is the event used to signal when a given message ID has been garbage collected.
func (*MessageIDGarbageCollected) String ¶ added in v0.0.3
func (e *MessageIDGarbageCollected) String() string
String returns a string representation of a MessageIDGarbageCollected.
type MessageReplyEvent ¶ added in v0.0.3
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 ¶ added in v0.0.3
func (e *MessageReplyEvent) String() string
String returns a string representation of the MessageReplyEvent.
type MessageSentEvent ¶ added in v0.0.3
type MessageSentEvent struct { // MessageID is the local unique identifier for the message, generated // when the message was enqueued. MessageID *[cConstants.MessageIDLength]byte // SentAt contains the time the message was sent. SentAt time.Time // ReplyETA is the expected round trip time to receive a response. ReplyETA time.Duration // 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 ¶ added in v0.0.3
func (e *MessageSentEvent) String() string
String returns a string representation of a MessageSentEvent.
type NewDocumentEvent ¶ added in v0.0.3
NewDocumentEvent is the new document event, signaling that we have received a new document from the PKI.
func (*NewDocumentEvent) String ¶ added in v0.0.3
func (e *NewDocumentEvent) String() string
String returns a string representation of a NewDocumentEvent.
type Queue ¶ added in v0.0.3
Queue is our in-memory queue implementation used as our egress FIFO queue for messages sent by the client.
func (*Queue) Peek ¶ added in v0.0.3
Peek returns the next message ref from the queue without modifying the queue.
type Session ¶ added in v0.0.3
type Session struct { worker.Worker EventSink chan Event // contains filtered or unexported fields }
Session is the struct type that keeps state for a given session.
func NewSession ¶ added in v0.0.3
func NewSession( 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) BlockingSendReliableMessage ¶ added in v0.0.27
func (s *Session) BlockingSendReliableMessage(recipient, provider string, message []byte) ([]byte, error)
BlockingSendReliableMessage sends a message with automatic message retransmission enabled
func (*Session) BlockingSendUnreliableMessage ¶ added in v0.0.3
func (*Session) CurrentDocument ¶ added in v0.0.3
func (*Session) GetPandaConfig ¶ added in v0.0.3
func (*Session) GetReunionConfig ¶ added in v0.0.8
func (*Session) GetService ¶ added in v0.0.3
func (s *Session) GetService(serviceName string) (*utils.ServiceDescriptor, error)
GetService returns a randomly selected service matching the specified service name
func (*Session) SendReliableMessage ¶ added in v0.0.27
func (s *Session) SendReliableMessage(recipient, provider string, message []byte) (*[cConstants.MessageIDLength]byte, error)
SendReliableMessage asynchronously sends messages with automatic retransmissiosn.
func (*Session) SendUnreliableMessage ¶ added in v0.0.3
func (s *Session) SendUnreliableMessage(recipient, provider string, message []byte) (*[cConstants.MessageIDLength]byte, error)
SendUnreliableMessage asynchronously sends message without any automatic retransmissions.
type TimerQueue ¶ added in v0.0.3
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 ¶ added in v0.0.3
func NewTimerQueue(nextQueue nqueue) *TimerQueue
NewTimerQueue intantiates a new TimerQueue and starts the worker routine
func (*TimerQueue) Push ¶ added in v0.0.3
func (a *TimerQueue) Push(i Item)
Push adds a message to the TimerQueue
func (*TimerQueue) Remove ¶ added in v0.0.3
func (a *TimerQueue) Remove(i Item) error
Remove removes a Message from the TimerQueue
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package config implements the configuration for the Katzenpost client.
|
Package config implements the configuration for the Katzenpost client. |
internal
|
|
pkiclient
Package pkiclient implements a caching wrapper around core/pki.Client.
|
Package pkiclient implements a caching wrapper around core/pki.Client. |
proxy
Package proxy implements the support for an upstream (outgoing) proxy.
|
Package proxy implements the support for an upstream (outgoing) proxy. |