Predefined Tunnels

Define multiple tunnels in config and start them by name.

Overview

Instead of typing tunnel commands every time, you can define tunnels in your config file and start them by name using drip start.

Configuration

Add a tunnels section to your config file (~/.drip/config.yaml):

yaml
server: tunnel.example.com:443
token: your-token
tls: true

tunnels:
  - name: web
    type: http
    port: 3000
    subdomain: myapp

  - name: api
    type: http
    port: 8080
    subdomain: api
    transport: wss

  - name: db
    type: tcp
    port: 5432
    allow_ips:
      - 192.168.0.0/16
      - 10.0.0.0/8

Tunnel Configuration Options

OptionTypeDescription
namestringUnique name for the tunnel (required)
typestringTunnel type: http, https, or tcp (required)
portintLocal port to forward (required)
subdomainstringCustom subdomain for HTTP/HTTPS tunnels
addressstringTarget address (default: 127.0.0.1)
transportstringTransport protocol: auto, tcp, wss
allow_ipslistIP whitelist (CIDR notation supported)
deny_ipslistIP blacklist (CIDR notation supported)

Starting Tunnels

Start a Specific Tunnel

bash
drip start web

Start Multiple Tunnels

bash
drip start web api

Start All Configured Tunnels

bash
drip start --all

List Available Tunnels

Run drip start without arguments to see all configured tunnels:

bash
drip start

Example Configurations

Development Setup

yaml
tunnels:
  - name: frontend
    type: http
    port: 3000
    subdomain: dev

  - name: backend
    type: http
    port: 8080
    subdomain: api-dev

  - name: docs
    type: http
    port: 4000
    subdomain: docs-dev

Home Server Setup

yaml
tunnels:
  - name: nas
    type: http
    port: 5000
    address: 192.168.1.50
    subdomain: nas

  - name: plex
    type: http
    port: 32400
    address: 192.168.1.50
    subdomain: plex

  - name: ssh
    type: tcp
    port: 22
    allow_ips:
      - 203.0.113.50

Production with Security

yaml
tunnels:
  - name: staging
    type: http
    port: 3000
    subdomain: staging
    transport: wss
    allow_ips:
      - 10.0.0.0/8
      - 192.168.0.0/16

  - name: database
    type: tcp
    port: 5432
    address: db-server
    allow_ips:
      - 10.0.0.100
    deny_ips:
      - 10.0.0.200

Managing Running Tunnels

Tunnels started with drip start run in the background. Use the standard daemon commands to manage them:

bash
# List running tunnels
drip list

# View logs
drip attach http 3000

# Stop specific tunnel
drip stop http 3000

# Stop all tunnels
drip stop all

Benefits

  • Consistency: Same tunnel configuration every time
  • Convenience: Start multiple tunnels with one command
  • Documentation: Config file serves as documentation
  • Version Control: Track tunnel configurations in git