itzg / mc-router

Routes Minecraft client connections to backend servers based upon the requested server address
MIT License
533 stars 35 forks source link

Failed to read packet and Unable to find registered backend #318

Open alexis-vannot opened 1 month ago

alexis-vannot commented 1 month ago

Hi guys,

I can't figure out how to block "slowstack.tv" and fix the "Failed to read packet".

There is my .yml

  # ==================================
  # |   Minecraft Router             |
  # ==================================
  minecraft-router:
    # ---- Service information ----
    container_name: minecraft-router
    image: itzg/mc-router:latest

    # ---- Build information ----
    depends_on:
      - minecraft
      - minecraft-2
      - minecraft-3
    ports:
      - 127.0.0.1:25564:25564 # API port to only loopback to avoid external exposure
    environment:
      API_BINDING: ":25564"
      DEBUG: True
      TRUSTED-PROXIES: REVERSE_PROXY_IP
      MAPPING: |
        URL-1.dev=minecraft:25565
        URL-2.dev=minecraft-2:25565
        URL-3.dev=minecraft-3:25565
    labels:
      - traefik.enable=true
      - traefik.docker.network=traefik
      - traefik.tcp.routers.minecraft-router.rule=HostSNI(`*`)
      - traefik.tcp.routers.minecraft-router.entrypoints=minecraft
      - traefik.tcp.routers.minecraft-router.service=minecraft-router-service
      - traefik.tcp.services.minecraft-router-service.loadbalancer.server.port=25565
    networks:
      - minecraft
      - traefik

There is the log of mc-router

minecraft-router     | INFO[0092] Got connection                                client="REVERSE_PROXY_IP:47742"
minecraft-router     | DEBU[0092] Reading packet                                client="REVERSE_PROXY_IP:47742"
minecraft-router     | DEBU[0092] Reading frame                                 client="REVERSE_PROXY_IP:47742"
minecraft-router     | DEBU[0092] Read frame length                             client="REVERSE_PROXY_IP:47742" length=19
minecraft-router     | DEBU[0092] Reading frame content                         client="REVERSE_PROXY_IP:47742" length=19 total=19
minecraft-router     | DEBU[0092] Read frame                                    client="REVERSE_PROXY_IP:47742" frame="Frame:[len=19, payload=0X00FF050C736C6F77737461636B2E7476053901]"
minecraft-router     | DEBU[0092] Read packet                                   client="REVERSE_PROXY_IP:47742" packet="Frame:[len=19, packetId=0, data=0XFF050C736C6F77737461636B2E7476053901]"
minecraft-router     | DEBU[0092] Got packet                                    client="REVERSE_PROXY_IP:47742" length=19 packetID=0
minecraft-router     | DEBU[0092] Got handshake                                 client="REVERSE_PROXY_IP:47742" handshake="&{767 slowstack.tv 1337 1}"
minecraft-router     | DEBU[0092] Finding backend for server address            serverAddress=slowstack.tv
minecraft-router     | WARN[0092] Unable to find registered backend             resolvedHost=slowstack.tv serverAddress=slowstack.tv
minecraft-router     | DEBU[0092] Closing frontend connection                   client="REVERSE_PROXY_IP:47742"
minecraft-router     | INFO[0097] Got connection                                client="REVERSE_PROXY_IP:47754"
minecraft-router     | DEBU[0097] Reading packet                                client="REVERSE_PROXY_IP:47754"
minecraft-router     | DEBU[0097] Reading frame                                 client="REVERSE_PROXY_IP:47754"
minecraft-router     | DEBU[0097] Read frame length                             client="REVERSE_PROXY_IP:47754" length=10
minecraft-router     | DEBU[0097] Reading frame content                         client="REVERSE_PROXY_IP:47754" length=10 total=10
minecraft-router     | DEBU[0097] Read frame                                    client="REVERSE_PROXY_IP:47754" frame="Frame:[len=10, payload=0X00F8050361616163DD01]"
minecraft-router     | DEBU[0097] Read packet                                   client="REVERSE_PROXY_IP:47754" packet="Frame:[len=10, packetId=0, data=0XF8050361616163DD01]"
minecraft-router     | DEBU[0097] Got packet                                    client="REVERSE_PROXY_IP:47754" length=10 packetID=0
minecraft-router     | DEBU[0097] Got handshake                                 client="REVERSE_PROXY_IP:47754" handshake="&{760 aaa 25565 1}"
minecraft-router     | DEBU[0097] Finding backend for server address            serverAddress=aaa
minecraft-router     | WARN[0097] Unable to find registered backend             resolvedHost=aaa serverAddress=aaa
minecraft-router     | DEBU[0097] Closing frontend connection                   client="REVERSE_PROXY_IP:47754"
minecraft-router     | INFO[0119] Got connection                                client="REVERSE_PROXY_IP:33026"
minecraft-router     | DEBU[0119] Reading packet                                client="REVERSE_PROXY_IP:33026"
minecraft-router     | ERRO[0124] Failed to read packet                         clientAddr="REVERSE_PROXY_IP:33026" error="read tcp 172.16.80.5:25565->REVERSE_PROXY_IP:33026: i/o timeout"
minecraft-router     | DEBU[0124] Closing frontend connection                   client="REVERSE_PROXY_IP:33026"
minecraft-router     | INFO[0131] Got connection                                client="REVERSE_PROXY_IP:45882"
minecraft-router     | DEBU[0131] Reading packet                                client="REVERSE_PROXY_IP:45882"
minecraft-router     | ERRO[0136] Failed to read packet                         clientAddr="REVERSE_PROXY_IP:45882" error="read tcp 172.16.80.5:25565->REVERSE_PROXY_IP:45882: i/o timeout"
minecraft-router     | DEBU[0136] Closing frontend connection                   client="REVERSE_PROXY_IP:45882"

Thank you in advance for your answers!

itzg commented 1 month ago

Currently there's no way to block any particular backend requests. That would be a helpful feature for your scenario though.