wiserain/ctunnel

By wiserain

Updated about 4 years ago

caddy-forwardproxy + green-tunnel

Image
2

1M+

wiserain/ctunnel repository overview

docker-ctunnel

[c]addy-forwardproxy + green-[tunnel]

Usage

version: '3'

services:
  ctunnel:
    container_name: ctunnel
    image: wiserain/ctunnel:latest
    restart: always
    network_mode: bridge
    ports:
      - "${PORT_TO_EXPOSE}:${PROXY_PORT:-8008}"
    environment:
      - PUID=${PUID}
      - PGID=${PGID}
      - PROXY_USER=${PROXY_USER}
      - PROXY_PASS=${PROXY_PASS}

You can access to your password-authenticated proxy server via

http://${PROXY_USER}:${PROXY_PASS}@${DOCKER_HOST}:${PROXY_PORT:-8008}

This service is run by caddy forward-proxy and will relay all your requests to the internally running green-tunnel below

gt --ip 0.0.0.0 --port ${GT_PORT:-21000} --system-proxy false \
    --dns-type ${GT_DNSTYPE:-https} \
    --dns-server ${GT_DNSSERVER:-https://1.1.1.1/dns-query}

If you are familar with Caddyfile, you may want your container-volume /config maped and make your own Caddyfile to customize behaviour of caddy-server. Default is

0.0.0.0:${PROXY_PORT:-8008}
forwardproxy {
    basicauth ${PROXY_USER} ${PROXY_PASS}
    upstream http://localhost:${GT_PORT:-21000}
    hide_ip
    hide_via
}

Direct connection to green-tunnel

As green-tunnel is running with 0.0.0.0:21000, you can directly access it independently to caddy forward-proxy running at front by publishing your container port 21000. It is highly recommended exposing the port for internal use only.

Environment variables

ENVDescriptionDefault
PUID / PGIDuid and gid for running an app911 / 911
TZtimezoneAsia/Seoul
PROXY_ENABLEDset false to disable caddytrue
PROXY_USER / PROXY_PASSrequired both to activate proxy authentication
PROXY_PORTto run caddy forward-proxy in a different port8008
PROXY_VERBOSEappend -log stdout to caddy server cmd
GT_ENABLEDset false to disable green-tunneltrue
GT_PORTto run green-tunnel in different port21000
GT_VERBOSEset true to run green-tunnel in verbose mode for the purpose of debugging
GT_DNSTYPEagrument --dns-type for green-tunnel CLIhttps
GT_DNSSERVERagrument --dns-server for green-tunnel CLIhttps://1.1.1.1/dns-query

TODO

  • Suppress log for certificate maintenance
  • Apply http/2 for better performance?

Tag summary

Content type

Image

Digest

Size

48.1 MB

Last updated

about 4 years ago

docker pull wiserain/ctunnel:1