suxitunnel 0.1.0__py3-none-any.whl → 0.1.2__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.
.gitignore CHANGED
@@ -48,3 +48,7 @@ build/
48
48
 
49
49
  # Local cloudflared downloads
50
50
  .cloudflare-tunnel/
51
+ cloudflared
52
+ cloudflared.exe
53
+
54
+ .claude/settings.local.json
PKG-INFO CHANGED
@@ -1,11 +1,11 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: suxitunnel
3
- Version: 0.1.0
3
+ Version: 0.1.2
4
4
  Summary: A simple Python library to expose local servers using Cloudflare Tunnel
5
- Project-URL: Homepage, https://github.com/sadwx/cloudflare-tunnel
6
- Project-URL: Repository, https://github.com/sadwx/cloudflare-tunnel
7
- Project-URL: Issues, https://github.com/sadwx/cloudflare-tunnel/issues
8
- Project-URL: Documentation, https://github.com/sadwx/cloudflare-tunnel#readme
5
+ Project-URL: Homepage, https://github.com/sadwx/suxitunnel
6
+ Project-URL: Repository, https://github.com/sadwx/suxitunnel
7
+ Project-URL: Issues, https://github.com/sadwx/suxitunnel/issues
8
+ Project-URL: Documentation, https://github.com/sadwx/suxitunnel#readme
9
9
  Author-email: Simon <simon@suxi.world>
10
10
  License-Expression: MIT
11
11
  License-File: LICENSE
@@ -21,7 +21,7 @@ Requires-Python: >=3.14
21
21
  Requires-Dist: requests>=2.32.0
22
22
  Description-Content-Type: text/markdown
23
23
 
24
- # cloudflare-tunnel
24
+ # suxitunnel
25
25
 
26
26
  A simple Python library to expose your local server to the internet using Cloudflare's infrastructure.
27
27
 
@@ -30,13 +30,13 @@ Inspired by [localtunnel-py](https://github.com/gweidart/localtunnel-py) but usi
30
30
  ## Installation
31
31
 
32
32
  ```bash
33
- pip install cloudflare-tunnel
33
+ pip install suxitunnel
34
34
  ```
35
35
 
36
36
  ## Quick Start
37
37
 
38
38
  ```python
39
- from cloudflare_tunnel import Tunnel
39
+ from suxitunnel import Tunnel
40
40
 
41
41
  # Expose local port 8000
42
42
  tunnel = Tunnel(8000)
@@ -63,7 +63,7 @@ That's it! No configuration, no authentication, no manual setup.
63
63
  ### Basic Usage
64
64
 
65
65
  ```python
66
- from cloudflare_tunnel import Tunnel
66
+ from suxitunnel import Tunnel
67
67
 
68
68
  tunnel = Tunnel(8000)
69
69
  print(tunnel.url) # https://random-name.trycloudflare.com
@@ -76,7 +76,7 @@ tunnel.close() # Close when done
76
76
  ### Context Manager (Recommended)
77
77
 
78
78
  ```python
79
- from cloudflare_tunnel import Tunnel
79
+ from suxitunnel import Tunnel
80
80
 
81
81
  with Tunnel(8000) as tunnel:
82
82
  print(f"Public URL: {tunnel.url}")
@@ -88,7 +88,7 @@ with Tunnel(8000) as tunnel:
88
88
 
89
89
  ```python
90
90
  from flask import Flask
91
- from cloudflare_tunnel import Tunnel
91
+ from suxitunnel import Tunnel
92
92
  import threading
93
93
 
94
94
  app = Flask(__name__)
@@ -110,7 +110,7 @@ if __name__ == '__main__':
110
110
 
111
111
  ```python
112
112
  from fastapi import FastAPI
113
- from cloudflare_tunnel import Tunnel
113
+ from suxitunnel import Tunnel
114
114
  import uvicorn
115
115
 
116
116
  app = FastAPI()
@@ -191,7 +191,7 @@ tunnel.close()
191
191
  Convenience function to create a tunnel.
192
192
 
193
193
  ```python
194
- from cloudflare_tunnel import open_tunnel
194
+ from suxitunnel import open_tunnel
195
195
 
196
196
  tunnel = open_tunnel(8000)
197
197
  ```
@@ -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 `~/.cloudflare-tunnel/`.
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)
@@ -225,7 +225,7 @@ Supported platforms:
225
225
 
226
226
  ## Comparison with Alternatives
227
227
 
228
- | Feature | cloudflare-tunnel | localtunnel | ngrok |
228
+ | Feature | suxitunnel | localtunnel | ngrok |
229
229
  |---------|------------------|-------------|-------|
230
230
  | Free tier | ✅ Unlimited | ✅ Yes | ⚠️ Limited |
231
231
  | Custom domains | ❌ Random | ❌ Random | 💰 Paid |
@@ -343,8 +343,8 @@ See the `examples/` directory for complete working examples:
343
343
 
344
344
  ```bash
345
345
  # Clone the repo
346
- git clone https://github.com/sadwx/cloudflare-tunnel.git
347
- cd cloudflare-tunnel
346
+ git clone https://github.com/sadwx/suxitunnel.git
347
+ cd suxitunnel
348
348
 
349
349
  # Install in development mode
350
350
  pip install -e .
README.md CHANGED
@@ -1,4 +1,4 @@
1
- # cloudflare-tunnel
1
+ # suxitunnel
2
2
 
3
3
  A simple Python library to expose your local server to the internet using Cloudflare's infrastructure.
4
4
 
@@ -7,13 +7,13 @@ Inspired by [localtunnel-py](https://github.com/gweidart/localtunnel-py) but usi
7
7
  ## Installation
8
8
 
9
9
  ```bash
10
- pip install cloudflare-tunnel
10
+ pip install suxitunnel
11
11
  ```
12
12
 
13
13
  ## Quick Start
14
14
 
15
15
  ```python
16
- from cloudflare_tunnel import Tunnel
16
+ from suxitunnel import Tunnel
17
17
 
18
18
  # Expose local port 8000
19
19
  tunnel = Tunnel(8000)
@@ -40,7 +40,7 @@ That's it! No configuration, no authentication, no manual setup.
40
40
  ### Basic Usage
41
41
 
42
42
  ```python
43
- from cloudflare_tunnel import Tunnel
43
+ from suxitunnel import Tunnel
44
44
 
45
45
  tunnel = Tunnel(8000)
46
46
  print(tunnel.url) # https://random-name.trycloudflare.com
@@ -53,7 +53,7 @@ tunnel.close() # Close when done
53
53
  ### Context Manager (Recommended)
54
54
 
55
55
  ```python
56
- from cloudflare_tunnel import Tunnel
56
+ from suxitunnel import Tunnel
57
57
 
58
58
  with Tunnel(8000) as tunnel:
59
59
  print(f"Public URL: {tunnel.url}")
@@ -65,7 +65,7 @@ with Tunnel(8000) as tunnel:
65
65
 
66
66
  ```python
67
67
  from flask import Flask
68
- from cloudflare_tunnel import Tunnel
68
+ from suxitunnel import Tunnel
69
69
  import threading
70
70
 
71
71
  app = Flask(__name__)
@@ -87,7 +87,7 @@ if __name__ == '__main__':
87
87
 
88
88
  ```python
89
89
  from fastapi import FastAPI
90
- from cloudflare_tunnel import Tunnel
90
+ from suxitunnel import Tunnel
91
91
  import uvicorn
92
92
 
93
93
  app = FastAPI()
@@ -168,7 +168,7 @@ tunnel.close()
168
168
  Convenience function to create a tunnel.
169
169
 
170
170
  ```python
171
- from cloudflare_tunnel import open_tunnel
171
+ from suxitunnel import open_tunnel
172
172
 
173
173
  tunnel = open_tunnel(8000)
174
174
  ```
@@ -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 `~/.cloudflare-tunnel/`.
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)
@@ -202,7 +202,7 @@ Supported platforms:
202
202
 
203
203
  ## Comparison with Alternatives
204
204
 
205
- | Feature | cloudflare-tunnel | localtunnel | ngrok |
205
+ | Feature | suxitunnel | localtunnel | ngrok |
206
206
  |---------|------------------|-------------|-------|
207
207
  | Free tier | ✅ Unlimited | ✅ Yes | ⚠️ Limited |
208
208
  | Custom domains | ❌ Random | ❌ Random | 💰 Paid |
@@ -320,8 +320,8 @@ See the `examples/` directory for complete working examples:
320
320
 
321
321
  ```bash
322
322
  # Clone the repo
323
- git clone https://github.com/sadwx/cloudflare-tunnel.git
324
- cd cloudflare-tunnel
323
+ git clone https://github.com/sadwx/suxitunnel.git
324
+ cd suxitunnel
325
325
 
326
326
  # Install in development mode
327
327
  pip install -e .
pyproject.toml CHANGED
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "suxitunnel"
3
- version = "0.1.0"
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"
@@ -23,10 +23,10 @@ dependencies = [
23
23
  ]
24
24
 
25
25
  [project.urls]
26
- Homepage = "https://github.com/sadwx/cloudflare-tunnel"
27
- Repository = "https://github.com/sadwx/cloudflare-tunnel"
28
- Issues = "https://github.com/sadwx/cloudflare-tunnel/issues"
29
- Documentation = "https://github.com/sadwx/cloudflare-tunnel#readme"
26
+ Homepage = "https://github.com/sadwx/suxitunnel"
27
+ Repository = "https://github.com/sadwx/suxitunnel"
28
+ Issues = "https://github.com/sadwx/suxitunnel/issues"
29
+ Documentation = "https://github.com/sadwx/suxitunnel#readme"
30
30
 
31
31
  [build-system]
32
32
  requires = ["hatchling"]
@@ -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
  ]
@@ -1,11 +1,11 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: suxitunnel
3
- Version: 0.1.0
3
+ Version: 0.1.2
4
4
  Summary: A simple Python library to expose local servers using Cloudflare Tunnel
5
- Project-URL: Homepage, https://github.com/sadwx/cloudflare-tunnel
6
- Project-URL: Repository, https://github.com/sadwx/cloudflare-tunnel
7
- Project-URL: Issues, https://github.com/sadwx/cloudflare-tunnel/issues
8
- Project-URL: Documentation, https://github.com/sadwx/cloudflare-tunnel#readme
5
+ Project-URL: Homepage, https://github.com/sadwx/suxitunnel
6
+ Project-URL: Repository, https://github.com/sadwx/suxitunnel
7
+ Project-URL: Issues, https://github.com/sadwx/suxitunnel/issues
8
+ Project-URL: Documentation, https://github.com/sadwx/suxitunnel#readme
9
9
  Author-email: Simon <simon@suxi.world>
10
10
  License-Expression: MIT
11
11
  License-File: LICENSE
@@ -21,7 +21,7 @@ Requires-Python: >=3.14
21
21
  Requires-Dist: requests>=2.32.0
22
22
  Description-Content-Type: text/markdown
23
23
 
24
- # cloudflare-tunnel
24
+ # suxitunnel
25
25
 
26
26
  A simple Python library to expose your local server to the internet using Cloudflare's infrastructure.
27
27
 
@@ -30,13 +30,13 @@ Inspired by [localtunnel-py](https://github.com/gweidart/localtunnel-py) but usi
30
30
  ## Installation
31
31
 
32
32
  ```bash
33
- pip install cloudflare-tunnel
33
+ pip install suxitunnel
34
34
  ```
35
35
 
36
36
  ## Quick Start
37
37
 
38
38
  ```python
39
- from cloudflare_tunnel import Tunnel
39
+ from suxitunnel import Tunnel
40
40
 
41
41
  # Expose local port 8000
42
42
  tunnel = Tunnel(8000)
@@ -63,7 +63,7 @@ That's it! No configuration, no authentication, no manual setup.
63
63
  ### Basic Usage
64
64
 
65
65
  ```python
66
- from cloudflare_tunnel import Tunnel
66
+ from suxitunnel import Tunnel
67
67
 
68
68
  tunnel = Tunnel(8000)
69
69
  print(tunnel.url) # https://random-name.trycloudflare.com
@@ -76,7 +76,7 @@ tunnel.close() # Close when done
76
76
  ### Context Manager (Recommended)
77
77
 
78
78
  ```python
79
- from cloudflare_tunnel import Tunnel
79
+ from suxitunnel import Tunnel
80
80
 
81
81
  with Tunnel(8000) as tunnel:
82
82
  print(f"Public URL: {tunnel.url}")
@@ -88,7 +88,7 @@ with Tunnel(8000) as tunnel:
88
88
 
89
89
  ```python
90
90
  from flask import Flask
91
- from cloudflare_tunnel import Tunnel
91
+ from suxitunnel import Tunnel
92
92
  import threading
93
93
 
94
94
  app = Flask(__name__)
@@ -110,7 +110,7 @@ if __name__ == '__main__':
110
110
 
111
111
  ```python
112
112
  from fastapi import FastAPI
113
- from cloudflare_tunnel import Tunnel
113
+ from suxitunnel import Tunnel
114
114
  import uvicorn
115
115
 
116
116
  app = FastAPI()
@@ -191,7 +191,7 @@ tunnel.close()
191
191
  Convenience function to create a tunnel.
192
192
 
193
193
  ```python
194
- from cloudflare_tunnel import open_tunnel
194
+ from suxitunnel import open_tunnel
195
195
 
196
196
  tunnel = open_tunnel(8000)
197
197
  ```
@@ -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 `~/.cloudflare-tunnel/`.
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)
@@ -225,7 +225,7 @@ Supported platforms:
225
225
 
226
226
  ## Comparison with Alternatives
227
227
 
228
- | Feature | cloudflare-tunnel | localtunnel | ngrok |
228
+ | Feature | suxitunnel | localtunnel | ngrok |
229
229
  |---------|------------------|-------------|-------|
230
230
  | Free tier | ✅ Unlimited | ✅ Yes | ⚠️ Limited |
231
231
  | Custom domains | ❌ Random | ❌ Random | 💰 Paid |
@@ -343,8 +343,8 @@ See the `examples/` directory for complete working examples:
343
343
 
344
344
  ```bash
345
345
  # Clone the repo
346
- git clone https://github.com/sadwx/cloudflare-tunnel.git
347
- cd cloudflare-tunnel
346
+ git clone https://github.com/sadwx/suxitunnel.git
347
+ cd suxitunnel
348
348
 
349
349
  # Install in development mode
350
350
  pip install -e .
@@ -1,16 +1,16 @@
1
- ./.gitignore,sha256=P8LMWLmPLbZx9l9idXHBUuyZgTg2yS72dp3GhiNO-78,420
1
+ ./.gitignore,sha256=Zj2M7GCQqPm6hifX5LW6RkR6DYgZUaz9a4oYrGtoqWM,477
2
2
  ./LICENSE,sha256=1QbfFX4K5Hc9fT1l8GK3N8RQEXz4L9HfZKdd8HKthPQ,1053
3
- ./PKG-INFO,sha256=Ih7CtZJn_wLPbQOjpE9rGYKxmCQu5qCZdBL968MzQc8,10430
4
- ./README.md,sha256=oOsSyJdhoBl-fYvva-SphH3X1-beOFAZ89ssEH9uVSs,9405
3
+ ./PKG-INFO,sha256=-VEXmZc6Fp7x2KoA2Al1Z4GDUgs20zBLH49NaW8R7z4,10338
4
+ ./README.md,sha256=OCBSHbI1lbi9uAPzoejKcGpj6QEw8Y9CqLfHFp8D328,9341
5
5
  ./__init__.py,sha256=b37S0Mt7B88CPV2j_xJ5VLSqrvMvF-_K-vuSpdmGWFo,223
6
- ./pyproject.toml,sha256=LQFaEoQV_EfAjgpeP7hCgxrkul68pGgUY_PjiFS8gWI,1326
7
- ./suxitunnel.py,sha256=VmySlgkUAZ_cYfEiZ9_Jun_lBatoA_SgvGa6mITZETY,9662
6
+ ./pyproject.toml,sha256=VEOdkiwYsvv2PDvKScFRyyIFhRIcKfapA__OGeceX38,1365
7
+ ./suxitunnel.py,sha256=a5pULsz7kBz1nclGoz9fchL6xABLcg3BJ_f1ZgwU0zo,10126
8
8
  ./examples/basic_example.py,sha256=H3pYsBoliHwevU07Pgd91mZXEQRII2mwoSzTAso3LXo,1025
9
9
  ./examples/context_manager.py,sha256=0uWx04VN_7kPwOiMnMuhWA3MCl5kIW-cAV4c7cJov1o,2808
10
10
  ./examples/fastapi_example.py,sha256=zG4dN7O4DgZr9KLs-xP2PWE1vCBQDd7CRWlaioa85Fw,1353
11
11
  ./examples/flask_example.py,sha256=aRmfRqGxzp41scbIgRQb3BOj3oa1KKarSYsSHLJCgms,1243
12
12
  ./examples/multiple_tunnels.py,sha256=6lamM7g0nYKvxwWD5bTcnvVfXg_19eZ_np0bYt5neZA,3228
13
- suxitunnel-0.1.0.dist-info/METADATA,sha256=Ih7CtZJn_wLPbQOjpE9rGYKxmCQu5qCZdBL968MzQc8,10430
14
- suxitunnel-0.1.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
15
- suxitunnel-0.1.0.dist-info/licenses/LICENSE,sha256=1QbfFX4K5Hc9fT1l8GK3N8RQEXz4L9HfZKdd8HKthPQ,1053
16
- suxitunnel-0.1.0.dist-info/RECORD,,
13
+ suxitunnel-0.1.2.dist-info/METADATA,sha256=-VEXmZc6Fp7x2KoA2Al1Z4GDUgs20zBLH49NaW8R7z4,10338
14
+ suxitunnel-0.1.2.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
15
+ suxitunnel-0.1.2.dist-info/licenses/LICENSE,sha256=1QbfFX4K5Hc9fT1l8GK3N8RQEXz4L9HfZKdd8HKthPQ,1053
16
+ suxitunnel-0.1.2.dist-info/RECORD,,
suxitunnel.py CHANGED
@@ -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 location
143
- download_dir = Path.home() / ".cloudflare-tunnel"
144
- download_dir.mkdir(parents=True, exist_ok=True)
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)