2017-01-07 19:06:35 -05:00
|
|
|
package scenarios
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
2019-01-11 11:17:59 -05:00
|
|
|
"time"
|
2017-01-07 19:06:35 -05:00
|
|
|
|
2017-01-08 04:10:37 -05:00
|
|
|
xproxy "golang.org/x/net/proxy"
|
2021-10-28 06:34:19 -04:00
|
|
|
"google.golang.org/protobuf/types/known/anypb"
|
2018-10-05 19:34:07 -04:00
|
|
|
socks4 "h12.io/socks"
|
2018-10-12 17:57:56 -04:00
|
|
|
|
2022-01-02 10:16:23 -05:00
|
|
|
core "github.com/v2fly/v2ray-core/v5"
|
|
|
|
"github.com/v2fly/v2ray-core/v5/app/proxyman"
|
|
|
|
"github.com/v2fly/v2ray-core/v5/app/router"
|
|
|
|
"github.com/v2fly/v2ray-core/v5/common"
|
|
|
|
"github.com/v2fly/v2ray-core/v5/common/net"
|
|
|
|
"github.com/v2fly/v2ray-core/v5/common/protocol"
|
|
|
|
"github.com/v2fly/v2ray-core/v5/common/serial"
|
|
|
|
"github.com/v2fly/v2ray-core/v5/proxy/blackhole"
|
|
|
|
"github.com/v2fly/v2ray-core/v5/proxy/dokodemo"
|
|
|
|
"github.com/v2fly/v2ray-core/v5/proxy/freedom"
|
|
|
|
"github.com/v2fly/v2ray-core/v5/proxy/socks"
|
|
|
|
"github.com/v2fly/v2ray-core/v5/testing/servers/tcp"
|
|
|
|
"github.com/v2fly/v2ray-core/v5/testing/servers/udp"
|
2017-01-07 19:06:35 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestSocksBridgeTCP(t *testing.T) {
|
|
|
|
tcpServer := tcp.Server{
|
|
|
|
MsgProcessor: xor,
|
|
|
|
}
|
|
|
|
dest, err := tcpServer.Start()
|
2019-01-11 11:17:59 -05:00
|
|
|
common.Must(err)
|
2017-01-07 19:06:35 -05:00
|
|
|
defer tcpServer.Close()
|
|
|
|
|
2018-03-01 05:53:39 -05:00
|
|
|
serverPort := tcp.PickPort()
|
2017-01-07 19:06:35 -05:00
|
|
|
serverConfig := &core.Config{
|
2018-01-10 06:22:37 -05:00
|
|
|
Inbound: []*core.InboundHandlerConfig{
|
2017-01-07 19:06:35 -05:00
|
|
|
{
|
2017-01-26 14:46:44 -05:00
|
|
|
ReceiverSettings: serial.ToTypedMessage(&proxyman.ReceiverConfig{
|
2017-08-29 06:56:57 -04:00
|
|
|
PortRange: net.SinglePortRange(serverPort),
|
|
|
|
Listen: net.NewIPOrDomain(net.LocalHostIP),
|
2017-01-26 14:46:44 -05:00
|
|
|
}),
|
|
|
|
ProxySettings: serial.ToTypedMessage(&socks.ServerConfig{
|
2017-01-07 19:06:35 -05:00
|
|
|
AuthType: socks.AuthType_PASSWORD,
|
|
|
|
Accounts: map[string]string{
|
|
|
|
"Test Account": "Test Password",
|
|
|
|
},
|
2017-08-29 06:56:57 -04:00
|
|
|
Address: net.NewIPOrDomain(net.LocalHostIP),
|
2017-01-07 19:06:35 -05:00
|
|
|
UdpEnabled: false,
|
|
|
|
}),
|
|
|
|
},
|
|
|
|
},
|
2018-01-10 06:22:37 -05:00
|
|
|
Outbound: []*core.OutboundHandlerConfig{
|
2017-01-07 19:06:35 -05:00
|
|
|
{
|
2017-01-26 14:46:44 -05:00
|
|
|
ProxySettings: serial.ToTypedMessage(&freedom.Config{}),
|
2017-01-07 19:06:35 -05:00
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2018-03-01 05:53:39 -05:00
|
|
|
clientPort := tcp.PickPort()
|
2017-01-07 19:06:35 -05:00
|
|
|
clientConfig := &core.Config{
|
2018-01-10 06:22:37 -05:00
|
|
|
Inbound: []*core.InboundHandlerConfig{
|
2017-01-07 19:06:35 -05:00
|
|
|
{
|
2017-01-26 14:46:44 -05:00
|
|
|
ReceiverSettings: serial.ToTypedMessage(&proxyman.ReceiverConfig{
|
2017-08-29 06:56:57 -04:00
|
|
|
PortRange: net.SinglePortRange(clientPort),
|
|
|
|
Listen: net.NewIPOrDomain(net.LocalHostIP),
|
2017-01-26 14:46:44 -05:00
|
|
|
}),
|
|
|
|
ProxySettings: serial.ToTypedMessage(&dokodemo.Config{
|
2017-08-29 06:56:57 -04:00
|
|
|
Address: net.NewIPOrDomain(dest.Address),
|
2017-01-07 19:06:35 -05:00
|
|
|
Port: uint32(dest.Port),
|
2017-08-29 06:56:57 -04:00
|
|
|
NetworkList: &net.NetworkList{
|
|
|
|
Network: []net.Network{net.Network_TCP},
|
2017-01-07 19:06:35 -05:00
|
|
|
},
|
|
|
|
}),
|
|
|
|
},
|
|
|
|
},
|
2018-01-10 06:22:37 -05:00
|
|
|
Outbound: []*core.OutboundHandlerConfig{
|
2017-01-07 19:06:35 -05:00
|
|
|
{
|
2017-01-26 14:46:44 -05:00
|
|
|
ProxySettings: serial.ToTypedMessage(&socks.ClientConfig{
|
2017-01-07 19:06:35 -05:00
|
|
|
Server: []*protocol.ServerEndpoint{
|
|
|
|
{
|
2017-08-29 06:56:57 -04:00
|
|
|
Address: net.NewIPOrDomain(net.LocalHostIP),
|
2017-01-07 19:06:35 -05:00
|
|
|
Port: uint32(serverPort),
|
|
|
|
User: []*protocol.User{
|
|
|
|
{
|
|
|
|
Account: serial.ToTypedMessage(&socks.Account{
|
|
|
|
Username: "Test Account",
|
|
|
|
Password: "Test Password",
|
|
|
|
}),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2017-05-17 18:39:30 -04:00
|
|
|
servers, err := InitializeServerConfigs(serverConfig, clientConfig)
|
2019-01-11 11:17:59 -05:00
|
|
|
common.Must(err)
|
|
|
|
defer CloseAllServers(servers)
|
2017-01-07 19:06:35 -05:00
|
|
|
|
2019-01-11 11:17:59 -05:00
|
|
|
if err := testTCPConn(clientPort, 1024, time.Second*2)(); err != nil {
|
|
|
|
t.Error(err)
|
|
|
|
}
|
2017-01-07 19:06:35 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestSocksBridageUDP(t *testing.T) {
|
|
|
|
udpServer := udp.Server{
|
|
|
|
MsgProcessor: xor,
|
|
|
|
}
|
|
|
|
dest, err := udpServer.Start()
|
2019-02-02 16:19:30 -05:00
|
|
|
common.Must(err)
|
2017-01-07 19:06:35 -05:00
|
|
|
defer udpServer.Close()
|
|
|
|
|
2018-03-01 05:53:39 -05:00
|
|
|
serverPort := tcp.PickPort()
|
2017-01-07 19:06:35 -05:00
|
|
|
serverConfig := &core.Config{
|
2018-01-10 06:22:37 -05:00
|
|
|
Inbound: []*core.InboundHandlerConfig{
|
2017-01-07 19:06:35 -05:00
|
|
|
{
|
2017-01-26 14:46:44 -05:00
|
|
|
ReceiverSettings: serial.ToTypedMessage(&proxyman.ReceiverConfig{
|
2017-08-29 06:56:57 -04:00
|
|
|
PortRange: net.SinglePortRange(serverPort),
|
|
|
|
Listen: net.NewIPOrDomain(net.LocalHostIP),
|
2017-01-26 14:46:44 -05:00
|
|
|
}),
|
|
|
|
ProxySettings: serial.ToTypedMessage(&socks.ServerConfig{
|
2017-01-07 19:06:35 -05:00
|
|
|
AuthType: socks.AuthType_PASSWORD,
|
|
|
|
Accounts: map[string]string{
|
|
|
|
"Test Account": "Test Password",
|
|
|
|
},
|
2017-08-29 06:56:57 -04:00
|
|
|
Address: net.NewIPOrDomain(net.LocalHostIP),
|
2017-01-07 19:06:35 -05:00
|
|
|
UdpEnabled: true,
|
|
|
|
}),
|
|
|
|
},
|
|
|
|
},
|
2018-01-10 06:22:37 -05:00
|
|
|
Outbound: []*core.OutboundHandlerConfig{
|
2017-01-07 19:06:35 -05:00
|
|
|
{
|
2017-01-26 14:46:44 -05:00
|
|
|
ProxySettings: serial.ToTypedMessage(&freedom.Config{}),
|
2017-01-07 19:06:35 -05:00
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2018-03-01 05:53:39 -05:00
|
|
|
clientPort := tcp.PickPort()
|
2017-01-07 19:06:35 -05:00
|
|
|
clientConfig := &core.Config{
|
2018-01-10 06:22:37 -05:00
|
|
|
Inbound: []*core.InboundHandlerConfig{
|
2017-01-07 19:06:35 -05:00
|
|
|
{
|
2017-01-26 14:46:44 -05:00
|
|
|
ReceiverSettings: serial.ToTypedMessage(&proxyman.ReceiverConfig{
|
2017-08-29 06:56:57 -04:00
|
|
|
PortRange: net.SinglePortRange(clientPort),
|
|
|
|
Listen: net.NewIPOrDomain(net.LocalHostIP),
|
2017-01-26 14:46:44 -05:00
|
|
|
}),
|
|
|
|
ProxySettings: serial.ToTypedMessage(&dokodemo.Config{
|
2017-08-29 06:56:57 -04:00
|
|
|
Address: net.NewIPOrDomain(dest.Address),
|
2017-01-07 19:06:35 -05:00
|
|
|
Port: uint32(dest.Port),
|
2017-08-29 06:56:57 -04:00
|
|
|
NetworkList: &net.NetworkList{
|
|
|
|
Network: []net.Network{net.Network_TCP, net.Network_UDP},
|
2017-01-07 19:06:35 -05:00
|
|
|
},
|
|
|
|
}),
|
|
|
|
},
|
|
|
|
},
|
2018-01-10 06:22:37 -05:00
|
|
|
Outbound: []*core.OutboundHandlerConfig{
|
2017-01-07 19:06:35 -05:00
|
|
|
{
|
2017-01-26 14:46:44 -05:00
|
|
|
ProxySettings: serial.ToTypedMessage(&socks.ClientConfig{
|
2017-01-07 19:06:35 -05:00
|
|
|
Server: []*protocol.ServerEndpoint{
|
|
|
|
{
|
2017-08-29 06:56:57 -04:00
|
|
|
Address: net.NewIPOrDomain(net.LocalHostIP),
|
2017-01-07 19:06:35 -05:00
|
|
|
Port: uint32(serverPort),
|
|
|
|
User: []*protocol.User{
|
|
|
|
{
|
|
|
|
Account: serial.ToTypedMessage(&socks.Account{
|
|
|
|
Username: "Test Account",
|
|
|
|
Password: "Test Password",
|
|
|
|
}),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2017-05-17 18:39:30 -04:00
|
|
|
servers, err := InitializeServerConfigs(serverConfig, clientConfig)
|
2019-02-02 16:19:30 -05:00
|
|
|
common.Must(err)
|
2019-02-03 13:46:53 -05:00
|
|
|
defer CloseAllServers(servers)
|
2017-01-07 19:06:35 -05:00
|
|
|
|
2019-02-03 13:46:53 -05:00
|
|
|
if err := testUDPConn(clientPort, 1024, time.Second*5)(); err != nil {
|
|
|
|
t.Error(err)
|
|
|
|
}
|
2018-07-03 15:38:02 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestSocksBridageUDPWithRouting(t *testing.T) {
|
|
|
|
udpServer := udp.Server{
|
|
|
|
MsgProcessor: xor,
|
|
|
|
}
|
|
|
|
dest, err := udpServer.Start()
|
2019-02-02 16:19:30 -05:00
|
|
|
common.Must(err)
|
2018-07-03 15:38:02 -04:00
|
|
|
defer udpServer.Close()
|
|
|
|
|
|
|
|
serverPort := tcp.PickPort()
|
|
|
|
serverConfig := &core.Config{
|
2021-06-19 09:36:54 -04:00
|
|
|
App: []*anypb.Any{
|
2018-07-03 15:38:02 -04:00
|
|
|
serial.ToTypedMessage(&router.Config{
|
|
|
|
Rule: []*router.RoutingRule{
|
|
|
|
{
|
2018-11-07 19:01:53 -05:00
|
|
|
TargetTag: &router.RoutingRule_Tag{
|
|
|
|
Tag: "out",
|
|
|
|
},
|
2018-07-03 15:38:02 -04:00
|
|
|
InboundTag: []string{"socks"},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}),
|
|
|
|
},
|
|
|
|
Inbound: []*core.InboundHandlerConfig{
|
|
|
|
{
|
|
|
|
Tag: "socks",
|
|
|
|
ReceiverSettings: serial.ToTypedMessage(&proxyman.ReceiverConfig{
|
|
|
|
PortRange: net.SinglePortRange(serverPort),
|
|
|
|
Listen: net.NewIPOrDomain(net.LocalHostIP),
|
|
|
|
}),
|
|
|
|
ProxySettings: serial.ToTypedMessage(&socks.ServerConfig{
|
|
|
|
AuthType: socks.AuthType_NO_AUTH,
|
|
|
|
Address: net.NewIPOrDomain(net.LocalHostIP),
|
|
|
|
UdpEnabled: true,
|
|
|
|
}),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
Outbound: []*core.OutboundHandlerConfig{
|
|
|
|
{
|
|
|
|
ProxySettings: serial.ToTypedMessage(&blackhole.Config{}),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Tag: "out",
|
|
|
|
ProxySettings: serial.ToTypedMessage(&freedom.Config{}),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
clientPort := tcp.PickPort()
|
|
|
|
clientConfig := &core.Config{
|
|
|
|
Inbound: []*core.InboundHandlerConfig{
|
|
|
|
{
|
|
|
|
ReceiverSettings: serial.ToTypedMessage(&proxyman.ReceiverConfig{
|
|
|
|
PortRange: net.SinglePortRange(clientPort),
|
|
|
|
Listen: net.NewIPOrDomain(net.LocalHostIP),
|
|
|
|
}),
|
|
|
|
ProxySettings: serial.ToTypedMessage(&dokodemo.Config{
|
|
|
|
Address: net.NewIPOrDomain(dest.Address),
|
|
|
|
Port: uint32(dest.Port),
|
|
|
|
NetworkList: &net.NetworkList{
|
|
|
|
Network: []net.Network{net.Network_TCP, net.Network_UDP},
|
|
|
|
},
|
|
|
|
}),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
Outbound: []*core.OutboundHandlerConfig{
|
|
|
|
{
|
|
|
|
ProxySettings: serial.ToTypedMessage(&socks.ClientConfig{
|
|
|
|
Server: []*protocol.ServerEndpoint{
|
|
|
|
{
|
|
|
|
Address: net.NewIPOrDomain(net.LocalHostIP),
|
|
|
|
Port: uint32(serverPort),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
servers, err := InitializeServerConfigs(serverConfig, clientConfig)
|
2019-02-02 16:19:30 -05:00
|
|
|
common.Must(err)
|
2019-02-03 13:46:53 -05:00
|
|
|
defer CloseAllServers(servers)
|
2018-07-03 15:38:02 -04:00
|
|
|
|
2019-02-03 13:46:53 -05:00
|
|
|
if err := testUDPConn(clientPort, 1024, time.Second*5)(); err != nil {
|
|
|
|
t.Error(err)
|
|
|
|
}
|
2017-01-07 19:06:35 -05:00
|
|
|
}
|
2017-01-08 04:10:37 -05:00
|
|
|
|
2020-06-28 01:59:26 -04:00
|
|
|
func TestSocksConformanceMod(t *testing.T) {
|
2017-01-08 04:10:37 -05:00
|
|
|
tcpServer := tcp.Server{
|
|
|
|
MsgProcessor: xor,
|
|
|
|
}
|
|
|
|
dest, err := tcpServer.Start()
|
2019-02-02 16:19:30 -05:00
|
|
|
common.Must(err)
|
2017-01-08 04:10:37 -05:00
|
|
|
defer tcpServer.Close()
|
|
|
|
|
2018-03-01 05:53:39 -05:00
|
|
|
authPort := tcp.PickPort()
|
|
|
|
noAuthPort := tcp.PickPort()
|
2017-01-08 04:10:37 -05:00
|
|
|
serverConfig := &core.Config{
|
2018-01-10 06:22:37 -05:00
|
|
|
Inbound: []*core.InboundHandlerConfig{
|
2017-01-08 04:10:37 -05:00
|
|
|
{
|
2017-01-26 14:46:44 -05:00
|
|
|
ReceiverSettings: serial.ToTypedMessage(&proxyman.ReceiverConfig{
|
2017-08-29 06:56:57 -04:00
|
|
|
PortRange: net.SinglePortRange(authPort),
|
|
|
|
Listen: net.NewIPOrDomain(net.LocalHostIP),
|
2017-01-26 14:46:44 -05:00
|
|
|
}),
|
|
|
|
ProxySettings: serial.ToTypedMessage(&socks.ServerConfig{
|
2017-01-08 04:10:37 -05:00
|
|
|
AuthType: socks.AuthType_PASSWORD,
|
|
|
|
Accounts: map[string]string{
|
|
|
|
"Test Account": "Test Password",
|
|
|
|
},
|
2017-08-29 06:56:57 -04:00
|
|
|
Address: net.NewIPOrDomain(net.LocalHostIP),
|
2017-01-08 04:10:37 -05:00
|
|
|
UdpEnabled: false,
|
|
|
|
}),
|
|
|
|
},
|
|
|
|
{
|
2017-01-26 14:46:44 -05:00
|
|
|
ReceiverSettings: serial.ToTypedMessage(&proxyman.ReceiverConfig{
|
2017-08-29 06:56:57 -04:00
|
|
|
PortRange: net.SinglePortRange(noAuthPort),
|
|
|
|
Listen: net.NewIPOrDomain(net.LocalHostIP),
|
2017-01-26 14:46:44 -05:00
|
|
|
}),
|
|
|
|
ProxySettings: serial.ToTypedMessage(&socks.ServerConfig{
|
2017-01-08 04:10:37 -05:00
|
|
|
AuthType: socks.AuthType_NO_AUTH,
|
|
|
|
Accounts: map[string]string{
|
|
|
|
"Test Account": "Test Password",
|
|
|
|
},
|
2017-08-29 06:56:57 -04:00
|
|
|
Address: net.NewIPOrDomain(net.LocalHostIP),
|
2017-01-08 04:10:37 -05:00
|
|
|
UdpEnabled: false,
|
|
|
|
}),
|
|
|
|
},
|
|
|
|
},
|
2018-01-10 06:22:37 -05:00
|
|
|
Outbound: []*core.OutboundHandlerConfig{
|
2017-01-08 04:10:37 -05:00
|
|
|
{
|
2017-01-26 14:46:44 -05:00
|
|
|
ProxySettings: serial.ToTypedMessage(&freedom.Config{}),
|
2017-01-08 04:10:37 -05:00
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2017-05-17 18:39:30 -04:00
|
|
|
servers, err := InitializeServerConfigs(serverConfig)
|
2019-02-02 16:19:30 -05:00
|
|
|
common.Must(err)
|
2019-02-03 13:46:53 -05:00
|
|
|
defer CloseAllServers(servers)
|
2017-01-08 04:10:37 -05:00
|
|
|
|
|
|
|
{
|
2017-08-29 06:56:57 -04:00
|
|
|
noAuthDialer, err := xproxy.SOCKS5("tcp", net.TCPDestination(net.LocalHostIP, noAuthPort).NetAddr(), nil, xproxy.Direct)
|
2019-02-02 16:19:30 -05:00
|
|
|
common.Must(err)
|
2017-01-08 04:10:37 -05:00
|
|
|
conn, err := noAuthDialer.Dial("tcp", dest.NetAddr())
|
2019-02-02 16:19:30 -05:00
|
|
|
common.Must(err)
|
2019-02-03 13:46:53 -05:00
|
|
|
defer conn.Close()
|
2017-01-08 04:10:37 -05:00
|
|
|
|
2019-02-03 13:46:53 -05:00
|
|
|
if err := testTCPConn2(conn, 1024, time.Second*5)(); err != nil {
|
|
|
|
t.Error(err)
|
|
|
|
}
|
2017-01-08 04:10:37 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2017-08-29 06:56:57 -04:00
|
|
|
authDialer, err := xproxy.SOCKS5("tcp", net.TCPDestination(net.LocalHostIP, authPort).NetAddr(), &xproxy.Auth{User: "Test Account", Password: "Test Password"}, xproxy.Direct)
|
2019-02-02 16:19:30 -05:00
|
|
|
common.Must(err)
|
2017-01-08 04:10:37 -05:00
|
|
|
conn, err := authDialer.Dial("tcp", dest.NetAddr())
|
2019-02-02 16:19:30 -05:00
|
|
|
common.Must(err)
|
2019-02-03 13:46:53 -05:00
|
|
|
defer conn.Close()
|
2017-01-08 04:10:37 -05:00
|
|
|
|
2019-02-03 13:46:53 -05:00
|
|
|
if err := testTCPConn2(conn, 1024, time.Second*5)(); err != nil {
|
|
|
|
t.Error(err)
|
|
|
|
}
|
2017-01-08 04:10:37 -05:00
|
|
|
}
|
|
|
|
|
2017-01-08 04:23:55 -05:00
|
|
|
{
|
2020-06-27 08:36:10 -04:00
|
|
|
dialer := socks4.Dial("socks4://" + net.TCPDestination(net.LocalHostIP, noAuthPort).NetAddr())
|
2017-01-08 04:23:55 -05:00
|
|
|
conn, err := dialer("tcp", dest.NetAddr())
|
2019-02-02 16:19:30 -05:00
|
|
|
common.Must(err)
|
2019-02-03 13:46:53 -05:00
|
|
|
defer conn.Close()
|
2017-01-08 04:23:55 -05:00
|
|
|
|
2019-02-03 13:46:53 -05:00
|
|
|
if err := testTCPConn2(conn, 1024, time.Second*5)(); err != nil {
|
|
|
|
t.Error(err)
|
|
|
|
}
|
2017-01-08 04:23:55 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2020-06-27 08:36:10 -04:00
|
|
|
dialer := socks4.Dial("socks4://" + net.TCPDestination(net.LocalHostIP, noAuthPort).NetAddr())
|
2020-06-28 01:59:26 -04:00
|
|
|
conn, err := dialer("tcp", net.TCPDestination(net.LocalHostIP, tcpServer.Port).NetAddr())
|
2019-02-02 16:19:30 -05:00
|
|
|
common.Must(err)
|
2019-02-03 13:46:53 -05:00
|
|
|
defer conn.Close()
|
2017-01-08 04:23:55 -05:00
|
|
|
|
2019-02-03 13:46:53 -05:00
|
|
|
if err := testTCPConn2(conn, 1024, time.Second*5)(); err != nil {
|
|
|
|
t.Error(err)
|
|
|
|
}
|
2017-01-08 04:23:55 -05:00
|
|
|
}
|
2017-01-08 04:10:37 -05:00
|
|
|
}
|