Skip to content

Commit 399dc78

Browse files
committed
rpn: rmv amnezia
1 parent 49c44e6 commit 399dc78

5 files changed

Lines changed: 8 additions & 998 deletions

File tree

intra/backend/ipn_proxies.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ const ( // see ipn/proxies.go
2323
Auto = "Auto"
2424
// RPN Warp (must be registered by Rpn.RegisterWarp)
2525
RpnWg = WG + "w" + RPN
26-
// RPN Amnezia (must be registered by Rpn.RegisterAmnezia)
27-
RpnAmz = WG + "a" + RPN
2826
// RPN Win proxy (must be registered by Rpn.RegisterWin)
2927
RpnWin = WG + "y" + RPN
3028
// Alias for RPN Win
@@ -90,16 +88,12 @@ type Rpn interface {
9088
RegisterWarp(existingStateJson *Gobyte) (json *Gobyte, err error)
9189
// RegisterSE registers a new SurfEasy user.
9290
RegisterSE() error
93-
// RegisterAmnezia registers a new Amnezia installation.
94-
RegisterAmnezia(existingStateJson *Gobyte) (json *Gobyte, err error)
9591
// RegisterProton is alias for RegisterWin.
9692
RegisterProton(entitlementOrStateJson *Gobyte) (json *Gobyte, err error)
9793
// RegisterWin is alias for RegisterWin.
9894
RegisterWin(entitlementOrStateJson *Gobyte) (json *Gobyte, err error)
9995
// UnregisterWarp unregisters a Warp public key.
10096
UnregisterWarp() bool
101-
// UnregisterAmnezia unregisters an Amnezia installation.
102-
UnregisterAmnezia() bool
10397
// UnregisterProton is an alias for UnregisterWin.
10498
UnregisterProton() bool
10599
// UnregisterWin unregisters a Windscribe installation.
@@ -108,8 +102,6 @@ type Rpn interface {
108102
UnregisterSE() bool
109103
// TestWarp connects to some Warp IPs and returns reachable ones.
110104
TestWarp() (ips *Gostr, errs error)
111-
// TestAmnezia connects to the Amnezia gateway and returns its IP if reachable.
112-
TestAmnezia() (ips *Gostr, errs error)
113105
// TestWin connects to the Windscribe gateway and returns its IP if reachable.
114106
TestWin() (ips *Gostr, errs error)
115107
// TestProton is an alias for TestWin.
@@ -124,8 +116,6 @@ type Rpn interface {
124116
Win() (wg RpnProxy, err error)
125117
// Proton is an alias for Win.
126118
Proton() (wg RpnProxy, err error)
127-
// Amnezia returns a Amnezia WireGuard proxy.
128-
Amnezia() (awg RpnProxy, err error)
129119
// Pip returns a RpnWs proxy.
130120
Pip() (ws RpnProxy, err error)
131121
// Exit64 returns a Exit proxy hopping over preset publicly-available

intra/ipn/auto.go

Lines changed: 8 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,6 @@ func (h *auto) DialerHandle() (mix uintptr) {
9090
if pro, _ := h.pxr.mainRpnProxyOf(RpnPro); pro != nil {
9191
mix ^= pro.DialerHandle()
9292
}
93-
if amz, _ := h.pxr.mainRpnProxyOf(RpnAmz); amz != nil {
94-
mix ^= amz.DialerHandle()
95-
}
9693
if sep, _ := h.pxr.mainRpnProxyOf(RpnSE); sep != nil {
9794
mix ^= sep.DialerHandle()
9895
}
@@ -119,10 +116,9 @@ func (h *auto) dial(network, laddr, raddr string) (protect.Conn, error) {
119116
exit64, ex64err := h.pxr.ProxyFor(Rpn64)
120117
warp, waerr := h.pxr.mainRpnProxyOf(RpnWg)
121118
pro, proerr := h.pxr.mainRpnProxyOf(RpnPro)
122-
amz, amzerr := h.pxr.mainRpnProxyOf(RpnAmz)
123119
sep, seerr := h.pxr.mainRpnProxyOf(RpnSE)
124120

125-
pxrerrs := core.JoinErr(exerr, waerr, proerr, amzerr, seerr, ex64err)
121+
pxrerrs := core.JoinErr(exerr, waerr, proerr, seerr, ex64err)
126122

127123
if usevia(h.viaID) {
128124
if v, vok := h.via.Get(); !vok {
@@ -137,7 +133,7 @@ func (h *auto) dial(network, laddr, raddr string) (protect.Conn, error) {
137133
parallelDial := settings.AutoDialsParallel.Load()
138134

139135
if !parallelDial {
140-
rpns := []Proxy{exit, warp, amz, exit64, sep, pro}
136+
rpns := []Proxy{exit, warp, exit64, sep, pro}
141137
healthy := core.Map(
142138
core.FilterLeft(
143139
rpns,
@@ -248,25 +244,6 @@ func (h *auto) dial(network, laddr, raddr string) (protect.Conn, error) {
248244
return h.dialIfHealthy(exit64, network, laddr, raddr)
249245
}, func(ctx context.Context) (protect.Conn, error) {
250246
const myidx = 3
251-
if amz == nil {
252-
return nil, amzerr
253-
}
254-
if recent {
255-
if previdx != myidx {
256-
return nil, errNotPinned
257-
}
258-
// ip pinned to this proxy
259-
return h.dialAlways(amz, network, laddr, raddr)
260-
}
261-
262-
select {
263-
case <-ctx.Done():
264-
return nil, ctx.Err()
265-
case <-time.After(shortdelay * myidx): // 400ms
266-
}
267-
return h.dialIfHealthy(amz, network, laddr, raddr)
268-
}, func(ctx context.Context) (protect.Conn, error) {
269-
const myidx = 4
270247
if sep == nil {
271248
return nil, seerr
272249
}
@@ -281,11 +258,11 @@ func (h *auto) dial(network, laddr, raddr string) (protect.Conn, error) {
281258
select {
282259
case <-ctx.Done():
283260
return nil, ctx.Err()
284-
case <-time.After(shortdelay * myidx): // 500ms
261+
case <-time.After(shortdelay * myidx): // 400ms
285262
}
286263
return h.dialIfHealthy(sep, network, laddr, raddr)
287264
}, func(ctx context.Context) (protect.Conn, error) {
288-
const myidx = 5
265+
const myidx = 4
289266
if pro == nil {
290267
return nil, proerr
291268
}
@@ -302,7 +279,7 @@ func (h *auto) dial(network, laddr, raddr string) (protect.Conn, error) {
302279
select {
303280
case <-ctx.Done():
304281
return nil, ctx.Err()
305-
case <-time.After(shortdelay * myidx): // 100ms
282+
case <-time.After(shortdelay * myidx): // 500ms
306283
}
307284
}
308285
return h.dialIfHealthy(pro, network, laddr, raddr)
@@ -331,7 +308,6 @@ func (h *auto) Announce(network, local string) (protect.PacketConn, error) {
331308
exit, exerr := h.pxr.ProxyFor(Exit)
332309
warp, waerr := h.pxr.mainRpnProxyOf(RpnWg)
333310
pro, proerr := h.pxr.mainRpnProxyOf(RpnPro)
334-
amz, amzerr := h.pxr.mainRpnProxyOf(RpnAmz)
335311

336312
previdx, recent := h.exp.Get(local)
337313

@@ -388,24 +364,6 @@ func (h *auto) Announce(network, local string) (protect.PacketConn, error) {
388364
case <-time.After(shortdelay * myidx): // 200ms
389365
}
390366
return h.announceIfHealthy(warp, network, local)
391-
}, func(ctx context.Context) (protect.PacketConn, error) {
392-
const myidx = 3
393-
if amz == nil {
394-
return nil, amzerr
395-
}
396-
if recent {
397-
if previdx != myidx {
398-
return nil, errNotPinned
399-
}
400-
// ip pinned to this proxy
401-
return h.announceIfHealthy(amz, network, local)
402-
}
403-
select {
404-
case <-ctx.Done():
405-
return nil, ctx.Err()
406-
case <-time.After(shortdelay * myidx): // 300ms
407-
}
408-
return h.announceIfHealthy(amz, network, local)
409367
}, // seasy-proxy does not support udp?
410368
)
411369
defer localDialStatus(h.status, err)
@@ -491,23 +449,20 @@ func (h *auto) Hop(p Proxy, dryrun bool) error {
491449
return errProxyStopped
492450
}
493451

494-
var warp, sep, amz, pro Proxy
495-
var waerr, seerr, amzerr, proerr error
452+
var warp, sep, pro Proxy
453+
var waerr, seerr, proerr error
496454
old := h.swapVia(p)
497455
if warp, waerr = h.pxr.mainRpnProxyOf(RpnWg); warp != nil {
498456
waerr = warp.Hop(p, dryrun)
499457
}
500458
if pro, proerr = h.pxr.mainRpnProxyOf(RpnPro); pro != nil {
501459
proerr = pro.Hop(p, dryrun)
502460
}
503-
if amz, amzerr = h.pxr.mainRpnProxyOf(RpnAmz); amz != nil {
504-
amzerr = amz.Hop(p, dryrun)
505-
}
506461
if sep, seerr = h.pxr.mainRpnProxyOf(RpnSE); sep != nil {
507462
seerr = sep.Hop(p, dryrun)
508463
}
509464

510-
errs := core.JoinErr(waerr, seerr, amzerr, proerr) // may be nil
465+
errs := core.JoinErr(waerr, seerr, proerr) // may be nil
511466

512467
logei(errs)("proxy: auto: hop(%s) => %s; errs? %v",
513468
idhandle(old), idhandle(p), errs)

intra/ipn/proxies.go

Lines changed: 0 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ const (
4141
RpnWg = x.RpnWg
4242
RpnPro = x.RpnWin // pro is an alias for win
4343
RpnWin = x.RpnWin
44-
RpnAmz = x.RpnAmz
4544
RpnWs = x.RpnWs
4645
Rpn64 = x.Rpn64
4746
RpnH2 = x.RpnH2
@@ -258,7 +257,6 @@ type proxifier struct {
258257

259258
lastSeErr *core.Volatile[error] // se proxy registration error
260259
lastWarpErr *core.Volatile[error] // warp registration error
261-
lastAmzErr *core.Volatile[error] // amnezia registration error
262260
lastWinErr *core.Volatile[error] // win registration error
263261
}
264262

@@ -298,7 +296,6 @@ func NewProxifier(pctx context.Context, l3 string, mtu int, c protect.Controller
298296
rp: make(map[string]RpnProxy),
299297
lastSeErr: core.NewZeroVolatile[error](),
300298
lastWarpErr: core.NewZeroVolatile[error](),
301-
lastAmzErr: core.NewZeroVolatile[error](),
302299
lastWinErr: core.NewZeroVolatile[error](),
303300
}
304301

@@ -1177,44 +1174,6 @@ func (px *proxifier) registerWarp(existingStateJson []byte) (wc RpnAcc, err erro
11771174
}
11781175
}
11791176

1180-
// RegisterAmnezia implements x.Rpn.
1181-
func (px *proxifier) RegisterAmnezia(existingState *x.Gobyte) (stateJson *x.Gobyte, err error) {
1182-
defer func() {
1183-
px.lastAmzErr.Store(err) // may be nil
1184-
}()
1185-
existingStateJson := existingState.V()
1186-
restore := len(existingStateJson) > 0
1187-
1188-
ac, err := px.registerAmnezia(existingStateJson)
1189-
1190-
if err != nil || core.IsNil(ac) {
1191-
log.E("proxy: amz: make (restore? %t) failed: %v", restore, err)
1192-
return nil, core.JoinErr(err, errNilAmzId)
1193-
}
1194-
1195-
state, err := ac.State()
1196-
if err != nil {
1197-
return nil, err
1198-
}
1199-
1200-
rp, err := px.addRpnProxy(ac, maincc(ac))
1201-
if err != nil || rp == nil {
1202-
log.E("proxy: amz: add wg for %s failed: %v", ac.Who(), err)
1203-
return nil, core.JoinErr(err, errNotRpnProxy)
1204-
}
1205-
1206-
log.I("proxy: amz: registered: %s / %d; new? %t", ac.Who(), state.Len(), !restore)
1207-
return state, nil
1208-
}
1209-
1210-
func (px *proxifier) registerAmnezia(existingStateJson []byte) (RpnAcc, error) {
1211-
if len(existingStateJson) > 0 { // restore
1212-
return px.extc.MakeAmzWgFrom(existingStateJson)
1213-
} else {
1214-
return px.extc.MakeAmzWg()
1215-
}
1216-
}
1217-
12181177
// RegisterProton implements x.Rpn.
12191178
func (px *proxifier) RegisterProton(existingState *x.Gobyte) (stateJson *x.Gobyte, err error) {
12201179
return px.RegisterWin(existingState) // same as RegisterWin
@@ -1287,11 +1246,6 @@ func (px *proxifier) UnregisterWarp() bool {
12871246
return px.unregisterRpn(RpnWg)
12881247
}
12891248

1290-
// UnregisterAmnezia implements x.Rpn.
1291-
func (px *proxifier) UnregisterAmnezia() bool {
1292-
return px.unregisterRpn(RpnAmz)
1293-
}
1294-
12951249
// UnregisterProton implements x.Rpn.
12961250
func (px *proxifier) UnregisterProton() bool {
12971251
return px.UnregisterWin()
@@ -1346,15 +1300,6 @@ func (px *proxifier) Win() (x.RpnProxy, error) {
13461300
return win, nil
13471301
}
13481302

1349-
// Amnezia implements x.Rpn.
1350-
func (px *proxifier) Amnezia() (x.RpnProxy, error) {
1351-
amz, err := px.mainRpnProxyOf(RpnAmz)
1352-
if amz == nil {
1353-
return nil, core.JoinErr(err, px.lastAmzErr.Load())
1354-
}
1355-
return amz, nil
1356-
}
1357-
13581303
// Pip implements x.Rpn.
13591304
func (px *proxifier) Pip() (x.RpnProxy, error) {
13601305
// TODO: Register and Unregister for Pip
@@ -1498,38 +1443,6 @@ func (px *proxifier) testWin() (string, error) {
14981443
return strings.Join(oks, ","), nil
14991444
}
15001445

1501-
// TestAmnezia implements x.Rpn.
1502-
func (px *proxifier) TestAmnezia() (*x.Gostr, error) {
1503-
return x.StrOfFunc(px.testAmnezia)
1504-
}
1505-
1506-
func (px *proxifier) testAmnezia() (ips string, errs error) {
1507-
v4, _, err := warp.AmzEndpoints()
1508-
if err != nil {
1509-
log.W("proxy: amz: err testing endpoints: %v", err)
1510-
return "", err
1511-
}
1512-
1513-
// todo: amnezia presently does not support ipv6
1514-
oks := make([]string, 0, len(v4))
1515-
for _, ip := range v4 {
1516-
ipstr := ip.String()
1517-
// base can route back into netstack (settings.LoopingBack)
1518-
// in which case all endpoints will "seem" reachable.
1519-
// exit, however, never routes back into netstack and has
1520-
// the true, unhindered path to the underlying network.
1521-
if Reaches(px.exit, ipstr, "tcp") {
1522-
oks = append(oks, ipstr)
1523-
}
1524-
}
1525-
1526-
if len(oks) <= 0 {
1527-
log.E("proxy: amz: no reachable addrs among %v", v4)
1528-
return "", core.JoinErr(errNoSuitableAddress, px.lastAmzErr.Load())
1529-
}
1530-
return strings.Join(oks, ","), nil
1531-
}
1532-
15331446
// TestExit64 implements x.Rpn.
15341447
func (px *proxifier) TestExit64() (*x.Gostr, error) {
15351448
return x.StrOfFunc(px.testExit64)

0 commit comments

Comments
 (0)