RebindingTransport

class RebindingTransport(val first: InMemoryTransport, val second: InMemoryTransport, val switchAt: Int, val oldAddressReceives: Boolean = true) : DatagramTransport(source)

A DatagramTransport whose source address changes in the middle of a conversation, as a NAT rebinding does to a client behind it: datagrams go out from first until switchAt of them were sent, and from second after that, so the peer sees the later ones come from another address. Datagrams arrive on both addresses, unless oldAddressReceives is false: then whatever reaches first after the switch is lost, as when the old NAT binding has expired.

val client = RebindingTransport(network.attach(), network.attach(), switchAt = 5)

close closes both transports.

Constructors

Link copied to clipboard
constructor(first: InMemoryTransport, second: InMemoryTransport, switchAt: Int, oldAddressReceives: Boolean = true)

Properties

Link copied to clipboard
Link copied to clipboard

Whether the switch has happened: the next datagram goes out from second.

Link copied to clipboard

The address datagrams go out from now.

Link copied to clipboard
open override val maxDatagramSize: Int
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val sent: Int

How many datagrams were sent so far, from either address.

Link copied to clipboard

Functions

Link copied to clipboard
open suspend override fun close()
Link copied to clipboard
open suspend override fun receive(): DatagramEvent
Link copied to clipboard
open suspend override fun send(to: Endpoint, datagram: ByteArray)
Link copied to clipboard
open override fun toString(): String