Class TunnelInventory
- Namespace
- McServerLauncher.Services
- Assembly
- McServerLauncher.dll
Reading the account's tunnels against the servers on this machine: which ones lead nowhere, which ones two servers are fighting over, which are there twice, and what is missing.
public static class TunnelInventory
- Inheritance
-
TunnelInventory
- Inherited Members
Remarks
Pure and without network access, so every rule can be pinned by a test. The identity of a tunnel is its local port and its protocol, the same definition Match(IEnumerable<PlayitTunnel>, int, bool) uses: TCP belongs to a server's Java port, UDP to its Bedrock port. Matching on the port alone would let a Bedrock tunnel look like a server's Java one whenever the two numbers coincided.
It only ever reads. Nothing here deletes or renames anything; it says what it would suggest and the caller decides, because deleting a tunnel cannot be undone.
Methods
Build(IReadOnlyList<PlayitTunnel>, IReadOnlyList<ServerPorts>)
public static TunnelReport Build(IReadOnlyList<PlayitApiService.PlayitTunnel> tunnels, IReadOnlyList<ServerPorts> servers)
Parameters
tunnelsIReadOnlyList<PlayitApiService.PlayitTunnel>serversIReadOnlyList<ServerPorts>
Returns
NameFor(string, bool)
The name a tunnel is created under, and recognised by: the server's, plus a suffix for Bedrock.
public static string NameFor(string serverName, bool udp)
Parameters
Returns
RenamesFor(ServerPorts, string, IReadOnlyList<PlayitTunnel>, IReadOnlyList<ServerPorts>)
The renames that keep a server's tunnels in step after the server itself was renamed.
public static IReadOnlyList<(string TunnelId, string NewName)> RenamesFor(ServerPorts server, string oldName, IReadOnlyList<PlayitApiService.PlayitTunnel> tunnels, IReadOnlyList<ServerPorts> servers)
Parameters
serverServerPortsThe server, carrying its new name.
oldNamestringThe name it had.
tunnelsIReadOnlyList<PlayitApiService.PlayitTunnel>Every tunnel of the account.
serversIReadOnlyList<ServerPorts>Every server on this machine, to tell whose a tunnel is.
Returns
Remarks
Only a tunnel still carrying exactly the name the app would have given it is touched. One the user named by hand, on the website or here, is theirs and stays as it is; the app only follows its own naming, never overwrites somebody else's.