目录变更

This commit is contained in:
刘河
2019-02-03 17:25:00 +08:00
parent 87f2c8b2ce
commit 74b262503e
27 changed files with 328 additions and 203 deletions

View File

@@ -3,8 +3,8 @@ package main
import (
"flag"
"github.com/cnlh/nps/client"
"github.com/cnlh/nps/utils"
_ "github.com/cnlh/nps/utils"
"github.com/cnlh/nps/lib"
_ "github.com/cnlh/nps/lib"
"strings"
)
@@ -18,15 +18,15 @@ var (
func main() {
flag.Parse()
utils.InitDaemon("client")
lib.InitDaemon("npc")
if *logType == "stdout" {
utils.InitLogFile("client", true)
lib.InitLogFile("npc", true)
} else {
utils.InitLogFile("client", false)
lib.InitLogFile("npc", false)
}
stop := make(chan int)
for _, v := range strings.Split(*verifyKey, ",") {
utils.Println("客户端启动,连接:", *serverAddr, " 验证令牌:", v)
lib.Println("客户端启动,连接:", *serverAddr, " 验证令牌:", v)
go client.NewRPClient(*serverAddr, v).Start()
}
<-stop

View File

@@ -4,7 +4,7 @@ import (
"flag"
"github.com/astaxie/beego"
"github.com/cnlh/nps/server"
"github.com/cnlh/nps/utils"
"github.com/cnlh/nps/lib"
_ "github.com/cnlh/nps/web/routers"
"os"
)
@@ -30,37 +30,37 @@ func main() {
if len(os.Args) > 1 && os.Args[1] == "test" {
test = true
}
utils.InitDaemon("server")
lib.InitDaemon("nps")
if *logType == "stdout" || test {
utils.InitLogFile("server", true)
lib.InitLogFile("nps", true)
} else {
utils.InitLogFile("server", false)
lib.InitLogFile("nps", false)
}
task := &utils.Tunnel{
task := &lib.Tunnel{
TcpPort: *httpPort,
Mode: *rpMode,
Target: *tunnelTarget,
Config: &utils.Config{
Config: &lib.Config{
U: *u,
P: *p,
Compress: *compress,
Crypt: utils.GetBoolByStr(*crypt),
Crypt: lib.GetBoolByStr(*crypt),
},
Flow: &utils.Flow{},
Flow: &lib.Flow{},
UseClientCnf: false,
}
if *VerifyKey != "" {
c := &utils.Client{
c := &lib.Client{
Id: 0,
VerifyKey: *VerifyKey,
Addr: "",
Remark: "",
Status: true,
IsConnect: false,
Cnf: &utils.Config{},
Flow: &utils.Flow{},
Cnf: &lib.Config{},
Flow: &lib.Flow{},
}
c.Cnf.CompressDecode, c.Cnf.CompressEncode = utils.GetCompressType(c.Cnf.Compress)
c.Cnf.CompressDecode, c.Cnf.CompressEncode = lib.GetCompressType(c.Cnf.Compress)
server.CsvDb.Clients[0] = c
task.Client = c
}
@@ -72,8 +72,8 @@ func main() {
*TcpPort = 8284
}
}
utils.Println("服务端启动监听tcp服务端端口", *TcpPort)
task.Config.CompressDecode, task.Config.CompressEncode = utils.GetCompressType(task.Config.Compress)
lib.Println("服务端启动监听tcp服务端端口", *TcpPort)
task.Config.CompressDecode, task.Config.CompressEncode = lib.GetCompressType(task.Config.Compress)
if *rpMode != "webServer" {
server.CsvDb.Tasks[0] = task
}