Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lite mode is not reading favicon files #218

Closed
dalbitresb12 opened this issue Jul 10, 2023 · 1 comment
Closed

Lite mode is not reading favicon files #218

dalbitresb12 opened this issue Jul 10, 2023 · 1 comment
Labels
bug Something isn't working gate-lite Regarding Gate Lite mode good first issue Good for newcomers priority/high High priority task

Comments

@dalbitresb12
Copy link

Hi there! I was just trying the new Lite mode that was recently introduced. I've been trying to make it work with a favicon file, but it doesn't show the image on the Minecraft server list.

image

I've done a bit of debugging and I think it is because the code for Lite mode is never calling the Favicon parsing function as it does with the normal mode.

As you can see here, the value for Favicon in the fallbackPong is still the filename, not the image in base64:

image

The code from the screenshot is from pkg/edition/java/lite/forward.go.

I tried setting a debug point in the Favicon parse function, but it's never called when using Lite mode.

This is the config file I've been using:
config:
  bind: 0.0.0.0:25568
  debug: true
  lite:
    enabled: true
    routes:
      - host: '*'
        backend: localhost:25565
        fallback:
          motd: |
            Server is offline
          version:
            name: 'Offline'
            protocol: -1
          favicon: favicon.png

connect:
  enabled: false

The image is a valid 64x64 PNG file:

image

And this is the logs generated by Gate with debug mode enabled:
2023-07-10T01:16:37.795-0500    INFO    gate/root.go:93 logging verbosity       {"verbosity": 127}
2023-07-10T01:16:37.796-0500    INFO    gate/root.go:94 using config file       {"config": "/home/dab12/gate/config.yml"}
2023-07-10T01:16:37.823-0500    INFO    java    proxy/proxy.go:157      running in debug mode
2023-07-10T01:16:37.824-0500    INFO    java    proxy/proxy.go:160      running in lite mode
2023-07-10T01:16:37.828-0500    INFO    java    proxy/proxy.go:457      listening for connections       {"addr": "0.0.0.0:25568"}
2023-07-10T01:16:49.773-0500    LEVEL(-2)       java.client.decoder     codec/decoder.go:97     decoded packet  {"context": "PacketContext:direction=ServerBound,Protocol=4,KnownPacket=true,PacketID=0,PacketType=*packet.Handshake,Payloadlen=21"}
2023-07-10T01:16:49.774-0500    INFO    java.client.statusSession       proxy/session_status.go:57      got server list status request  {"inbound": "[initial connection] 172.27.96.1:51154 -> 172.27.102.206:25568", "protocol": "757"}
2023-07-10T01:16:49.774-0500    LEVEL(-2)       java.client.decoder     codec/decoder.go:97     decoded packet  {"context": "PacketContext:direction=ServerBound,Protocol=757,KnownPacket=true,PacketID=0,PacketType=*packet.StatusRequest,Payloadlen=1"}
2023-07-10T01:16:49.775-0500    DEBUG   java.client.statusSession.lite  lite/forward.go:341     resolving status        {"inbound": "[initial connection] 172.27.96.1:51154 -> 172.27.102.206:25568", "protocol": "757", "clientAddr": "172.27.96.1", "virtualHost": "172.27.102.206", "protocol": "757", "route": "*", "backendAddr": "localhost:25565"}
2023-07-10T01:16:49.781-0500    INFO    java.client.statusSession.lite  lite/forward.go:79      failed to try backend   {"inbound": "[initial connection] 172.27.96.1:51154 -> 172.27.102.206:25568", "protocol": "757", "clientAddr": "172.27.96.1", "virtualHost": "172.27.102.206", "protocol": "757", "route": "*", "backendAddr": "localhost:25565", "error": "failed to dial route: failed to connect to backend localhost:25565: dial tcp 127.0.0.1:25565: connect: connection refused"}
2023-07-10T01:16:49.781-0500    INFO    java.client.statusSession.lite  lite/forward.go:290     failed to resolve status response, will use fallback status response    {"inbound": "[initial connection] 172.27.96.1:51154 -> 172.27.102.206:25568", "protocol": "757", "clientAddr": "172.27.96.1", "virtualHost": "172.27.102.206", "protocol": "757", "route": "*", "error": "all backends failed"}
2023-07-10T01:16:49.786-0500    DEBUG   java.client.statusSession.lite  lite/forward.go:303     using fallback status response  {"inbound": "[initial connection] 172.27.96.1:51154 -> 172.27.102.206:25568", "protocol": "757", "clientAddr": "172.27.96.1", "virtualHost": "172.27.102.206", "protocol": "757", "route": "*", "status": "{\"description\":{\"text\":\"Server is offline\"},\"version\":{\"protocol\":-1,\"name\":\"Offline\"},\"favicon\":\"favicon.png\",\"modinfo\":{\"type\":\"\",\"modList\":null}}"}
2023-07-10T01:16:49.786-0500    LEVEL(-2)       java.client.encoder     codec/encoder.go:93     encoded packet  {"context": "PacketContext:direction=ClientBound,Protocol=757,KnownPacket=true,PacketID=0,PacketType=*packet.StatusResponse,Payloadlen=0", "bytes": 151}
2023-07-10T01:16:49.790-0500    LEVEL(-2)       java.client.decoder     codec/decoder.go:97     decoded packet  {"context": "PacketContext:direction=ServerBound,Protocol=757,KnownPacket=true,PacketID=1,PacketType=*packet.StatusPing,Payloadlen=9"}

If you use a base64 image, it does work correctly in Lite mode.

I'm not really experienced with Go but I do use other languages so that's why I was able to debug the source. I'd love to contribute to this but I haven't done any Go programming before.

@robinbraemer robinbraemer added bug Something isn't working good first issue Good for newcomers gate-lite Regarding Gate Lite mode priority/high High priority task labels Jul 12, 2023
@robinbraemer
Copy link
Member

Turns out UnmarshalYAML is never called in any mode due to spf13/viper#338 (comment).

I'm on it...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working gate-lite Regarding Gate Lite mode good first issue Good for newcomers priority/high High priority task
Projects
None yet
Development

No branches or pull requests

2 participants