Skip to content

Commit 550f0e5

Browse files
committed
ipn/auto: fail open if none healthy
1 parent 8c50d4e commit 550f0e5

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

intra/ipn/auto.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,10 @@ func (h *auto) dial(network, laddr, raddr string) (protect.Conn, error) {
135135
parallelDial := settings.AutoDialsParallel.Load()
136136

137137
if !parallelDial {
138-
all := core.Map(
138+
rpns := []Proxy{pro, warp, amz, sep}
139+
healthy := core.Map(
139140
core.FilterLeft(
140-
[]Proxy{pro, warp, amz, sep},
141+
rpns,
141142
func(p Proxy) bool {
142143
if p == nil || core.IsNil(p) {
143144
return false // nil proxies out
@@ -155,7 +156,14 @@ func (h *auto) dial(network, laddr, raddr string) (protect.Conn, error) {
155156
return p.Dialer()
156157
})
157158
// TODO: pinning IPs
158-
return dialAny(all, network, laddr, raddr)
159+
if len(healthy) <= 0 {
160+
// no healthy proxies; fail open
161+
all := core.Map(rpns, func(p Proxy) protect.RDialer {
162+
return p.Dialer()
163+
})
164+
return dialAny(core.WithoutNils(all), network, laddr, raddr)
165+
}
166+
return dialAny(healthy, network, laddr, raddr)
159167
}
160168

161169
previdx, recent := h.exp.Get(raddr)

0 commit comments

Comments
 (0)