Function encode

  • Encodes a QWBP packet

    Parameters

    • fingerprint: Uint8Array

      32-byte DTLS fingerprint

    • candidates: QWBPCandidate[]

      Array of ICE candidates to encode

    Returns Uint8Array

    Encoded binary packet

    QWBPEncodeError if fingerprint is not 32 bytes or IP addresses are invalid

    const packet = QWBPEncoder.encode(fingerprint, [
    { ip: '192.168.1.5', port: 54321, type: 'host', protocol: 'udp' },
    { ip: '203.0.113.50', port: 54322, type: 'srflx', protocol: 'udp' },
    ]);