Class NetherNetDiscoverySignaling
java.lang.Object
org.cloudburstmc.netty.channel.nethernet.signaling.NetherNetDiscoverySignaling
- All Implemented Interfaces:
AutoCloseable,NetherNetClientSignaling,NetherNetServerSignaling,NetherNetSignaling
public class NetherNetDiscoverySignaling
extends Object
implements NetherNetClientSignaling, NetherNetServerSignaling
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.cloudburstmc.netty.channel.nethernet.signaling.NetherNetClientSignaling
NetherNetClientSignaling.NotFoundHandlerNested classes/interfaces inherited from interface org.cloudburstmc.netty.channel.nethernet.signaling.NetherNetServerSignaling
NetherNetServerSignaling.NewConnectionHandler, NetherNetServerSignaling.PongDataNested classes/interfaces inherited from interface org.cloudburstmc.netty.channel.nethernet.signaling.NetherNetSignaling
NetherNetSignaling.IceServerInfo, NetherNetSignaling.SignalHandler -
Constructor Summary
ConstructorsConstructorDescriptionCreates a NetherNetDiscoverySignaling with a random local Network ID and binds to an ephemeral port.NetherNetDiscoverySignaling(long localNetworkId) Creates a NetherNetDiscoverySignaling with the specified local Network ID.NetherNetDiscoverySignaling(long localNetworkId, InetSocketAddress bindAddress) Creates a NetherNetDiscoverySignaling with the specified local Network ID and bind address. -
Method Summary
Modifier and TypeMethodDescriptionbooleanWhether ICE may bind to the address the channel was bound to, instead of an ephemeral port.voidbind(SocketAddress localAddress, io.netty.channel.EventLoop eventLoop) Binds the signaling medium to listen for incoming connections (Server mode).voidclose()Closes the signaling channel and releases any associated resources.connect(SocketAddress remote) Connects to the signaling medium (Client mode).Returns the Local Network ID of this client as a String.booleanisActive()Whether the signaling is connected and able to carry messagesvoidremoveSignalHandler(long connectionId) Removes the signaling handler for a specific connection ID.voidsendSignal(String targetNetworkId, String data) Sends a signaling message to the remote peer.voidSets the advertisement data for the discovery mechanism (e.g.voidHandler for new connections.voidSets a handler to be called when a signaling message is received for an unknown connection ID.voidsetSignalHandler(long connectionId, NetherNetSignaling.SignalHandler handler) Sets a handler to receive signaling messages for a specific connection ID.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.cloudburstmc.netty.channel.nethernet.signaling.NetherNetServerSignaling
getIceServers, serverIdentity, setMetrics, usesTrickleIceMethods inherited from interface org.cloudburstmc.netty.channel.nethernet.signaling.NetherNetSignaling
sendFullSdp
-
Constructor Details
-
NetherNetDiscoverySignaling
public NetherNetDiscoverySignaling()Creates a NetherNetDiscoverySignaling with a random local Network ID and binds to an ephemeral port. -
NetherNetDiscoverySignaling
public NetherNetDiscoverySignaling(long localNetworkId) Creates a NetherNetDiscoverySignaling with the specified local Network ID.- Parameters:
localNetworkId- The local Network ID to use.
-
NetherNetDiscoverySignaling
Creates a NetherNetDiscoverySignaling with the specified local Network ID and bind address.- Parameters:
localNetworkId- The local Network ID to use.bindAddress- The address to bind the discovery socket to.
-
-
Method Details
-
getLocalNetworkId
Description copied from interface:NetherNetSignalingReturns the Local Network ID of this client as a String. This is required for formatting the 'candidate:' string in SDP.- Specified by:
getLocalNetworkIdin interfaceNetherNetSignaling
-
connect
Description copied from interface:NetherNetClientSignalingConnects to the signaling medium (Client mode).- Specified by:
connectin interfaceNetherNetClientSignaling- Parameters:
remote- The address of the signaling server to connect to.
-
allowsIceOnLocalPort
public boolean allowsIceOnLocalPort()Description copied from interface:NetherNetServerSignalingWhether ICE may bind to the address the channel was bound to, instead of an ephemeral port.- Specified by:
allowsIceOnLocalPortin interfaceNetherNetServerSignaling- Returns:
- true if ICE should be pinned to the bound address
-
bind
Description copied from interface:NetherNetServerSignalingBinds the signaling medium to listen for incoming connections (Server mode).- Specified by:
bindin interfaceNetherNetServerSignaling- Parameters:
localAddress- The local address to bind to.eventLoop- The owning channel's event loop.
-
setNewConnectionHandler
Description copied from interface:NetherNetServerSignalingHandler for new connections.- Specified by:
setNewConnectionHandlerin interfaceNetherNetServerSignaling- Parameters:
handler- Functional interface receiving (ConnectionID, RemoteNetworkID, Payload)
-
setAdvertisementData
Description copied from interface:NetherNetServerSignalingSets the advertisement data for the discovery mechanism (e.g. LAN Pong).- Specified by:
setAdvertisementDatain interfaceNetherNetServerSignaling- Parameters:
pongData- The Pong advertisement data.
-
sendSignal
Description copied from interface:NetherNetSignalingSends a signaling message to the remote peer.- Specified by:
sendSignalin interfaceNetherNetSignaling- Parameters:
targetNetworkId- The Network ID of the destination (String to support Realms).data- The raw signaling payload.
-
setSignalHandler
Description copied from interface:NetherNetSignalingSets a handler to receive signaling messages for a specific connection ID.- Specified by:
setSignalHandlerin interfaceNetherNetSignaling- Parameters:
connectionId- The connection ID to listen for.handler- The handler to process incoming signaling messages.
-
removeSignalHandler
public void removeSignalHandler(long connectionId) Description copied from interface:NetherNetSignalingRemoves the signaling handler for a specific connection ID.- Specified by:
removeSignalHandlerin interfaceNetherNetSignaling- Parameters:
connectionId- The connection ID whose handler should be removed.
-
setNotFoundHandler
Description copied from interface:NetherNetClientSignalingSets a handler to be called when a signaling message is received for an unknown connection ID.- Specified by:
setNotFoundHandlerin interfaceNetherNetClientSignaling- Parameters:
handler- The handler to process incoming signaling messages for unknown connection IDs.
-
isActive
public boolean isActive()Description copied from interface:NetherNetSignalingWhether the signaling is connected and able to carry messages- Specified by:
isActivein interfaceNetherNetSignaling
-
close
public void close()Description copied from interface:NetherNetSignalingCloses the signaling channel and releases any associated resources.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceNetherNetSignaling
-