suxitunnel 0.1.1__tar.gz → 0.1.2__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.
- {suxitunnel-0.1.1 → suxitunnel-0.1.2}/.gitignore +4 -0
- {suxitunnel-0.1.1 → suxitunnel-0.1.2}/PKG-INFO +2 -2
- {suxitunnel-0.1.1 → suxitunnel-0.1.2}/README.md +1 -1
- {suxitunnel-0.1.1 → suxitunnel-0.1.2}/pyproject.toml +4 -1
- {suxitunnel-0.1.1 → suxitunnel-0.1.2}/suxitunnel.py +25 -12
- {suxitunnel-0.1.1 → suxitunnel-0.1.2}/LICENSE +0 -0
- {suxitunnel-0.1.1 → suxitunnel-0.1.2}/__init__.py +0 -0
- {suxitunnel-0.1.1 → suxitunnel-0.1.2}/examples/basic_example.py +0 -0
- {suxitunnel-0.1.1 → suxitunnel-0.1.2}/examples/context_manager.py +0 -0
- {suxitunnel-0.1.1 → suxitunnel-0.1.2}/examples/fastapi_example.py +0 -0
- {suxitunnel-0.1.1 → suxitunnel-0.1.2}/examples/flask_example.py +0 -0
- {suxitunnel-0.1.1 → suxitunnel-0.1.2}/examples/multiple_tunnels.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: suxitunnel
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.2
|
|
4
4
|
Summary: A simple Python library to expose local servers using Cloudflare Tunnel
|
|
5
5
|
Project-URL: Homepage, https://github.com/sadwx/suxitunnel
|
|
6
6
|
Project-URL: Repository, https://github.com/sadwx/suxitunnel
|
|
@@ -216,7 +216,7 @@ Your App (localhost:8000) → cloudflared → Cloudflare Edge → Internet
|
|
|
216
216
|
|
|
217
217
|
### Cloudflared Binary
|
|
218
218
|
|
|
219
|
-
The library automatically downloads the `cloudflared` binary on first use if it's not already installed. The binary is saved to
|
|
219
|
+
The library automatically downloads the `cloudflared` binary on first use if it's not already installed. The binary is saved to the library's installation directory.
|
|
220
220
|
|
|
221
221
|
Supported platforms:
|
|
222
222
|
- Linux (x64, ARM64)
|
|
@@ -193,7 +193,7 @@ Your App (localhost:8000) → cloudflared → Cloudflare Edge → Internet
|
|
|
193
193
|
|
|
194
194
|
### Cloudflared Binary
|
|
195
195
|
|
|
196
|
-
The library automatically downloads the `cloudflared` binary on first use if it's not already installed. The binary is saved to
|
|
196
|
+
The library automatically downloads the `cloudflared` binary on first use if it's not already installed. The binary is saved to the library's installation directory.
|
|
197
197
|
|
|
198
198
|
Supported platforms:
|
|
199
199
|
- Linux (x64, ARM64)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "suxitunnel"
|
|
3
|
-
version = "0.1.
|
|
3
|
+
version = "0.1.2"
|
|
4
4
|
description = "A simple Python library to expose local servers using Cloudflare Tunnel"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
license = "MIT"
|
|
@@ -47,5 +47,8 @@ include = [
|
|
|
47
47
|
[dependency-groups]
|
|
48
48
|
dev = [
|
|
49
49
|
"build>=1.4.0",
|
|
50
|
+
"fastapi>=0.128.0",
|
|
51
|
+
"flask>=3.1.2",
|
|
50
52
|
"twine>=6.2.0",
|
|
53
|
+
"uvicorn>=0.40.0",
|
|
51
54
|
]
|
|
@@ -86,8 +86,20 @@ class Tunnel:
|
|
|
86
86
|
# Start the tunnel
|
|
87
87
|
self._start()
|
|
88
88
|
|
|
89
|
+
def _get_library_dir(self) -> Path:
|
|
90
|
+
"""Get the directory where the library is located"""
|
|
91
|
+
return Path(__file__).parent
|
|
92
|
+
|
|
89
93
|
def _find_cloudflared(self) -> Optional[str]:
|
|
90
94
|
"""Try to find cloudflared in common locations"""
|
|
95
|
+
system = platform.system().lower()
|
|
96
|
+
binary_name = "cloudflared.exe" if system == "windows" else "cloudflared"
|
|
97
|
+
|
|
98
|
+
# First check the library directory (where downloaded binaries are stored)
|
|
99
|
+
lib_dir_path = self._get_library_dir() / binary_name
|
|
100
|
+
if lib_dir_path.exists():
|
|
101
|
+
return str(lib_dir_path)
|
|
102
|
+
|
|
91
103
|
# Check if in PATH
|
|
92
104
|
try:
|
|
93
105
|
result = subprocess.run(
|
|
@@ -99,29 +111,31 @@ class Tunnel:
|
|
|
99
111
|
return "cloudflared"
|
|
100
112
|
except (FileNotFoundError, subprocess.TimeoutExpired):
|
|
101
113
|
pass
|
|
102
|
-
|
|
114
|
+
|
|
103
115
|
# Check common install locations
|
|
104
116
|
possible_paths = [
|
|
105
117
|
"/usr/local/bin/cloudflared",
|
|
106
118
|
"/usr/bin/cloudflared",
|
|
107
119
|
str(Path.home() / "bin" / "cloudflared"),
|
|
108
120
|
str(Path.home() / ".local" / "bin" / "cloudflared"),
|
|
121
|
+
# Legacy download location
|
|
122
|
+
str(Path.home() / ".cloudflare-tunnel" / binary_name),
|
|
109
123
|
]
|
|
110
|
-
|
|
124
|
+
|
|
111
125
|
for path in possible_paths:
|
|
112
126
|
if Path(path).exists():
|
|
113
127
|
return path
|
|
114
|
-
|
|
128
|
+
|
|
115
129
|
return None
|
|
116
130
|
|
|
117
131
|
def _download_cloudflared(self) -> str:
|
|
118
132
|
"""Download cloudflared binary for the current platform"""
|
|
119
133
|
system = platform.system().lower()
|
|
120
134
|
machine = platform.machine().lower()
|
|
121
|
-
|
|
135
|
+
|
|
122
136
|
# Determine download URL
|
|
123
137
|
base_url = "https://github.com/cloudflare/cloudflared/releases/latest/download"
|
|
124
|
-
|
|
138
|
+
|
|
125
139
|
if system == "darwin": # macOS
|
|
126
140
|
if "arm" in machine or "aarch64" in machine:
|
|
127
141
|
filename = "cloudflared-darwin-arm64.tgz"
|
|
@@ -136,13 +150,12 @@ class Tunnel:
|
|
|
136
150
|
filename = "cloudflared-windows-amd64.exe"
|
|
137
151
|
else:
|
|
138
152
|
raise TunnelError(f"Unsupported platform: {system} {machine}")
|
|
139
|
-
|
|
153
|
+
|
|
140
154
|
download_url = f"{base_url}/{filename}"
|
|
141
|
-
|
|
142
|
-
# Download
|
|
143
|
-
download_dir =
|
|
144
|
-
|
|
145
|
-
|
|
155
|
+
|
|
156
|
+
# Download to the library directory
|
|
157
|
+
download_dir = self._get_library_dir()
|
|
158
|
+
|
|
146
159
|
if filename.endswith(".tgz"):
|
|
147
160
|
archive_path = download_dir / filename
|
|
148
161
|
binary_path = download_dir / "cloudflared"
|
|
@@ -150,7 +163,7 @@ class Tunnel:
|
|
|
150
163
|
binary_path = download_dir / "cloudflared.exe"
|
|
151
164
|
else:
|
|
152
165
|
binary_path = download_dir / "cloudflared"
|
|
153
|
-
|
|
166
|
+
|
|
154
167
|
# Check if already downloaded
|
|
155
168
|
if binary_path.exists():
|
|
156
169
|
return str(binary_path)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|