encode
fun encode(added: List<UtPex.PexPeer>, dropped: List<UtPex.PexPeer> = emptyList(), includeEmpty: Boolean = true, maxAdded: Int = MAX_ADDED_ENTRIES): ByteArray
Encode a PEX message from added and dropped peer lists. Each peer is routed to its IPv4 or IPv6 key by address length; flags are written for added peers only (added.f and added6.f), never for dropped ones. This matches ut_pex_plugin::tick.
Empty lists are still emitted as empty strings, the way libtorrent always materializes added/dropped/added.f (and the v6 variants) even when no peers fall into a bucket. Pass includeEmpty = false to omit empty keys.
At most maxAdded peers from added are written (across both families, combined), reproducing the num_added >= max_peer_entries break in ut_pex_plugin::tick. dropped is never truncated. The default cap is MAX_ADDED_ENTRIES; pass a larger value to lift it.