You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
star/net/natt_test.go

51 lines
1.0 KiB
Go

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)
}