go-compile / localrelay

A reverse proxying program to allow services e.g. Nextcloud, Bitwarden etc to be accessed over Tor (SOCKS5) even when the client app do not support SOCKS proxies.
https://hub.docker.com/r/gocompile/localrelay
GNU General Public License v3.0
18 stars 0 forks source link
bitwarden hidden-services mobile nextcloud proxy reverse-proxy selfhosted socks tor

Localrelay

GitHub release Go Report Card go.dev reference Docker Size Docker Version GitHub Workflow Status

Localrelay is a cross platform (Windows, Linux, Mac, Android, and more) reverse proxy which allows the destination address to be customised and can even use a SOCKS5 proxy. Supporting both raw TCP connections and HTTP/HTTPS connections. Localrelay allows you to host services e.g. Nextcloud on Tor and access it on your mobile or laptop anywhere without needing to open your firewall.

**[\[ Wiki & Guide \]](https://github.com/go-compile/localrelay/wiki)** [\[ Download Release \]](https://github.com/go-compile/localrelay/releases/latest) [\[ Docker Image \]](https://hub.docker.com/r/gocompile/localrelay)

Common Localrelay Use Cases

  1. YOUR HOME LAB AWAY FROM HOME
    Localrelay is commonly used with failover proxies to allow for custom routing rules based on network connectivity. Connect directly to your home lab via the IP when on your home network, and when away, connect via a hop server or proxy!

When home connect directly to the IP, when away from home connect with Tor! Or when away connect via a hop server, or several.

  1. FORCE APPLICATIONS TO USE TOR
    Another use of Localrelay is force an application which doesn't allow for proxies to use one. For example, you can force Bitwarden to connect over Tor, or force Nextcloud to do the same.

Protect your IP and force applications to use SOCKS5 proxies even when they don't natively support it, all possible with Localrelay.

  1. FAILOVER ROUTING
    Prevent service downtime by setting up failover relays for TCP, UDP, HTTP or HTTPS destinations. Localrelay will automatically pick the next available destination and route your traffic over it.

Stop downtime, setup failover routing to ensure you always have a route to your destination. You can even setup proxy failover, if one SOCKS proxy fails, use another automatically! All can be configured exactly how you wish with a simple config file.

  1. LOADBALANCING WITH FAILOVER
    Distribute your load evenly, or bias using weights, with Localrelay load balancer.

Load balance your server connections for HTTP(s), TCP, or UDP. Or setup your browser to load balance between SOCKS5 proxies, giving you a new IP address per website you visit!


If you self host a service for example; Bitwarden, Nextcloud, Syncthing, Grafana, Gitea... You may not want to expose your public IP address to the internet, you may prefer to protect it behind Tor.

Access your local or remote services securely over Tor without needing to port forward.

Many apps such as Nextcloud, Termis and Bitwarden do not allow you to specify a proxy when connecting to your self-hosted server. Localrelay allows you to host a local reverse proxy on your devices loopback. This relay then encrypts the outgoing traffic through your set SOCKS5 proxy (Tor: 127.0.0.1:9050).

When at home connect locally, when away connect over Tor. Securely connect remotely over Tor without port forwarding AND when at home connect directly with high speeds.

Features

Manage the Localrelay Service

You can optionally install Localrelay as a service/daemon on Windows, Mac, Linux, and Unix other like systems to run your relays in the background and start at boot.

Reverse Proxy Screenshots
Localrelay CLI status command
Localrelay CLI monitor proxies
Localrelay CLI view connected IP addresses to relays
Relay spoofing useragent & using Tor

Install & Build

To install Localrelay you can either build from source, or use one of the installers.

CLI Usage

This is a basic overview, view the wiki for more detailed information.

Create Relay

To run a relay you must first create a relay config, this allows for permanent storage of relay configuration and easy management. You can create as many of these as you like.

Syntax

# Create a simple TCP relay
localrelay new <relay_name> -host <bind_addr> -destination <remote_addr>

# Create HTTP relay
localrelay new <relay_name> -host <bind_addr> -destination <remote_addr> -http

# Create HTTPS relay
localrelay new <relay_name> -host <bind_addr> -destination <remote_addr> -https -certificate=cert.pem key=key.pem

# Use proxy
localrelay new <relay_name> -host <bind_addr> -destination <remote_addr> -proxy <proxy_url>

# Set custom output config file
localrelay new <relay_name> -host <bind_addr> -destination <remote_addr> -output ./config.toml

# Create a failover TCP relay
localrelay new <relay_name> -host <bind_addr> -destination <remote_addr_(1)>,<remote_addr_(2)> -failover

Examples

# Create a simple TCP relay
localrelay new example.com -host 127.0.0.1:8080 -destination example.com:80

# Create HTTP relay
localrelay new example.com -host 127.0.0.1:8080 -destination http://example.com -http

# Create HTTPS relay
localrelay new example.com -host 127.0.0.1:8080 -destination https://example.com -https -certificate=cert.pem key=key.pem

# Create a TCP relay and store it in the config dir to auto start on system boot (daemon required)
sudo localrelay new example.com -host 127.0.0.1:8080 -destination example.com:80 -store

# Use proxy
localrelay new onion -host 127.0.0.1:8080 -destination 2gzyxa5ihm7nsggfxnu52rck2vv4rvmdlkiu3zzui5du4xyclen53wid.onion:80 -proxy socks5://127.0.0.1:9050

# Create a failover TCP relay with one remote accessed via Tor
localrelay new onion -host 127.0.0.1:8080 -destination 192.168.1.240:80,2gzyxa5ihm7nsggfxnu52rck2vv4rvmdlkiu3zzui5du4xyclen53wid.onion:80 -failover -ignore_proxy=0 -proxy socks5://127.0.0.1:9050

**[Installation And Usage Guide On The Wiki](https://github.com/go-compile/localrelay/wiki)**