update the document

This commit is contained in:
wweir
2021-08-09 06:53:44 +08:00
parent 8694ff6edd
commit 397825556c
3 changed files with 249 additions and 66 deletions
+3 -3
View File
@@ -7,14 +7,14 @@ test:
${GO} vet ./...
${GO} test ./...
build: client server
build: sower sowerd
client:
sower:
${GO} build -ldflags "\
-X main.version=$(shell git describe --tags --always) \
-X main.date=$(shell date +%Y-%m-%d)" \
-o sower ./cmd/sower
server:
sowerd:
${GO} build -ldflags "\
-X main.version=$(shell git describe --tags --always) \
-X main.date=$(shell date +%Y-%m-%d)" \
+35 -63
View File
@@ -1,7 +1,6 @@
# sower
[![GitHub release](http://img.shields.io/github/release/wweir/sower.svg?style=popout)](https://github.com/wweir/sower/releases)
[![Actions Status](https://github.com/wweir/sower/workflows/Go/badge.svg)](https://github.com/wweir/sower/actions)
[![Docker Cloud Build Status](https://img.shields.io/docker/cloud/build/wweir/sower.svg?style=popout)](https://hub.docker.com/r/wweir/sower)
[![GitHub issue](https://img.shields.io/github/issues/wweir/sower.svg?style=popout)](https://github.com/wweir/sower/issues)
[![GitHub star](https://img.shields.io/github/stars/wweir/sower.svg?style=popout)](https://github.com/wweir/sower/stargazers)
[![GitHub license](https://img.shields.io/github/license/wweir/sower.svg?style=popout)](LICENSE)
@@ -9,82 +8,55 @@
中文介绍见 [Wiki](https://github.com/wweir/sower/wiki)
The sower is a cross-platform intelligent transparent proxy tool.
The first time you visit a new website, the sower will detect if the domain is accessible and add it in the dynamic detect list. So, you do not need to care about the rules, sower will handle it intelligently.
Sower provider both http_proxy/https_proxy and DNS-based proxy. All these kinds of proxy support intelligent router. You can also port-forward any TCP request to remote, such as SSH / SMTP / POP3.
You can enjoy it by setting http_proxy or your DNS without any other settings.
The sower is a cross-platform intelligent transparent proxy tool. It provide both socks5 proxy and DNS-based proxy. All these kinds of proxy support intelligent router.
If you already have another proxy solution, you can use it's socks5(h) service as a parent proxy to enjoy the sower's intelligent router.
## Installation
To enjoy the sower, you need to deploy sower on both server-side and client-side.
To enjoy the sower, you need to deploy sower on both server-side(sowerd) and client-side(sower).
The installation script has been integrated into the sower. You can install sower as system service by running `./sower -install 'xxx'` in terminal on the three most popular operating system platforms: Linux / Windows and masOS.
## Sowerd
*If you wanna use sower as secondary proxy to provide intelligent router, you can skip sowerd.*
## Server
*If you already have another proxy solution with socks5h support, you can skip server-side.*
At the server-side, the sowerd runs just like a web server proxy. It will occupy two ports `80` / `443`.
At the server-side, the sower runs just like a web server proxy.
It redirects HTTP requests to HTTPS and proxy https requests to the upstream HTTP service.
You can use your certificate or use the auto-generated certificate by the sower.
You can use your own certificate or the certificate automatically applied for by the sowerd from [`Let's Encrypt`](https://letsencrypt.org/).
What you must set is the upstream HTTP service. You can set it by parameter `-s`, eg:
``` shell
# sower -s 127.0.0.1:8080
```
There are two ways to run the sowerd service:
1. run the shell command with root permission
``` shell
# sowerd -password XXX -fake_site 127.0.0.1:8080
```
2. install as a systemd service
```service
[Unit]
Description=sower server service
After=network.target
## Client
The easiest way to run it is:
``` shell
# sower -c aa.bb.cc # the `aa.bb.cc` can also be `socks5h://127.0.0.1:1080`
```
But a configuration file is recommended to persist dynamic rules in client side.
[Service]
Type=simple
ExecStart=/usr/local/bin/sowerd
Environment="FAKE_SITE=127.0.0.1:8080"
Environment="PASSWORD=XXX"
There are 3 kinds of proxy solutions, they are HTTP(S)_PROXY / DNS-based proxy / port-forward.
[Install]
WantedBy=multi-user.target
```
### HTTP(S)_PROXY
An HTTP(S)_PROXY listening on `:8080` is set by default if you run sower as client mode.
## Sower
### DNS-based proxy
**DNS-based** solution is not recommanded now, for incompatible with TLS 1.3 esni extention. DNS flush logic has been dropped, you should flush your dns cache manually
in Windows and macOS.
A config file is required in sower client side. [Here](https://github.com/wweir/sower/wiki/sower.hcl) is an usable example in China.
You can set the `dns_serve_ip` field in the configuration file to start the DNS-based proxy. You should also set the value of `dns_upstream` as your default DNS in OS.
If you want to enjoy the full experience provided by the sower, you can take sower as your private DNS on a long-running server and set it as your default DNS in your router.
### port-forward
The port-forward can be only setted in configuration file, you can set it in section `client.port_mapping`, eg:
``` toml
[client.port_mapping]
":2222"="aa.bb.cc:22"
```
`Sower` will take 4 port by default with root permission. They are: `udp(53)` / `tcp(80)` / `tcp(443)` / `tcp(1080)`.
After do the next three step, you can enjoy the intelligent transparent proxy solution:
1. run the command line with root permission:
```shell
# sower -f sower.hcl
```
2. changing your DNS server to `127.0.0.1` and
3. setting your proxy to `socks5h://127.0.0.1:1080`.
## Architecture
```
relay <--+ +-> target
http service | | service
+-------+-------+----+
| sower server |
+----^-------^-------+
80 443
301 http -+ +----- https
to https | service
protected
by tls
socks5 |
dns <---+ ^ | +--> direct
relay | | | | request
+---+---+----+--+----+
| sower client |
+----^--^----^---^---+
| | | |
dns --+ + + +-- port
80 http(s) forward
443 proxy
```
![Architecture diagram](./sower.drawio.svg)
+211
View File
@@ -0,0 +1,211 @@
<svg host="65bd71144e" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="296px" height="462px" viewBox="-0.5 -0.5 296 462" content="&lt;mxfile&gt;&lt;diagram id=&quot;u2y3ysnPqCVZKoHCRF4D&quot; name=&quot;第 1 页&quot;&gt;3VnZdtowEP0aHpPjBS88JpA2D2nLObSnzaPAwlZjWz6yHCBf3xGSMfLSEJYQ8gLWeLTdO7ozgp49TJZfGcqibzTAcc8ygmXPHvUsa+D68CkMK2nwPE8aQkYCaTIrw4S8YGU0lLUgAc41R05pzEmmG2c0TfGMazbEGF3obnMa67NmKMQNw2SG4qb1Nwl4JK2+5VX2e0zCqJzZdAfyTYJKZ7WTPEIBXWyZ7LuePWSUcvmULIc4FtiVuMh+XzrebhbGcMp36dCXHZ5RXKi93f/8OZ6oxfFVuWMcAACqSRmPaEhTFN9V1ltGizTAYlgDWpXPA6UZGE0w/sWcrxSbqOAUTBFPYvUWVsxWf0T/a6dsPm6/Gy3V4LK1Ui25VrHATgyUKacFmykvS4UNYiFWXvYGf4hbTBMMs4ALwzHi5FkfHakICjd+FcjwoHDuIKkJek5nT7kDtiLLOcMoOQsBS8Il/pajmo8l4vBcwS8aR0D/AKhV1zElMIllKF2xfHWqlKzYrqEPIdlWvSrCbhhDqy23TDjk3fPYTvs8Ff9yxCoaNnvcLUDc89LvXSb9jvs+9PcHJ6bfa+hDQJjIY2AjOeGt0fGAppBkNUZRTMIUnmfABWZgeMaME0hjN+pFQoJABg/OyQuarscTtCoIYHDntueMNkSLAfCyLceqzlVm00LAbSdcjWRcG6braZheqdH3DYnShc7nOeY1et5KiNWi1wsAtE6DfgQXEeF4kqF10C+gDtLJ6QS0cXY6cavrXb+sjxZVUbLxibYLEsPoRnLnNOafQ6X2E5xDU3uHEFg6/lYd1g7B2UcTBp88JZyIocG7MWS3i0Tw4VTC6u+oEv4RRMK7HI1QRdf2jeAodcpbywvHcDS+HLt2hXtFhWr+B5cjfktgy9uKixIRruk0F1+wKOhIQrxeXMbocnVxhYr335N0ZVzbpmvqhUr/sEKlXGOtx1HqFrfB3K347UNULjp14PQLzHmDrzxCmXgskvhmxuk2NWsaxxTKUUIFRVPKOU1auOO0pmm04DFJ8XDz44xxHKGri/3mPrAldHaLztWvCXsVQ9Z58/Pu6Vk0xpgR2KI4agek7MGJBPN1hbNOdK+3P5byms2aYvR9IvCEI4QF9JH4TIVQGPOYLprn+sL01+wIoEqA+57va6B/pIvioMHXD6CIfQ55tevR/o7yWk69hewcPYngB4BwA1fYJD9dhAsdzqUki6FzzugTwB0L/kYpTfGR0lnt5yzTb+LttuBdF8e98DYbeCuZ/8yI277zKuLecRCHZvUnj1Sa6p8y++4f&lt;/diagram&gt;&lt;/mxfile&gt;">
<defs/>
<g>
<path d="M 147 230 L 147 146.37" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="stroke"/>
<path d="M 147 141.12 L 150.5 148.12 L 147 146.37 L 143.5 148.12 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="all"/>
<g transform="translate(-0.5 -0.5)">
<switch>
<foreignObject style="overflow: visible; text-align: left;" pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
<div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 1px; height: 1px; padding-top: 185px; margin-left: 147px;">
<div style="box-sizing: border-box; font-size: 0; text-align: center; ">
<div style="display: inline-block; font-size: 11px; font-family: Helvetica; color: #000000; line-height: 1.2; pointer-events: all; background-color: #ffffff; white-space: nowrap; ">
HTTPS
</div>
</div>
</div>
</foreignObject>
<text x="147" y="188" fill="#000000" font-family="Helvetica" font-size="11px" text-anchor="middle">
HTTPS
</text>
</switch>
</g>
<path d="M 77 230 L 77 180 L 13.37 180" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="stroke"/>
<path d="M 8.12 180 L 15.12 176.5 L 13.37 180 L 15.12 183.5 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="all"/>
<g transform="translate(-0.5 -0.5)">
<switch>
<foreignObject style="overflow: visible; text-align: left;" pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
<div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 1px; height: 1px; padding-top: 180px; margin-left: 67px;">
<div style="box-sizing: border-box; font-size: 0; text-align: center; ">
<div style="display: inline-block; font-size: 11px; font-family: Helvetica; color: #000000; line-height: 1.2; pointer-events: all; background-color: #ffffff; white-space: nowrap; ">
socks5 upstream
</div>
</div>
</div>
</foreignObject>
<text x="67" y="183" fill="#000000" font-family="Helvetica" font-size="11px" text-anchor="middle">
socks5 upstream
</text>
</switch>
</g>
<path d="M 217 230 L 217 180 L 280.63 180" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="stroke"/>
<path d="M 285.88 180 L 278.88 183.5 L 280.63 180 L 278.88 176.5 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="all"/>
<g transform="translate(-0.5 -0.5)">
<switch>
<foreignObject style="overflow: visible; text-align: left;" pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
<div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 1px; height: 1px; padding-top: 182px; margin-left: 229px;">
<div style="box-sizing: border-box; font-size: 0; text-align: center; ">
<div style="display: inline-block; font-size: 11px; font-family: Helvetica; color: #000000; line-height: 1.2; pointer-events: all; background-color: #ffffff; white-space: nowrap; ">
direct visit
</div>
</div>
</div>
</foreignObject>
<text x="229" y="185" fill="#000000" font-family="Helvetica" font-size="11px" text-anchor="middle">
direct visit
</text>
</switch>
</g>
<rect x="7" y="230" width="280" height="100" fill="#ffffff" stroke="#000000" pointer-events="all"/>
<g transform="translate(-0.5 -0.5)">
<switch>
<foreignObject style="overflow: visible; text-align: left;" pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
<div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 278px; height: 1px; padding-top: 280px; margin-left: 8px;">
<div style="box-sizing: border-box; font-size: 0; text-align: center; ">
<div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: #000000; line-height: 1.2; pointer-events: all; white-space: normal; word-wrap: normal; ">
sower
</div>
</div>
</div>
</foreignObject>
<text x="147" y="284" fill="#000000" font-family="Helvetica" font-size="12px" text-anchor="middle">
sower
</text>
</switch>
</g>
<path d="M 147 60 L 147 26.37" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="stroke"/>
<path d="M 147 21.12 L 150.5 28.12 L 147 26.37 L 143.5 28.12 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="all"/>
<path d="M 217 60 L 217 26.37" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="stroke"/>
<path d="M 217 21.12 L 220.5 28.12 L 217 26.37 L 213.5 28.12 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="all"/>
<rect x="7" y="60" width="280" height="80" fill="#ffffff" stroke="#000000" pointer-events="all"/>
<g transform="translate(-0.5 -0.5)">
<switch>
<foreignObject style="overflow: visible; text-align: left;" pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
<div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 278px; height: 1px; padding-top: 100px; margin-left: 8px;">
<div style="box-sizing: border-box; font-size: 0; text-align: center; ">
<div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: #000000; line-height: 1.2; pointer-events: all; white-space: normal; word-wrap: normal; ">
sowerd
</div>
</div>
</div>
</foreignObject>
<text x="147" y="104" fill="#000000" font-family="Helvetica" font-size="12px" text-anchor="middle">
sowerd
</text>
</switch>
</g>
<path d="M 232 380 L 232 350 L 147 350 L 147 336.37" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="stroke"/>
<path d="M 147 331.12 L 150.5 338.12 L 147 336.37 L 143.5 338.12 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="all"/>
<g transform="translate(-0.5 -0.5)">
<switch>
<foreignObject style="overflow: visible; text-align: left;" pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
<div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 1px; height: 1px; padding-top: 347px; margin-left: 228px;">
<div style="box-sizing: border-box; font-size: 0; text-align: center; ">
<div style="display: inline-block; font-size: 11px; font-family: Helvetica; color: #000000; line-height: 1.2; pointer-events: all; background-color: #ffffff; white-space: nowrap; ">
socks5 intelligent proxy
</div>
</div>
</div>
</foreignObject>
<text x="228" y="350" fill="#000000" font-family="Helvetica" font-size="11px" text-anchor="middle">
socks5 intelligent proxy
</text>
</switch>
</g>
<ellipse cx="232" cy="387.5" rx="7.5" ry="7.5" fill="#ffffff" stroke="#000000" pointer-events="all"/>
<path d="M 232 395 L 232 420 M 232 400 L 217 400 M 232 400 L 247 400 M 232 420 L 217 440 M 232 420 L 247 440" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="all"/>
<g transform="translate(-0.5 -0.5)">
<switch>
<foreignObject style="overflow: visible; text-align: left;" pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
<div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe flex-start; justify-content: unsafe center; width: 1px; height: 1px; padding-top: 447px; margin-left: 232px;">
<div style="box-sizing: border-box; font-size: 0; text-align: center; ">
<div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: #000000; line-height: 1.2; pointer-events: all; white-space: nowrap; ">
Browser  Users
</div>
</div>
</div>
</foreignObject>
<text x="232" y="459" fill="#000000" font-family="Helvetica" font-size="12px" text-anchor="middle">
Brows...
</text>
</switch>
</g>
<path d="M 62 380 L 62 350 L 147 350 L 147 336.37" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="stroke"/>
<path d="M 147 331.12 L 150.5 338.12 L 147 336.37 L 143.5 338.12 Z" fill="#000000" stroke="#000000" stroke-miterlimit="10" pointer-events="all"/>
<g transform="translate(-0.5 -0.5)">
<switch>
<foreignObject style="overflow: visible; text-align: left;" pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
<div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 1px; height: 1px; padding-top: 350px; margin-left: 68px;">
<div style="box-sizing: border-box; font-size: 0; text-align: center; ">
<div style="display: inline-block; font-size: 11px; font-family: Helvetica; color: #000000; line-height: 1.2; pointer-events: all; background-color: #ffffff; white-space: nowrap; ">
DNS route the net flow
</div>
</div>
</div>
</foreignObject>
<text x="68" y="353" fill="#000000" font-family="Helvetica" font-size="11px" text-anchor="middle">
DNS route the net flow
</text>
</switch>
</g>
<ellipse cx="62" cy="387.5" rx="7.5" ry="7.5" fill="#ffffff" stroke="#000000" pointer-events="all"/>
<path d="M 62 395 L 62 420 M 62 400 L 47 400 M 62 400 L 77 400 M 62 420 L 47 440 M 62 420 L 77 440" fill="none" stroke="#000000" stroke-miterlimit="10" pointer-events="all"/>
<g transform="translate(-0.5 -0.5)">
<switch>
<foreignObject style="overflow: visible; text-align: left;" pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
<div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe flex-start; justify-content: unsafe center; width: 1px; height: 1px; padding-top: 447px; margin-left: 62px;">
<div style="box-sizing: border-box; font-size: 0; text-align: center; ">
<div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: #000000; line-height: 1.2; pointer-events: all; white-space: nowrap; ">
Other Users
</div>
</div>
</div>
</foreignObject>
<text x="62" y="459" fill="#000000" font-family="Helvetica" font-size="12px" text-anchor="middle">
Other...
</text>
</switch>
</g>
<rect x="187" y="0" width="60" height="20" fill="none" stroke="none" pointer-events="all"/>
<g transform="translate(-0.5 -0.5)">
<switch>
<foreignObject style="overflow: visible; text-align: left;" pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
<div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 1px; height: 1px; padding-top: 10px; margin-left: 217px;">
<div style="box-sizing: border-box; font-size: 0; text-align: center; ">
<div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: #000000; line-height: 1.2; pointer-events: all; white-space: nowrap; ">
fake site
</div>
</div>
</div>
</foreignObject>
<text x="217" y="14" fill="#000000" font-family="Helvetica" font-size="12px" text-anchor="middle">
fake site
</text>
</switch>
</g>
<rect x="112" y="0" width="70" height="20" fill="none" stroke="none" pointer-events="all"/>
<g transform="translate(-0.5 -0.5)">
<switch>
<foreignObject style="overflow: visible; text-align: left;" pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
<div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 1px; height: 1px; padding-top: 10px; margin-left: 147px;">
<div style="box-sizing: border-box; font-size: 0; text-align: center; ">
<div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: #000000; line-height: 1.2; pointer-events: all; white-space: nowrap; ">
target site
</div>
</div>
</div>
</foreignObject>
<text x="147" y="14" fill="#000000" font-family="Helvetica" font-size="12px" text-anchor="middle">
target site
</text>
</switch>
</g>
</g>
<switch>
<g requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"/>
<a transform="translate(0,-5)" xlink:href="https://www.diagrams.net/doc/faq/svg-export-text-problems" target="_blank">
<text text-anchor="middle" font-size="10px" x="50%" y="100%">
Viewer does not support full SVG 1.1
</text>
</a>
</switch>
</svg>

After

Width:  |  Height:  |  Size: 17 KiB