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
@@ -24,19 +27,22 @@ Users who want something similar but for Amnezia VPN can use [this fork](https:/
2427of wireproxy by [ @artem-russkikh ] ( https://github.com/artem-russkikh ) .
2528
2629# Feature
30+
2731- TCP static routing for client and server
2832- SOCKS5/HTTP proxy (currently only CONNECT is supported)
2933
3034# TODO
35+
3136- UDP Support in SOCKS5
3237- UDP static routing
3338
3439# Usage
35- ```
40+
41+ ``` bash
3642./wireproxy [-c path to config]
3743```
3844
39- ```
45+ ``` bash
4046usage: wireproxy [-h| --help] [-c| --config " <value>" ] [-s| --silent]
4147 [-d| --daemon] [-i| --info " <value>" ] [-v| --version]
4248 [-n| --configtest]
@@ -54,21 +60,29 @@ Arguments:
5460 -v --version Print version
5561 -n --configtest Configtest mode. Only check the configuration file for
5662 validity.
57-
5863```
5964
6065# Build instruction
61- ```
66+
67+ ``` bash
6268git clone https://github.com/octeep/wireproxy
6369cd wireproxy
6470make
6571```
6672
73+ # Install
74+
75+ ``` bash
76+ go install github.com/pufferffish/wireproxy/cmd/wireproxy@v1.0.9 # or @latest
77+ ```
78+
6779# Use with VPN
80+
6881Instructions for using wireproxy with Firefox container tabs and auto-start on MacOS can be found [ here] ( /UseWithVPN.md ) .
6982
7083# Sample config file
71- ```
84+
85+ ``` ini
7286# The [Interface] and [Peer] configurations follow the same semantics and meaning
7387# of a wg-quick configuration. To understand what these fields mean, please refer to:
7488# https://wiki.archlinux.org/title/WireGuard#Persistent_configuration
@@ -135,7 +149,8 @@ BindAddress = 127.0.0.1:25345
135149
136150Alternatively, if you already have a wireguard config, you can import it in the
137151wireproxy config file like this:
138- ```
152+
153+ ``` ini
139154WGConfig = <path to the wireguard config>
140155
141156# Same semantics as above
@@ -151,7 +166,8 @@ WGConfig = <path to the wireguard config>
151166
152167Having multiple peers is also supported. ` AllowedIPs ` would need to be specified
153168such that wireproxy would know which peer to forward to.
154- ```
169+
170+ ``` ini
155171[Interface]
156172Address = 10.254.254.40/32
157173PrivateKey = XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX =
@@ -183,7 +199,8 @@ Target = service-three.servicenet:80
183199```
184200
185201Wireproxy can also allow peers to connect to it:
186- ```
202+
203+ ``` ini
187204[Interface]
188205ListenPort = 5400
189206...
@@ -193,7 +210,9 @@ PublicKey = YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY=
193210AllowedIPs = 10.254.254.100/32
194211# Note there is no Endpoint defined here.
195212```
213+
196214# Health endpoint
215+
197216Wireproxy supports exposing a health endpoint for monitoring purposes.
198217The 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.
199218
@@ -204,7 +223,8 @@ Currently two endpoints are implemented:
204223` /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.
205224
206225For example:
207- ```
226+
227+ ``` ini
208228[Interface]
209229PrivateKey = censored
210230Address = 10.2.0.2/32
@@ -220,8 +240,10 @@ Endpoint = 149.34.244.174:51820
220240[Socks5]
221241BindAddress = 127.0.0.1:25344
222242```
243+
223244` /readyz ` would respond with
224- ```
245+
246+ ``` text
225247< HTTP/1.1 503 Service Unavailable
226248< Date: Thu, 11 Apr 2024 00:54:59 GMT
227249< Content-Length: 35
@@ -231,15 +253,18 @@ BindAddress = 127.0.0.1:25344
231253```
232254
233255And for:
234- ```
256+
257+ ``` ini
235258[Interface]
236259PrivateKey = censored
237260Address = 10.2.0.2/32
238261DNS = 10.2.0.1
239262CheckAlive = 1.1.1.1
240263```
264+
241265` /readyz ` would respond with
242- ```
266+
267+ ``` text
243268< HTTP/1.1 200 OK
244269< Date: Thu, 11 Apr 2024 00:56:21 GMT
245270< Content-Length: 23
@@ -253,4 +278,5 @@ If nothing is set for `CheckAlive`, an empty JSON object with 200 will be the re
253278The peer which the ICMP ping packet is routed to depends on the ` AllowedIPs ` set for each peers.
254279
255280# Stargazers over time
281+
256282[ ![ Stargazers over time] ( https://starchart.cc/octeep/wireproxy.svg )] ( https://starchart.cc/octeep/wireproxy )
0 commit comments