Skip to content

Commit 47cd451

Browse files
authored
docs: add syntax highlighting and Go install command (#158)
* docs: add syntax language for codeblocks * docs: add install instructions for Go
1 parent d710683 commit 47cd451

File tree

2 files changed

+50
-17
lines changed

2 files changed

+50
-17
lines changed

README.md

Lines changed: 38 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
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

67
A 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,
1012
and exposes a socks5/http proxy or tunnels on the machine. This can be useful if you need
1113
to connect to certain sites via a wireguard peer, but can't be bothered to setup a new network
1214
interface 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:/
2427
of 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
4046
usage: 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
6268
git clone https://github.com/octeep/wireproxy
6369
cd wireproxy
6470
make
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+
6881
Instructions 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

136150
Alternatively, if you already have a wireguard config, you can import it in the
137151
wireproxy config file like this:
138-
```
152+
153+
```ini
139154
WGConfig = <path to the wireguard config>
140155

141156
# Same semantics as above
@@ -151,7 +166,8 @@ WGConfig = <path to the wireguard config>
151166

152167
Having multiple peers is also supported. `AllowedIPs` would need to be specified
153168
such that wireproxy would know which peer to forward to.
154-
```
169+
170+
```ini
155171
[Interface]
156172
Address = 10.254.254.40/32
157173
PrivateKey = XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX=
@@ -183,7 +199,8 @@ Target = service-three.servicenet:80
183199
```
184200

185201
Wireproxy can also allow peers to connect to it:
186-
```
202+
203+
```ini
187204
[Interface]
188205
ListenPort = 5400
189206
...
@@ -193,7 +210,9 @@ PublicKey = YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY=
193210
AllowedIPs = 10.254.254.100/32
194211
# Note there is no Endpoint defined here.
195212
```
213+
196214
# Health endpoint
215+
197216
Wireproxy supports exposing a health endpoint for monitoring purposes.
198217
The 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

206225
For example:
207-
```
226+
227+
```ini
208228
[Interface]
209229
PrivateKey = censored
210230
Address = 10.2.0.2/32
@@ -220,8 +240,10 @@ Endpoint = 149.34.244.174:51820
220240
[Socks5]
221241
BindAddress = 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

233255
And for:
234-
```
256+
257+
```ini
235258
[Interface]
236259
PrivateKey = censored
237260
Address = 10.2.0.2/32
238261
DNS = 10.2.0.1
239262
CheckAlive = 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
253278
The 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)

UseWithVPN.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
# Getting a Wireguard Server
2+
23
You can create your own wireguard server using a host service like DigitalOcean,
34
or you can get a VPN service that provides WireGuard configs.
45

56
I recommend ProtonVPN, because it is highly secure and has a great WireGuard
67
config generator.
78

8-
Simply go to https://account.protonvpn.com/downloads and scroll down to the
9+
Simply go to <https://account.protonvpn.com/downloads> and scroll down to the
910
wireguard section to generate your configs, then paste into the appropriate
1011
section below.
1112

@@ -25,9 +26,11 @@ naming should also be similar (e.g.
2526
`/Users/jonny/Library/LaunchAgents/com.ProtonUS.adblock.plist`)
2627

2728
## Config File
29+
2830
Make sure you use a unique port for every separate server
2931
I recommend you set proxy authentication, you can use the same user/pass for all
30-
```
32+
33+
```ini
3134
# Link to the Downloaded config
3235
WGConfig = /Users/jonny/vpntabs/ProtonUS.adblock.server.conf
3336

@@ -43,24 +46,27 @@ BindAddress = 127.0.0.1:25344 # Update the port here for each new server
4346
```
4447

4548
## Startup Script File
49+
4650
This is a bash script to facilitate startup, not strictly essential, but adds
4751
ease.
4852
Note, you MUST update the first path to wherever you installed this code to.
4953
Make sure you use the path for the config file above, not the one you downloaded
5054
from e.g. protonvpn.
51-
```
55+
56+
```bash
5257
#!/bin/bash
5358
/Users/jonny/wireproxy/wireproxy -c /Users/jonny/vpntabs/ProtonUS.adblock.conf
5459
```
5560

5661
## MacOS LaunchAgent
62+
5763
To make it run every time you start your computer, you can create a launch agent
5864
in `$HOME/Library/LaunchAgents`. Name reference above.
5965

6066
That file should contain the following, the label should be the same as the file
6167
name and the paths should be set correctly:
6268

63-
```
69+
```xml
6470
<?xml version="1.0" encoding="UTF-8"?>
6571
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
6672
<plist version="1.0">
@@ -70,7 +76,7 @@ name and the paths should be set correctly:
7076
<key>Program</key>
7177
<string>/Users/jonny/vpntabs/ProtonUS.adblock.sh</string>
7278
<key>RunAtLoad</key>
73-
<true/>
79+
<true/>
7480
<key>KeepAlive</key>
7581
<true/>
7682
</dict>
@@ -82,6 +88,7 @@ To enable it, run
8288
`launchtl start ~/Library/LaunchAgents/com.PortonUS.adblock.plist`
8389

8490
# Firefox Setup
91+
8592
You will need to enable the Multi Account Container Tabs extension and a proxy extension, I
8693
recommend Sideberry, but Container Proxy also works.
8794

0 commit comments

Comments
 (0)