Documentation
¶
Index ¶
- type Citizen
- func (c *Citizen) Announce(ctx context.Context, randy io.Reader, letter Letter, recipients []url.URL) error
- func (c *Citizen) AsPeer() *Peer
- func (c *Citizen) Compose(r io.Reader, recipient *url.URL) *Envelope
- func (c *Citizen) ComposePlain(recipient *url.URL, str string) *Envelope
- func (c *Citizen) Establish(ctx context.Context, kp delphi.KeyPair) error
- func (c *Citizen) Join(ctx context.Context) (chan Envelope, chan Envelope, chan error, error)
- func (c *Citizen) Leave(ctx context.Context, inbox chan Envelope, outbox chan Envelope, ...) error
- func (c *Citizen) Send(ctx context.Context, randy io.Reader, letter Letter, recipient *url.URL) error
- func (c *Citizen) Shutdown()
- type Connection
- type Envelope
- type Letter
- func (letter *Letter) Deserialize(p []byte) error
- func (letter *Letter) Equal(f Letter) bool
- func (letter *Letter) GetHeader(key string) (string, bool)
- func (letter *Letter) Headers() (map[string]string, error)
- func (letter *Letter) Serialize() []byte
- func (letter *Letter) SetHeader(k, v string) error
- func (letter *Letter) SetHeaders(m map[string]string) error
- func (letter *Letter) SetSubject(str string) error
- func (letter *Letter) Sign(r io.Reader, signer crypto.Signer) error
- func (letter *Letter) Subject() string
- func (letter *Letter) Verify(v Verifier) error
- type Node
- type Oracle
- type Peer
- type PeerSet
- type PemBag
- type Profile
- type ProfileSet
- type Verifier
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Citizen ¶
A Citizen is a Connection with an Oracle.
func (*Citizen) Compose ¶
Compose is a convenience function to create an Envelope intended for a particular recipient
func (*Citizen) ComposePlain ¶
ComposePlain is an even more convenient convenience function.
type Connection ¶
type Connection interface {
ReadFrom([]byte) (int, net.Addr, error)
WriteTo([]byte, net.Addr) (int, error)
LocalAddr() net.Addr
Close() error
Node() Node
}
A Connection is a subset of net.PacketConn, with a reference to its parent Node
type Envelope ¶
type Envelope struct {
Letter Letter `json:"letter" msgpack:"letter"`
Sender *url.URL `json:"sender,omitempty" msgpack:"sender"`
Recipient *url.URL `json:"recipient,omitempty" msgpack:"recipient"`
}
An Envelope is a Letter with a recipient and sender
func NewEnvelope ¶
func (*Envelope) Deserialize ¶
type Letter ¶
A Letter is a message.Message, but with a subject and headers. Headers are stored in the message's AAD field. Subject is too. It's stored in the "pemType" key. It is an error to have AAD data that cannot be marshaled into a map[string, string].
func (*Letter) Deserialize ¶
func (*Letter) SetSubject ¶
type Node ¶
type Node interface {
URL() *url.URL // the address of the Connection, including username
Connect(ctx context.Context, pair delphi.KeyPair) (Connection, error)
Disconnect() error
Connection() Connection
UrlToAddr(url.URL) (net.Addr, error)
}
A Node is a participant on a network with a unique URL.
type Peer ¶
A Peer is an oracle.Peer with a convenient way to access its address.
func PeerFromKey ¶
func PeerFromURL ¶
func (*Peer) Deserialize ¶
type ProfileSet ¶
func (*ProfileSet) SetAliveness ¶
func (vs *ProfileSet) SetAliveness(pubKey delphi.PublicKey, alive bool) error