Documentation ¶
Overview ¶
Package socket implements signed datagram sockets.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CachingSealer ¶
type CachingSealer struct {
// contains filtered or unexported fields
}
CachingSealer uses a simple LRU-cache strategy to reduce CPU load due to repeated signing. Additionally, it returns the signed bytes to a global free-list upon eviction.
func NewCachingSealer ¶
func NewCachingSealer(pk crypto.PrivKey, size int) (*CachingSealer, error)
func NewCachingSealerFromHost ¶
func NewCachingSealerFromHost(h host.Host, size int) (*CachingSealer, error)
func (*CachingSealer) Purge ¶
func (c *CachingSealer) Purge()
type Hashable ¶
Hashable is an optional interface that records MAY provide in order to override the default key-derivation function. This may be desireable when MarshalRecord() allocates heavily. Use of xxhash is RECOMMENDED.
See boot.Record for an example.
type Socket ¶
type Socket struct { // Conn is a datagram-oriented connection that can read and // write packets. This is most often a *net.UDPSocket, and // MAY be support multicast. Conn net.PacketConn // Sealer can marshal and sign a record. Most applications // SHOULD use *CachingSealer. Sealer Sealer }
Socket is a packet-oriented network interface that exchanges signed messages. A socket's maximum transmission unit (MTU) is exactly 2KB. Sockets will fail to unmarshal records from payloads exceeding 2 << 10 bytes. Bear in mind that payloads are automatically signed, which increases payload size. In practice, an overhead of 128 bytes is generally sufficient.