新功能+bug修复

This commit is contained in:
刘河
2019-01-13 00:09:12 +08:00
parent bb882f348a
commit 851241a0c7
17 changed files with 394 additions and 178 deletions

View File

@@ -14,9 +14,6 @@ var (
func main() {
flag.Parse()
//go func() {
// http.ListenAndServe("0.0.0.0:8899", nil)
//}()
stop := make(chan int)
for _, v := range strings.Split(*verifyKey, ",") {
log.Println("客户端启动,连接:", *serverAddr, " 验证令牌:", v)

View File

@@ -2,6 +2,7 @@ package main
import (
"flag"
"github.com/astaxie/beego"
"github.com/cnlh/easyProxy/server"
"github.com/cnlh/easyProxy/utils"
_ "github.com/cnlh/easyProxy/web/routers"
@@ -9,10 +10,9 @@ import (
)
var (
configPath = flag.String("config", "config.json", "配置文件路径")
TcpPort = flag.Int("tcpport", 8284, "客户端与服务端通信端口")
TcpPort = flag.Int("tcpport", 0, "客户端与服务端通信端口")
httpPort = flag.Int("httpport", 8024, "对外监听的端口")
rpMode = flag.String("mode", "client", "启动模式")
rpMode = flag.String("mode", "webServer", "启动模式")
tunnelTarget = flag.String("target", "10.1.50.203:80", "远程目标")
VerifyKey = flag.String("vkey", "", "验证密钥")
u = flag.String("u", "", "验证用户名(socks5和web)")
@@ -42,6 +42,15 @@ func main() {
CompressEncode: 0,
CompressDecode: 0,
}
if *TcpPort == 0 {
p, err := beego.AppConfig.Int("tcpport")
if err == nil && *rpMode == "webServer" {
*TcpPort = p
} else {
*TcpPort = 8284
}
}
log.SetFlags(log.Lshortfile)
cnf.CompressDecode, cnf.CompressEncode = utils.GetCompressType(cnf.Compress)
server.StartNewServer(*TcpPort, &cnf)
}