Send messages through intermediate systems
Router2 routes datagrams between two systems that are not directly connected by using the bandwidth of a third system, to which the other two systems were connected. It is of benefit when a fully connected mesh topology is desired, but could not be completely established due to routers and/or firewalls. As the system address of a remote system will be the system address of the intermediary, it is necessary to use the RakNetGUID object to refer to systems, including with other plugins
Attach one instance of the Router2 plugin to each system..
Call EstablishRouting with the RakNetGUID of the destination system.
A message will be broadcast to all connected instances of RakPeer. For each of those that are running the Router2 plugin, the connection list will be queried to see who, if anyone is connected to the target system.
After all systems are queried, the system with the lowest total ping, that is also already forwarding the fewest connections, will start the UDPForwarder system and return ID_ROUTER_2_FORWARDING_ESTABLISHED. If no path is available, ID_ROUTER_2_FORWARDING_NO_PATH will be returned instead.
Once a path is established, you should attempt to connect to the target system as usual. The following code should be used:
RakNet::BitStream bs(packet->data, packet->length, false);
Note that rerouting happens automatically. When a connection is rerouted, you will get ID_ROUTER_2_REROUTED. While the SystemAddress will have changed, the RakNetGUID will not. Therefore, you must only refer to the target system using RakNetGUID when using this plugin.
NAT Traversal architecture