Instances and identity
An instance is one running Paper server or Velocity proxy with the Minekube plugin and its connector turned on. Servers and proxies are the same thing to the registry: each is an instance with a key, labels, a status and a home relay. The registry records which platform and version each one runs.
An instance is the unit that joins a network, takes players and runs the bundles a network deploys.
The key is the identity
Section titled “The key is the identity”On its first start, the connector makes an Ed25519 key and keeps it in instance.key in the plugin’s folder, readable only by the user that runs the server. The public half, written in hex, is the instance’s ID.
- The registry maps keys to networks. Which network an instance belongs to is a fact about its key, set only when the instance joins with consent.
- The key signs everything the instance says. Every request to the Minekube API and the control channel carry a fresh signature, so nobody can speak for an instance without its key.
- Relays and other instances dial the key, not an address. That is how an instance behind NAT, or one that moved, stays reachable.
- The key is in the network’s key set. Anyone can check a token the instance signed against its network’s published keys. A bundle gets such a token with
Instance.token, to show a backend which server of which network calls (instance tokens).
Why a key and not a name or an address: an address changes when a server moves or its router restarts, and a name can be claimed by anyone. A key is made on the server, never leaves it, and proves itself on every request.
A new key is a new instance. A server set up again, or one whose key file was deleted, joins the network again like any new server. Because code addresses instances by labels, not by key, no code changes.
Labels say what it is
Section titled “Labels say what it is”An instance carries labels, such as stage=lobby or game=arena, and every selector in the network picks instances by them. They come from three places:
| Labels | Set by |
|---|---|
Its own, such as stage=lobby, and minekube.com/entry=true on entry instances |
The instance’s connector.json |
| Labels from the invite or trust rule it joined with | The registry, from the network’s owner |
minekube.com/platform, minekube.com/version and minekube.com/region |
The registry |
Labels and selectors explains selectors and the system labels.
Status says how it is doing
Section titled “Status says how it is doing”An instance’s status is not a label. Labels decide which instances match; status decides among the matches.
- Online while its control channel to the Minekube API is open and it reported recently. An instance that goes silent is offline, and no player is sent to it.
- Load: whether it is ready for players, how many it has, and how many it takes at most. An instance without a player limit counts as having the most free slots.
The connector reports the load over its control channel at a fixed interval. Limits lists the intervals.
The home relay is where it can be reached
Section titled “The home relay is where it can be reached”An instance needs no open port, because it connects outward. The connector measures the relays it is given and keeps a connection to the nearest one, its home relay.
- Players come in through it. A relay opens player streams to the instance over that connection.
- The registry knows it, so other instances and relays find the way. The region of the home relay becomes the label
minekube.com/region. - A direct path is tried too. The instance also reports its direct addresses, and iroh, the networking library underneath, uses a direct path when one exists.
An instance without a network
Section titled “An instance without a network”A connector whose key belongs to no network keeps running, but nobody can reach it through Minekube, and the Minekube API answers none of its questions. It logs a short claim code and waits for its owner to let it in. See Joining with consent.
Built and planned
Section titled “Built and planned”The key, labels, status and home relay are built and in preview. Planned: an instance reports which version it runs and whether an update waits, so a network can send new players elsewhere during an update.
Related
Section titled “Related”- connector.json: where an instance’s labels, key file and network are set.
- Connector, relay and API: how the three parts work together.
Was this helpful?
Thanks for the feedback.