refactor(layout): переименовать пакеты (split wire/transport/proxy)
internal/wrap → internal/wire/srtpmimicry; правки doc ("обфускация, не security").
internal/bond/{frame,client,server} → internal/wire/bondframe,
internal/proxy/bondclient, internal/proxy/bondserver.
internal/netadapt → internal/netconn.
internal/turnpipe → internal/transport/turndial; internal/dtlsdial →
internal/transport/dtlsdial.
tcputil → internal/transport/kcptun; selectedKCPProfile и selectedFEC теперь
кешируются через sync.Once (env читается один раз вместо per-connection).
internal/proxy/udp → internal/proxy/udprelay; internal/proxy/vless →
internal/proxy/tcpfwd. Флаг CLI -vless сохранён.
internal/ish → internal/client/ish; doc пакета расширен (iSH = Linux user-mode
эмулятор на iOS, только linux/386).
Чисто механическое переименование + обновление import-путей/идентификаторов.
Wire-формат, флаги CLI и поведение не изменены. go build + go test зелёные.
This commit is contained in:
1 parent
7fd2d9594d
commit
1fb869b3e1
27 files changed
+178
-147
No files matched your search
@@ -0,0 +1,65 @@
|
||||
// Package dtlsdial wraps pion-dtls client setup (self-signed cert, EMS,
|
||||
// AES-128-GCM, send-only CID) plus an optional concurrency gate around the
|
||||
// handshake. Used by the client UDP and VLESS pipelines.
|
||||
package dtlsdial
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net"
|
||||
"time"
|
||||
|
||||
"github.com/pion/dtls/v3"
|
||||
"github.com/pion/dtls/v3/pkg/crypto/selfsign"
|
||||
)
|
||||
|
||||
// Dialer configures the DTLS client handshake.
|
||||
type Dialer struct {
|
||||
// HandshakeTimeout caps the handshake context. Zero means no timeout.
|
||||
HandshakeTimeout time.Duration
|
||||
// HandshakeSem, if non-nil, gates concurrent handshakes (Dial blocks
|
||||
// until a slot is available or ctx fires).
|
||||
HandshakeSem chan struct{}
|
||||
}
|
||||
|
||||
// Dial generates a fresh self-signed cert, acquires the optional handshake
|
||||
// slot, and performs a DTLS client handshake over pc to peer. On success
|
||||
// returns the connected *dtls.Conn. Caller closes it.
|
||||
func (d *Dialer) Dial(ctx context.Context, pc net.PacketConn, peer *net.UDPAddr) (*dtls.Conn, error) {
|
||||
certificate, err := selfsign.GenerateSelfSigned()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if d.HandshakeSem != nil {
|
||||
select {
|
||||
case d.HandshakeSem <- struct{}{}:
|
||||
defer func() { <-d.HandshakeSem }()
|
||||
case <-ctx.Done():
|
||||
return nil, ctx.Err()
|
||||
}
|
||||
}
|
||||
|
||||
hsCtx := ctx
|
||||
if d.HandshakeTimeout > 0 {
|
||||
var cancel context.CancelFunc
|
||||
hsCtx, cancel = context.WithTimeout(ctx, d.HandshakeTimeout)
|
||||
defer cancel()
|
||||
}
|
||||
|
||||
dtlsConn, err := dtls.ClientWithOptions(
|
||||
pc,
|
||||
peer,
|
||||
dtls.WithCertificates(certificate),
|
||||
dtls.WithInsecureSkipVerify(true),
|
||||
dtls.WithExtendedMasterSecret(dtls.RequireExtendedMasterSecret),
|
||||
dtls.WithCipherSuites(dtls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256),
|
||||
dtls.WithConnectionIDGenerator(dtls.OnlySendCIDGenerator()),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := dtlsConn.HandshakeContext(hsCtx); err != nil {
|
||||
_ = dtlsConn.Close()
|
||||
return nil, err
|
||||
}
|
||||
return dtlsConn, nil
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package dtlsdial
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
// fakePC blocks forever on ReadFrom and accepts writes — enough to keep the
|
||||
// DTLS handshake stuck so we can exercise the gate/cancel paths.
|
||||
type fakePC struct{}
|
||||
|
||||
func (fakePC) ReadFrom(b []byte) (int, net.Addr, error) {
|
||||
select {} // block forever
|
||||
}
|
||||
func (fakePC) WriteTo(b []byte, _ net.Addr) (int, error) { return len(b), nil }
|
||||
func (fakePC) Close() error { return nil }
|
||||
func (fakePC) LocalAddr() net.Addr { return &net.UDPAddr{IP: net.IPv4zero} }
|
||||
func (fakePC) SetDeadline(time.Time) error { return nil }
|
||||
func (fakePC) SetReadDeadline(time.Time) error { return nil }
|
||||
func (fakePC) SetWriteDeadline(time.Time) error { return nil }
|
||||
|
||||
// When HandshakeSem is full and ctx fires, Dial must return ctx.Err()
|
||||
// without ever touching the underlying PacketConn.
|
||||
func TestDial_SemBlocksUntilCtx(t *testing.T) {
|
||||
sem := make(chan struct{}, 1)
|
||||
sem <- struct{}{} // pre-fill: no slots free
|
||||
d := &Dialer{HandshakeSem: sem, HandshakeTimeout: 5 * time.Second}
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 100*time.Millisecond)
|
||||
defer cancel()
|
||||
peer := &net.UDPAddr{IP: net.ParseIP("127.0.0.1"), Port: 1}
|
||||
_, err := d.Dial(ctx, fakePC{}, peer)
|
||||
if !errors.Is(err, context.DeadlineExceeded) {
|
||||
t.Fatalf("expected DeadlineExceeded, got %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
var _ = errors.New
|
||||
@@ -0,0 +1,245 @@
|
||||
package kcptun
|
||||
|
||||
import (
|
||||
"net"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/xtaci/kcp-go/v5"
|
||||
"github.com/xtaci/smux"
|
||||
)
|
||||
|
||||
var (
|
||||
kcpProfileOnce sync.Once
|
||||
cachedKCPProfile kcpProfile
|
||||
|
||||
fecOnce sync.Once
|
||||
cachedFECData int
|
||||
cachedFECParity int
|
||||
)
|
||||
|
||||
type kcpProfile struct {
|
||||
nodelay int
|
||||
interval int
|
||||
resend int
|
||||
nc int
|
||||
sndWnd int
|
||||
rcvWnd int
|
||||
mtu int
|
||||
ackNoDelay bool
|
||||
}
|
||||
|
||||
func selectedKCPProfile() kcpProfile {
|
||||
kcpProfileOnce.Do(func() {
|
||||
cachedKCPProfile = loadKCPProfile()
|
||||
})
|
||||
return cachedKCPProfile
|
||||
}
|
||||
|
||||
func loadKCPProfile() kcpProfile {
|
||||
profile := strings.ToLower(strings.TrimSpace(os.Getenv("VK_TURN_KCP_PROFILE")))
|
||||
var cfg kcpProfile
|
||||
switch profile {
|
||||
case "legacy", "fast":
|
||||
cfg = kcpProfile{
|
||||
nodelay: 1,
|
||||
interval: 10,
|
||||
resend: 2,
|
||||
nc: 1,
|
||||
sndWnd: 4096,
|
||||
rcvWnd: 4096,
|
||||
mtu: 1280,
|
||||
ackNoDelay: true,
|
||||
}
|
||||
case "cc", "balanced":
|
||||
cfg = kcpProfile{
|
||||
nodelay: 1,
|
||||
interval: 20,
|
||||
resend: 2,
|
||||
nc: 0,
|
||||
sndWnd: 512,
|
||||
rcvWnd: 512,
|
||||
mtu: 1200,
|
||||
ackNoDelay: true,
|
||||
}
|
||||
case "slow", "conservative":
|
||||
cfg = kcpProfile{
|
||||
nodelay: 0,
|
||||
interval: 40,
|
||||
resend: 2,
|
||||
nc: 0,
|
||||
sndWnd: 256,
|
||||
rcvWnd: 256,
|
||||
mtu: 1150,
|
||||
ackNoDelay: false,
|
||||
}
|
||||
default:
|
||||
cfg = kcpProfile{
|
||||
nodelay: 1,
|
||||
interval: 20,
|
||||
resend: 2,
|
||||
nc: 1,
|
||||
sndWnd: 512,
|
||||
rcvWnd: 512,
|
||||
mtu: 1200,
|
||||
ackNoDelay: true,
|
||||
}
|
||||
}
|
||||
|
||||
cfg.nodelay = envInt("VK_TURN_KCP_NODELAY", cfg.nodelay)
|
||||
cfg.interval = envInt("VK_TURN_KCP_INTERVAL", cfg.interval)
|
||||
cfg.resend = envInt("VK_TURN_KCP_RESEND", cfg.resend)
|
||||
cfg.nc = envInt("VK_TURN_KCP_NC", cfg.nc)
|
||||
cfg.sndWnd = envInt("VK_TURN_KCP_SNDWND", cfg.sndWnd)
|
||||
cfg.rcvWnd = envInt("VK_TURN_KCP_RCVWND", cfg.rcvWnd)
|
||||
cfg.mtu = envInt("VK_TURN_KCP_MTU", cfg.mtu)
|
||||
cfg.ackNoDelay = envBool("VK_TURN_KCP_ACK_NODELAY", cfg.ackNoDelay)
|
||||
return cfg
|
||||
}
|
||||
|
||||
func envInt(name string, fallback int) int {
|
||||
raw := strings.TrimSpace(os.Getenv(name))
|
||||
if raw == "" {
|
||||
return fallback
|
||||
}
|
||||
value, err := strconv.Atoi(raw)
|
||||
if err != nil {
|
||||
return fallback
|
||||
}
|
||||
return value
|
||||
}
|
||||
|
||||
// selectedFEC parses VK_TURN_KCP_FEC as "data:parity" (e.g. "10:3").
|
||||
// Returns 0,0 if unset/invalid (FEC disabled). Both sides must match.
|
||||
func selectedFEC() (dataShards, parityShards int) {
|
||||
fecOnce.Do(func() {
|
||||
cachedFECData, cachedFECParity = loadFEC()
|
||||
})
|
||||
return cachedFECData, cachedFECParity
|
||||
}
|
||||
|
||||
func loadFEC() (dataShards, parityShards int) {
|
||||
raw := strings.TrimSpace(os.Getenv("VK_TURN_KCP_FEC"))
|
||||
if raw == "" {
|
||||
return 0, 0
|
||||
}
|
||||
parts := strings.SplitN(raw, ":", 2)
|
||||
if len(parts) != 2 {
|
||||
return 0, 0
|
||||
}
|
||||
d, err1 := strconv.Atoi(strings.TrimSpace(parts[0]))
|
||||
p, err2 := strconv.Atoi(strings.TrimSpace(parts[1]))
|
||||
if err1 != nil || err2 != nil || d <= 0 || p <= 0 {
|
||||
return 0, 0
|
||||
}
|
||||
return d, p
|
||||
}
|
||||
|
||||
func envBool(name string, fallback bool) bool {
|
||||
raw := strings.ToLower(strings.TrimSpace(os.Getenv(name)))
|
||||
switch raw {
|
||||
case "1", "true", "yes", "on":
|
||||
return true
|
||||
case "0", "false", "no", "off":
|
||||
return false
|
||||
default:
|
||||
return fallback
|
||||
}
|
||||
}
|
||||
|
||||
// DtlsPacketConn wraps a net.Conn (DTLS) as a net.PacketConn for KCP.
|
||||
// Each DTLS Read/Write preserves message boundaries (datagram semantics).
|
||||
type DtlsPacketConn struct {
|
||||
conn net.Conn
|
||||
}
|
||||
|
||||
func NewDtlsPacketConn(conn net.Conn) *DtlsPacketConn {
|
||||
return &DtlsPacketConn{conn: conn}
|
||||
}
|
||||
|
||||
func (d *DtlsPacketConn) ReadFrom(b []byte) (int, net.Addr, error) {
|
||||
n, err := d.conn.Read(b)
|
||||
return n, d.conn.RemoteAddr(), err
|
||||
}
|
||||
|
||||
func (d *DtlsPacketConn) WriteTo(b []byte, _ net.Addr) (int, error) {
|
||||
return d.conn.Write(b)
|
||||
}
|
||||
|
||||
func (d *DtlsPacketConn) Close() error {
|
||||
return d.conn.Close()
|
||||
}
|
||||
|
||||
func (d *DtlsPacketConn) LocalAddr() net.Addr {
|
||||
return d.conn.LocalAddr()
|
||||
}
|
||||
|
||||
func (d *DtlsPacketConn) SetDeadline(t time.Time) error {
|
||||
return d.conn.SetDeadline(t)
|
||||
}
|
||||
|
||||
func (d *DtlsPacketConn) SetReadDeadline(t time.Time) error {
|
||||
return d.conn.SetReadDeadline(t)
|
||||
}
|
||||
|
||||
func (d *DtlsPacketConn) SetWriteDeadline(t time.Time) error {
|
||||
return d.conn.SetWriteDeadline(t)
|
||||
}
|
||||
|
||||
// NewKCPOverDTLS creates a KCP session over a DTLS connection.
|
||||
// isServer: true for server-side (listener), false for client-side (dialer).
|
||||
func NewKCPOverDTLS(dtlsConn net.Conn, isServer bool) (*kcp.UDPSession, error) {
|
||||
pc := NewDtlsPacketConn(dtlsConn)
|
||||
|
||||
block, err := kcp.NewNoneBlockCrypt(nil) // DTLS already encrypts
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var sess *kcp.UDPSession
|
||||
|
||||
dataShards, parityShards := selectedFEC()
|
||||
|
||||
if isServer {
|
||||
// Server: listen on the PacketConn and accept one session
|
||||
var listener *kcp.Listener
|
||||
listener, err = kcp.ServeConn(block, dataShards, parityShards, pc)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err = listener.SetDeadline(time.Now().Add(30 * time.Second)); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
sess, err = listener.AcceptKCP()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
} else {
|
||||
// Client: dial through the PacketConn
|
||||
sess, err = kcp.NewConn2(dtlsConn.RemoteAddr(), block, dataShards, parityShards, pc)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
profile := selectedKCPProfile()
|
||||
sess.SetNoDelay(profile.nodelay, profile.interval, profile.resend, profile.nc)
|
||||
sess.SetWindowSize(profile.sndWnd, profile.rcvWnd)
|
||||
sess.SetMtu(profile.mtu)
|
||||
sess.SetACKNoDelay(profile.ackNoDelay)
|
||||
|
||||
return sess, nil
|
||||
}
|
||||
|
||||
// DefaultSmuxConfig returns smux config tuned for TURN tunnel.
|
||||
func DefaultSmuxConfig() *smux.Config {
|
||||
cfg := smux.DefaultConfig()
|
||||
cfg.MaxReceiveBuffer = 4 * 1024 * 1024
|
||||
cfg.MaxStreamBuffer = 1 * 1024 * 1024
|
||||
cfg.KeepAliveInterval = 10 * time.Second
|
||||
cfg.KeepAliveTimeout = 30 * time.Second
|
||||
return cfg
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
// Package turndial centralizes the TURN dial+allocate pipeline shared by
|
||||
// the client UDP (oneTurnConnection) and VLESS (createSmuxSession) modes.
|
||||
//
|
||||
// One call to Open performs: parse target, apply host/port overrides,
|
||||
// resolve UDP addr, dial UDP-or-TCP (with SplitFirstWriteConn over TCP),
|
||||
// turn.NewClient, Listen, Allocate. Returns the relay PacketConn plus a
|
||||
// Close that tears down the allocation, TURN client, and underlying conn.
|
||||
package turndial
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net"
|
||||
"time"
|
||||
|
||||
"github.com/cacggghp/vk-turn-proxy/internal/netconn"
|
||||
"github.com/pion/logging"
|
||||
"github.com/pion/turn/v5"
|
||||
)
|
||||
|
||||
// Config configures one Open call.
|
||||
type Config struct {
|
||||
// HostOverride, if non-empty, replaces the host part returned by the
|
||||
// credentials lookup.
|
||||
HostOverride string
|
||||
// PortOverride, if non-empty, replaces the port part returned by the
|
||||
// credentials lookup.
|
||||
PortOverride string
|
||||
// UDP=true dials TURN over UDP; otherwise over TCP via STUNConn.
|
||||
UDP bool
|
||||
// DialTimeout caps the TCP dial. Zero defaults to 5s.
|
||||
DialTimeout time.Duration
|
||||
}
|
||||
|
||||
// Stream is a live TURN allocation with its dependencies. Close tears
|
||||
// everything down in reverse order.
|
||||
type Stream struct {
|
||||
// Relay is the allocated relay PacketConn returned by turn.Client.Allocate.
|
||||
Relay net.PacketConn
|
||||
// ServerUDPAddr is the resolved TURN server UDP address (host:port).
|
||||
ServerUDPAddr *net.UDPAddr
|
||||
close func() error
|
||||
}
|
||||
|
||||
// Close releases the allocation, TURN client and underlying transport.
|
||||
// Safe to call once. Returns the first non-nil error (if any).
|
||||
func (s *Stream) Close() error {
|
||||
if s == nil || s.close == nil {
|
||||
return nil
|
||||
}
|
||||
return s.close()
|
||||
}
|
||||
|
||||
// Open dials TURN, creates a turn.Client and allocates a relay. rawAddr is
|
||||
// the host:port returned by the credentials lookup; user/pass are the TURN
|
||||
// long-term credentials.
|
||||
func Open(ctx context.Context, cfg Config, peer *net.UDPAddr, user, pass, rawAddr string) (*Stream, error) {
|
||||
urlhost, urlport, err := net.SplitHostPort(rawAddr)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("parse TURN addr: %w", err)
|
||||
}
|
||||
if cfg.HostOverride != "" {
|
||||
urlhost = cfg.HostOverride
|
||||
}
|
||||
if cfg.PortOverride != "" {
|
||||
urlport = cfg.PortOverride
|
||||
}
|
||||
turnServerAddr := net.JoinHostPort(urlhost, urlport)
|
||||
turnServerUDPAddr, err := net.ResolveUDPAddr("udp", turnServerAddr)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("resolve TURN addr: %w", err)
|
||||
}
|
||||
turnServerAddr = turnServerUDPAddr.String()
|
||||
|
||||
dialTimeout := cfg.DialTimeout
|
||||
if dialTimeout == 0 {
|
||||
dialTimeout = 5 * time.Second
|
||||
}
|
||||
|
||||
var (
|
||||
turnConn net.PacketConn
|
||||
closeConn func() error
|
||||
)
|
||||
if cfg.UDP {
|
||||
c, derr := net.DialUDP("udp", nil, turnServerUDPAddr) //nolint:noctx
|
||||
if derr != nil {
|
||||
return nil, fmt.Errorf("dial TURN (udp): %w", derr)
|
||||
}
|
||||
turnConn = &netconn.ConnectedUDPConn{UDPConn: c}
|
||||
closeConn = c.Close
|
||||
} else {
|
||||
dctx, cancel := context.WithTimeout(ctx, dialTimeout)
|
||||
defer cancel()
|
||||
var d net.Dialer
|
||||
c, derr := d.DialContext(dctx, "tcp", turnServerAddr)
|
||||
if derr != nil {
|
||||
return nil, fmt.Errorf("dial TURN (tcp): %w", derr)
|
||||
}
|
||||
wrapped := &netconn.SplitFirstWriteConn{Conn: c, SplitAt: 6, Delay: 20 * time.Millisecond}
|
||||
turnConn = turn.NewSTUNConn(wrapped)
|
||||
closeConn = c.Close
|
||||
}
|
||||
|
||||
var addrFamily turn.RequestedAddressFamily
|
||||
if peer.IP.To4() != nil {
|
||||
addrFamily = turn.RequestedAddressFamilyIPv4
|
||||
} else {
|
||||
addrFamily = turn.RequestedAddressFamilyIPv6
|
||||
}
|
||||
client, err := turn.NewClient(&turn.ClientConfig{
|
||||
STUNServerAddr: turnServerAddr,
|
||||
TURNServerAddr: turnServerAddr,
|
||||
Conn: turnConn,
|
||||
Net: netconn.New(),
|
||||
Username: user,
|
||||
Password: pass,
|
||||
RequestedAddressFamily: addrFamily,
|
||||
LoggerFactory: logging.NewDefaultLoggerFactory(),
|
||||
})
|
||||
if err != nil {
|
||||
if cerr := closeConn(); cerr != nil {
|
||||
err = fmt.Errorf("%w (close: %v)", err, cerr)
|
||||
}
|
||||
return nil, fmt.Errorf("create TURN client: %w", err)
|
||||
}
|
||||
if err = client.Listen(); err != nil {
|
||||
client.Close()
|
||||
if cerr := closeConn(); cerr != nil {
|
||||
err = fmt.Errorf("%w (close: %v)", err, cerr)
|
||||
}
|
||||
return nil, fmt.Errorf("TURN listen: %w", err)
|
||||
}
|
||||
relay, err := client.Allocate()
|
||||
if err != nil {
|
||||
client.Close()
|
||||
if cerr := closeConn(); cerr != nil {
|
||||
err = fmt.Errorf("%w (close: %v)", err, cerr)
|
||||
}
|
||||
return nil, fmt.Errorf("TURN allocate: %w", err)
|
||||
}
|
||||
|
||||
return &Stream{
|
||||
Relay: relay,
|
||||
ServerUDPAddr: turnServerUDPAddr,
|
||||
close: func() error {
|
||||
var firstErr error
|
||||
if cerr := relay.Close(); cerr != nil {
|
||||
firstErr = cerr
|
||||
}
|
||||
client.Close()
|
||||
if cerr := closeConn(); cerr != nil && firstErr == nil {
|
||||
firstErr = cerr
|
||||
}
|
||||
return firstErr
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package turndial
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Open dialing a bogus address must surface a wrapped resolve/dial error.
|
||||
func TestOpen_BadAddress(t *testing.T) {
|
||||
peer := &net.UDPAddr{IP: net.ParseIP("1.2.3.4"), Port: 1}
|
||||
_, err := Open(context.Background(), Config{}, peer, "u", "p", "not-a-host-port")
|
||||
if err == nil {
|
||||
t.Fatal("expected error for malformed addr")
|
||||
}
|
||||
if !strings.Contains(err.Error(), "parse TURN addr") {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// Open with overrides resolves the override host:port (still fails because
|
||||
// there's no TURN server, but the dial error must mention the override).
|
||||
func TestOpen_HostOverrideApplied(t *testing.T) {
|
||||
peer := &net.UDPAddr{IP: net.ParseIP("1.2.3.4"), Port: 1}
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 500*time.Millisecond)
|
||||
defer cancel()
|
||||
_, err := Open(ctx, Config{HostOverride: "127.0.0.1", PortOverride: "1", UDP: false, DialTimeout: 200 * time.Millisecond}, peer, "u", "p", "8.8.8.8:443")
|
||||
if err == nil {
|
||||
t.Fatal("expected dial error against unreachable :1")
|
||||
}
|
||||
if !strings.Contains(err.Error(), "dial TURN") {
|
||||
t.Fatalf("expected dial error, got: %v", err)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user