Skip to content

K0IN/docker-wireguard-socks-proxy

 
 

Repository files navigation

docker-wireguard-socks-proxy

Expose WireGuard as a SOCKS5 proxy in a Docker container.

What does this fork do?

Add multiple arch support, and restored the "build ability" of the image.

Why?

This is arguably the easiest way to achieve "app based" routing. For example, you may only want certain applications to go through your WireGuard tunnel while the rest of your system should go through the default gateway. You can also achieve "domain name based" routing by using a PAC file that most browsers support.

Usage

Preferably, using start in this repository:

bash start.sh /directory/containing/your/wireguard/conf/file

Alternatively, you can use docker run directly if you want to customize things such as port mapping:

docker run -it --rm --cap-add=NET_ADMIN \
    --name wireguard-socks-proxy \
    -v ${PWD}:/etc/wireguard/:ro \
    -p 1080:1080 \
    ghcr.io/k0in/docker-wireguard-socks-proxy:latest

Then connect to SOCKS proxy through through 127.0.0.1:1080 (or local.docker:1080 for Mac / docker-machine / etc.). For example:

curl --proxy socks5h:https://127.0.0.1:1080 ipinfo.io

HTTP Proxy

You can easily convert this to an HTTP proxy using http-proxy-to-socks, e.g.

hpts -s 127.0.0.1:1080 -p 8080

Troubleshooting

I get "Permission Denied"

This can happen if your WireGuard configuration file includes an IPv6 address but your host interface does not work with it. Try removing the IPv6 address in Address from your configuration file.

I get bindinternal(): [...] for server to listen on failed: Address not available

Try to add --sysctl net.ipv6.conf.all.disable_ipv6=1 to your docker run parameters.

I cannot request https origins / or cannot access proxy from external host

this is a bug with docker the docker network / mtu have a look at the docker-compose.yml to fix it.

About

Expose a WireGuard tunnel as a SOCKS5 proxy, with updated images and support for multiple arch's

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages

  • Dockerfile 59.0%
  • Shell 41.0%