erjadi / kubecraftadmin

MIT License
992 stars 33 forks source link

/connect 10.0.0.1:8000/ws - nothing happends #27

Open wioxjk opened 2 years ago

wioxjk commented 2 years ago

Hi,

Running the latest and greatest version of Minecraft Bedrock - and nothing happends if you try to connect to the KubeCraftAdmin websockets.

erjadi commented 2 years ago

Hi, I've updated the image now, could you check if it is still not working? Have you doublechecked that the port is open and accessible at 10.0.0.1:8000?

wioxjk commented 2 years ago

Hi, I've updated the image now, could you check if it is still not working? Have you doublechecked that the port is open and accessible at 10.0.0.1:8000?

Hi, Great that you updated the image :)

Sadly, I could not connect either. I am able to reach the container via the webbrowser with http://127.0.0.1:8000/ws, and I am greeted with a "bad request" - so I guess the container starts as it should.

I am not able to see any logs in the container itself thou

pathtofile commented 2 years ago

Hey @wioxjk , not sure if this is your issue, but I had the same problem when running the server on my localhost on Windows, and just fixed it.

The issue stems from how UWP Apps (the type of program Minecraft Bedrock addition is) are prevented by default from talking to the localhost/loopback network.

To fix this, I had to run a few PowerShell commands as Administrator, to tell Windows to allow Minecraft to reach my golang server:

# First find the "Package Family Name" of Minecraft, which should look like like 'microsoft.minecraftuwp_RANDOM_STRING'
$family_name=(Get-AppxPackage '*minecraft*').PackageFamilyName

# Enable minecraft to reach loopback network
cmd.exe /C "checknetisolation loopbackexempt -a -n=$family_name"

# Check it worked, you should see minecraft here
checknetisolation loopbackexempt -s

Note this does technically lower the security of your system at least a little bit, however as it is Minecraft, you are probably ok with this.

wioxjk commented 2 years ago

Hi @pathtofile Thank you very much for you answer, I just saw it. Well that would explain it! I guess I could deploy that service on another Linux-host.

I'll try that and let you know!

wioxjk commented 2 years ago

Hi again! I can confirm that running the container on another machine actually works! However, I am getting this error in the container when I step on the beacon:

Player has entered!
KubeCraftAdmin
The Adventurer's Admin Tool
Connected to k8s cluster
init
Creating Animal Pens  {-261.51513671875 65.62001037597656 1214.8662109375}
2022/01/27 13:57:00 http: panic serving 192.168.2.154:31887: runtime error: invalid memory address or nil pointer dereference
goroutine 8 [running]:
net/http.(*conn).serve.func1(0xc000108000)
        /usr/local/go/src/net/http/server.go:1801 +0x147
panic(0x1466b80, 0x203b060)
        /usr/local/go/src/runtime/panic.go:975 +0x3e9
k8s.io/client-go/kubernetes.(*Clientset).CoreV1(...)
        /go/src/k8s.io/client-go/kubernetes/clientset.go:264
main.main.func1.1.1(0xc00003d260)
        /app/main.go:86 +0x1a2
reflect.Value.call(0x13f8f60, 0xc0001e66f0, 0x13, 0x15ed26b, 0x4, 0xc00047b7e8, 0x1, 0x1, 0xc0000ac100, 0xc00000e0d8, ...)
        /usr/local/go/src/reflect/value.go:475 +0x8c7
reflect.Value.Call(0x13f8f60, 0xc0001e66f0, 0x13, 0xc00047b7e8, 0x1, 0x1, 0x0, 0xc000495201, 0x22)
        /usr/local/go/src/reflect/value.go:336 +0xb9
github.com/sandertv/mcwss.(*Player).handleIncomingPacket(0xc00000a1e0, 0xc000495290, 0x24, 0xc00033a2d0, 0xf, 0x1, 0x13c0280, 0xc00009c200, 0x0, 0x0)
        /go/src/github.com/sandertv/mcwss/player.go:511 +0x3a5
github.com/sandertv/mcwss.(*Server).handleResponse(0xc0004c6000, 0x17a97c0, 0xc000110000, 0xc0000fe300)
        /go/src/github.com/sandertv/mcwss/server.go:153 +0x405
net/http.HandlerFunc.ServeHTTP(0xc00003a060, 0x17a97c0, 0xc000110000, 0xc0000fe300)
        /usr/local/go/src/net/http/server.go:2042 +0x44
net/http.(*ServeMux).ServeHTTP(0x20585c0, 0x17a97c0, 0xc000110000, 0xc0000fe300)
        /usr/local/go/src/net/http/server.go:2417 +0x1ad
net/http.serverHandler.ServeHTTP(0xc0001101c0, 0x17a97c0, 0xc000110000, 0xc0000fe300)
        /usr/local/go/src/net/http/server.go:2843 +0xa3
net/http.(*conn).serve(0xc000108000, 0x17ac2c0, 0xc0000ac000)
        /usr/local/go/src/net/http/server.go:1925 +0x8ad
created by net/http.(*Server).Serve
        /usr/local/go/src/net/http/server.go:2969 +0x36c
initialized!

Does this mean that the kubeconfig is wrong ?