Skip to content

Add simple HOSTID and port-number retention support #163

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jaqchen
Copy link

@jaqchen jaqchen commented May 1, 2025

In order for `bore to be employed by large number of embedded devices, a series of changes is needed. First, a specific host-ID string is necessary to query on the server side, to fetch the port number for a given embedded device:

netcat -w 1 127.0.0.1 10088
client[0] => hostid: dev_ubuntu, online: true, portno: 15921, last_dance: 1746084941, discon: 4 client[1] => hostid: dev_raspbe, online: true, portno: 10846, last_dance: 1746085815, discon: 1

Secondly, heartbeat messages from bore server should be minimized to reduce TCP/IP traffic for embedded devices, as it might not have inexpensive internet connections. Interval (in seconds) for heartbeat messages can be changed via setting environment variable BORE_HEARTBEAT_INTERVAL, which defaults to 180 seconds.

Thirdly, as intervals between heartbeat have been greatly increased, TCP KeepAlive settings are supported to enable proper detection of closed TCP connections. Intervals for TCP-KeepAlive packages can be modified by setting environment variable `BORE_KEEPINTERVAL, which defaults to 120 seconds.

The remaining problem is that, `bore server cannot detect fast reconnection from clients, port-number reusing is very likely to fail in such scenario.

yejq added 2 commits May 1, 2025 16:10
In order for `bore to be employed by large number of embedded devices,
a series of changes is needed. First, a specific host-ID string is
necessary to query on the server side, to fetch the port number for a
given embedded device:

netcat -w 1 127.0.0.1 10088
client[0] => hostid: dev_ubuntu, online: true, portno: 15921, last_dance: 1746084941, discon: 4
client[1] => hostid: dev_raspbe, online: true, portno: 10846, last_dance: 1746085815, discon: 1

Secondly, heartbeat messages from `bore server should be minimized to reduce
TCP/IP traffic for embedded devices, as it might not have inexpensive internet
connections. Interval (in seconds) for heartbeat messages can be changed via
setting environment variable `BORE_HEARTBEAT_INTERVAL, which defaults to 180
seconds.

Thirdly, as intervals between heartbeat have been greatly increased, TCP KeepAlive
settings are supported to enable proper detection of closed TCP connections.
Intervals for TCP-KeepAlive packages can be modified by setting environment
variable `BORE_KEEPINTERVAL, which defaults to 120 seconds.

The remaining problem is that, `bore server cannot detect fast reconnection
from clients, port-number reusing is very likely to fail in such scenario.
The commit resolves the problem that previously occupied port
cannot be easily freed, a newly connected client with identical
`hostid has to bind to another port number. Also, the commit
requires that `hostid string from clients cannot be empty. If
`hostid is not specified, an random string will be generated.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant