evo-cli 0.36.4__tar.gz → 0.36.6__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 (157) hide show
  1. {evo_cli-0.36.4 → evo_cli-0.36.6}/PKG-INFO +1 -1
  2. evo_cli-0.36.6/evo_cli/VERSION +1 -0
  3. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/openvpn.py +43 -0
  4. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli.egg-info/PKG-INFO +1 -1
  5. {evo_cli-0.36.4 → evo_cli-0.36.6}/tests/test_openvpn.py +58 -0
  6. evo_cli-0.36.4/evo_cli/VERSION +0 -1
  7. {evo_cli-0.36.4 → evo_cli-0.36.6}/Containerfile +0 -0
  8. {evo_cli-0.36.4 → evo_cli-0.36.6}/HISTORY.md +0 -0
  9. {evo_cli-0.36.4 → evo_cli-0.36.6}/LICENSE +0 -0
  10. {evo_cli-0.36.4 → evo_cli-0.36.6}/MANIFEST.in +0 -0
  11. {evo_cli-0.36.4 → evo_cli-0.36.6}/README.md +0 -0
  12. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/__init__.py +0 -0
  13. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/__main__.py +0 -0
  14. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/base.py +0 -0
  15. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/cli.py +0 -0
  16. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/__init__.py +0 -0
  17. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/agent_toy.py +0 -0
  18. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/claude_code.py +0 -0
  19. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/cloudflare.py +0 -0
  20. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/cred.py +0 -0
  21. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/download.py +0 -0
  22. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/fix_claude.py +0 -0
  23. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/gdrive.py +0 -0
  24. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/gh.py +0 -0
  25. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/harness/__init__.py +0 -0
  26. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/harness/_dag.py +0 -0
  27. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/harness/_git.py +0 -0
  28. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/harness/_hub.py +0 -0
  29. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/harness/_mirror.py +0 -0
  30. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/harness/_model.py +0 -0
  31. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/harness/_mutate.py +0 -0
  32. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/harness/_paths.py +0 -0
  33. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/harness/_render.py +0 -0
  34. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/harness/_server.py +0 -0
  35. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/harness/check.py +0 -0
  36. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/harness/clone.py +0 -0
  37. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/harness/edit.py +0 -0
  38. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/harness/pull.py +0 -0
  39. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/harness/serve.py +0 -0
  40. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/harness/show.py +0 -0
  41. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/harness/views.py +0 -0
  42. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/harness/web/assets/index-Cs7hXRPJ.css +0 -0
  43. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/harness/web/assets/index-CuNOlaH7.js +0 -0
  44. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/harness/web/assets/inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2 +0 -0
  45. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/harness/web/assets/inter-cyrillic-wght-normal-DqGufNeO.woff2 +0 -0
  46. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/harness/web/assets/inter-greek-ext-wght-normal-DlzME5K_.woff2 +0 -0
  47. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/harness/web/assets/inter-greek-wght-normal-CkhJZR-_.woff2 +0 -0
  48. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/harness/web/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
  49. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/harness/web/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
  50. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/harness/web/assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2 +0 -0
  51. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/harness/web/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
  52. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/harness/web/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
  53. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/harness/web/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
  54. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/harness/web/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
  55. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/harness/web/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
  56. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/harness/web/index.html +0 -0
  57. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/hwid.py +0 -0
  58. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/hwid_reset.py +0 -0
  59. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/image.py +0 -0
  60. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/localproxy.py +0 -0
  61. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/mcp.py +0 -0
  62. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/miniconda.py +0 -0
  63. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/netcheck.py +0 -0
  64. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/ngrok.py +0 -0
  65. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/opencode.py +0 -0
  66. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/openvpn.py +0 -0
  67. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/plantuml.py +0 -0
  68. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/route/__init__.py +0 -0
  69. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/route/_dns.py +0 -0
  70. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/route/_dnswatch.py +0 -0
  71. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/route/_dpi.py +0 -0
  72. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/route/_hosts.py +0 -0
  73. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/route/_page.py +0 -0
  74. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/route/_probe.py +0 -0
  75. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/route/_spoofdpi.py +0 -0
  76. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/route/check.py +0 -0
  77. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/route/fix.py +0 -0
  78. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/route/probe.py +0 -0
  79. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/route/status.py +0 -0
  80. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/serp.py +0 -0
  81. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/site2s.py +0 -0
  82. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/ssh.py +0 -0
  83. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/storage.py +0 -0
  84. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/sysmon.py +0 -0
  85. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/tts.py +0 -0
  86. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/update.py +0 -0
  87. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/commands/wifi.py +0 -0
  88. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/console.py +0 -0
  89. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/credentials/__init__.py +0 -0
  90. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/credentials/doctor.py +0 -0
  91. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/credentials/google_oauth.py +0 -0
  92. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/credentials/migrate.py +0 -0
  93. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/credentials/oauth_flow.py +0 -0
  94. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/credentials/registry.py +0 -0
  95. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/credentials/store.py +0 -0
  96. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/credentials/sync.py +0 -0
  97. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/imaging/__init__.py +0 -0
  98. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/imaging/align.py +0 -0
  99. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/imaging/core.py +0 -0
  100. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/imaging/creds.py +0 -0
  101. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/imaging/errors.py +0 -0
  102. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/imaging/gemini.py +0 -0
  103. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/imaging/ncnn.py +0 -0
  104. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/mcp_registry.py +0 -0
  105. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/serp/__init__.py +0 -0
  106. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/serp/client.py +0 -0
  107. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/serp/creds.py +0 -0
  108. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/serp/errors.py +0 -0
  109. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/serp/install.py +0 -0
  110. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/serp/render.py +0 -0
  111. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/tts/__init__.py +0 -0
  112. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/tts/chunking.py +0 -0
  113. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/tts/core.py +0 -0
  114. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/tts/creds.py +0 -0
  115. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/tts/errors.py +0 -0
  116. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/tts/gemini.py +0 -0
  117. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/tts/http.py +0 -0
  118. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/tts/openai.py +0 -0
  119. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/tts/player.py +0 -0
  120. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli/tts/vbee.py +0 -0
  121. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli.egg-info/SOURCES.txt +0 -0
  122. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli.egg-info/dependency_links.txt +0 -0
  123. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli.egg-info/entry_points.txt +0 -0
  124. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli.egg-info/requires.txt +0 -0
  125. {evo_cli-0.36.4 → evo_cli-0.36.6}/evo_cli.egg-info/top_level.txt +0 -0
  126. {evo_cli-0.36.4 → evo_cli-0.36.6}/pyproject.toml +0 -0
  127. {evo_cli-0.36.4 → evo_cli-0.36.6}/setup.cfg +0 -0
  128. {evo_cli-0.36.4 → evo_cli-0.36.6}/tests/__init__.py +0 -0
  129. {evo_cli-0.36.4 → evo_cli-0.36.6}/tests/fake_evo_agents.py +0 -0
  130. {evo_cli-0.36.4 → evo_cli-0.36.6}/tests/fixtures/hub/contract-0.2.0.json +0 -0
  131. {evo_cli-0.36.4 → evo_cli-0.36.6}/tests/fixtures/hub/mirror-demo.yaml +0 -0
  132. {evo_cli-0.36.4 → evo_cli-0.36.6}/tests/test_agent_toy.py +0 -0
  133. {evo_cli-0.36.4 → evo_cli-0.36.6}/tests/test_claude_code.py +0 -0
  134. {evo_cli-0.36.4 → evo_cli-0.36.6}/tests/test_cli.py +0 -0
  135. {evo_cli-0.36.4 → evo_cli-0.36.6}/tests/test_console.py +0 -0
  136. {evo_cli-0.36.4 → evo_cli-0.36.6}/tests/test_cred.py +0 -0
  137. {evo_cli-0.36.4 → evo_cli-0.36.6}/tests/test_download.py +0 -0
  138. {evo_cli-0.36.4 → evo_cli-0.36.6}/tests/test_fix_claude.py +0 -0
  139. {evo_cli-0.36.4 → evo_cli-0.36.6}/tests/test_gdrive.py +0 -0
  140. {evo_cli-0.36.4 → evo_cli-0.36.6}/tests/test_gh.py +0 -0
  141. {evo_cli-0.36.4 → evo_cli-0.36.6}/tests/test_harness.py +0 -0
  142. {evo_cli-0.36.4 → evo_cli-0.36.6}/tests/test_harness_clone.py +0 -0
  143. {evo_cli-0.36.4 → evo_cli-0.36.6}/tests/test_harness_dag.py +0 -0
  144. {evo_cli-0.36.4 → evo_cli-0.36.6}/tests/test_harness_hub.py +0 -0
  145. {evo_cli-0.36.4 → evo_cli-0.36.6}/tests/test_harness_show.py +0 -0
  146. {evo_cli-0.36.4 → evo_cli-0.36.6}/tests/test_image.py +0 -0
  147. {evo_cli-0.36.4 → evo_cli-0.36.6}/tests/test_mcp.py +0 -0
  148. {evo_cli-0.36.4 → evo_cli-0.36.6}/tests/test_ngrok.py +0 -0
  149. {evo_cli-0.36.4 → evo_cli-0.36.6}/tests/test_opencode.py +0 -0
  150. {evo_cli-0.36.4 → evo_cli-0.36.6}/tests/test_plantuml.py +0 -0
  151. {evo_cli-0.36.4 → evo_cli-0.36.6}/tests/test_route.py +0 -0
  152. {evo_cli-0.36.4 → evo_cli-0.36.6}/tests/test_serp.py +0 -0
  153. {evo_cli-0.36.4 → evo_cli-0.36.6}/tests/test_storage.py +0 -0
  154. {evo_cli-0.36.4 → evo_cli-0.36.6}/tests/test_sysmon.py +0 -0
  155. {evo_cli-0.36.4 → evo_cli-0.36.6}/tests/test_tts.py +0 -0
  156. {evo_cli-0.36.4 → evo_cli-0.36.6}/tests/test_update.py +0 -0
  157. {evo_cli-0.36.4 → evo_cli-0.36.6}/tests/test_wifi.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: evo_cli
3
- Version: 0.36.4
3
+ Version: 0.36.6
4
4
  Summary: Evolution CLI - a developer toolbox for setting up dev machines
5
5
  Author: maycuatroi
6
6
  Project-URL: Homepage, https://github.com/maycuatroi/evo-cli
@@ -0,0 +1 @@
1
+ 0.36.6
@@ -243,6 +243,47 @@ def default_gateway():
243
243
  return None
244
244
 
245
245
 
246
+ def gateway_to(address):
247
+ """The gateway ``address`` is routed through now, or None when it is on-link or the lookup fails."""
248
+ try:
249
+ output = subprocess.run(
250
+ ["route", "-n", "get", address], capture_output=True, text=True, timeout=5, check=False
251
+ ).stdout
252
+ except (OSError, subprocess.TimeoutExpired):
253
+ return None
254
+ match = re.search(r"gateway:\s*(\S+)", output)
255
+ return match.group(1) if match else None
256
+
257
+
258
+ def lan_resolvers(path="/var/run/resolv.conf"):
259
+ """The system's DNS servers that are reached through the physical gateway (macOS).
260
+
261
+ mDNSResponder sends each query out of the interface its server came from, so the system's own lookups
262
+ still work when a VPN pushes a route that covers the LAN's DNS server. A program with its own resolver
263
+ reads this file and follows the routing table instead, into a tunnel that does not answer: SpoofDPI
264
+ behind `evo route` then fails every name, and the browser shows ERR_TUNNEL_CONNECTION_FAILED. Pinning
265
+ these servers to the gateway keeps such resolvers where mDNSResponder already is. On-link servers need
266
+ no pin: a pushed route is never more specific than the link's own.
267
+ """
268
+ try:
269
+ lines = Path(path).read_text().splitlines()
270
+ except OSError:
271
+ return []
272
+ candidates = []
273
+ for line in lines:
274
+ words = line.split()
275
+ if len(words) < 2 or words[0] != "nameserver":
276
+ continue
277
+ try:
278
+ address = ipaddress.IPv4Address(words[1])
279
+ except ValueError:
280
+ continue
281
+ if not (address.is_loopback or address.is_link_local) and str(address) not in candidates:
282
+ candidates.append(str(address))
283
+ gateway = default_gateway() if candidates else None
284
+ return [address for address in candidates if gateway and gateway_to(address) == gateway]
285
+
286
+
246
287
  def remote_addresses(remotes):
247
288
  """IPv4 addresses of the profile's servers, resolved just before OpenVPN resolves them itself."""
248
289
  addresses = []
@@ -727,6 +768,8 @@ def worker(name, timeout):
727
768
  pinned = [] if takes_default_route(profile["config"]) else remotes
728
769
  if profile.get("otp_url"):
729
770
  pinned = [*pinned, urlparse(profile["otp_url"]).hostname]
771
+ if sys.platform == "darwin":
772
+ pinned = [*pinned, *lan_resolvers()]
730
773
  if pinned:
731
774
  command = pin_remotes(command, pinned)
732
775
  if os.geteuid() != 0:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: evo_cli
3
- Version: 0.36.4
3
+ Version: 0.36.6
4
4
  Summary: Evolution CLI - a developer toolbox for setting up dev machines
5
5
  Author: maycuatroi
6
6
  Project-URL: Homepage, https://github.com/maycuatroi/evo-cli
@@ -27,6 +27,8 @@ def store(tmp_path, monkeypatch):
27
27
  # Keep Unix socket paths below the macOS 104-byte limit.
28
28
  import tempfile
29
29
 
30
+ # The worker reads this machine's DNS servers on macOS; tests that need some set their own.
31
+ monkeypatch.setattr(vpn, "lan_resolvers", list)
30
32
  with tempfile.TemporaryDirectory(prefix="evpn-", dir="/tmp") as runtime:
31
33
  monkeypatch.setenv("EVO_OPENVPN_HOME", runtime)
32
34
  yield tmp_path
@@ -201,6 +203,62 @@ def test_split_tunnel_pins_its_server_around_openvpn(tmp_path, monkeypatch, plat
201
203
  assert not (tmp_path / "pwned").exists()
202
204
 
203
205
 
206
+ @pytest.mark.parametrize(
207
+ "output,gateway",
208
+ [
209
+ (" route to: 192.0.2.53\n gateway: 192.0.2.1\n interface: en0\n", "192.0.2.1"),
210
+ # On-link: no gateway line.
211
+ (" route to: 198.51.100.1\n interface: en0\n flags: <UP,HOST,DONE,LLINFO>\n", None),
212
+ ("", None),
213
+ ],
214
+ )
215
+ def test_gateway_to_reads_the_route(monkeypatch, output, gateway):
216
+ monkeypatch.setattr(vpn.subprocess, "run", lambda *a, **k: subprocess.CompletedProcess(a, 0, output, ""))
217
+ assert vpn.gateway_to("192.0.2.53") == gateway
218
+
219
+
220
+ def test_lan_resolvers_are_the_dns_servers_behind_the_gateway(tmp_path, monkeypatch):
221
+ conf = tmp_path / "resolv.conf"
222
+ conf.write_text(
223
+ "# comment\nsearch example\n"
224
+ "nameserver 192.0.2.53\n" # behind the gateway: a pushed route could take it
225
+ "nameserver 198.51.100.1\n" # on-link
226
+ "nameserver 203.0.113.9\n" # already behind another gateway (a tunnel)
227
+ "nameserver 127.0.0.1\nnameserver 169.254.1.1\nnameserver fe80::1%en0\nnameserver\n"
228
+ "nameserver 192.0.2.53\n"
229
+ )
230
+ routes = {"192.0.2.53": "192.0.2.1", "203.0.113.9": "10.8.0.1"}
231
+ asked = []
232
+ monkeypatch.setattr(vpn, "gateway_to", lambda address: asked.append(address) or routes.get(address))
233
+ monkeypatch.setattr(vpn, "default_gateway", lambda: "192.0.2.1")
234
+ assert vpn.lan_resolvers(conf) == ["192.0.2.53"]
235
+ assert "127.0.0.1" not in asked and "169.254.1.1" not in asked
236
+ assert vpn.lan_resolvers(tmp_path / "missing") == []
237
+ # No physical gateway (the default route is a tunnel's): nothing to pin to.
238
+ monkeypatch.setattr(vpn, "default_gateway", lambda: None)
239
+ assert vpn.lan_resolvers(conf) == []
240
+
241
+
242
+ @pytest.mark.parametrize("platform,pinned", [("darwin", [["192.0.2.53"]]), ("linux", [])])
243
+ def test_worker_pins_the_lan_resolvers_on_macos(store, monkeypatch, platform, pinned):
244
+ # A full-tunnel profile pins nothing of its own, so only the resolvers show.
245
+ vpn.save_profile("m1", {"config": CERT_ONLY})
246
+ monkeypatch.setattr(sys, "stdin", io.StringIO("\n"))
247
+ monkeypatch.setattr(vpn.os, "geteuid", lambda: 0)
248
+ monkeypatch.setattr(vpn.shutil, "which", lambda _: "/fake/openvpn")
249
+ monkeypatch.setattr(vpn.sys, "platform", platform)
250
+ monkeypatch.setattr(vpn, "lan_resolvers", lambda: ["192.0.2.53"])
251
+ seen = []
252
+ monkeypatch.setattr(vpn, "pin_remotes", lambda command, hosts: seen.append(hosts) or command)
253
+
254
+ def popen(command, **_):
255
+ raise OSError("stop before running anything")
256
+
257
+ monkeypatch.setattr(vpn.subprocess, "Popen", popen)
258
+ vpn.worker("m1", 10)
259
+ assert seen == pinned
260
+
261
+
204
262
  def test_no_pin_without_a_physical_gateway_or_address(monkeypatch):
205
263
  monkeypatch.setattr(vpn, "default_gateway", lambda: None)
206
264
  assert vpn.pin_remotes(["openvpn"], ["198.51.100.7 1194"]) == ["openvpn"]
@@ -1 +0,0 @@
1
- 0.36.4
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes