Minecraft Port Knock With Golang

Minecraft Port Knock

A simple program that performs two duties:

  1. Monitor a Minecraft server and stop it after it has been empty for some amount of time
  2. Emulate the Minecraft server, wait for a client connection and start the Minecraft server

Purpose

An empty Minecraft server consumes a decent amount of resources. This program is designed to take advantage of downtime and periods of reduced activity to free up those resources. While in server emulation mode, the Minecraft server will appear to be online to Minecraft clients / websites / etc.

If a client attempts to connect to the program while in emulation mode, the client will receive a configurable error and the Minecraft server will be started in the background.

On Demand

The program essentially provides "on demand" access to a minecraft server that can be activated by a simple connect attempt from any Minecraft client.

Usage

Update the settings in config.json and run go run mcPortKnock.go Binary Releases coming Soon(tm)

Similar Resources

GoLang Library for Browser Capabilities Project

Browser Capabilities GoLang Project PHP has get_browser() function which tells what the user's browser is capable of. You can check original documenta

Sep 27, 2022

Golang counters for readers/writers

Datacounter Golang counters for readers/writers. Examples ReaderCounter buf := bytes.Buffer{} buf.Write(data) counter := datacounter.NewReaderCounter(

Oct 9, 2022

Golang beautify data display for Humans

Golang beautify data display for Humans English 简体中文 Install # Stable version go get -u -v gopkg.in/ffmt.v1 # Latest version go get -u -v github.com/

Dec 22, 2022

a generic object pool for golang

Go Commons Pool The Go Commons Pool is a generic object pool for Golang, direct rewrite from Apache Commons Pool. Features Support custom PooledObject

Jan 5, 2023

Resiliency patterns for golang

go-resiliency Resiliency patterns for golang. Based in part on Hystrix, Semian, and others. Currently implemented patterns include: circuit-breaker (i

Jan 3, 2023

psutil for golang

gopsutil: psutil for golang This is a port of psutil (https://github.com/giampaolo/psutil). The challenge is porting all psutil functions on some arch

Jan 2, 2023

Type-safe Prometheus metrics builder library for golang

gotoprom A Prometheus metrics builder gotoprom offers an easy to use declarative API with type-safe labels for building and using Prometheus metrics.

Dec 5, 2022

Simple licensing library for golang.

license-key A simple licensing library in Golang, that generates license files containing arbitrary data. Note that this implementation is quite basic

Dec 24, 2022

Some utilities for Persian language in Go (Golang)

persian Some utilities for Persian language in Go (Golang). Installation go get github.com/mavihq/persian API .ToPersianDigits Converts all English d

Oct 22, 2022
Comments
  • Added a Dockerized build

    Added a Dockerized build

    Adds a multi-stage Dockerized build-from-source of mcPortKnock.

    docker build -t localbuild/mc-port-knock .
    docker run -it --rm -v $(pwd)/config.json:/config.json localbuild/mc-port-knock
    

    This provides an amd64 arch statically-linked binary. I tested and you can run this from a scratch image if desired (you need to run as root or copy a passwd file over in that case). By-default this build goes-on to add mcPortKnock to a debian:11-slim image (BASE is configurable build-arg).

    Other than the built binary, the final image on its own isn't super valuable, as there's no local MC server installed and possibly not the commands to operate on a remote one, but this image could serve as a base. With a little more work (mostly around environment-as-config) this makes a mcPortKnock image that can be hosted in a container environment - this can also be done as-is with a volume-mount for config.json.

  • Support always-listening / always-monitoring (remote mc server)

    Support always-listening / always-monitoring (remote mc server)

    Currently mcPortKnock implements a:

    • monitor (real mc server is running, detect idle and run stopCommand) ->
    • listen/be-fake-mc-server (port knock listener and run startCommand on client join-server knock) ->
    • monitor etc.

    ... loop. This is ideal when mcPortKnock runs on the same server as Minecraft and would typically listen on the same TCP port, so both mcPortKnock and Minecraft can't listen simultaneously.

    mcPortKnock can actually work quite well already in a different scenario, where it runs on a different server to the Minecraft server it monitors. In this case, mcPortKnock can run on a tiny server with startCommand and stopCommand controlling a remote mc server running on bigger hardware, which can then be completely shutdown when idle, since it isn't hosting mcPortKnock.

    In this scenario, an enhancement would be for mcPortKnock to always-listen e.g. 25565/tcp, since it won't ever have to yield that port for a local real mc server. Additionally, it can always-monitor, allowing it to stopCommand the mc server when it is idle, even when it is in "listen" mode, where currently I don't expect it would be monitoring mc or expect it to be running.

    If implemented, this enhancement could improve tiny/off-mc-host mcPortKnock to improve responsiveness and avoid any out-of-sync states where mc is not shutdown when idle.

    Networking for above usage: there are a number of great ways to incorporate mcPortKnock as a port-knock with mc-direct when running - I've used DNS with health-checks and failover rules, but other DNS and load-balancing options also work.

    Thanks for the nifty utility and project.

Go binding to libserialport for serial port functionality.

Go Serial Package serial provides a binding to libserialport for serial port functionality. Serial ports are commonly used with embedded systems, such

Nov 1, 2022
Lima launches Linux virtual machines on macOS, with automatic file sharing, port forwarding, and containerd.

Lima: Linux-on-Mac ("macOS subsystem for Linux", "containerd for Mac")

Jan 8, 2023
Entitas-Go is a fast Entity Component System Framework (ECS) Go 1.17 port of Entitas v1.13.0 for C# and Unity.

Entitas-Go Entitas-GO is a fast Entity Component System Framework (ECS) Go 1.17 port of Entitas v1.13.0 for C# and Unity. Code Generator Install the l

Dec 26, 2022
A simple tool to send binary data over a serial port. Designed for use with my retro computer systems.

Colin's Transfer Tool This is a really basic tool to transfer firmware files to my retro computer systems over a serial port. This removes the need fo

Dec 21, 2021
A Go package to allow you to read and write from the serial port as a stream of bytes.

Serial A Go package to allow you to read and write from the serial port as a stream of bytes. Details It aims to have the same API on all platforms, i

Jan 6, 2023
Golang CS:GO external base. Development currently halted due to compiler/runtime Golang bugs.

gogo Golang CS:GO External cheat/base. Also, my first Golang project. Wait! Development momentarily halted due to compiler/runtime bugs. Disclaimer Th

Jun 25, 2022
Belajar Golang Install Golang

Golang belajar Golang Install Golang = download di https://golang.org/dl/ = pilih yg Zip = extract file zipnya = buka foldernya - copy folder go = pas

Nov 15, 2021
Golang-module-references - A reference for how to setup a Golang project with modules - Task Management + Math Examples

Golang Module Project The purpose of this project is to act as a reference for setting up future Golang projects using modules. This project has a mat

Jan 2, 2022
Golang-echo-sample - Make an out-of-the-box backend based on golang-echo

Golang-echo-sample - Make an out-of-the-box backend based on golang-echo

Dec 31, 2021
Minimalistic, pluggable Golang evloop/timer handler with dependency-injection

Anagent Minimalistic, pluggable Golang evloop/timer handler with dependency-injection - based on codegangsta/inject - go-macaron/inject and chuckpresl

Sep 27, 2022