Simple SNI relay server written in Go.
What it does:
- Listens for incoming HTTP or HTTPS connections.
- Parses the hostname from the HTTP request or TLS ClientHello.
- Proxies the traffic further to that hostname.
Why would you need it? For instance, if you operate a DNS server, and you want to relay some domains to an intermediate server (effectively, change your IP address).
make
./snirelay -l 127.0.0.1 -p 80:443
Alternatively, you can supply a list of custom domain<->IP mappings:
./snirelay -l 127.0.0.1 -p 80:443 --sni-mappings-path=sni_mapping.csv
# Simple connect via relay:
gocurl --connect-to="example.org:443:127.0.0.1:80" -I https://example.org/
The docker image is available. snirelay
listens to the
ports 8080
and 8443
inside the container, so you don't have to specify the
listen address and ports, other arguments are available.
Run snirelay
as a background service in server mode and expose on the host's
ports 80
and 443
(tcp):
docker run -d --name snirelay \
-p 80:8443/tcp -p 443:8443/tcp \
ghcr.io/ameshkov/snirelay
Usage:
snirelay [OPTIONS]
Application Options:
-l, --listen=<IP> Address the tool will be listening to (required).
-p, --ports=<PLAIN_PORT:TLS_PORT> Port for accepting plain HTTP (required).
--proxy=[protocol://username:password@]host[:port] Proxy URL (optional).
--sni-mappings-path= Path to the file with SNI mappings (optional).
-v, --verbose Verbose output (optional).
Help Options:
-h, --help Show this help message