aitun 2.19.0__py3-none-any.whl

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.
aitun/__init__.py ADDED
@@ -0,0 +1,2 @@
1
+ """AiTun - Secure Tunnel Service"""
2
+ __version__ = "2.19.0"
aitun/cli.py ADDED
@@ -0,0 +1,96 @@
1
+ #!/usr/bin/env python3
2
+ """AiTun Client CLI wrapper - downloads and runs the native binary."""
3
+
4
+ import os
5
+ import sys
6
+ import platform
7
+ import subprocess
8
+ import urllib.request
9
+ from pathlib import Path
10
+
11
+ GITHUB_REPO = "ctz168/tunnelgo"
12
+ DEFAULT_SERVER = "aitun.cc:6639"
13
+ VERSION = "2.19.0"
14
+
15
+ def get_bin_dir():
16
+ return Path(__file__).parent / "bin"
17
+
18
+ def get_platform_suffix():
19
+ system = platform.system().lower()
20
+ machine = platform.machine().lower()
21
+ if system == "linux":
22
+ if machine in ("x86_64", "amd64"):
23
+ return "tunnelgo-client-linux-amd64"
24
+ elif machine in ("aarch64", "arm64"):
25
+ return "tunnelgo-client-linux-arm64"
26
+ elif system == "darwin":
27
+ if machine in ("x86_64", "amd64", "i386"):
28
+ return "tunnelgo-client-darwin-amd64"
29
+ elif machine in ("arm64",):
30
+ return "tunnelgo-client-darwin-arm64"
31
+ elif system == "windows":
32
+ return "tunnelgo-client-windows-amd64.exe"
33
+ return None
34
+
35
+ def get_binary_path():
36
+ suffix = get_platform_suffix()
37
+ if suffix is None:
38
+ return None
39
+ return get_bin_dir() / suffix
40
+
41
+ def download_binary(force=False):
42
+ binary_path = get_binary_path()
43
+ if binary_path is None:
44
+ print(f"Error: Unsupported platform: {platform.system()}/{platform.machine()}")
45
+ sys.exit(1)
46
+ if binary_path.exists() and not force:
47
+ return binary_path
48
+ binary_path.parent.mkdir(parents=True, exist_ok=True)
49
+ suffix = get_platform_suffix()
50
+ download_url = f"https://aitun.cc/downloads/{suffix}"
51
+ print(f"Downloading AiTun client v{VERSION} for {platform.system()}/{platform.machine()}...")
52
+ try:
53
+ req = urllib.request.Request(download_url, headers={"User-Agent": "aitun-pip"})
54
+ with urllib.request.urlopen(req, timeout=120) as resp:
55
+ data = resp.read()
56
+ with open(binary_path, 'wb') as f:
57
+ f.write(data)
58
+ os.chmod(binary_path, 0o755)
59
+ print(f"Download complete: {binary_path}")
60
+ return binary_path
61
+ except Exception as e:
62
+ gh_url = f"https://github.com/{GITHUB_REPO}/releases/latest/download/{suffix}"
63
+ print(f"Primary download failed, trying GitHub: {gh_url}")
64
+ try:
65
+ req = urllib.request.Request(gh_url, headers={"User-Agent": "aitun-pip"})
66
+ with urllib.request.urlopen(req, timeout=120) as resp:
67
+ data = resp.read()
68
+ with open(binary_path, 'wb') as f:
69
+ f.write(data)
70
+ os.chmod(binary_path, 0o755)
71
+ print(f"Download complete: {binary_path}")
72
+ return binary_path
73
+ except Exception as e2:
74
+ print(f"Error: Failed to download client binary: {e2}")
75
+ sys.exit(1)
76
+
77
+ def main():
78
+ binary_path = get_binary_path()
79
+ if binary_path is None or not binary_path.exists():
80
+ binary_path = download_binary()
81
+ args = sys.argv[1:]
82
+ has_server = any(a in args for a in ('-s', '--server'))
83
+ if not has_server:
84
+ args = ['-s', DEFAULT_SERVER] + args
85
+ try:
86
+ result = subprocess.run([str(binary_path)] + args)
87
+ sys.exit(result.returncode)
88
+ except FileNotFoundError:
89
+ print(f"Error: Client binary not found at {binary_path}")
90
+ print("Try running: aitun download")
91
+ sys.exit(1)
92
+ except KeyboardInterrupt:
93
+ sys.exit(130)
94
+
95
+ if __name__ == "__main__":
96
+ main()
aitun/connect_cli.py ADDED
@@ -0,0 +1,82 @@
1
+ #!/usr/bin/env python3
2
+ """AiTun Connect CLI wrapper - for connecting to remote tunnel TCP services."""
3
+
4
+ import os
5
+ import sys
6
+ import platform
7
+ import subprocess
8
+ import urllib.request
9
+ from pathlib import Path
10
+
11
+ GITHUB_REPO = "ctz168/tunnelgo"
12
+ DEFAULT_SERVER = "aitun.cc:6639"
13
+
14
+ def get_bin_dir():
15
+ return Path(__file__).parent / "bin"
16
+
17
+ def get_connect_platform_suffix():
18
+ system = platform.system().lower()
19
+ machine = platform.machine().lower()
20
+ if system == "linux":
21
+ if machine in ("x86_64", "amd64"):
22
+ return "tunnelgo-connect-linux-amd64"
23
+ elif machine in ("aarch64", "arm64"):
24
+ return "tunnelgo-connect-linux-arm64"
25
+ elif system == "darwin":
26
+ if machine in ("x86_64", "amd64", "i386"):
27
+ return "tunnelgo-connect-darwin-amd64"
28
+ elif machine in ("arm64",):
29
+ return "tunnelgo-connect-darwin-arm64"
30
+ elif system == "windows":
31
+ return "tunnelgo-connect-windows-amd64.exe"
32
+ return None
33
+
34
+ def get_connect_binary_path():
35
+ suffix = get_connect_platform_suffix()
36
+ if suffix is None:
37
+ return None
38
+ return get_bin_dir() / suffix
39
+
40
+ def download_connect_binary(force=False):
41
+ binary_path = get_connect_binary_path()
42
+ if binary_path is None:
43
+ print(f"Error: Unsupported platform: {platform.system()}/{platform.machine()}")
44
+ sys.exit(1)
45
+ if binary_path.exists() and not force:
46
+ return binary_path
47
+ binary_path.parent.mkdir(parents=True, exist_ok=True)
48
+ suffix = get_connect_platform_suffix()
49
+ download_url = f"https://aitun.cc/downloads/{suffix}"
50
+ print(f"Downloading AiTun connect tool for {platform.system()}/{platform.machine()}...")
51
+ try:
52
+ req = urllib.request.Request(download_url, headers={"User-Agent": "aitun-pip"})
53
+ with urllib.request.urlopen(req, timeout=120) as resp:
54
+ data = resp.read()
55
+ with open(binary_path, 'wb') as f:
56
+ f.write(data)
57
+ os.chmod(binary_path, 0o755)
58
+ print(f"Download complete: {binary_path}")
59
+ return binary_path
60
+ except Exception as e:
61
+ print(f"Error: Failed to download connect binary: {e}")
62
+ sys.exit(1)
63
+
64
+ def main():
65
+ binary_path = get_connect_binary_path()
66
+ if binary_path is None or not binary_path.exists():
67
+ binary_path = download_connect_binary()
68
+ args = sys.argv[1:]
69
+ has_server = any(a in args for a in ('-s', '--server'))
70
+ if not has_server:
71
+ args = ['-s', DEFAULT_SERVER] + args
72
+ try:
73
+ result = subprocess.run([str(binary_path)] + args)
74
+ sys.exit(result.returncode)
75
+ except FileNotFoundError:
76
+ print(f"Error: Connect binary not found at {binary_path}")
77
+ sys.exit(1)
78
+ except KeyboardInterrupt:
79
+ sys.exit(130)
80
+
81
+ if __name__ == "__main__":
82
+ main()
@@ -0,0 +1,64 @@
1
+ Metadata-Version: 2.4
2
+ Name: aitun
3
+ Version: 2.19.0
4
+ Summary: AiTun - Secure tunnel service that exposes local servers to the public internet, supporting IPv6/IPv4 P2P and relay modes
5
+ Author-email: AiTun <admin@aitun.cc>
6
+ License: MIT
7
+ Project-URL: Homepage, https://aitun.cc
8
+ Project-URL: Documentation, https://aitun.cc
9
+ Project-URL: Repository, https://github.com/ctz168/tunnelgo
10
+ Keywords: tunnel,ngrok,nat-traversal,p2p,reverse-proxy,aitun
11
+ Classifier: Development Status :: 5 - Production/Stable
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Topic :: Internet :: Proxy Servers
17
+ Classifier: Topic :: System :: Networking
18
+ Requires-Python: >=3.7
19
+ Description-Content-Type: text/markdown
20
+
21
+ # AiTun - Secure Tunnel Service
22
+
23
+ AiTun is a secure tunnel service that exposes local servers to the public internet, supporting IPv6/IPv4 P2P direct connection and server relay.
24
+
25
+ ## Installation
26
+
27
+ ```bash
28
+ pip install aitun
29
+ ```
30
+
31
+ ## Quick Start
32
+
33
+ ```bash
34
+ # Start a tunnel for your local service on port 8080
35
+ aitun -s aitun.cc:6639 -l 8080
36
+
37
+ # Or use the legacy command name
38
+ tunnelgo-client -s aitun.cc:6639 -l 8080
39
+
40
+ # Connect to a remote tunnel
41
+ aitun-connect -s aitun.cc:6639 -t <tunnel-id>
42
+ ```
43
+
44
+ ## Features
45
+
46
+ - P2P direct connection (IPv6/IPv4)
47
+ - Server relay fallback
48
+ - Custom subdomains (e.g., myapp.t.aitun.cc)
49
+ - End-to-end encryption
50
+ - Cross-platform support (Linux, macOS, Windows)
51
+ - Easy pip installation with auto-downloaded binaries
52
+
53
+ ## Commands
54
+
55
+ After installation, the following commands are available:
56
+
57
+ - `aitun` - Start a tunnel client (alias: `tunnelgo-client`)
58
+ - `aitun-connect` - Connect to a remote tunnel (alias: `tunnelgo-connect`)
59
+
60
+ ## Links
61
+
62
+ - Website: https://aitun.cc
63
+ - Downloads: https://aitun.cc/downloads/
64
+ - GitHub: https://github.com/ctz168/tunnelgo
@@ -0,0 +1,8 @@
1
+ aitun/__init__.py,sha256=mQpfzectjLDGNpDmWgtps7mWEbTSBPLDx454M2vsGN0,59
2
+ aitun/cli.py,sha256=1mjc6f_vMEDndL_zNZRszG5u3vnS0E2oyj92MevOawY,3393
3
+ aitun/connect_cli.py,sha256=gQQyhhY-UyM1_m16CUN8xsEaq7O1JqR1u62m9Z8vc-w,2796
4
+ aitun-2.19.0.dist-info/METADATA,sha256=mjxgxIk4C6hHuYKp0rNoEPQb6Nz542fC5hmhDLn-FSY,1906
5
+ aitun-2.19.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
6
+ aitun-2.19.0.dist-info/entry_points.txt,sha256=qNaGC1NCine3n-_fKao5D2PurqQdEICy7BbCsyrm0PU,155
7
+ aitun-2.19.0.dist-info/top_level.txt,sha256=miR8nfzrkMzzGfZF37a0qwnJcvTYjy0MFGUgRxWutiY,6
8
+ aitun-2.19.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (82.0.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,5 @@
1
+ [console_scripts]
2
+ aitun = aitun.cli:main
3
+ aitun-connect = aitun.connect_cli:main
4
+ tunnelgo-client = aitun.cli:main
5
+ tunnelgo-connect = aitun.connect_cli:main
@@ -0,0 +1 @@
1
+ aitun