package net import ( "b612.me/apps/b612/netforward" "fmt" "testing" "time" ) func TestNathrough(t *testing.T) { var n = NatThrough{ Forward: netforward.NetForward{ LocalAddr: "0.0.0.0", LocalPort: 0, RemoteURI: "127.0.0.1:88", EnableTCP: true, EnableUDP: false, DelayMilSec: 0, DelayToward: 0, StdinMode: false, IgnoreEof: false, DialTimeout: 3000, UDPTimeout: 3000, KeepAlivePeriod: 30, KeepAliveIdel: 30, KeepAliveCount: 5, UserTimeout: 0, UsingKeepAlive: true, }, Type: "tcp", STUN: "turn.b612.me:3478", Remote: "baidu.com:80", KeepAlivePeriod: 3000, KeepAliveIdel: 3000, KeepAliveCount: 5, AutoUPnP: true, stopFn: nil, stopCtx: nil, } go func() { time.Sleep(time.Second * 10) fmt.Println(n.ExtUrl) }() if err := n.Run(); err != nil { fmt.Println(err) t.Error(err) } n.HealthCheck() time.Sleep(time.Second * 5) }