mirror of
https://github.com/ehang-io/nps.git
synced 2025-09-02 11:56:53 +00:00
P2p first version
This commit is contained in:
@@ -48,7 +48,7 @@ func DealBridgeTask() {
|
||||
file.GetCsvDb().DelClient(id)
|
||||
case s := <-Bridge.SecretChan:
|
||||
logs.Trace("New secret connection, addr", s.Conn.Conn.RemoteAddr())
|
||||
if t := file.GetCsvDb().GetSecretTask(s.Password); t != nil {
|
||||
if t := file.GetCsvDb().GetTaskByMd5Password(s.Password); t != nil {
|
||||
if !t.Client.GetConn() {
|
||||
logs.Info("Connections exceed the current client %d limit", t.Client.Id)
|
||||
s.Conn.Close()
|
||||
@@ -75,6 +75,9 @@ func StartNewServer(bridgePort int, cnf *file.Tunnel, bridgeType string) {
|
||||
} else {
|
||||
logs.Info("Server startup, the bridge type is %s, the bridge port is %d", bridgeType, bridgePort)
|
||||
}
|
||||
if p, err := beego.AppConfig.Int("p2pPort"); err == nil {
|
||||
go proxy.NewP2PServer(p).Start()
|
||||
}
|
||||
go DealBridgeTask()
|
||||
if svr := NewMode(Bridge, cnf); svr != nil {
|
||||
if err := svr.Start(); err != nil {
|
||||
|
Reference in New Issue
Block a user