Class IceUdpMuxListener

java.lang.Object
tel.schich.libdatachannel.IceUdpMuxListener
All Implemented Interfaces:
AutoCloseable

public final class IceUdpMuxListener extends Object implements AutoCloseable
Accepts incoming ICE connections on one UDP endpoint. Native code retains the first STUN request while the application decides; packets never pass through Java. Accepted peers are caller-owned and should be closed before this listener.
  • Constructor Details

  • Method Details

    • failure

      public @Nullable Throwable failure()
      An admission infrastructure failure, for diagnostics.
    • statistics

      public IceUdpMuxListener.Statistics statistics()
    • monitorStun

      public StunUdpMuxMonitor monitorStun(String serverHost, int serverPort)
      Starts caller-owned STUN monitoring on this listener's exact native socket. No peer or data channel is created. Close the returned monitor separately; closing this listener leaves its monitor and already accepted peers owned by their callers.
    • setAdmission

      public void setAdmission(byte[] context, Map<String,byte[]> secretsByUfragPrefix)
      Drops requests that neither a key nor a peer on this endpoint authenticates, natively and before the handler runs. A request whose local ufrag starts with a key's prefix authenticates with BASE64(HMAC-SHA256(secret, context || local ufrag)[0..24]). Secrets are copied. Limits: 8 keys, 1 to 16 character prefixes, 1 to 64 byte secrets and a 1024 byte context.
    • clearAdmission

      public void clearAdmission()
      Hands every request to the handler again.
    • setProxyProtocol

      public static void setProxyProtocol(@Nullable InetAddress bindAddress, int port, Collection<String> proxies)
      Reads a PROXY protocol v2 header from these relays, as numeric addresses or CIDR ranges, on a shared ICE UDP port, for listeners and peers alike, and attributes their datagrams to the client the header declares. Replies go back through the relay, so a relay must use one source port per client, and nothing else leaves the port straight but STUN server lookups. Other incoming datagrams are dropped except STUN responses to the port's own requests. The port stays open while set. A new list keeps the clients of relays it still lists, and an empty one clears it. The bind address must match the peers' or listener's, where a wildcard and null are the same port.
    • proxyRelay

      public static @Nullable InetSocketAddress proxyRelay(@Nullable InetAddress bindAddress, int port, InetSocketAddress client)
      The relay a client comes through on a port with PROXY protocol relays, by the address and port its header declared, which is how the client's peer reports it.
      Returns:
      The relay, or null when none speaks for the client, also when none are set
    • stats

      @Deprecated public long[] stats()
      Deprecated.
      Use statistics() for named counters.
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable