Sign inSign up

finwo/udphole

By finwo

Updated 6 months ago

UDP hole punching proxy with RESP2 API | Source: https://github.com/finwo/udphole

Image
0

3.6K

finwo/udphole repository overview

UDPHOLE Docker

Run udphole as a Docker container.

Quick Start

docker run -p 6379:6379 -p 7000-7999:7000-7999/udp finwo/udphole

The entrypoint always adds --no-daemonize to ensure the container stays running.

Environment Variables

VariableDefaultDescription
API_PORT6379TCP port for the RESP2 API server
UDP_PORTS7000-7999UDP port range for UDP sockets
LOG_LEVELinfoLog verbosity: fatal, error, warn, info, debug, trace
API_ADMIN_USERadminUsername for admin user
API_ADMIN_PASSsupers3cretPassword for admin user
CLUSTERComma-separated list of cluster node addresses (enables cluster mode, e.g., tcp://user:pass@host1:6379,tcp://user:pass@host2:6379)

Auto-generated Config

If no config file is mounted, the container auto-generates /etc/udphole.conf from environment variables:

[udphole]
ports = 7000-7999
listen = :6379

[user:admin]
permit = *
secret = supers3cret
Custom Config

Mount your own config file to override defaults:

docker run -p 6379:6379 -p 7000-7999:7000-7999/udp \
  -v /path/to/udphole.conf:/etc/udphole.conf:ro \
  finwo/udphole

Note: Even with cluster fields defined in a mounted config, you must set CLUSTER to any value to run in cluster mode (the entrypoint uses this to decide between daemon and cluster commands).

Listen Address Formats

The listen directive supports multiple addresses:

FormatDescription
:6379All interfaces, port 6379
6379All interfaces, port 6379
localhost:6379Loopback only
192.168.1.1:6379Specific IPv4 address
tcp://:6379Explicit TCP, all interfaces
tcp://localhost:6379Explicit TCP, loopback
unix:///tmp/udphole.sockUnix socket

Multiple listen addresses can be specified:

[udphole]
listen = :6379
listen = 192.168.1.1:6380
listen = unix:///tmp/udphole.sock

Cluster Mode

To run in cluster mode, set the CLUSTER environment variable with comma-separated node addresses:

docker run -p 6379:6379 -p 7000-7999:7000-7999/udp \
  -e CLUSTER="tcp://user:[email protected]:6379,tcp://user:[email protected]:6379" \
  finwo/udphole

This generates:

[udphole]
ports = 7000-7999
listen = :6379
cluster = tcp://user:[email protected]:6379
cluster = tcp://user:[email protected]:6379

[user:admin]
permit = *
secret = supers3cret
Cluster Node Address Formats
FormatDescription
tcp://host:portTCP connection
tcp://user:pass@host:portTCP with authentication
unix:///path/to/socketUnix socket

Docker Compose

services:
  udphole:
    image: finwo/udphole
    ports:
      - "6379:6379"
      - "7000-7999:7000-7999/udp"
    environment:
      - API_PORT=6379
      - UDP_PORTS=7000-7999
      - LOG_LEVEL=info
      - API_ADMIN_USER=admin
      - API_ADMIN_PASS=supers3cret
    healthcheck:
      test: ["CMD", "nc", "-z", "localhost", "6379"]
      interval: 10s
      timeout: 5s
      retries: 3

Healthcheck

The container includes a healthcheck using nc to verify the API port is listening:

nc -z localhost 6379

Architecture

The container is available for:

  • linux/amd64
  • linux/arm64/v8 (e.g., Raspberry Pi 4+, M1 Mac)
  • linux/riscv64

Docker automatically selects the correct variant for your host architecture.

Tag summary

Content type

Image

Digest

sha256:50fb9be73

Size

2.2 MB

Last updated

6 months ago

docker pull finwo/udphole