-
Notifications
You must be signed in to change notification settings - Fork 0
Configuration
The environment variables that are available to the SocketForwarder are as below:
If not provided the TCP forwarder will not run.
This is the port that the TCP forwarder will listen on for new connections to join a forwarder group.
If not provided the UDP forwarder will not run.
This is the port that the UDP forwarder will listen on for all messages.
If not provided this will default to "SOCKETFORWARDER-NEW:".
For TCP:
- When a client connects to the TCP listening port, its first message should begin with this prefix following by an identifier string that is unique to the group that they wish to forward to and receive from.
E.g.
SOCKETFORWARDER-NEW:my-group-ID-1234567890
For UDP:
- When a client wishes to be added to the UDP forwarding group (there is only a single UDP group since we cannot categorise connections and determine who sent what using UDP. For multiple UDP forwarder groups you would need to run multiple instances of this application). The message sent must begin with this prefix then followed by the
port numberthat they will be listening to responses from. This allows the forwarder to store this provided port and the incoming address to forward future data from the UDP group to this connection. - Any message sent to the UDP forwarder listening port that does not begin with this prefix will be assumed that it is a message to be forwarded to all known peers.
E.g.
SOCKETFORWARDER-NEW:44567
If not provided this will default to 10240.
This will be the maximum read size for all TCP and UDP socket read operations.
If not provided the value "0.0.0.0" is used.
This will be the address that the application binds to for both TCP and UDP.
If not provided no addresses will be preconfigured into any TCP groups.
This property allows you to pre-register specific addresses under specific TCP groups during startup. This property acts as a whitelist for incoming TCP connections, any address in this list does not need to explicitly subscribe to the forwarder. Upon accepting the TCP connection request the forwarder will automatically place this socket into the correct group that was initially configured and forward appropriate messages to this connection.
If there are any interruptions to the socket connection, the client can attempt to re-connect and the forwarder will maintain this preconfigured list for its lifetime and always automatically accept and emplace socket connections coming from the provided addresses into the correct group.
The format for this property is as follows, firstly specifying the group ID, the address and port then commas after each entry. E.g. "group1:localhost:12345,group1:localhost:34211,group2:localhost:45321"
For clarity, using the configuration above, any incoming TCP connection from "localhost:45321" will be accepted and placed immediately into the "group2" group. The client does not need to send any initial message to verify itself.
If not provided no addresses will be preconfigured into the UDP group.
This property allows you to pre-register specific addresses under the UDP group. Meaning that the UDP clients do not need to register or subscribe to the forwarder, the forwarder will automatically add these address (if resolved successfully) and begin forwarding messages to theses addresses immediately.
Since the UDP forwarder cannot detect disconnections through UDP, any address added will continue to have all messages forwarded to it until the forwarder is stopped.
The format for this is a comma separated list of "hostname:port".
E.g. "localhost:65432,localhost:44321"