lingling 2.1.20.post35__tar.gz → 2.1.20.post37__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. {lingling-2.1.20.post35 → lingling-2.1.20.post37}/PKG-INFO +27 -9
  2. {lingling-2.1.20.post35 → lingling-2.1.20.post37}/README.md +26 -8
  3. {lingling-2.1.20.post35 → lingling-2.1.20.post37}/lingling/__init__.py +1 -1
  4. {lingling-2.1.20.post35 → lingling-2.1.20.post37}/lingling/bench.py +14 -0
  5. {lingling-2.1.20.post35 → lingling-2.1.20.post37}/lingling/mitm.py +1362 -1340
  6. {lingling-2.1.20.post35 → lingling-2.1.20.post37}/lingling/update.py +7 -2
  7. {lingling-2.1.20.post35 → lingling-2.1.20.post37}/lingling.egg-info/PKG-INFO +27 -9
  8. {lingling-2.1.20.post35 → lingling-2.1.20.post37}/pyproject.toml +1 -1
  9. {lingling-2.1.20.post35 → lingling-2.1.20.post37}/LICENSE +0 -0
  10. {lingling-2.1.20.post35 → lingling-2.1.20.post37}/lingling/__main__.py +0 -0
  11. {lingling-2.1.20.post35 → lingling-2.1.20.post37}/lingling/bounds.py +0 -0
  12. {lingling-2.1.20.post35 → lingling-2.1.20.post37}/lingling/cli.py +0 -0
  13. {lingling-2.1.20.post35 → lingling-2.1.20.post37}/lingling/demo.py +0 -0
  14. {lingling-2.1.20.post35 → lingling-2.1.20.post37}/lingling/exits.py +0 -0
  15. {lingling-2.1.20.post35 → lingling-2.1.20.post37}/lingling/health.py +0 -0
  16. {lingling-2.1.20.post35 → lingling-2.1.20.post37}/lingling/lanes.py +0 -0
  17. {lingling-2.1.20.post35 → lingling-2.1.20.post37}/lingling/netutil.py +0 -0
  18. {lingling-2.1.20.post35 → lingling-2.1.20.post37}/lingling/proof.py +0 -0
  19. {lingling-2.1.20.post35 → lingling-2.1.20.post37}/lingling/relay.py +0 -0
  20. {lingling-2.1.20.post35 → lingling-2.1.20.post37}/lingling/winjob.py +0 -0
  21. {lingling-2.1.20.post35 → lingling-2.1.20.post37}/lingling.egg-info/SOURCES.txt +0 -0
  22. {lingling-2.1.20.post35 → lingling-2.1.20.post37}/lingling.egg-info/dependency_links.txt +0 -0
  23. {lingling-2.1.20.post35 → lingling-2.1.20.post37}/lingling.egg-info/entry_points.txt +0 -0
  24. {lingling-2.1.20.post35 → lingling-2.1.20.post37}/lingling.egg-info/requires.txt +0 -0
  25. {lingling-2.1.20.post35 → lingling-2.1.20.post37}/lingling.egg-info/top_level.txt +0 -0
  26. {lingling-2.1.20.post35 → lingling-2.1.20.post37}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lingling
3
- Version: 2.1.20.post35
3
+ Version: 2.1.20.post37
4
4
  Summary: Official OpenCode, but your requests ride rotating Tor exit lanes.
5
5
  Author: huranth
6
6
  License-Expression: LicenseRef-Lingling
@@ -32,10 +32,17 @@ you by IP, so right when the conversation gets good — bam, wall. Very rude.
32
32
 
33
33
  Lingling fixes this the fun way. It spins up a little kitchen of Tor exit
34
34
  lanes on your machine, each one a different country, and sends every request
35
- down **all** of them at once. The first answer takes it; the rest are cut
35
+ down **five** of them at once. The first answer takes it; the rest are cut
36
36
  before they say a word. One exit gets throttled? Cute. Four of them do, and
37
37
  you are answered by the fifth without ever noticing. You just keep typing.
38
38
 
39
+ Five, not the whole fleet, and that number is measured rather than shy. The
40
+ free tier refuses a client it sees arrive from half a dozen addresses for the
41
+ same session — `403 FreeTierError` — and once it has refused that client, it
42
+ refuses it through every exit. Ten lanes are still worth having: they spread
43
+ the day's allowance and give the sweep somewhere to move a lane to. Ten copies
44
+ of one call are not.
45
+
39
46
  ```
40
47
  pip install lingling
41
48
 
@@ -134,17 +141,28 @@ tier through that address. Nothing about the lane or its tor is wrong, so no
134
141
  lane moves. But it is not your answer either, and refusing is cheaper than
135
142
  answering, so a gated lane always reaches the race *first*. It is held back
136
143
  like a 429 is: the call goes on to the lanes that can still serve, and only a
137
- pool where every exit is gated hands the 403 over. That exit is then sat out
138
- for the rest of the free-tier day rather than raced on every call, and the
139
- sweep moves its lane somewhere else: `lane 9 {fr} 403 -- the gate closed this
140
- exit, sitting it out`. The pane still shows the attempt that found it, so you
141
- can see which exits the gate has closed.
144
+ wave where every exit is gated hands the 403 over — and then the call stops
145
+ there. The refusal is about the *client*, not the exit, so walking the other
146
+ five exits on the same call pays for the same wall twice and is what makes the
147
+ gate stick; the far end's own words reach the client instead. That exit then
148
+ sits out a few minutes (`LINGLING_GATE_COOLDOWN_S`, default 300) rather than
149
+ the rest of the free-tier day, and the sweep moves its lane somewhere else:
150
+ `lane 9 {fr} 403 -- the gate closed this exit, sitting it out`. The pane still
151
+ shows the attempt that found it, so you can see which exits the gate has
152
+ closed.
153
+
154
+ Why minutes and not a day: on 2026-10-18 a ten-lane session took fifty of
155
+ these refusals in ninety seconds, and each one wrote its exit off until 00:00
156
+ UTC. The pool was dead for the rest of the day even though the gate had never
157
+ said a word about any of those exits. A gate is a verdict about what we look
158
+ like, not about where we are standing.
142
159
 
143
160
  **Load.** How much a lane is carrying decides where it sits in the race,
144
161
  never whether it keeps serving. A loaded lane is healthy and still ours, so
145
162
  nothing is retired for it — and nothing queues either, because the request
146
- already went out on every live lane at once. **The quickest 200 wins** — and
147
- nothing but a 200 may take the call.
163
+ already went out on its wave of five at once. **The quickest 200 wins** — and
164
+ nothing but a 200 may take the call. `LINGLING_RACE_WIDTH` widens or narrows
165
+ that wave (default 5); the lanes that were not in it take the next call.
148
166
 
149
167
  **The far end's bad moments.** A 502, 503 or 504 means opencode's edge is
150
168
  unwell — not your client, and not that exit's quota. A different exit reaches
@@ -7,10 +7,17 @@ you by IP, so right when the conversation gets good — bam, wall. Very rude.
7
7
 
8
8
  Lingling fixes this the fun way. It spins up a little kitchen of Tor exit
9
9
  lanes on your machine, each one a different country, and sends every request
10
- down **all** of them at once. The first answer takes it; the rest are cut
10
+ down **five** of them at once. The first answer takes it; the rest are cut
11
11
  before they say a word. One exit gets throttled? Cute. Four of them do, and
12
12
  you are answered by the fifth without ever noticing. You just keep typing.
13
13
 
14
+ Five, not the whole fleet, and that number is measured rather than shy. The
15
+ free tier refuses a client it sees arrive from half a dozen addresses for the
16
+ same session — `403 FreeTierError` — and once it has refused that client, it
17
+ refuses it through every exit. Ten lanes are still worth having: they spread
18
+ the day's allowance and give the sweep somewhere to move a lane to. Ten copies
19
+ of one call are not.
20
+
14
21
  ```
15
22
  pip install lingling
16
23
 
@@ -109,17 +116,28 @@ tier through that address. Nothing about the lane or its tor is wrong, so no
109
116
  lane moves. But it is not your answer either, and refusing is cheaper than
110
117
  answering, so a gated lane always reaches the race *first*. It is held back
111
118
  like a 429 is: the call goes on to the lanes that can still serve, and only a
112
- pool where every exit is gated hands the 403 over. That exit is then sat out
113
- for the rest of the free-tier day rather than raced on every call, and the
114
- sweep moves its lane somewhere else: `lane 9 {fr} 403 -- the gate closed this
115
- exit, sitting it out`. The pane still shows the attempt that found it, so you
116
- can see which exits the gate has closed.
119
+ wave where every exit is gated hands the 403 over — and then the call stops
120
+ there. The refusal is about the *client*, not the exit, so walking the other
121
+ five exits on the same call pays for the same wall twice and is what makes the
122
+ gate stick; the far end's own words reach the client instead. That exit then
123
+ sits out a few minutes (`LINGLING_GATE_COOLDOWN_S`, default 300) rather than
124
+ the rest of the free-tier day, and the sweep moves its lane somewhere else:
125
+ `lane 9 {fr} 403 -- the gate closed this exit, sitting it out`. The pane still
126
+ shows the attempt that found it, so you can see which exits the gate has
127
+ closed.
128
+
129
+ Why minutes and not a day: on 2026-10-18 a ten-lane session took fifty of
130
+ these refusals in ninety seconds, and each one wrote its exit off until 00:00
131
+ UTC. The pool was dead for the rest of the day even though the gate had never
132
+ said a word about any of those exits. A gate is a verdict about what we look
133
+ like, not about where we are standing.
117
134
 
118
135
  **Load.** How much a lane is carrying decides where it sits in the race,
119
136
  never whether it keeps serving. A loaded lane is healthy and still ours, so
120
137
  nothing is retired for it — and nothing queues either, because the request
121
- already went out on every live lane at once. **The quickest 200 wins** — and
122
- nothing but a 200 may take the call.
138
+ already went out on its wave of five at once. **The quickest 200 wins** — and
139
+ nothing but a 200 may take the call. `LINGLING_RACE_WIDTH` widens or narrows
140
+ that wave (default 5); the lanes that were not in it take the next call.
123
141
 
124
142
  **The far end's bad moments.** A 502, 503 or 504 means opencode's edge is
125
143
  unwell — not your client, and not that exit's quota. A different exit reaches
@@ -4,7 +4,7 @@ import os
4
4
  import tempfile
5
5
  from pathlib import Path
6
6
 
7
- __version__ = "2.1.20.post35"
7
+ __version__ = "2.1.20.post37"
8
8
 
9
9
 
10
10
  def data_dir() -> Path:
@@ -1,5 +1,13 @@
1
1
  """The limit bench: what a limited exit earned, and how long it sits out.
2
2
 
3
+ A gated exit sits out ``GATE_COOLDOWN_S``, not the free-tier day. The gate's
4
+ 403 names the CLIENT ("the free tier can only be used from within OpenCode"),
5
+ not the exit, and it refuses every exit in a wave at once. Benching each of
6
+ them until 00:00 UTC is what turned one tripped call into a dead pool:
7
+ measured 2026-10-18, fifty refusals in ninety seconds wrote the fleet off for
8
+ the rest of the day. A few minutes stops us re-racing the exit and still lets
9
+ the pool come back on its own.
10
+
3
11
  Two ledgers live here, both keyed to the 00:00 UTC the free tier resets on.
4
12
  The notepad holds what an exit was benched for. The spend ledger holds how
5
13
  much of that day we have put through each exit ourselves, which is what lets a
@@ -52,6 +60,10 @@ EXIT_SOFT_CAP = bounds.count("LINGLING_EXIT_SOFT_CAP",
52
60
 
53
61
  EXIT_HOLD_S = bounds.number("LINGLING_EXIT_HOLD_S", 600, 0.0, bounds.WINDOW_S)
54
62
 
63
+ #: gate cooldown
64
+ GATE_COOLDOWN_S = bounds.number("LINGLING_GATE_COOLDOWN_S", 300,
65
+ 0.0, bounds.WINDOW_S)
66
+
55
67
 
56
68
  def day_of(now: Optional[float] = None) -> int:
57
69
  """Which free-tier day ``now`` falls in: the 00:00 UTC that owns it."""
@@ -72,6 +84,8 @@ def bench_span(reason: str, retry_after: float = 0.0,
72
84
  if reason == RATE_LIMIT:
73
85
  return (min(retry_after, RATE_LIMIT_FALLBACK_S) if retry_after > 0
74
86
  else RATE_LIMIT_FALLBACK_S)
87
+ if reason == GATE_LIMIT:
88
+ return min(GATE_COOLDOWN_S, _LIMIT_CEILING_S)
75
89
  if retry_after > 0:
76
90
  return min(retry_after, _LIMIT_CEILING_S)
77
91
  return min(next_free_reset(moment) - moment, _LIMIT_CEILING_S)