diff --git a/adapters/outbound/urltest.go b/adapters/outbound/urltest.go index 6f61d8d7..b9efd8d2 100644 --- a/adapters/outbound/urltest.go +++ b/adapters/outbound/urltest.go @@ -33,14 +33,16 @@ func (u *URLTest) Now() string { return u.fast.Name() } -func (u *URLTest) Dial(metadata *C.Metadata) (C.Conn, error) { - a, err := u.fast.Dial(metadata) - if err != nil { +func (u *URLTest) Dial(metadata *C.Metadata) (c C.Conn, err error) { + for i := 0; i < 3; i++ { + c, err = u.fast.Dial(metadata) + if err == nil { + c.AppendToChains(u) + return + } u.fallback() - } else { - a.AppendToChains(u) } - return a, err + return } func (u *URLTest) DialUDP(metadata *C.Metadata) (C.PacketConn, net.Addr, error) {