Versions in this module Expand all Collapse all v0 v0.0.1 Nov 7, 2022 Changes in this version + const FrameLengthSize + const FrameMaxSize + const NoiseStartPattern + const Origin + const URL + const WAMagicValue + var ErrFrameTooLarge = errors.New("frame too large") + var ErrSocketAlreadyOpen = errors.New("frame socket is already open") + var ErrSocketClosed = errors.New("frame socket is closed") + var WAConnHeader = []byte + type DisconnectHandler func(socket *NoiseSocket, remote bool) + type FrameHandler func([]byte) + type FrameSocket struct + Frames chan []byte + Header []byte + OnDisconnect func(remote bool) + Proxy Proxy + WriteTimeout time.Duration + func NewFrameSocket(log waLog.Logger, header []byte, proxy Proxy) *FrameSocket + func (fs *FrameSocket) Close(code int) + func (fs *FrameSocket) Connect() error + func (fs *FrameSocket) Context() context.Context + func (fs *FrameSocket) IsConnected() bool + func (fs *FrameSocket) SendFrame(data []byte) error + type NoiseHandshake struct + func NewNoiseHandshake() *NoiseHandshake + func (nh *NoiseHandshake) Authenticate(data []byte) + func (nh *NoiseHandshake) Decrypt(ciphertext []byte) (plaintext []byte, err error) + func (nh *NoiseHandshake) Encrypt(plaintext []byte) []byte + func (nh *NoiseHandshake) Finish(fs *FrameSocket, frameHandler FrameHandler, ...) (*NoiseSocket, error) + func (nh *NoiseHandshake) MixIntoKey(data []byte) error + func (nh *NoiseHandshake) MixSharedSecretIntoKey(priv, pub [32]byte) error + func (nh *NoiseHandshake) Start(pattern string, header []byte) + type NoiseSocket struct + func (ns *NoiseSocket) Context() context.Context + func (ns *NoiseSocket) IsConnected() bool + func (ns *NoiseSocket) SendFrame(plaintext []byte) error + func (ns *NoiseSocket) Stop(disconnect bool) + type Proxy = func(*http.Request) (*url.URL, error)