Merge branch 'dev' of https://ehang.io/nps into dev

pull/426/head
ffdfgdfg 2020-02-28 00:32:05 +08:00
commit 9061201684
2 changed files with 6 additions and 3 deletions

View File

@ -36,6 +36,7 @@ var (
logPath = flag.String("log_path", "", "npc log path")
debug = flag.Bool("debug", true, "npc debug")
pprofAddr = flag.String("pprof", "", "PProf debug addr (ip:port)")
stunAddr = flag.String("stun_addr", "stun.stunprotocol.org:3478", "stun server address (eg:stun.stunprotocol.org:3478)")
)
func main() {
@ -107,7 +108,9 @@ func main() {
install.UpdateNpc()
return
case "nat":
nat, host, err := stun.NewClient().Discover()
c := stun.NewClient()
c.SetServerAddr(*stunAddr)
nat, host, err := c.Discover()
if err != nil || host == nil {
logs.Error("get nat type error", err)
return

View File

@ -1,9 +1,9 @@
# 增强功能
## nat类型检测
```
./npc nat
./npc nat -stun_addr=stun.stunprotocol.org:3478
```
如果p2p双方都是Symmetric Nat肯定不能成功其他组合都有较大成功率。
如果p2p双方都是Symmetric Nat肯定不能成功其他组合都有较大成功率。`stun_addr`可以指定stun服务器地址。
## 状态检查
```
./npc status -config=npc配置文件路径