Skip to content

Commit be56579

Browse files
committed
ipn/se: m docs, var names
1 parent 0d603a3 commit be56579

File tree

3 files changed

+16
-14
lines changed

3 files changed

+16
-14
lines changed

intra/common.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -227,21 +227,23 @@ func (h *baseHandler) onFlow(localaddr, target netip.AddrPort) (fm *Mark, undidA
227227
return h.listener.Flow(proto, int32(uid), x.StrOf(src), x.StrOf(dst), x.StrOf(ips), x.StrOf(doms), x.StrOf(pdoms), x.StrOf(blocklists)), nil
228228
}, onFlowTimeout)
229229

230+
loopback := settings.Loopingback.Load()
231+
230232
if fm == nil || !ok { // zeroListener returns nil
231233
log.W("com: %s: onFlow: empty res or on flow timeout %t; block!", h.proto, ok)
232234
fm = optionsBlock
233235
} else if len(fm.PIDCSV) <= 0 {
236+
fm.PIDCSV = ipn.Exit
234237
if preuid == SELF_UID {
235-
fm.PIDCSV = ipn.Exit
236-
} else if h.prox.AutoActive() {
237-
fm.PIDCSV = ipn.Auto
238-
} else {
239-
fm.PIDCSV = ipn.Exit
238+
if loopback {
239+
fm.PIDCSV = ipn.Base
240+
} else if h.prox.AutoActive() {
241+
fm.PIDCSV = ipn.Auto
242+
}
240243
}
241244
log.E("com: %s: onFlow: missing proxyid for preuid %s (%s => %s) from kt (alg: %v + %v); %s!",
242245
h.proto, preuid, src, dst, ips, doms, fm.PIDCSV)
243246
}
244-
loopback := settings.Loopingback.Load()
245247
// in loopback mode, user may have setup SELF_UID to be routed out via remote proxies.
246248
// in other cases, routing Rethink via remote proxies is probably a bug.
247249
if !loopback && preuid == SELF_UID && !ipn.IsAnyLocalProxy(strings.Split(fm.PIDCSV, ",")...) {

intra/ipn/seproxy.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -110,25 +110,25 @@ var _ Proxy = (*seproxy)(nil)
110110
var _ proxy.Dialer = (*sedialer)(nil)
111111

112112
// NewSEasyProxy returns a new seproxy.
113-
func NewSEasyProxy(ctx context.Context, c protect.Controller, px ProxyProvider, sec *seasy.SEApi) (*seproxy, error) {
114-
if sec == nil {
113+
func NewSEasyProxy(ctx context.Context, c protect.Controller, px ProxyProvider, seapi *seasy.SEApi) (*seproxy, error) {
114+
if seapi == nil {
115115
return nil, errMissingSEClient
116116
}
117117

118118
ctx, done := context.WithCancel(ctx)
119-
if _, err := sec.Start(ctx); err != nil {
119+
if _, err := seapi.Start(ctx); err != nil {
120120
done()
121121
return nil, err
122122
}
123123

124-
endpoints := sec.Endpoints()
124+
endpoints := seapi.Endpoints()
125125
if len(endpoints) <= 0 { // unlikely
126126
done()
127127
return nil, errSENoEndpoints
128128
}
129129

130130
authfn := func() string {
131-
return headerBasicAuth(sec.GetProxyCredentials())
131+
return headerBasicAuth(seapi.GetProxyCredentials())
132132
}
133133

134134
var missingcert *x509.Certificate
@@ -145,8 +145,8 @@ func NewSEasyProxy(ctx context.Context, c protect.Controller, px ProxyProvider,
145145

146146
sep := &seproxy{
147147
done: done,
148-
sec: sec,
149-
addrs: sec.Addrs(),
148+
sec: seapi,
149+
addrs: seapi.Addrs(),
150150
px: px,
151151
viaID: core.NewZeroVolatile[string](),
152152
lastRefresh: core.NewVolatile(now),

intra/settings/proxyopts.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ func (m AutoModeType) String() string {
138138
}
139139
}
140140

141-
// SetAutoMode sets the global AutoMode variable to y.
141+
// SetAutoMode sets the global AutoMode variable to m.
142142
// Indicates if backend.Auto proxy is in local, remote, or hybrid mode.
143143
func SetAutoMode(m int32) (prev int32) {
144144
m = max(m, AutoModeLocal)

0 commit comments

Comments
 (0)