qdm12 / gluetun

VPN client in a thin Docker container for multiple VPN providers, written in Go, and using OpenVPN or Wireguard, DNS over TLS, with a few proxy servers built-in.
https://hub.docker.com/r/qmcgaw/gluetun
MIT License
6.71k stars 331 forks source link

Bug: runtime error: index out of range [0] with length 0 with Wireguard custom configuration #2248

Closed pepihub closed 1 month ago

pepihub commented 1 month ago

Is this urgent?

None

Host OS

Ubuntu Jammy Jellyfish

CPU arch

x86_64

VPN service provider

Custom

What are you using to run the container

Portainer

What is the version of Gluetun

Running latest version built on 2024-04-30T08:05 (commit 7e0738d)

What's the problem 🤔

After upgrading to the latest version built on 2024-04-30T08:05 I'm getting this error:

panic: runtime error: index out of range [0] with length 0

It works fine on v3.38, and if I remember correctly, it worked 4 commits before 7e0738d.

Share your logs (at least 10 lines)

2024-04-30T21:14:18.513950929Z 2024-04-30T23:14:18+02:00 INFO [routing] default route found: interface eth0, gateway 172.30.0.1, assigned IP 172.30.0.2 and family v4
2024-04-30T21:14:18.513987360Z 2024-04-30T23:14:18+02:00 INFO [routing] adding route for 0.0.0.0/0
2024-04-30T21:14:18.514091565Z 2024-04-30T23:14:18+02:00 INFO [firewall] setting allowed subnets...
2024-04-30T21:14:18.514236860Z 2024-04-30T23:14:18+02:00 INFO [routing] default route found: interface eth0, gateway 172.30.0.1, assigned IP 172.30.0.2 and family v4
2024-04-30T21:14:18.514435198Z 2024-04-30T23:14:18+02:00 INFO [dns] using plaintext DNS at address 1.1.1.1
2024-04-30T21:14:18.514646776Z 2024-04-30T23:14:18+02:00 INFO [http server] http server listening on [::]:8000
2024-04-30T21:14:18.514738010Z 2024-04-30T23:14:18+02:00 INFO [healthcheck] listening on 127.0.0.1:9999
2024-04-30T21:14:18.518981165Z panic: runtime error: index out of range [0] with length 0
2024-04-30T21:14:18.519015577Z 
2024-04-30T21:14:18.519022967Z goroutine 123 [running]:
2024-04-30T21:14:18.519029887Z github.com/qdm12/gluetun/internal/provider/custom.getWireguardConnection(...)
2024-04-30T21:14:18.519036727Z  github.com/qdm12/gluetun/internal/provider/custom/connection.go:60
2024-04-30T21:14:18.519043858Z github.com/qdm12/gluetun/internal/provider/custom.(*Provider).GetConnection(_, {{0xc000028021, 0x9}, {{0x0, 0xffffc0917c03}, 0xc000010018}, {0x0, 0x0, 0x0}, {0x0, ...}, ...}, ...)
2024-04-30T21:14:18.519051588Z  github.com/qdm12/gluetun/internal/provider/custom/connection.go:24 +0x35a
2024-04-30T21:14:18.519058308Z github.com/qdm12/gluetun/internal/vpn.setupWireguard({_, _}, {_, _}, {_, _}, {_, _}, {{0xc000028021, 0x9}, ...}, ...)
2024-04-30T21:14:18.519067659Z  github.com/qdm12/gluetun/internal/vpn/wireguard.go:20 +0xbe
2024-04-30T21:14:18.519073609Z github.com/qdm12/gluetun/internal/vpn.(*Loop).Run(0xc0000ff080, {0x12260e0, 0xc000280eb0}, 0xc0001d0ea0?)
2024-04-30T21:14:18.519079519Z  github.com/qdm12/gluetun/internal/vpn/run.go:40 +0x4df
2024-04-30T21:14:18.519085239Z created by main._main in goroutine 39
2024-04-30T21:14:18.519091060Z  ./main.go:443 +0x33d7

Share your configuration

services:
  gluetun:
    image: qmcgaw/gluetun
    container_name: testgluetun
    restart: always
    cap_add:
      - NET_ADMIN
    volumes:
      - /dir/vpnfile.conf:/gluetun/wireguard/wg0.conf:ro
    environment:
      - VPN_SERVICE_PROVIDER=custom
      - VPN_TYPE=wireguard
      - UPDATER_PERIOD=12h
github-actions[bot] commented 1 month ago

@qdm12 is more or less the only maintainer of this project and works on it in his free time. Please:

DFDC commented 1 month ago

Duplicate of #2244

github-actions[bot] commented 1 month ago

Closed issues are NOT monitored, so commenting here is likely to be not seen. If you think this is still unresolved and have more information to bring, please create another issue.

This is an automated comment setup because @qdm12 is the sole maintainer of this project which became too popular to monitor issues closed.