11# wireproxy
2+
23[ ![ ISC licensed] ( https://img.shields.io/badge/license-ISC-blue )] ( ./LICENSE )
34[ ![ Build status] ( https://github.com/octeep/wireproxy/actions/workflows/build.yml/badge.svg )] ( https://github.com/octeep/wireproxy/actions )
45[ ![ Documentation] ( https://img.shields.io/badge/godoc-wireproxy-blue )] ( https://pkg.go.dev/github.com/octeep/wireproxy )
56
67A wireguard client that exposes itself as a socks5/http proxy or tunnels.
78
89# What is this
10+
911` wireproxy ` is a completely userspace application that connects to a wireguard peer,
1012and exposes a socks5/http proxy or tunnels on the machine. This can be useful if you need
1113to connect to certain sites via a wireguard peer, but can't be bothered to setup a new network
1214interface for whatever reasons.
1315
1416# Why you might want this
17+
1518- You simply want to use wireguard as a way to proxy some traffic.
1619- You don't want root permission just to change wireguard settings.
1720
@@ -20,23 +23,33 @@ and configured my browser to use wireproxy for certain sites. It's pretty useful
2023wireproxy is completely isolated from my network interfaces, and I don't need root to configure
2124anything.
2225
23- Users who want something similar but for Amnezia VPN can use [ this fork] ( https://github.com/juev/wireproxy/tree/feature/amnezia-go )
24- of wireproxy by [ @juev ] ( https://github.com/juev ) .
26+ Users who want something similar but for Amnezia VPN can use [ this fork] ( https://github.com/artem-russkikh/wireproxy-awg )
27+ of wireproxy by [ @artem-russkikh ] ( https://github.com/artem-russkikh ) .
28+
29+ # Sponsor
30+
31+ This project is supported by [ IPRoyal] ( https://iproyal.com/?r=795836 ) . You can get premium quality proxies at unbeatable prices
32+ with a discount using [ this referral link] ( https://iproyal.com/?r=795836 ) ! 🚀
33+
34+ ![ IPRoyal] ( /assets/iproyal.png )
2535
2636# Feature
37+
2738- TCP static routing for client and server
2839- SOCKS5/HTTP proxy (currently only CONNECT is supported)
2940
3041# TODO
42+
3143- UDP Support in SOCKS5
3244- UDP static routing
3345
3446# Usage
35- ```
47+
48+ ``` bash
3649./wireproxy [-c path to config]
3750```
3851
39- ```
52+ ``` bash
4053usage: wireproxy [-h| --help] [-c| --config " <value>" ] [-s| --silent]
4154 [-d| --daemon] [-i| --info " <value>" ] [-v| --version]
4255 [-n| --configtest]
@@ -54,21 +67,29 @@ Arguments:
5467 -v --version Print version
5568 -n --configtest Configtest mode. Only check the configuration file for
5669 validity.
57-
5870```
5971
6072# Build instruction
61- ```
73+
74+ ``` bash
6275git clone https://github.com/octeep/wireproxy
6376cd wireproxy
6477make
6578```
6679
80+ # Install
81+
82+ ``` bash
83+ go install github.com/pufferffish/wireproxy/cmd/wireproxy@v1.0.9 # or @latest
84+ ```
85+
6786# Use with VPN
87+
6888Instructions for using wireproxy with Firefox container tabs and auto-start on MacOS can be found [ here] ( /UseWithVPN.md ) .
6989
7090# Sample config file
71- ```
91+
92+ ``` ini
7293# The [Interface] and [Peer] configurations follow the same semantics and meaning
7394# of a wg-quick configuration. To understand what these fields mean, please refer to:
7495# https://wiki.archlinux.org/title/WireGuard#Persistent_configuration
@@ -139,7 +160,8 @@ BindAddress = 127.0.0.1:25345
139160
140161Alternatively, if you already have a wireguard config, you can import it in the
141162wireproxy config file like this:
142- ```
163+
164+ ``` ini
143165WGConfig = <path to the wireguard config>
144166
145167# Same semantics as above
@@ -155,7 +177,8 @@ WGConfig = <path to the wireguard config>
155177
156178Having multiple peers is also supported. ` AllowedIPs ` would need to be specified
157179such that wireproxy would know which peer to forward to.
158- ```
180+
181+ ``` ini
159182[Interface]
160183Address = 10.254.254.40/32
161184PrivateKey = XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX =
@@ -187,7 +210,8 @@ Target = service-three.servicenet:80
187210```
188211
189212Wireproxy can also allow peers to connect to it:
190- ```
213+
214+ ``` ini
191215[Interface]
192216ListenPort = 5400
193217...
@@ -197,7 +221,9 @@ PublicKey = YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY=
197221AllowedIPs = 10.254.254.100/32
198222# Note there is no Endpoint defined here.
199223```
224+
200225# Health endpoint
226+
201227Wireproxy supports exposing a health endpoint for monitoring purposes.
202228The argument ` --info/-i ` specifies an address and port (e.g. ` localhost:9080 ` ), which exposes a HTTP server that provides health status metric of the server.
203229
@@ -208,7 +234,8 @@ Currently two endpoints are implemented:
208234` /readyz ` : This responds with a json which shows the last time a pong is received from an IP specified with ` CheckAlive ` . When ` CheckAlive ` is set, a ping is sent out to addresses in ` CheckAlive ` per ` CheckAliveInterval ` seconds (defaults to 5) via wireguard. If a pong has not been received from one of the addresses within the last ` CheckAliveInterval ` seconds (+2 seconds for some leeway to account for latency), then it would respond with a 503, otherwise a 200.
209235
210236For example:
211- ```
237+
238+ ``` ini
212239[Interface]
213240PrivateKey = censored
214241Address = 10.2.0.2/32
@@ -224,8 +251,10 @@ Endpoint = 149.34.244.174:51820
224251[Socks5]
225252BindAddress = 127.0.0.1:25344
226253```
254+
227255` /readyz ` would respond with
228- ```
256+
257+ ``` text
229258< HTTP/1.1 503 Service Unavailable
230259< Date: Thu, 11 Apr 2024 00:54:59 GMT
231260< Content-Length: 35
@@ -235,15 +264,18 @@ BindAddress = 127.0.0.1:25344
235264```
236265
237266And for:
238- ```
267+
268+ ``` ini
239269[Interface]
240270PrivateKey = censored
241271Address = 10.2.0.2/32
242272DNS = 10.2.0.1
243273CheckAlive = 1.1.1.1
244274```
275+
245276` /readyz ` would respond with
246- ```
277+
278+ ``` text
247279< HTTP/1.1 200 OK
248280< Date: Thu, 11 Apr 2024 00:56:21 GMT
249281< Content-Length: 23
@@ -257,4 +289,5 @@ If nothing is set for `CheckAlive`, an empty JSON object with 200 will be the re
257289The peer which the ICMP ping packet is routed to depends on the ` AllowedIPs ` set for each peers.
258290
259291# Stargazers over time
292+
260293[ ![ Stargazers over time] ( https://starchart.cc/octeep/wireproxy.svg )] ( https://starchart.cc/octeep/wireproxy )
0 commit comments