mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-13 23:14:53 +09:00
12 lines
362 B
TypeScript
12 lines
362 B
TypeScript
import * as lib from "@clusterio/lib";
|
|
|
|
export function instancePublicAddress(instance: lib.InstanceDetails, host?: lib.HostDetails | null) {
|
|
if (instance.assignedHost === undefined || !host || !host.publicAddress) {
|
|
return "";
|
|
}
|
|
if (instance.gamePort === undefined) {
|
|
return host.publicAddress;
|
|
}
|
|
return `${host.publicAddress}:${instance.gamePort}`;
|
|
}
|