Skip to content

improve autopause port detection #1545

Open
@atfrase

Description

@atfrase

Enhancement Type

Improve an existing feature

Describe the enhancement

Currently, autopause starts with a template /autopause/knockd-config.cfg file and then substitutes SERVER_PORT and RCON_PORT in case they've been changed. The config also includes port 19132/udp (the default Bedrock port) just in case someone installs GeyserMC, but if they were to run that on a different port, there's no way for them to make that port change in the knockd config.

Some other plugins also add server ports that ought to prevent or resume from pause, such as the Dynmap plugin with its built-in web server, and there's similarly no easy way to add those ports to the knockd config so that connections to the map port (8123 by default) wake up the server.

To handle both of these cases, I wonder if it would be worth just generating the entire knockd-config.cfg file dynamically on startup, by having the container ask docker which ports have been mapped into it and adding knockd listeners for each one. Anyone who changes a port (such as for GeyserMC), or adds a plugin that needs a new port (such as Dynmap) must necessarily add that port mapping to their docker-compose.yml, so it should suffice for knockd to just listen on all of those ports (plus RCON).

Ideally (but maybe optionally) it would be great to somehow also detect activity on any such additional ports (such as someone watching Dynmap) to prevent server pause even if no players are connected any more. I'm not sure how best to do that, though, and that maybe should have to be explicitly set (i.e. env AUTOPAUSE_TCP_PORTS) rather than being automatic for every port mapped to the container.

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    To do

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions