neruton 0.2.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.
- neruton/__init__.py +107 -0
- neruton/__main__.py +10 -0
- neruton/_version.py +11 -0
- neruton/cli.py +258 -0
- neruton/client.py +1017 -0
- neruton/config.py +188 -0
- neruton/errors.py +64 -0
- neruton/forwarder.py +810 -0
- neruton/protocol.py +358 -0
- neruton/py.typed +0 -0
- neruton/ui.py +127 -0
- neruton/yamux.py +974 -0
- neruton-0.2.0.dist-info/METADATA +136 -0
- neruton-0.2.0.dist-info/RECORD +18 -0
- neruton-0.2.0.dist-info/WHEEL +5 -0
- neruton-0.2.0.dist-info/entry_points.txt +2 -0
- neruton-0.2.0.dist-info/licenses/LICENSE +21 -0
- neruton-0.2.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: neruton
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Native pure-Python tunnel client & SDK for Neruton (WSS + Yamux HTTP/WebSocket intranet proxy)
|
|
5
|
+
Author: neruton contributors
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/kaecho/neruton
|
|
8
|
+
Project-URL: Repository, https://github.com/kaecho/neruton
|
|
9
|
+
Project-URL: Issues, https://github.com/kaecho/neruton/issues
|
|
10
|
+
Keywords: neruton,tunnel,proxy,yamux,websocket,intranet,reverse-proxy,cloudflared
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Environment :: Web Environment
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Intended Audience :: System Administrators
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
24
|
+
Classifier: Topic :: Internet :: Proxy Servers
|
|
25
|
+
Classifier: Topic :: Internet :: WWW/HTTP
|
|
26
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
27
|
+
Classifier: Typing :: Typed
|
|
28
|
+
Requires-Python: >=3.9
|
|
29
|
+
Description-Content-Type: text/markdown
|
|
30
|
+
License-File: LICENSE
|
|
31
|
+
Requires-Dist: websockets>=12.0
|
|
32
|
+
Requires-Dist: tomli>=2.0.1; python_version < "3.11"
|
|
33
|
+
Provides-Extra: dev
|
|
34
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
35
|
+
Dynamic: license-file
|
|
36
|
+
|
|
37
|
+
# neruton (Python SDK & CLI)
|
|
38
|
+
|
|
39
|
+
Native pure-Python tunnel client & SDK for [Neruton](https://github.com/kaecho/neruton) — self-hosted intranet penetration, wildcard subdomain reverse proxy, and WebSocket tunneling over port 443 (`WSS + Yamux`).
|
|
40
|
+
|
|
41
|
+
- **100% pure Python** (no Rust binary wrapper, no C extensions) implementing the exact Neruton control protocol and **Yamux v0** multiplexer byte-for-byte compatible with `neruton-server` (`yamux 0.13`).
|
|
42
|
+
- **Async & Sync Python APIs** with full PEP 561 type annotations (`py.typed`).
|
|
43
|
+
- **Drop-in CLI** (`neruton` and `python -m neruton`) sharing `~/.config/neruton/config.toml` (`0600`) and `NERUTON_SERVER` / `NERUTON_TOKEN` environment variables with the Rust CLI.
|
|
44
|
+
- **Full HTTP/1.1 & WebSocket forwarding** with Host rewriting, chunked streaming, local HTTPS (`--no-tls-verify`), automatic reconnect with sticky prefix, and fail-fast on HTTP 401 auth errors.
|
|
45
|
+
|
|
46
|
+
## Installation
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
pip install neruton
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Requires Python 3.9+.
|
|
53
|
+
|
|
54
|
+
## Quick Start — Python SDK
|
|
55
|
+
|
|
56
|
+
### Async API (`asyncio` / FastAPI / Starlette / aiohttp)
|
|
57
|
+
|
|
58
|
+
```python
|
|
59
|
+
import asyncio
|
|
60
|
+
import neruton
|
|
61
|
+
|
|
62
|
+
async def main() -> None:
|
|
63
|
+
async with neruton.connect(
|
|
64
|
+
url="http://127.0.0.1:3000",
|
|
65
|
+
server="https://neruton.moer.eu.org",
|
|
66
|
+
token="ntk_your_token_here",
|
|
67
|
+
subdomain="my-app", # optional; auto-assigns UUID v4 if omitted
|
|
68
|
+
) as tunnel:
|
|
69
|
+
print("Public URL :", tunnel.public_url)
|
|
70
|
+
print("Preview URL:", tunnel.preview_url)
|
|
71
|
+
print("Path URL :", tunnel.path_url)
|
|
72
|
+
print("Prefix :", tunnel.prefix)
|
|
73
|
+
await tunnel.wait()
|
|
74
|
+
|
|
75
|
+
asyncio.run(main())
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Shorthand helpers for local ports:
|
|
79
|
+
|
|
80
|
+
```python
|
|
81
|
+
async with neruton.forward(3000, subdomain="my-app") as tunnel:
|
|
82
|
+
print(tunnel.public_url)
|
|
83
|
+
|
|
84
|
+
# Alias matching `neruton http 8080`:
|
|
85
|
+
tunnel = await neruton.http(8080)
|
|
86
|
+
try:
|
|
87
|
+
print(tunnel.public_url)
|
|
88
|
+
finally:
|
|
89
|
+
await tunnel.close()
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Sync API (Flask / Django / Scripts / Notebooks)
|
|
93
|
+
|
|
94
|
+
`neruton.open(...)` runs the tunnel's `asyncio` event loop on a dedicated daemon thread and shuts down cleanly when exiting the `with` block:
|
|
95
|
+
|
|
96
|
+
```python
|
|
97
|
+
import neruton
|
|
98
|
+
|
|
99
|
+
with neruton.open(5000, server="https://neruton.moer.eu.org", token="ntk_your_token_here") as tunnel:
|
|
100
|
+
print("Tunnel live at:", tunnel.public_url)
|
|
101
|
+
app.run(port=5000)
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Config Helpers
|
|
105
|
+
|
|
106
|
+
```python
|
|
107
|
+
import neruton
|
|
108
|
+
|
|
109
|
+
print(neruton.config_path()) # ~/.config/neruton/config.toml
|
|
110
|
+
neruton.save_config(server="https://neruton.moer.eu.org", token="ntk_your_token_here")
|
|
111
|
+
cfg = neruton.load_config()
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Quick Start — CLI
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
# Save default server and tunnel token (writes mode 0600 config.toml)
|
|
118
|
+
neruton config set --server https://neruton.moer.eu.org --token ntk_your_token_here
|
|
119
|
+
neruton config show
|
|
120
|
+
neruton config path
|
|
121
|
+
|
|
122
|
+
# Forward a local port with an auto-generated UUID v4 subdomain
|
|
123
|
+
neruton http 3000
|
|
124
|
+
|
|
125
|
+
# Forward with a custom subdomain prefix
|
|
126
|
+
neruton http 8080 -s my-app
|
|
127
|
+
neruton tunnel --url http://127.0.0.1:3000 --subdomain my-app
|
|
128
|
+
|
|
129
|
+
# Or invoke as a Python module
|
|
130
|
+
python -m neruton http 3000
|
|
131
|
+
python -m neruton version
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## License
|
|
135
|
+
|
|
136
|
+
MIT
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
neruton/__init__.py,sha256=EA5rxbzV8BBmq1p7gi3n-AkFb7c2ueVtbYgznmG1AnA,2407
|
|
2
|
+
neruton/__main__.py,sha256=V_MKvkP8dUJuZRm0tY1Zj6zYaHAVyOXCP7F4aYPzSYo,174
|
|
3
|
+
neruton/_version.py,sha256=ZHccx8ITrPj70xjM7NOYWPdf6Kd3pzV8Zy40YBUDbgc,308
|
|
4
|
+
neruton/cli.py,sha256=tIH3zMSy45AcfFVFTylDqku1rjjkuEWj25o5oe73Iko,8444
|
|
5
|
+
neruton/client.py,sha256=czYErLQAZfT2iQW9Vc0ZRaljf3SwbRbQlgppizsCTek,33798
|
|
6
|
+
neruton/config.py,sha256=w2YvV2K6sGiZ1yXObArGwpSmiQ2xGdh6GmoU0kpWO6M,5901
|
|
7
|
+
neruton/errors.py,sha256=gFpyLB-F8vX-sxYjpAJVM3Pb900qSkCPm52A00Kwtdk,1819
|
|
8
|
+
neruton/forwarder.py,sha256=1nJglwtetb-HzEG-goKk6kvtwBp9YLfBHLHHZR6dgTM,27380
|
|
9
|
+
neruton/protocol.py,sha256=edLMfWZg3BN_LmFnoo4f3jI8sXjnMPos_j8-J8ovsJ8,11937
|
|
10
|
+
neruton/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
11
|
+
neruton/ui.py,sha256=T7WheEO4lS_20Rc1d-KpeIfX4fxyNFkY8OL2sRhpPuQ,3699
|
|
12
|
+
neruton/yamux.py,sha256=Bio6aiNiYz_tNxoVPDfUnXoTPVyWcq7HNrK-dp_b8yY,34648
|
|
13
|
+
neruton-0.2.0.dist-info/licenses/LICENSE,sha256=AVMUjtjWtdd3xg5yB9dHZ_1FbFHd4029IOXzUgCwIHU,1077
|
|
14
|
+
neruton-0.2.0.dist-info/METADATA,sha256=JA1oMRBW0BcgMwOh_--q3EqIhWGTDgnEnyaWtYY7oTo,4622
|
|
15
|
+
neruton-0.2.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
16
|
+
neruton-0.2.0.dist-info/entry_points.txt,sha256=fe1zf6Ebnuu5hRIZ3AB0rEFV0mh4cGvlPCfNXxKoweA,45
|
|
17
|
+
neruton-0.2.0.dist-info/top_level.txt,sha256=IFkPnGCqDcxVDah01EFCTQdLK4ejUqf-v5zOsV2fqPg,8
|
|
18
|
+
neruton-0.2.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 neruton contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
neruton
|