Documentation ¶
Index ¶
- Constants
- func DebugLogger(n *Node) error
- func DiscardLogger(n *Node) error
- func RandomSeed(n *Node) error
- type Deliverer
- type DelivererFunc
- type Forwarder
- type ForwarderFunc
- type InvalidSignatureError
- type LeafSet
- type Message
- type Node
- func (n *Node) Accept(conn quic.Session, stream quic.Stream) (err error)
- func (n *Node) Apply(opts ...Option) error
- func (n *Node) Close() error
- func (n *Node) DialAndAccept(ctx context.Context, address string) error
- func (n *Node) Handshake(w io.Writer, r, rand io.Reader) (publicKey [ed25519.PublicKeySize]byte, sharedKey [32]byte, err error)
- func (n *Node) ListenAndServe(ctx context.Context, address string) error
- func (n *Node) PublicKey() ed25519.PublicKey
- func (n *Node) Route(ctx context.Context, key []byte, r io.Reader) error
- func (n *Node) Serve(l quic.Listener) error
- type Option
- type Peer
- type Table
Constants ¶
const B = 4
Variables ¶
This section is empty.
Functions ¶
func DebugLogger ¶
func DiscardLogger ¶
func RandomSeed ¶
Types ¶
type Deliverer ¶
Deliverer will be called when the node is the closest the message can be routed to.
type DelivererFunc ¶
DelivererFunc is an adapter to allow the use of ordinary functions as Deliverers.
type Forwarder ¶
Forwarder can modify the contents of redirect the message elsewhere or set next to nil to deliver to itself.
type ForwarderFunc ¶
ForwarderFunc is an adapter to allow the use of ordinary functions as Forwarders.
type InvalidSignatureError ¶
type InvalidSignatureError struct { PublicKey *[32]byte Signature [ed25519.SignatureSize]byte }
func (InvalidSignatureError) Error ¶
func (err InvalidSignatureError) Error() string
type LeafSet ¶
type LeafSet struct {
// contains filtered or unexported fields
}
func NewLeafSet ¶
type Node ¶
type Node struct { Leafset LeafSet // contains filtered or unexported fields }
func (*Node) Accept ¶
Accept takes the session and a pre-opened stream since we need to do the initial handshake. The only way to do that agnostically is to have a pre-opened stream.
func (*Node) DialAndAccept ¶
func (*Node) Handshake ¶
func (n *Node) Handshake( w io.Writer, r, rand io.Reader, ) ( publicKey [ed25519.PublicKeySize]byte, sharedKey [32]byte, err error, )
Handshake will generate an ephemeral key-pair and will then send our handshake to w. We will then read the peer's handshake from r, verifying the signature and then generating the shared secret.
The handshake looks as follows: <-> [
[32] public key, [32] ephemeral key public key, [64] signature(private key, ephemeral public key),
]