Documentation
¶
Overview ¶
Package link contains the encrypted network link implementation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Link ¶
type Link struct { Send chan *proto.Message Recv chan *proto.Message // contains filtered or unexported fields }
Accomplishes secure and authenticated full duplex communication. Note, only the headers are encrypted and decrypted. It is the responsibility of the caller to call proto.Message.Encrypt/Decrypt (link would bottleneck).
func New ¶
Creates a new, full-duplex encrypted link from the negotiated secret. The client is used to decide the key derivation order for the two half-duplex channels (server keys first, client key second).
func (*Link) RecvDirect ¶
The actual message receiving logic. Reads a message from the stream, verifies its mac, decodes the headers and send it upwards. Direct receive is public for handshake simplifications, after which the link should switch to channel mode.
func (*Link) SendDirect ¶
The actual message sending logic. Calculates the payload MAC, encrypts the headers and sends it down to the stream. Direct send is public for handshake simplifications. After that is done, the link should switch to channel mode.