Add user rule item

This commit is contained in:
世界 2022-07-17 15:11:26 +08:00
parent cf845d946e
commit d1e83882e5
No known key found for this signature in database
GPG key ID: CD109927C34A63C4
31 changed files with 212 additions and 177 deletions

View file

@ -46,15 +46,15 @@ func startInstance(t *testing.T, options option.Options) {
func testSuit(t *testing.T, clientPort uint16, testPort uint16) {
dialer := socks.NewClient(N.SystemDialer, M.ParseSocksaddrHostPort("127.0.0.1", clientPort), socks.Version5, "", "")
dialTCP := func() (net.Conn, error) {
return dialer.DialContext(context.Background(), "tcp", M.ParseSocksaddrHostPort("127.0.0.1", testPort))
dialTCP := func(port uint16) (net.Conn, error) {
return dialer.DialContext(context.Background(), "tcp", M.ParseSocksaddrHostPort("127.0.0.1", port))
}
dialUDP := func() (net.PacketConn, error) {
return dialer.ListenPacket(context.Background(), M.ParseSocksaddrHostPort("127.0.0.1", testPort))
dialUDP := func(port uint16) (net.PacketConn, error) {
return dialer.ListenPacket(context.Background(), M.ParseSocksaddrHostPort("127.0.0.1", port))
}
require.NoError(t, testPingPongWithConn(t, testPort, dialTCP))
require.NoError(t, testLargeDataWithConn(t, testPort, dialTCP))
require.NoError(t, testPingPongWithPacketConn(t, testPort, dialUDP))
require.NoError(t, testLargeDataWithPacketConn(t, testPort, dialUDP))
require.NoError(t, testPingPongWithConn(t, dialTCP))
require.NoError(t, testLargeDataWithConn(t, dialTCP))
require.NoError(t, testPingPongWithPacketConn(t, dialUDP))
require.NoError(t, testLargeDataWithPacketConn(t, dialUDP))
require.NoError(t, testPacketConnTimeout(t, dialUDP))
}