Skip to content

Commit b0e2829

Browse files
committed
ipn/auto: m always dial non-wg rpns when pinned
healthy() checks are only really useful for wg proxies
1 parent 550f0e5 commit b0e2829

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

intra/ipn/auto.go

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ func (h *auto) dial(network, laddr, raddr string) (protect.Conn, error) {
190190
return nil, errNotPinned
191191
}
192192
// ip pinned to this proxy
193-
h.dialIfHealthy(exit, network, laddr, raddr)
193+
return h.dialAlways(exit, network, laddr, raddr)
194194
}
195195
return h.dialIfReachable(exit, network, laddr, raddr)
196196
}, func(ctx context.Context) (protect.Conn, error) {
@@ -203,7 +203,7 @@ func (h *auto) dial(network, laddr, raddr string) (protect.Conn, error) {
203203
return nil, errNotPinned
204204
}
205205
// ip pinned to this proxy
206-
h.dialIfHealthy(pro, network, laddr, raddr)
206+
return h.dialIfHealthy(pro, network, laddr, raddr)
207207
}
208208

209209
// wait only if exit was used
@@ -247,7 +247,7 @@ func (h *auto) dial(network, laddr, raddr string) (protect.Conn, error) {
247247
return nil, errNotPinned
248248
}
249249
// ip pinned to this proxy
250-
return h.dialIfHealthy(exit64, network, laddr, raddr)
250+
return h.dialAlways(exit64, network, laddr, raddr)
251251
}
252252

253253
select {
@@ -538,6 +538,17 @@ func (h *auto) dialIfReachable(p Proxy, network, local, remote string) (net.Conn
538538
return h.dialIfHealthy(p, network, local, remote)
539539
}
540540

541+
func (*auto) dialAlways(p Proxy, network, local, remote string) (net.Conn, error) {
542+
err := healthy(p)
543+
if err != nil {
544+
log.E("auto dial; %s %s not ok; to %s; err: %v", idstr(p), network, remote, err)
545+
}
546+
if len(local) > 0 {
547+
return p.Dialer().DialBind(network, local, remote)
548+
}
549+
return p.Dialer().Dial(network, remote)
550+
}
551+
541552
func (*auto) dialIfHealthy(p Proxy, network, local, remote string) (net.Conn, error) {
542553
if err := healthy(p); err != nil {
543554
return nil, fmt.Errorf("auto dial; %s %s not ok; %v: %s", p.ID(), network, err, remote)

0 commit comments

Comments
 (0)