Versions in this module Expand all Collapse all v0 v0.5.0 Mar 23, 2021 Changes in this version + const ActOneSize + const ActThreeSize + const ActTwoSize + const HandshakeVersion + var ErrBrontideClose = errors.New("brontide connection closed") + var ErrMaxMessageLengthExceeded = errors.New(...) + var ErrMessageNotFlushed = errors.New("prior message not flushed") + var ErrReject = errors.New("unable to accept connection") + var ErrWrongChainID = errors.New("remote peer sent wrong chain identifier") + func EphemeralGenerator(gen func() (*secp256k1.PrivateKey, error)) func(*Machine) + type Conn struct + P2PPort int + Protocol types.Protocol + Version types.ProtoVersion + func Dial(localPriv *secp256k1.PrivateKey, protocol types.Protocol, ...) (*Conn, error) + func (c *Conn) Close() error + func (c *Conn) CloseChan() <-chan struct{} + func (c *Conn) Flush() (int, error) + func (c *Conn) LocalAddr() net.Addr + func (c *Conn) LocalPub() *secp256k1.PublicKey + func (c *Conn) Read(b []byte) (n int, err error) + func (c *Conn) ReadNextBody(buf []byte) ([]byte, error) + func (c *Conn) ReadNextHeader() (uint32, error) + func (c *Conn) ReadNextMessage() ([]byte, error) + func (c *Conn) RemoteAddr() net.Addr + func (c *Conn) RemotePub() *secp256k1.PublicKey + func (c *Conn) SetDeadline(t time.Time) error + func (c *Conn) SetReadDeadline(t time.Time) error + func (c *Conn) SetWriteDeadline(t time.Time) error + func (c *Conn) Write(b []byte) (n int, err error) + func (c *Conn) WriteMessage(b []byte) error + type Listener struct + func NewListener(localStatic *secp256k1.PrivateKey, host string, port int, ...) (*Listener, error) + func (l *Listener) Accept() (*Conn, error) + func (l *Listener) Addr() net.Addr + func (l *Listener) Close() error + type Machine struct + func NewBrontideMachine(initiator bool, localPub *secp256k1.PrivateKey, remotePub *secp256k1.PublicKey, ...) *Machine + func (b *Machine) Flush(w io.Writer) (int, error) + func (b *Machine) GenActOne() ([ActOneSize]byte, error) + func (b *Machine) GenActThree() ([ActThreeSize]byte, error) + func (b *Machine) GenActTwo() ([ActTwoSize]byte, error) + func (b *Machine) ReadBody(r io.Reader, buf []byte) ([]byte, error) + func (b *Machine) ReadHeader(r io.Reader) (uint32, error) + func (b *Machine) ReadMessage(r io.Reader) ([]byte, error) + func (b *Machine) RecvActOne(actOne [ActOneSize]byte) error + func (b *Machine) RecvActThree(actThree [ActThreeSize]byte) error + func (b *Machine) RecvActTwo(actTwo [ActTwoSize]byte) error + func (b *Machine) WriteMessage(p []byte) error + type NetAddress struct + Address net.Addr + IdentityKey *secp256k1.PublicKey