Signed-off-by: arraykeys@gmail.com <arraykeys@gmail.com>
This commit is contained in:
@ -6,7 +6,8 @@ v3.5
|
||||
4.tcp代理增加了kcp协议传输数据.
|
||||
5.优化了死循环检查,增加了添加本地IP参数,当VPS在nat设备后面,
|
||||
vps上网卡IP都是内网IP,这个时候可以通过-g参数添加vps的外网ip防止死循环.
|
||||
|
||||
6.增加了--daemon参数,可以后台运行程序哟.
|
||||
|
||||
v3.4
|
||||
1.socks5代理新增了用户名密码验证支持.
|
||||
2.socks5,http(s)代理增加了kcp传输协议支持.
|
||||
|
||||
12
README.md
12
README.md
@ -40,6 +40,7 @@ Proxy是golang实现的高性能http,https,websocket,tcp,udp,socks5代理服务
|
||||
### 首次使用必看
|
||||
- [环境](#首次使用必看-1)
|
||||
- [使用配置文件](#使用配置文件)
|
||||
- [后台运行](#后台运行)
|
||||
- [生成通讯证书文件](#生成加密通讯需要的证书文件)
|
||||
- [安全建议](#安全建议)
|
||||
|
||||
@ -150,6 +151,13 @@ http,tcp,udp代理过程会和上级通讯,为了安全我们采用加密通讯,
|
||||
`./proxy keygen`
|
||||
默认会在当前程序目录下面生成证书文件proxy.crt和key文件proxy.key。
|
||||
|
||||
### 后台运行
|
||||
默认执行proxy之后,如果要保持proxy运行,不能关闭命令行.
|
||||
如果想在后台运行proxy,命令行可以关闭,只需要在命令最后加上--daemon参数即可.
|
||||
比如:
|
||||
`./proxy http -t tcp -p "0.0.0.0:38080" --daemon`
|
||||
更推荐用monexec守护运行proxy比较好.
|
||||
|
||||
### 安全建议
|
||||
当VPS在nat设备后面,vps上网卡IP都是内网IP,这个时候可以通过-g参数添加vps的外网ip防止死循环.
|
||||
假设你的vps外网ip是23.23.23.23,下面命令通过-g参数设置23.23.23.23
|
||||
@ -218,7 +226,7 @@ http,tcp,udp代理过程会和上级通讯,为了安全我们采用加密通讯,
|
||||
KCP协议需要-B参数设置一个密码用于加密解密数据
|
||||
|
||||
一级HTTP代理(VPS,IP:22.22.22.22)
|
||||
`./proxy http -t kcp -p ":38080" -B mypassword
|
||||
`./proxy http -t kcp -p ":38080" -B mypassword`
|
||||
|
||||
二级HTTP代理(本地Linux)
|
||||
`./proxy http -t tcp -p ":8080" -T kcp -P "22.22.22.22:38080" -B mypassword`
|
||||
@ -508,7 +516,7 @@ server连接到bridge的时候,如果同时有多个client连接到同一个brid
|
||||
KCP协议需要-B参数设置一个密码用于加密解密数据
|
||||
|
||||
一级HTTP代理(VPS,IP:22.22.22.22)
|
||||
`./proxy socks -t kcp -p ":38080" -B mypassword
|
||||
`./proxy socks -t kcp -p ":38080" -B mypassword`
|
||||
|
||||
二级HTTP代理(本地Linux)
|
||||
`./proxy socks -t tcp -p ":8080" -T kcp -P "22.22.22.22:38080" -B mypassword`
|
||||
|
||||
14
config.go
14
config.go
@ -4,6 +4,7 @@ import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"os/exec"
|
||||
"proxy/services"
|
||||
"proxy/utils"
|
||||
|
||||
@ -36,6 +37,7 @@ func initConfig() (err error) {
|
||||
app = kingpin.New("proxy", "happy with proxy")
|
||||
app.Author("snail").Version(APP_VERSION)
|
||||
debug := app.Flag("debug", "debug log output").Default("false").Bool()
|
||||
daemon := app.Flag("daemon", "run proxy in background").Default("false").Bool()
|
||||
//########http#########
|
||||
http := app.Command("http", "proxy on http mode")
|
||||
httpArgs.Parent = http.Flag("parent", "parent address, such as: \"23.32.32.19:28008\"").Default("").Short('P').String()
|
||||
@ -140,6 +142,18 @@ func initConfig() (err error) {
|
||||
//parse args
|
||||
serviceName := kingpin.MustParse(app.Parse(os.Args[1:]))
|
||||
flags := log.Ldate
|
||||
if *daemon {
|
||||
args := []string{}
|
||||
for _, arg := range os.Args[1:] {
|
||||
if arg != "--daemon" {
|
||||
args = append(args, arg)
|
||||
}
|
||||
}
|
||||
cmd := exec.Command(os.Args[0], args...)
|
||||
cmd.Start()
|
||||
fmt.Printf("%s [PID] %d running...\n", os.Args[0], cmd.Process.Pid)
|
||||
os.Exit(0)
|
||||
}
|
||||
if *debug {
|
||||
flags |= log.Lshortfile | log.Lmicroseconds
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user