@@ -136,7 +136,7 @@ func (h *auto) dial(network, laddr, raddr string) (protect.Conn, error) {
136
136
parallelDial := settings .AutoDialsParallel .Load ()
137
137
138
138
if ! parallelDial {
139
- rpns := []Proxy {exit , pro , warp , amz , exit64 , sep }
139
+ rpns := []Proxy {exit , warp , amz , exit64 , sep , pro }
140
140
healthy := core .Map (
141
141
core .FilterLeft (
142
142
rpns ,
@@ -203,28 +203,6 @@ func (h *auto) dial(network, laddr, raddr string) (protect.Conn, error) {
203
203
return h .dialIfReachable (exit , network , laddr , raddr )
204
204
}, func (ctx context.Context ) (protect.Conn , error ) {
205
205
const myidx = 1
206
- if pro == nil {
207
- return nil , proerr
208
- }
209
- if recent {
210
- if previdx != myidx {
211
- return nil , errNotPinned
212
- }
213
- // ip pinned to this proxy
214
- return h .dialAlways (pro , network , laddr , raddr )
215
- }
216
-
217
- // wait only if exit was used
218
- if ! remoteOnly {
219
- select {
220
- case <- ctx .Done ():
221
- return nil , ctx .Err ()
222
- case <- time .After (shortdelay * myidx ): // 100ms
223
- }
224
- }
225
- return h .dialIfHealthy (pro , network , laddr , raddr )
226
- }, func (ctx context.Context ) (protect.Conn , error ) {
227
- const myidx = 2
228
206
if warp == nil {
229
207
return nil , waerr
230
208
}
@@ -243,7 +221,7 @@ func (h *auto) dial(network, laddr, raddr string) (protect.Conn, error) {
243
221
}
244
222
return h .dialIfHealthy (warp , network , laddr , raddr )
245
223
}, func (ctx context.Context ) (protect.Conn , error ) {
246
- const myidx = 3
224
+ const myidx = 2
247
225
if exit64 == nil {
248
226
return nil , ex64err
249
227
}
@@ -265,7 +243,7 @@ func (h *auto) dial(network, laddr, raddr string) (protect.Conn, error) {
265
243
}
266
244
return h .dialIfHealthy (exit64 , network , laddr , raddr )
267
245
}, func (ctx context.Context ) (protect.Conn , error ) {
268
- const myidx = 4
246
+ const myidx = 3
269
247
if amz == nil {
270
248
return nil , amzerr
271
249
}
@@ -284,7 +262,7 @@ func (h *auto) dial(network, laddr, raddr string) (protect.Conn, error) {
284
262
}
285
263
return h .dialIfHealthy (amz , network , laddr , raddr )
286
264
}, func (ctx context.Context ) (protect.Conn , error ) {
287
- const myidx = 5
265
+ const myidx = 4
288
266
if sep == nil {
289
267
return nil , seerr
290
268
}
@@ -302,6 +280,28 @@ func (h *auto) dial(network, laddr, raddr string) (protect.Conn, error) {
302
280
case <- time .After (shortdelay * myidx ): // 500ms
303
281
}
304
282
return h .dialIfHealthy (sep , network , laddr , raddr )
283
+ }, func (ctx context.Context ) (protect.Conn , error ) {
284
+ const myidx = 5
285
+ if pro == nil {
286
+ return nil , proerr
287
+ }
288
+ if recent {
289
+ if previdx != myidx {
290
+ return nil , errNotPinned
291
+ }
292
+ // ip pinned to this proxy
293
+ return h .dialAlways (pro , network , laddr , raddr )
294
+ }
295
+
296
+ // wait only if exit was used
297
+ if ! remoteOnly {
298
+ select {
299
+ case <- ctx .Done ():
300
+ return nil , ctx .Err ()
301
+ case <- time .After (shortdelay * myidx ): // 100ms
302
+ }
303
+ }
304
+ return h .dialIfHealthy (pro , network , laddr , raddr )
305
305
},
306
306
)
307
307
0 commit comments