http

package
v0.0.0-...-b56449a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 8, 2015 License: MPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PublicKey

func PublicKey(serverURL string, client *http.Client) (*sf.PublicKey, error)

PublicKey requests a shadowfax server's public key. An error is returned if the server URL is not https.

Types

type Client

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

Client pushes and pops messages in the shadowfax messaging system.

func NewClient

func NewClient(keyPair *sf.KeyPair, serverURL string, serverKey *sf.PublicKey, client *http.Client) *Client

NewClient returns a new shadowfax client.

func (*Client) Pop

func (c *Client) Pop() ([]*PopMessage, error)

Pop retrieves messages addressed to the client.

func (*Client) PublicKey

func (c *Client) PublicKey() *sf.PublicKey

PublicKey returns the public key identity of the client.

func (*Client) Push

func (c *Client) Push(recipient string, contents []byte) error

Push pushes a message to a recipient.

func (*Client) Request

func (c *Client) Request(method string, path string, contents []byte) ([]byte, error)

Request encrypts a request to the server and decrypts the response.

If the client and server have securely exchanged keys out of band, confidentiality does not depend on TLS.

type Handler

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

Handler handles HTTP requests as a shadowfax server.

func NewHandler

func NewHandler(keyPair *sf.KeyPair, service storage.Service) *Handler

NewHandler returns a new Handler with public key pair and service backend.

func (*Handler) Register

func (h *Handler) Register(r *httprouter.Router)

Register sets up endpoint routing for a shadowfax server.

type PopMessage

type PopMessage struct {
	ID       string
	Sender   string
	Contents []byte
}

PopMessage contains a message received.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL