penguin/tinyproxy

An L4 proxy designed to act as a tiny transparent shim

tinyproxy.conf

raw ยท 2362 bytes

# Format:
# listen <listen-proto> <listen-endpoint> <backend-proto> <backend-endpoint> [options...]
#
# Endpoint examples:
#   tcp :80
#   tcp 0.0.0.0:80
#   tcp 10.0.1.1:80
#   udp :19132
#   unix /tmp/test.sock
#   unix-dgram /tmp/testd.sock
#   builtin client_addr
#   file examples/http-response.txt
#
# Options:
#   proxy_v2
#   keep_alive
#   idle_timeout=<seconds>
#   connect_timeout=<seconds>
#
# builtin client_addr
#   Returns the observed client address as plain text, then closes.
#   Example response: 127.0.0.1:54321
#
# builtin discard
#   TCP: reads and discards client data until the client closes or timeout expires.
#   UDP: silently drops each datagram.
#
# builtin hang
#   Accepts the connection/datagram and intentionally produces no response.
#   TCP: the connection remains open until the client closes or the route idle timeout expires.
#   UDP: this is effectively a silent drop.
#
# builtin close
#   Accepts the connection and immediately closes it without reading or writing.
#   For UDP, this is equivalent to discard/drop because UDP has no connection to close.


# TCP stream forwarding.
listen tcp :80     tcp 10.0.1.1:80
listen tcp :443    tcp 10.0.1.1:443    proxy_v2,keep_alive

# TCP listener to UNIX stream backend.
listen tcp  :12990                unix /tmp/test.sock

# UDP datagram forwarding.
listen udp :12345  udp 10.0.1.1:12345  idle_timeout=10,connect_timeout=17
listen udp :19132  udp 10.0.1.1:19132

# UDP listener to UNIX datagram backend.
listen udp :13000  unix-dgram /tmp/testd.sock

# Builtin TCP test backends.
listen tcp :12995  builtin client_addr
listen tcp :12996  builtin hang         idle_timeout=3,connect_timeout=1
listen tcp :12997  builtin discard
listen tcp :12998  builtin close

# Builtin UDP test backends.
listen udp :12995  builtin client_addr
listen udp :12996  builtin hang
listen udp :12997  builtin discard
listen udp :12998  builtin close

# Static file TCP backends.
listen tcp :14000  file examples/http-response.txt
listen tcp :14001  file /does/not/exist

listen unix       /tmp/test-listen.sock   tcp     127.0.0.1:12991
listen unix       /tmp/test-listen-2.sock builtin client_addr
listen unix-dgram /tmp/test-listen.sock   udp     127.0.0.1:12991
listen unix-dgram /tmp/test-listen-3.sock builtin  client_addr
listen unix       /tmp/test-ping.sock     unix /tmp/test-pong.sock