1
0
mirror of https://github.com/fumiama/WireGold.git synced 2026-06-05 07:50:24 +08:00
Files
WireGold/upper/services/tunnel/tunnel_test.go
2021-12-27 23:24:41 +08:00

28 lines
559 B
Go

package tunnel
import (
"testing"
"github.com/fumiama/WireGold/gold/link"
"github.com/sirupsen/logrus"
)
func TestTunnel(t *testing.T) {
logrus.SetLevel(logrus.DebugLevel)
link.SetMyself([32]byte{}, "192.168.1.2", "127.0.0.1:1236")
link.AddPeer("192.168.1.2", nil, "127.0.0.1:1236", nil, 0, false)
tunn, err := Create("192.168.1.2", 1, 1)
if err != nil {
t.Error(err)
} else {
sendb := ([]byte)("1234")
tunn.Write(sendb)
p := make([]byte, 4)
tunn.Read(p)
if string(sendb) != string(p) {
t.Log("error: recv", p)
t.Fail()
}
}
}