Skip to content

UHST Next

Stefan Dimitrov edited this page Jan 23, 2021 · 3 revisions

UHST next supports public relay directory. Upon startup the relay will output appKey. Add this appKey and the relay URL in the UHST client configuration and the UHST client will connect directly to the relay instead of getting a public relay from the directory.
The UHST client passes the appKey in a header which is verified by the UHST relay in order to unlock custom host ids.
Note that if no appKey is configured the UHST client will call the API which in turn will respond with 302 redirect to a pseudo-random relay. For initHost the relay is random but the last redirect timestamp is persisted in directory. When the relay receives initHost call it requests its random host id prefix from the API which stores a timestamp of this request. The difference between last initHost timestamp and last prefix request are used to confirm the relay is live. Upon join, the API uses the prefix of the unique identifier for lookup in the directory to ensure all clients connect to the same relay. Thus, attempts to connect directly to a relay without appKey or with invalid appKey will fail if the host id is passed by the client in host().
On the other hand, when a relay receives a host request with a valid appKey it will send a heartbeat to the API which will also add the relay to the public directory. In order to disable this feature on your own relay you need to specify privateRelay=true flag in the config. The UHST public relay network exists thanks to the generous bandwidth contribution by our community. We encourage you to share your relay on the public directory. The relay attempts to register in the directory the first time it receives initHost request with valid appKey, if privateRelay=false (default configuration). The API considers relays which have longer than X time between initHost redirect timestamp and prefix request as not alive until the next time they send a registration request.

Clone this wiki locally