bypass-vpn 1.0.0 → 1.1.0

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.
package/README.md CHANGED
@@ -70,6 +70,10 @@ Routes are ephemeral — they reset on reboot or network change. Re-run as neede
70
70
  npm uninstall -g bypass-vpn
71
71
  ```
72
72
 
73
+ ## Credits
74
+
75
+ Idea by [Sourabh Khot](https://github.com/sourabh-khot65)
76
+
73
77
  ## License
74
78
 
75
79
  MIT
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "bypass-vpn",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "Route AI service traffic (Claude, ChatGPT, Firebase) through Wi-Fi gateway to bypass VPN",
5
5
  "bin": {
6
- "bypass-vpn": "./bin/bypass-vpn.js"
6
+ "bypass-vpn": "bin/bypass-vpn.js"
7
7
  },
8
8
  "engines": {
9
9
  "node": ">=16.0.0"
@@ -27,6 +27,6 @@
27
27
  "license": "MIT",
28
28
  "repository": {
29
29
  "type": "git",
30
- "url": "https://github.com/ProjectAJ14/bypass-ai-vpn"
30
+ "url": "git+https://github.com/ProjectAJ14/bypass-ai-vpn.git"
31
31
  }
32
32
  }
package/src/resolver.js CHANGED
@@ -1,12 +1,39 @@
1
+ const { execSync } = require('child_process');
1
2
  const dns = require('dns');
2
3
  const dnsPromises = dns.promises;
3
4
 
5
+ /**
6
+ * Resolve a domain using `dig` — works outside VPN tunnel.
7
+ * Falls back to Node.js DNS if `dig` is unavailable.
8
+ */
9
+ function resolveDomain(domain) {
10
+ try {
11
+ const output = execSync(`dig +short +time=3 "${domain}"`, {
12
+ timeout: 5000,
13
+ encoding: 'utf8',
14
+ });
15
+ const ips = output
16
+ .split('\n')
17
+ .map((line) => line.trim())
18
+ .filter((line) => /^\d+\.\d+\.\d+\.\d+$/.test(line));
19
+ if (ips.length > 0) return ips;
20
+ } catch {
21
+ // dig not available or failed — fall through to Node DNS
22
+ }
23
+ return null;
24
+ }
25
+
4
26
  async function resolveAll(domains) {
5
27
  const resolved = new Map();
6
28
  const failed = [];
7
29
 
8
30
  const results = await Promise.allSettled(
9
31
  domains.map(async (domain) => {
32
+ // Try dig first (bypasses VPN DNS interception)
33
+ const digIps = resolveDomain(domain);
34
+ if (digIps) return { domain, ips: digIps };
35
+
36
+ // Fallback to Node.js built-in DNS
10
37
  const ips = await withTimeout(dnsPromises.resolve4(domain), 5000);
11
38
  return { domain, ips };
12
39
  })
@@ -21,7 +48,6 @@ async function resolveAll(domains) {
21
48
  failed.push(domain);
22
49
  }
23
50
  } else {
24
- // Extract domain from the original array by index
25
51
  const idx = results.indexOf(result);
26
52
  failed.push(domains[idx]);
27
53
  }