Skip to content

Commit b5917d4

Browse files
committed
ipn/auto: m rename local/laddr, remote/raddr
1 parent 5175c86 commit b5917d4

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

intra/ipn/auto.go

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ func (h *auto) DialBind(network, local, remote string) (protect.Conn, error) {
111111
return h.dial(network, local, remote)
112112
}
113113

114-
func (h *auto) dial(network, local, remote string) (protect.Conn, error) {
114+
func (h *auto) dial(network, laddr, raddr string) (protect.Conn, error) {
115115
if h.status.Load() == END {
116116
return nil, errProxyStopped
117117
}
@@ -140,13 +140,13 @@ func (h *auto) dial(network, local, remote string) (protect.Conn, error) {
140140
all = []protect.RDialer{pro, warp, amz, sep}
141141
}
142142
// TODO: pinning IPs
143-
return dialAny(all, network, local, remote)
143+
return dialAny(all, network, laddr, raddr)
144144
}
145145

146-
previdx, recent := h.exp.Get(remote)
146+
previdx, recent := h.exp.Get(raddr)
147147

148148
c, who, err := core.Race(
149-
network+".dial-auto."+remote,
149+
network+".dial-auto."+raddr,
150150
tlsHandshakeTimeout,
151151
func(ctx context.Context) (protect.Conn, error) {
152152
const myidx = 0
@@ -167,9 +167,9 @@ func (h *auto) dial(network, local, remote string) (protect.Conn, error) {
167167
return nil, errNotPinned
168168
}
169169
// ip pinned to this proxy
170-
h.dialIfHealthy(exit, network, local, remote)
170+
h.dialIfHealthy(exit, network, laddr, raddr)
171171
}
172-
return h.dialIfReachable(exit, network, local, remote)
172+
return h.dialIfReachable(exit, network, laddr, raddr)
173173
}, func(ctx context.Context) (protect.Conn, error) {
174174
const myidx = 1
175175
if pro == nil {
@@ -180,7 +180,7 @@ func (h *auto) dial(network, local, remote string) (protect.Conn, error) {
180180
return nil, errNotPinned
181181
}
182182
// ip pinned to this proxy
183-
h.dialIfHealthy(pro, network, local, remote)
183+
h.dialIfHealthy(pro, network, laddr, raddr)
184184
}
185185

186186
// wait only if exit was used
@@ -191,7 +191,7 @@ func (h *auto) dial(network, local, remote string) (protect.Conn, error) {
191191
case <-time.After(shortdelay * myidx): // 100ms
192192
}
193193
}
194-
return h.dialIfHealthy(pro, network, local, remote)
194+
return h.dialIfHealthy(pro, network, laddr, raddr)
195195
}, func(ctx context.Context) (protect.Conn, error) {
196196
const myidx = 2
197197
if warp == nil {
@@ -202,15 +202,15 @@ func (h *auto) dial(network, local, remote string) (protect.Conn, error) {
202202
return nil, errNotPinned
203203
}
204204
// ip pinned to this proxy
205-
return h.dialIfHealthy(warp, network, local, remote)
205+
return h.dialIfHealthy(warp, network, laddr, raddr)
206206
}
207207

208208
select {
209209
case <-ctx.Done():
210210
return nil, ctx.Err()
211211
case <-time.After(shortdelay * myidx): // 200ms
212212
}
213-
return h.dialIfHealthy(warp, network, local, remote)
213+
return h.dialIfHealthy(warp, network, laddr, raddr)
214214
}, func(ctx context.Context) (protect.Conn, error) {
215215
const myidx = 3
216216
if exit64 == nil {
@@ -224,15 +224,15 @@ func (h *auto) dial(network, local, remote string) (protect.Conn, error) {
224224
return nil, errNotPinned
225225
}
226226
// ip pinned to this proxy
227-
return h.dialIfHealthy(exit64, network, local, remote)
227+
return h.dialIfHealthy(exit64, network, laddr, raddr)
228228
}
229229

230230
select {
231231
case <-ctx.Done():
232232
return nil, ctx.Err()
233233
case <-time.After(shortdelay * myidx): // 300ms
234234
}
235-
return h.dialIfHealthy(exit64, network, local, remote)
235+
return h.dialIfHealthy(exit64, network, laddr, raddr)
236236
}, func(ctx context.Context) (protect.Conn, error) {
237237
const myidx = 4
238238
if amz == nil {
@@ -243,15 +243,15 @@ func (h *auto) dial(network, local, remote string) (protect.Conn, error) {
243243
return nil, errNotPinned
244244
}
245245
// ip pinned to this proxy
246-
return h.dialIfHealthy(amz, network, local, remote)
246+
return h.dialIfHealthy(amz, network, laddr, raddr)
247247
}
248248

249249
select {
250250
case <-ctx.Done():
251251
return nil, ctx.Err()
252252
case <-time.After(shortdelay * myidx): // 400ms
253253
}
254-
return h.dialIfHealthy(amz, network, local, remote)
254+
return h.dialIfHealthy(amz, network, laddr, raddr)
255255
}, func(ctx context.Context) (protect.Conn, error) {
256256
const myidx = 5
257257
if sep == nil {
@@ -262,27 +262,27 @@ func (h *auto) dial(network, local, remote string) (protect.Conn, error) {
262262
return nil, errNotPinned
263263
}
264264
// ip pinned to this proxy
265-
return h.dialIfHealthy(sep, network, local, remote)
265+
return h.dialIfHealthy(sep, network, laddr, raddr)
266266
}
267267

268268
select {
269269
case <-ctx.Done():
270270
return nil, ctx.Err()
271271
case <-time.After(shortdelay * myidx): // 500ms
272272
}
273-
return h.dialIfHealthy(sep, network, local, remote)
273+
return h.dialIfHealthy(sep, network, laddr, raddr)
274274
},
275275
)
276276

277277
defer localDialStatus(h.status, err)
278278
if err != nil {
279-
h.exp.Del(remote)
279+
h.exp.Del(raddr)
280280
} else {
281-
h.exp.Put(remote, who)
281+
h.exp.Put(raddr, who)
282282
}
283283
maybeKeepAlive(c)
284284
logei(err)("proxy: auto: w(%d) pin(%t/%d), dial(%s) %s; err? %v",
285-
who, recent, previdx, network, remote, err)
285+
who, recent, previdx, network, raddr, err)
286286
return c, err
287287
}
288288

0 commit comments

Comments
 (0)