Class TunnelAddressTracker
- Namespace
- McServerLauncher.ViewModels
- Assembly
- McServerLauncher.dll
Finds out, and keeps up to date, the public address a server's Playit tunnel has — and makes the tunnel in the first place.
public sealed class TunnelAddressTracker
- Inheritance
-
TunnelAddressTracker
- Inherited Members
Remarks
Every path out of RefreshAsync(bool) sets a state. It used to return empty-handed in three different situations and say nothing about any of them, which is the whole of the "the address takes for ever to appear" report: most of the time it had appeared on Playit's side and the app was simply not going to ask again for another half minute.
Constructors
TunnelAddressTracker(ServerConfig, ServerPropertiesService, PlayitApiService, TunnelHost)
public TunnelAddressTracker(ServerConfig config, ServerPropertiesService properties, PlayitApiService api, TunnelHost host)
Parameters
configServerConfigpropertiesServerPropertiesServiceapiPlayitApiServicehostTunnelHost
Methods
CreateAsync(string, string)
Creates (if it doesn't exist) the Playit tunnel for this server's port, using the write key. Messages are shown in the server's console.
public Task CreateAsync(string writeKey, string serverName)
Parameters
writeKeystringThe account's write key.
serverNamestringThe name the tunnel is given on the account.
Returns
PollAsync()
Looks the address up a few times with a growing wait, then leaves it to the ordinary refresh.
public Task PollAsync()
Returns
Remarks
The Bedrock side has had this since crossplay was written; Java never did, and waited for the 30-second timer instead. With an arbitrary phase that is anything up to a minute of empty box — five with the window in the tray — starting from the moment the console says the address is seconds away.
RefreshAsync(bool)
Gets the tunnel address from the Playit API, matching by port and protocol.
public Task RefreshAsync(bool fresh = false)
Parameters
freshboolSkips the shared tunnel cache. Used by the burst after a tunnel is made.