Skip to main content

Module direct

Module direct 

Source
Expand description

Which address to reach a server at. Port of @redseat/api-http direct.ts and of the candidate order of the web app’s direct-access.ts.

Direct HTTPS to a Redseat server is https://<ip-encoded>.<label>.<zone>:<port>: the zone’s DNS decodes the IP from the first label, and the server holds a wildcard certificate for *.<label>.<zone>, so every address gets a valid TLS name.

Structs§

DirectCandidate
A base URL to try.
ProbeOptions
Probe timing.

Enums§

CandidateKind
Where a candidate address comes from.

Functions§

direct_candidates
Candidates in preference order: LAN, then global IPv6, then public IPv4. Addresses that are not IPs and duplicates are skipped.
direct_hostname
<ip-encoded>.<label>.<zone>.
direct_url
https://<ip-encoded>.<label>.<zone>[:port].
domain_candidate
A server’s custom domain, served over HTTPS by its own reverse proxy.
encode_ip_label
192.168.1.10 → 192-168-1-10; 2a01:e0a::1 → 2a01-e0a--1. None when address is not an IP address.
probe_candidates_with
Pings every candidate at once with ping (true: it answered). A success wins as soon as every more preferred candidate (earlier in the list) has failed, or after preference_window otherwise; the best success so far is used. None when none answers before timeout. Port of probeDirectCandidates.
public_direct_url
URL for links meant to leave this device (share, a player on another machine): a public address, never a LAN one. IPv4 first, since recipients may lack IPv6.
public_server_url
Public URL of a server: its public direct address, else its custom domain.
server_candidates
Every address of a server, best first: direct HTTPS candidates, then the custom domain. A preferred URL (the last one that worked, cached by the app) goes first.