-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf: add LICENSE, docs and runtime scripts
- Loading branch information
Showing
11 changed files
with
482 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# Sidecar | ||
|
||
基于 MITM 的 Https 代理服务器,用于站点访问加速,是 [dev-sidecar](https://github.com/docmirror/dev-sidecar) 的 golang 实现。 | ||
|
||
## 使用方法 | ||
|
||
支持系统包括 Linux , macOS 和 Windows 。 | ||
|
||
运行服务时需要 `conf.toml` 文件: | ||
|
||
``` bash | ||
# conf.toml | ||
[Sidecar] | ||
ProxyPort = 4396 | ||
OnlyListenIPv4 = true | ||
LogLevel = "info" | ||
|
||
[RemoteProxy] | ||
Server = "remote.server.com" # 使用时需要替换为实际的远端服务域名 | ||
ComplexPath = "FreeFreeFree" # 使用时需要替换为实际的远端服务入口路径 | ||
GfwListUrl = "https://raw.githubusercontent.com/gfwlist/gfwlist/master/gfwlist.txt" | ||
|
||
[RemoteProxy.CustomHeaders] | ||
# 使用时需要替换为实际的远端服务允许通过的 Header | ||
AuthHeader = "Secret" | ||
|
||
# 这部分信息可以生成远端服务的 nginx.conf ,仅在 create-nginx-conf 时被使用 | ||
[RemoteProxyConf] | ||
EnableListenHTTP2 = true | ||
EnableWebSocketProxy = true | ||
EnableModernTLSOnly = true | ||
NginxWorkDir = "/usr/local/openresty/nginx/logs" | ||
SSLCertificatePath = "/usr/local/openresty/nginx/conf/proxy/proxy.crt" | ||
SSLPrivateKeyPath = "/usr/local/openresty/nginx/conf/proxy/proxy.pri" | ||
``` | ||
|
||
修改 `conf.toml` 文件后存放到对应目录,启动服务时会自动生成对应的证书,信任并安装根证书后就可以正常使用。 | ||
|
||
通过 `sidecar-server start [-conf tomlfile] [-dir workdir] [-daemon]` 启动服务,通过 `sidecar-server stop [-dir workdir]` 停止服务。 | ||
|
||
不指定 `-conf` 则配置文件必须命名为 `conf.toml` 并且处于当前可执行文件所在的目录;不指定 `-dir` 则默认工作目录为当前可执行文件所在的目录,生成的证书和服务运行时的锁文件都会处于这个目录中;不指定 `-daemon` 则服务会占用当前终端,否则会运行在后台中。 | ||
|
||
### Windows | ||
|
||
在启动服务后,需要手动设置代理服务,或者使用提供的 bat 脚本。 | ||
|
||
### Linux | ||
|
||
在启动服务后,需要声明环境变量: | ||
|
||
``` bash | ||
export HTTPS_PROXY=127.0.0.1:4396 | ||
``` | ||
|
||
## 感谢 | ||
|
||
项目代码参考了以下项目: | ||
|
||
- [dev-sidecar](https://github.com/docmirror/dev-sidecar) | ||
- [go-mitmproxy](https://github.com/lqqyt2423/go-mitmproxy) | ||
- [koko](https://github.com/jumpserver/koko) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
|
||
PWD=`pwd` | ||
|
||
./sidecar-server start -dir $PWD -conf $PWD/conf.toml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
|
||
PWD=`pwd` | ||
|
||
./sidecar-server start -daemon -dir $PWD -conf $PWD/conf.toml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
|
||
PWD=`pwd` | ||
|
||
./sidecar-server stop -dir $PWD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
@echo off | ||
|
||
set PROXYSERVER=127.0.0.1:4396 | ||
set PROXYOVERRIDE=localhost;127.*;10.*;172.16.*;172.17.*;172.18.*;172.19.*;172.20.*;172.21.*;172.22.*;172.23.*;172.24.*;172.25.*;172.26.*;172.27.*;172.28.*;172.29.*;172.30.*;172.31.*;192.168.* | ||
|
||
echo "set Proxy Server ......" | ||
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /t REG_SZ /d %PROXYSERVER% /f | ||
|
||
echo "set Proxy Override ......" | ||
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyOverride /t REG_SZ /d %PROXYOVERRIDE% /f | ||
|
||
echo "Enable Proxy Server ......" | ||
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 1 /f | ||
|
||
echo "Start Sidecar Server ......" | ||
%cd%/sidecar-server.exe start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
@echo off | ||
|
||
set PROXYSERVER=127.0.0.1:4396 | ||
set PROXYOVERRIDE=localhost;127.*;10.*;172.16.*;172.17.*;172.18.*;172.19.*;172.20.*;172.21.*;172.22.*;172.23.*;172.24.*;172.25.*;172.26.*;172.27.*;172.28.*;172.29.*;172.30.*;172.31.*;192.168.* | ||
|
||
echo "Start Sidecar Server ......" | ||
%cd%/sidecar-server.exe start -daemon | ||
|
||
echo "set Proxy Server ......" | ||
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /t REG_SZ /d %PROXYSERVER% /f | ||
|
||
echo "set Proxy Override ......" | ||
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyOverride /t REG_SZ /d %PROXYOVERRIDE% /f | ||
|
||
echo "Enable Proxy Server ......" | ||
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 1 /f | ||
|
||
echo "Press Any Key To Close This Window ......" | ||
pause | ||
exit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
@echo off | ||
|
||
echo "Disable Proxy Server ......" | ||
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 0 /f | ||
|
||
echo "Stop Sidecar Server ......" | ||
%cd%/sidecar-server.exe stop | ||
|
||
echo "Press Any Key To Close This Window ......" | ||
pause | ||
exit |