Skip to content

runtime error in Lite mode with ProxyProtocol enabled (IPv6 parsing failure) #670

@FR-N

Description

@FR-N

I am encountering a runtime panic when running Gate in Lite mode with proxyProtocol: true.
When a client connects via IPv6, Gate crashes with panic: invalid IP address connect.Addr.

It appears that protoutil.ProxyHeader fails to correctly parse the IPv6 address (it seems to be missing brackets [] or port information in the string representation), causing the panic when attempting to construct the Proxy Protocol header.

This looks very similar to the previously closed issue #133.

To Reproduce

  1. Configure Gate with lite.enabled: true.
  2. Set a route with proxyProtocol: true.
  3. Start Gate.
  4. Connect to Gate using a client with an IPv6 address.
  5. Gate panics immediately upon receiving the server list status request (ping).

Expected behavior

Gate should correctly parse the IPv6 address and forward the connection with the Proxy Protocol header, or handle the address parsing error gracefully without crashing.

lite:
  enabled: true
  routes:
    - host: "*"
      backend: "127.0.0.1:25599"
      proxyProtocol: true
`
C:\Users\Administrator\Desktop\gate>gate_0.62.3_windows_amd64.exe -c 10.yml
2026-02-19T01:58:09.762+0800    �[34mINFO�[0m   gate/root.go:144        starting Gate proxy     {"version": "0.62.3"}
2026-02-19T01:58:09.800+0800    �[34mINFO�[0m   gate/root.go:145        logging verbosity       {"verbosity": 0}
2026-02-19T01:58:09.800+0800    �[34mINFO�[0m   gate/root.go:146        using config file       {"config": "10.yml"}
2026-02-19T01:58:09.861+0800    �[34mINFO�[0m   config  gate/gate.go:282        auto config reload enabled      {"path": "10.yml"}
2026-02-19T01:58:09.862+0800    �[34mINFO�[0m   java    proxy/proxy.go:186      running in lite mode
2026-02-19T01:58:09.864+0800    �[34mINFO�[0m   java    proxy/proxy.go:189      proxy protocol enabled
2026-02-19T01:58:09.874+0800    �[34mINFO�[0m   java    proxy/proxy.go:563      listening for connections       {"addr": "0.0.0.0:25565"}
2026-02-19T01:58:09.865+0800    �[34mINFO�[0m   connect.watch.proposal  config/setup_client.go:70       connecting to watch service...  {"endpoint": "Chocolate", "addr": "wss://watch-connect.minekube.net", "timeout": "1m0s"}
2026-02-19T01:58:11.390+0800    �[34mINFO�[0m   connect.watch.proposal  config/setup_client.go:83       connected               {"took": "1.514s"}
2026-02-19T01:58:11.418+0800    �[34mINFO�[0m   connect.watch.proposal.session  config/setup_client.go:124      received session proposal       {"session": "d6avrcp3la6s73dkncn0", "username": "", "playerAddr": "127.0.0.1", "passthrough": true}
2026-02-19T01:58:11.418+0800    �[34mINFO�[0m   connect.watch.proposal.session  config/setup_client.go:163      creating tunnel {"session": "d6avrcp3la6s73dkncn0", "username": "", "playerAddr": "127.0.0.1", "passthrough": true, "tunnelServiceAddr": "wss://connect-tunnel-edge.minekube.net?fi=6e824972c23e48&cid=moxy-d5kcjgj0n7tc27pepvdg"}
2026-02-19T01:58:12.014+0800    �[34mINFO�[0m   connect.watch.proposal.session  config/setup_client.go:180      tunnel connected        {"session": "d6avrcp3la6s73dkncn0", "username": "", "playerAddr": "127.0.0.1", "passthrough": true}
2026-02-19T01:58:12.015+0800    �[34mINFO�[0m   connect.watch.proposal.session  config/setup_client.go:193      established tunnel for session  {"session": "d6avrcp3la6s73dkncn0", "username": "", "playerAddr": "127.0.0.1", "passthrough": true}
2026-02-19T01:58:12.017+0800    �[34mINFO�[0m   java.client.handshakeSession.lite       lite/forward.go:77      forwarding connection   {"clientAddr": "127.0.0.1", "virtualHost": "chocolate", "protocol": "4", "route": "*", "backendAddr": "127.0.0.1:25599", "backendAddr": "127.0.0.1:25599"}
2026-02-19T01:58:15.723+0800    �[34mINFO�[0m   connect.watch.proposal.session  config/setup_client.go:124      received session proposal       {"session": "d6avrdp3la6s73dkncng", "username": "", "playerAddr": "2a09:bac6:d73f:28::4:31d", "passthrough": true}
2026-02-19T01:58:15.724+0800    �[34mINFO�[0m   connect.watch.proposal.session  config/setup_client.go:163      creating tunnel {"session": "d6avrdp3la6s73dkncng", "username": "", "playerAddr": "2a09:bac6:d73f:28::4:31d", "passthrough": true, "tunnelServiceAddr": "wss://connect-tunnel-edge.minekube.net?fi=6e824972c23e48&cid=moxy-d5kcjgj0n7tc27pepvdg"}
2026-02-19T01:58:15.843+0800    �[34mINFO�[0m   connect.watch.proposal.session  config/setup_client.go:124      received session proposal       {"session": "d6avrdp3la6s73dknco0", "username": "", "playerAddr": "2a09:bac6:d73f:3046::4cf:74", "passthrough": true}
2026-02-19T01:58:15.848+0800    �[34mINFO�[0m   connect.watch.proposal.session  config/setup_client.go:163      creating tunnel {"session": "d6avrdp3la6s73dknco0", "username": "", "playerAddr": "2a09:bac6:d73f:3046::4cf:74", "passthrough": true, "tunnelServiceAddr": "wss://connect-tunnel-edge.minekube.net?fi=6e824972c23e48&cid=moxy-d5kcjgj0n7tc27pepvdg"}
2026-02-19T01:58:16.341+0800    �[34mINFO�[0m   connect.watch.proposal.session  config/setup_client.go:180      tunnel connected        {"session": "d6avrdp3la6s73dkncng", "username": "", "playerAddr": "2a09:bac6:d73f:28::4:31d", "passthrough": true}
2026-02-19T01:58:16.342+0800    �[34mINFO�[0m   connect.watch.proposal.session  config/setup_client.go:193      established tunnel for session  {"session": "d6avrdp3la6s73dkncng", "username": "", "playerAddr": "2a09:bac6:d73f:28::4:31d", "passthrough": true}
2026-02-19T01:58:16.345+0800    �[34mINFO�[0m   java.client.statusSession       proxy/session_status.go:57      got server list status request  {"inbound": "[initial connection] 2a09:bac6:d73f:28::4:31d -> NoDDoS.zgwl.eu.org:25565", "protocol": "767"}
panic: invalid IP address connect.Addr: 2a09:bac6:d73f:28::4:31d (host: , port: 0)

        runtime/debug.Stack()
                /opt/hostedtoolcache/go/1.24.1/x64/src/runtime/debug/stack.go:26 +0x5e
        golang.org/x/sync/singleflight.newPanicError({0xe8f560, 0xc000506f80})
                /home/runner/go/pkg/mod/golang.org/x/sync@v0.19.0/singleflight/singleflight.go:44 +0x25
        golang.org/x/sync/singleflight.(*Group).doCall.func2.1()
                /home/runner/go/pkg/mod/golang.org/x/sync@v0.19.0/singleflight/singleflight.go:193 +0x34
        panic({0xe8f560?, 0xc000506f80?})
                /opt/hostedtoolcache/go/1.24.1/x64/src/runtime/panic.go:792 +0x132
        go.minekube.com/gate/pkg/edition/java/internal/protoutil.convert({0x11d73b8, 0xc00004cb20})
                /home/runner/work/gate/gate/pkg/edition/java/internal/protoutil/util.go:57 +0x26e
        go.minekube.com/gate/pkg/edition/java/internal/protoutil.ProxyHeader({0x11d73b8?, 0xc00004cb20?}, {0x11d7d80, 0xc0004ff8f0})
                /home/runner/work/gate/gate/pkg/edition/java/internal/protoutil/util.go:14 +0x2e
        go.minekube.com/gate/pkg/edition/java/lite.dialRoute({0x11dd8f0?, 0xc0004ff800?}, 0xff5820?, {0x11d73b8, 0xc00004cb20}, 0xc0001063d8, {0xc00031f1a0, 0xf}, 0xc0004ff380, 0xc00012eaa0, ...)
                /home/runner/work/gate/gate/pkg/edition/java/lite/forward.go:288 +0x1ad
        go.minekube.com/gate/pkg/edition/java/lite.resolveStatusResponse.func1({0x11dd768, 0x1a57120})
                /home/runner/work/gate/gate/pkg/edition/java/lite/forward.go:471 +0x1e5
        go.minekube.com/gate/pkg/edition/java/lite.resolveStatusResponse.func2({{0x209f5d533d8?, 0x209b0ab05a0?}, 0xd0?})
                /home/runner/work/gate/gate/pkg/edition/java/lite/forward.go:487 +0x29
        go.minekube.com/gate/pkg/edition/java/lite.resolveStatusResponse.withLoader[...].func4({{0xc00031f1a0, 0xc000207c60?}, 0x3c2353?})
                /home/runner/work/gate/gate/pkg/edition/java/lite/forward.go:553 +0x4b
        github.com/jellydator/ttlcache/v3.LoaderFunc[...].Load(...)
                /home/runner/go/pkg/mod/github.com/jellydator/ttlcache/v3@v3.4.0/cache.go:850
        github.com/jellydator/ttlcache/v3.(*SuppressedLoader[...]).Load.func1()
                /home/runner/go/pkg/mod/github.com/jellydator/ttlcache/v3@v3.4.0/cache.go:890 +0x39
        golang.org/x/sync/singleflight.(*Group).doCall.func2(0xc00001fcf6, 0xc00012ec30, 0x3c20d9?)
                /home/runner/go/pkg/mod/golang.org/x/sync@v0.19.0/singleflight/singleflight.go:198 +0x55
        golang.org/x/sync/singleflight.(*Group).doCall(0xee0040?, 0xc0004ff7d0?, {0xc00010c8d0?, 0x15?}, 0x15?)
                /home/runner/go/pkg/mod/golang.org/x/sync@v0.19.0/singleflight/singleflight.go:200 +0x7e
        golang.org/x/sync/singleflight.(*Group).Do(0xc00011e560, {0xc00010c8d0, 0x15}, 0xc000207db0)
                /home/runner/go/pkg/mod/golang.org/x/sync@v0.19.0/singleflight/singleflight.go:113 +0x15b
        github.com/jellydator/ttlcache/v3.(*SuppressedLoader[...]).Load(0x11e10c0, 0xc0002e2300, {{0xc00031f1a0, 0xf}, 0x2ff})
                /home/runner/go/pkg/mod/github.com/jellydator/ttlcache/v3@v3.4.0/cache.go:889 +0x10a
        github.com/jellydator/ttlcache/v3.(*Cache[...]).getWithOpts(0x11fdb00, {{0xc00031f1a0, 0x0?}, 0x0?}, 0x1?, {0xc000207fb8, 0x1, 0xc000207fd0})
                /home/runner/go/pkg/mod/github.com/jellydator/ttlcache/v3@v3.4.0/cache.go:274 +0x3d4
        github.com/jellydator/ttlcache/v3.(*Cache[...]).Get(...)
                /home/runner/go/pkg/mod/github.com/jellydator/ttlcache/v3@v3.4.0/cache.go:371
        go.minekube.com/gate/pkg/edition/java/lite.resolveStatusResponse.func3()
                /home/runner/work/gate/gate/pkg/edition/java/lite/forward.go:492 +0x5c
        created by go.minekube.com/gate/pkg/edition/java/lite.resolveStatusResponse in goroutine 8
                /home/runner/work/gate/gate/pkg/edition/java/lite/forward.go:492 +0x4fa


goroutine 33 [running]:
golang.org/x/sync/singleflight.(*Group).doCall.func1()
        /home/runner/go/pkg/mod/golang.org/x/sync@v0.19.0/singleflight/singleflight.go:170 +0x2b2
golang.org/x/sync/singleflight.(*Group).doCall(0xee0040?, 0xc0004ff7d0?, {0xc00010c8d0?, 0x15?}, 0x15?)
        /home/runner/go/pkg/mod/golang.org/x/sync@v0.19.0/singleflight/singleflight.go:205 +0x99
golang.org/x/sync/singleflight.(*Group).Do(0xc00011e560, {0xc00010c8d0, 0x15}, 0xc000207db0)
        /home/runner/go/pkg/mod/golang.org/x/sync@v0.19.0/singleflight/singleflight.go:113 +0x15b
github.com/jellydator/ttlcache/v3.(*SuppressedLoader[...]).Load(0x11e10c0, 0xc0002e2300, {{0xc00031f1a0, 0xf}, 0x2ff})
        /home/runner/go/pkg/mod/github.com/jellydator/ttlcache/v3@v3.4.0/cache.go:889 +0x10a
github.com/jellydator/ttlcache/v3.(*Cache[...]).getWithOpts(0x11fdb00, {{0xc00031f1a0, 0x0?}, 0x0?}, 0x1?, {0xc000207fb8, 0x1, 0xc000207fd0})
        /home/runner/go/pkg/mod/github.com/jellydator/ttlcache/v3@v3.4.0/cache.go:274 +0x3d4
github.com/jellydator/ttlcache/v3.(*Cache[...]).Get(...)
        /home/runner/go/pkg/mod/github.com/jellydator/ttlcache/v3@v3.4.0/cache.go:371
go.minekube.com/gate/pkg/edition/java/lite.resolveStatusResponse.func3()
        /home/runner/work/gate/gate/pkg/edition/java/lite/forward.go:492 +0x5c
created by go.minekube.com/gate/pkg/edition/java/lite.resolveStatusResponse in goroutine 8
        /home/runner/work/gate/gate/pkg/edition/java/lite/forward.go:492 +0x4fa

C:\Users\Administrator\Desktop\gate>pause
. . .`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions