mirror of
https://github.com/fumiama/WireGold.git
synced 2026-06-22 11:30:31 +08:00
24 lines
452 B
Go
24 lines
452 B
Go
package tunnel
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/fumiama/WireGold/gold/link"
|
|
)
|
|
|
|
func TestTunnel(t *testing.T) {
|
|
link.SetMyself([32]byte{}, "127.0.0.1:1234")
|
|
link.AddPeer("192.168.1.1", [32]byte{}, "127.0.0.1:1235", 0)
|
|
link.Listen("127.0.0.1:1234")
|
|
link.Listen("127.0.0.1:1235")
|
|
tunn, err := Create("192.168.1.1", 1, 1)
|
|
if err != nil {
|
|
t.Error(err)
|
|
} else {
|
|
tunn.Write(([]byte)("1234"))
|
|
p := make([]byte, 4)
|
|
tunn.Read(p)
|
|
t.Log(p)
|
|
}
|
|
}
|