veltix 1.0.0__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.
- veltix-1.0.0/LICENSE +21 -0
- veltix-1.0.0/PKG-INFO +215 -0
- veltix-1.0.0/README.md +189 -0
- veltix-1.0.0/Veltix/__init__.py +10 -0
- veltix-1.0.0/Veltix/exceptions.py +28 -0
- veltix-1.0.0/pyproject.toml +55 -0
- veltix-1.0.0/setup.cfg +4 -0
- veltix-1.0.0/tests/test_basic.py +185 -0
- veltix-1.0.0/veltix.egg-info/PKG-INFO +215 -0
- veltix-1.0.0/veltix.egg-info/SOURCES.txt +11 -0
- veltix-1.0.0/veltix.egg-info/dependency_links.txt +1 -0
- veltix-1.0.0/veltix.egg-info/requires.txt +4 -0
- veltix-1.0.0/veltix.egg-info/top_level.txt +1 -0
veltix-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 NytroxDev
|
|
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.
|
veltix-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: veltix
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: The networking library you always wanted
|
|
5
|
+
Author-email: Nytrox <nytrox.dev@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/NytroxDev/Veltix
|
|
8
|
+
Project-URL: Repository, https://github.com/NytroxDev/Veltix
|
|
9
|
+
Project-URL: Issues, https://github.com/NytroxDev/Veltix/issues
|
|
10
|
+
Keywords: networking,tcp,protocol,binary,socket,server,client
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
18
|
+
Classifier: Topic :: System :: Networking
|
|
19
|
+
Requires-Python: >=3.10
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
Provides-Extra: dev
|
|
23
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
24
|
+
Requires-Dist: pytest-cov>=4.0; extra == "dev"
|
|
25
|
+
Dynamic: license-file
|
|
26
|
+
|
|
27
|
+
# Veltix
|
|
28
|
+
|
|
29
|
+
> The networking library you always wanted
|
|
30
|
+
|
|
31
|
+
[](https://pypi.org/project/veltix/)
|
|
32
|
+
[](https://pypi.org/project/veltix/)
|
|
33
|
+
[](https://github.com/NytroxDev/Veltix/blob/main/LICENSE)
|
|
34
|
+
|
|
35
|
+
## β¨ Features
|
|
36
|
+
|
|
37
|
+
- π **Dead simple API** - Get started in minutes, not hours
|
|
38
|
+
- π **Message integrity** - Built-in SHA256 hash verification
|
|
39
|
+
- π¦ **Custom binary protocol** - Lightweight and efficient
|
|
40
|
+
- πͺΆ **Zero dependencies** - Pure Python stdlib only
|
|
41
|
+
- π **Extensible** - Custom message types with plugin support
|
|
42
|
+
- β‘ **Multi-threaded** - Handle multiple clients automatically
|
|
43
|
+
|
|
44
|
+
## π Why Veltix?
|
|
45
|
+
|
|
46
|
+
Existing Python networking libraries are either too low-level (raw sockets) or too complex (Twisted, asyncio). Veltix
|
|
47
|
+
fills the gap with a simple, modern API that handles the boring parts for you.
|
|
48
|
+
|
|
49
|
+
Built by a passionate developer who wanted networking to be easy, Veltix focuses on developer experience without
|
|
50
|
+
sacrificing power or performance.
|
|
51
|
+
|
|
52
|
+
## π Installation
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
pip install veltix
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
**Requirements:** Python 3.10+
|
|
59
|
+
|
|
60
|
+
**That's it!** Zero dependencies, ready to use.
|
|
61
|
+
|
|
62
|
+
## β‘ Quick Start
|
|
63
|
+
|
|
64
|
+
### Simple Chat Server
|
|
65
|
+
|
|
66
|
+
**Server (server.py):**
|
|
67
|
+
|
|
68
|
+
```python
|
|
69
|
+
from veltix import Server, ServerConfig, MessageType, Request, Binding
|
|
70
|
+
|
|
71
|
+
# Define message type
|
|
72
|
+
CHAT = MessageType(code=200, name="chat")
|
|
73
|
+
|
|
74
|
+
# Configure server
|
|
75
|
+
config = ServerConfig(host="0.0.0.0", port=8080)
|
|
76
|
+
server = Server(config)
|
|
77
|
+
sender = server.get_sender()
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def on_message(client, response):
|
|
81
|
+
print(f"[{client.addr[0]}] {response.content.decode()}")
|
|
82
|
+
# Broadcast to all
|
|
83
|
+
reply = Request(CHAT, f"Echo: {response.content.decode()}".encode())
|
|
84
|
+
sender.broadcast(reply, server.get_all_clients_sockets())
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
server.bind(Binding.ON_RECV, on_message)
|
|
88
|
+
server.start()
|
|
89
|
+
|
|
90
|
+
input("Press Enter to stop...")
|
|
91
|
+
server.close_all()
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
**Client (client.py):**
|
|
95
|
+
|
|
96
|
+
```python
|
|
97
|
+
from veltix import Client, ClientConfig, MessageType, Request, Binding
|
|
98
|
+
|
|
99
|
+
CHAT = MessageType(code=200, name="chat")
|
|
100
|
+
|
|
101
|
+
config = ClientConfig(server_addr="127.0.0.1", port=8080)
|
|
102
|
+
client = Client(config)
|
|
103
|
+
sender = client.get_sender()
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
def on_message(response):
|
|
107
|
+
print(f"Server: {response.content.decode()}")
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
client.bind(Binding.ON_RECV, on_message)
|
|
111
|
+
client.connect()
|
|
112
|
+
|
|
113
|
+
# Send message
|
|
114
|
+
msg = Request(CHAT, b"Hello Server!")
|
|
115
|
+
sender.send(msg)
|
|
116
|
+
|
|
117
|
+
input("Press Enter to disconnect...")
|
|
118
|
+
client.disconnect()
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
**Run:**
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
python server.py
|
|
125
|
+
python client.py # In another terminal
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## π¦ Examples
|
|
129
|
+
|
|
130
|
+
More examples in [`examples/`](examples/):
|
|
131
|
+
|
|
132
|
+
- **Echo Server** - Simple echo implementation
|
|
133
|
+
- **File Transfer** - Send files over network
|
|
134
|
+
- **Custom Types** - Define your message types
|
|
135
|
+
- **Advanced Sender** - Complex messaging patterns
|
|
136
|
+
|
|
137
|
+
## π Comparison
|
|
138
|
+
|
|
139
|
+
| Feature | Veltix | socket | asyncio | Twisted |
|
|
140
|
+
|-------------------|--------|--------|---------|---------|
|
|
141
|
+
| Easy API | β
| β | β οΈ | β |
|
|
142
|
+
| Zero deps | β
| β
| β
| β |
|
|
143
|
+
| Custom protocol | β
| β | β | β οΈ |
|
|
144
|
+
| Message integrity | β
| β | β | β |
|
|
145
|
+
| Multi-threading | β
| β | β | β
|
|
|
146
|
+
|
|
147
|
+
## πΊοΈ Roadmap
|
|
148
|
+
|
|
149
|
+
### v1.0.0 - Foundation (March 2026)
|
|
150
|
+
|
|
151
|
+
- Core TCP server/client
|
|
152
|
+
- Binary protocol with SHA256 integrity
|
|
153
|
+
- Custom message types
|
|
154
|
+
- Zero dependencies
|
|
155
|
+
- **Status: IN PROGRESS**
|
|
156
|
+
|
|
157
|
+
### v2.0.0 - Security (Summer 2026)
|
|
158
|
+
|
|
159
|
+
- End-to-end encryption (ChaCha20 + X25519 + Ed25519)
|
|
160
|
+
- Automatic key exchange
|
|
161
|
+
- Perfect forward secrecy
|
|
162
|
+
- **Status: PLANNED**
|
|
163
|
+
|
|
164
|
+
### v3.0.0 - Performance (Fall 2026)
|
|
165
|
+
|
|
166
|
+
- Rust core via PyO3
|
|
167
|
+
- 10-100x speed improvements
|
|
168
|
+
- Advanced optimizations
|
|
169
|
+
- **Status: RESEARCH**
|
|
170
|
+
|
|
171
|
+
### v4.0.0+ (2027+)
|
|
172
|
+
|
|
173
|
+
- UDP support
|
|
174
|
+
- Plugin ecosystem
|
|
175
|
+
- Compression
|
|
176
|
+
- WebSocket bridge
|
|
177
|
+
|
|
178
|
+
## π€ Contributing
|
|
179
|
+
|
|
180
|
+
We welcome contributions! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
|
|
181
|
+
|
|
182
|
+
### Quick ways to help:
|
|
183
|
+
|
|
184
|
+
- β Star the project
|
|
185
|
+
- π Report bugs
|
|
186
|
+
- π Improve documentation
|
|
187
|
+
- π» Submit pull requests
|
|
188
|
+
- π¬ Join discussions
|
|
189
|
+
|
|
190
|
+
## π Contributors
|
|
191
|
+
|
|
192
|
+
### Core Team
|
|
193
|
+
|
|
194
|
+
- **Nytrox** - Creator & Lead Developer
|
|
195
|
+
|
|
196
|
+
### Community Heroes
|
|
197
|
+
|
|
198
|
+
Thank you to everyone who has contributed through code, documentation, bug reports, and support!
|
|
199
|
+
|
|
200
|
+
Want to be listed here? Check out our [Contributing guide](CONTRIBUTING.md)!
|
|
201
|
+
|
|
202
|
+
## π License
|
|
203
|
+
|
|
204
|
+
MIT License - see [LICENSE](LICENSE) file for details.
|
|
205
|
+
|
|
206
|
+
## π Links
|
|
207
|
+
|
|
208
|
+
- **Documentation:** Coming soon
|
|
209
|
+
- **GitHub:** [NytroxDev/Veltix](https://github.com/NytroxDev/Veltix)
|
|
210
|
+
- **PyPI:** [pypi.org/project/veltix](https://pypi.org/project/veltix)
|
|
211
|
+
- **Issues:** [Report a bug](https://github.com/NytroxDev/Veltix/issues)
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
**Built with β€οΈ by Nytrox**
|
veltix-1.0.0/README.md
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
# Veltix
|
|
2
|
+
|
|
3
|
+
> The networking library you always wanted
|
|
4
|
+
|
|
5
|
+
[](https://pypi.org/project/veltix/)
|
|
6
|
+
[](https://pypi.org/project/veltix/)
|
|
7
|
+
[](https://github.com/NytroxDev/Veltix/blob/main/LICENSE)
|
|
8
|
+
|
|
9
|
+
## β¨ Features
|
|
10
|
+
|
|
11
|
+
- π **Dead simple API** - Get started in minutes, not hours
|
|
12
|
+
- π **Message integrity** - Built-in SHA256 hash verification
|
|
13
|
+
- π¦ **Custom binary protocol** - Lightweight and efficient
|
|
14
|
+
- πͺΆ **Zero dependencies** - Pure Python stdlib only
|
|
15
|
+
- π **Extensible** - Custom message types with plugin support
|
|
16
|
+
- β‘ **Multi-threaded** - Handle multiple clients automatically
|
|
17
|
+
|
|
18
|
+
## π Why Veltix?
|
|
19
|
+
|
|
20
|
+
Existing Python networking libraries are either too low-level (raw sockets) or too complex (Twisted, asyncio). Veltix
|
|
21
|
+
fills the gap with a simple, modern API that handles the boring parts for you.
|
|
22
|
+
|
|
23
|
+
Built by a passionate developer who wanted networking to be easy, Veltix focuses on developer experience without
|
|
24
|
+
sacrificing power or performance.
|
|
25
|
+
|
|
26
|
+
## π Installation
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
pip install veltix
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
**Requirements:** Python 3.10+
|
|
33
|
+
|
|
34
|
+
**That's it!** Zero dependencies, ready to use.
|
|
35
|
+
|
|
36
|
+
## β‘ Quick Start
|
|
37
|
+
|
|
38
|
+
### Simple Chat Server
|
|
39
|
+
|
|
40
|
+
**Server (server.py):**
|
|
41
|
+
|
|
42
|
+
```python
|
|
43
|
+
from veltix import Server, ServerConfig, MessageType, Request, Binding
|
|
44
|
+
|
|
45
|
+
# Define message type
|
|
46
|
+
CHAT = MessageType(code=200, name="chat")
|
|
47
|
+
|
|
48
|
+
# Configure server
|
|
49
|
+
config = ServerConfig(host="0.0.0.0", port=8080)
|
|
50
|
+
server = Server(config)
|
|
51
|
+
sender = server.get_sender()
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def on_message(client, response):
|
|
55
|
+
print(f"[{client.addr[0]}] {response.content.decode()}")
|
|
56
|
+
# Broadcast to all
|
|
57
|
+
reply = Request(CHAT, f"Echo: {response.content.decode()}".encode())
|
|
58
|
+
sender.broadcast(reply, server.get_all_clients_sockets())
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
server.bind(Binding.ON_RECV, on_message)
|
|
62
|
+
server.start()
|
|
63
|
+
|
|
64
|
+
input("Press Enter to stop...")
|
|
65
|
+
server.close_all()
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
**Client (client.py):**
|
|
69
|
+
|
|
70
|
+
```python
|
|
71
|
+
from veltix import Client, ClientConfig, MessageType, Request, Binding
|
|
72
|
+
|
|
73
|
+
CHAT = MessageType(code=200, name="chat")
|
|
74
|
+
|
|
75
|
+
config = ClientConfig(server_addr="127.0.0.1", port=8080)
|
|
76
|
+
client = Client(config)
|
|
77
|
+
sender = client.get_sender()
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def on_message(response):
|
|
81
|
+
print(f"Server: {response.content.decode()}")
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
client.bind(Binding.ON_RECV, on_message)
|
|
85
|
+
client.connect()
|
|
86
|
+
|
|
87
|
+
# Send message
|
|
88
|
+
msg = Request(CHAT, b"Hello Server!")
|
|
89
|
+
sender.send(msg)
|
|
90
|
+
|
|
91
|
+
input("Press Enter to disconnect...")
|
|
92
|
+
client.disconnect()
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
**Run:**
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
python server.py
|
|
99
|
+
python client.py # In another terminal
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## π¦ Examples
|
|
103
|
+
|
|
104
|
+
More examples in [`examples/`](examples/):
|
|
105
|
+
|
|
106
|
+
- **Echo Server** - Simple echo implementation
|
|
107
|
+
- **File Transfer** - Send files over network
|
|
108
|
+
- **Custom Types** - Define your message types
|
|
109
|
+
- **Advanced Sender** - Complex messaging patterns
|
|
110
|
+
|
|
111
|
+
## π Comparison
|
|
112
|
+
|
|
113
|
+
| Feature | Veltix | socket | asyncio | Twisted |
|
|
114
|
+
|-------------------|--------|--------|---------|---------|
|
|
115
|
+
| Easy API | β
| β | β οΈ | β |
|
|
116
|
+
| Zero deps | β
| β
| β
| β |
|
|
117
|
+
| Custom protocol | β
| β | β | β οΈ |
|
|
118
|
+
| Message integrity | β
| β | β | β |
|
|
119
|
+
| Multi-threading | β
| β | β | β
|
|
|
120
|
+
|
|
121
|
+
## πΊοΈ Roadmap
|
|
122
|
+
|
|
123
|
+
### v1.0.0 - Foundation (March 2026)
|
|
124
|
+
|
|
125
|
+
- Core TCP server/client
|
|
126
|
+
- Binary protocol with SHA256 integrity
|
|
127
|
+
- Custom message types
|
|
128
|
+
- Zero dependencies
|
|
129
|
+
- **Status: IN PROGRESS**
|
|
130
|
+
|
|
131
|
+
### v2.0.0 - Security (Summer 2026)
|
|
132
|
+
|
|
133
|
+
- End-to-end encryption (ChaCha20 + X25519 + Ed25519)
|
|
134
|
+
- Automatic key exchange
|
|
135
|
+
- Perfect forward secrecy
|
|
136
|
+
- **Status: PLANNED**
|
|
137
|
+
|
|
138
|
+
### v3.0.0 - Performance (Fall 2026)
|
|
139
|
+
|
|
140
|
+
- Rust core via PyO3
|
|
141
|
+
- 10-100x speed improvements
|
|
142
|
+
- Advanced optimizations
|
|
143
|
+
- **Status: RESEARCH**
|
|
144
|
+
|
|
145
|
+
### v4.0.0+ (2027+)
|
|
146
|
+
|
|
147
|
+
- UDP support
|
|
148
|
+
- Plugin ecosystem
|
|
149
|
+
- Compression
|
|
150
|
+
- WebSocket bridge
|
|
151
|
+
|
|
152
|
+
## π€ Contributing
|
|
153
|
+
|
|
154
|
+
We welcome contributions! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
|
|
155
|
+
|
|
156
|
+
### Quick ways to help:
|
|
157
|
+
|
|
158
|
+
- β Star the project
|
|
159
|
+
- π Report bugs
|
|
160
|
+
- π Improve documentation
|
|
161
|
+
- π» Submit pull requests
|
|
162
|
+
- π¬ Join discussions
|
|
163
|
+
|
|
164
|
+
## π Contributors
|
|
165
|
+
|
|
166
|
+
### Core Team
|
|
167
|
+
|
|
168
|
+
- **Nytrox** - Creator & Lead Developer
|
|
169
|
+
|
|
170
|
+
### Community Heroes
|
|
171
|
+
|
|
172
|
+
Thank you to everyone who has contributed through code, documentation, bug reports, and support!
|
|
173
|
+
|
|
174
|
+
Want to be listed here? Check out our [Contributing guide](CONTRIBUTING.md)!
|
|
175
|
+
|
|
176
|
+
## π License
|
|
177
|
+
|
|
178
|
+
MIT License - see [LICENSE](LICENSE) file for details.
|
|
179
|
+
|
|
180
|
+
## π Links
|
|
181
|
+
|
|
182
|
+
- **Documentation:** Coming soon
|
|
183
|
+
- **GitHub:** [NytroxDev/Veltix](https://github.com/NytroxDev/Veltix)
|
|
184
|
+
- **PyPI:** [pypi.org/project/veltix](https://pypi.org/project/veltix)
|
|
185
|
+
- **Issues:** [Report a bug](https://github.com/NytroxDev/Veltix/issues)
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
**Built with β€οΈ by Nytrox**
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
from .server.server import Server, ServerConfig, ClientInfo
|
|
2
|
+
from .client.client import Client, ClientConfig
|
|
3
|
+
|
|
4
|
+
from .utils.binding import Binding
|
|
5
|
+
|
|
6
|
+
from .network.types import MessageType
|
|
7
|
+
from .network.request import Request, Response
|
|
8
|
+
from .network.sender import Sender, Mode
|
|
9
|
+
|
|
10
|
+
from .exceptions import *
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
class VeltixError(Exception):
|
|
2
|
+
"""
|
|
3
|
+
Base exception class for all Veltix framework errors.
|
|
4
|
+
"""
|
|
5
|
+
def __init__(self, *args: object) -> None:
|
|
6
|
+
super().__init__(*args)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class MessageTypeError(VeltixError):
|
|
10
|
+
"""
|
|
11
|
+
Exception raised for invalid message type operations.
|
|
12
|
+
"""
|
|
13
|
+
def __init__(self, *args: object) -> None:
|
|
14
|
+
super().__init__(*args)
|
|
15
|
+
|
|
16
|
+
class SenderError(VeltixError):
|
|
17
|
+
"""
|
|
18
|
+
Exception raised for sender-related errors.
|
|
19
|
+
"""
|
|
20
|
+
def __init__(self, *args: object) -> None:
|
|
21
|
+
super().__init__(*args)
|
|
22
|
+
|
|
23
|
+
class RequestError(VeltixError):
|
|
24
|
+
"""
|
|
25
|
+
Exception raised for request parsing or compilation errors.
|
|
26
|
+
"""
|
|
27
|
+
def __init__(self, *args: object) -> None:
|
|
28
|
+
super().__init__(*args)
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "veltix"
|
|
7
|
+
version = "1.0.0"
|
|
8
|
+
description = "The networking library you always wanted"
|
|
9
|
+
authors = [
|
|
10
|
+
{ name = "Nytrox", email = "nytrox.dev@gmail.com" }
|
|
11
|
+
]
|
|
12
|
+
readme = "README.md"
|
|
13
|
+
license = { text = "MIT" }
|
|
14
|
+
requires-python = ">=3.10"
|
|
15
|
+
|
|
16
|
+
keywords = [
|
|
17
|
+
"networking",
|
|
18
|
+
"tcp",
|
|
19
|
+
"protocol",
|
|
20
|
+
"binary",
|
|
21
|
+
"socket",
|
|
22
|
+
"server",
|
|
23
|
+
"client",
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
classifiers = [
|
|
27
|
+
"Development Status :: 4 - Beta",
|
|
28
|
+
"Intended Audience :: Developers",
|
|
29
|
+
"License :: OSI Approved :: MIT License",
|
|
30
|
+
"Programming Language :: Python :: 3.10",
|
|
31
|
+
"Programming Language :: Python :: 3.11",
|
|
32
|
+
"Programming Language :: Python :: 3.12",
|
|
33
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
34
|
+
"Topic :: System :: Networking",
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
dependencies = []
|
|
38
|
+
|
|
39
|
+
[project.optional-dependencies]
|
|
40
|
+
dev = [
|
|
41
|
+
"pytest>=7.0",
|
|
42
|
+
"pytest-cov>=4.0",
|
|
43
|
+
]
|
|
44
|
+
|
|
45
|
+
[project.urls]
|
|
46
|
+
Homepage = "https://github.com/NytroxDev/Veltix"
|
|
47
|
+
Repository = "https://github.com/NytroxDev/Veltix"
|
|
48
|
+
Issues = "https://github.com/NytroxDev/Veltix/issues"
|
|
49
|
+
|
|
50
|
+
[tool.setuptools]
|
|
51
|
+
packages = ["Veltix"]
|
|
52
|
+
|
|
53
|
+
[tool.pytest.ini_options]
|
|
54
|
+
testpaths = ["tests"]
|
|
55
|
+
python_files = ["test_*.py"]
|
veltix-1.0.0/setup.cfg
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Basic tests for Veltix core functionality.
|
|
3
|
+
|
|
4
|
+
Run with: python -m pytest tests/test_basic.py
|
|
5
|
+
Or simply: python tests/test_basic.py
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
import threading
|
|
9
|
+
import time
|
|
10
|
+
|
|
11
|
+
from Veltix import (
|
|
12
|
+
Binding,
|
|
13
|
+
Client,
|
|
14
|
+
ClientConfig,
|
|
15
|
+
MessageType,
|
|
16
|
+
Request,
|
|
17
|
+
RequestError,
|
|
18
|
+
Response,
|
|
19
|
+
Server,
|
|
20
|
+
ServerConfig,
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
# Test message types
|
|
24
|
+
TEST_MSG = MessageType(code=200, name="test")
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def test_message_type_creation():
|
|
28
|
+
"""Test creating a MessageType."""
|
|
29
|
+
msg_type = MessageType(code=100, name="test", description="Test message")
|
|
30
|
+
|
|
31
|
+
assert msg_type.code == 100
|
|
32
|
+
assert msg_type.name == "test"
|
|
33
|
+
assert msg_type.description == "Test message"
|
|
34
|
+
print("β MessageType creation works")
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def test_request_compile_and_parse():
|
|
38
|
+
"""Test Request compilation and Response parsing."""
|
|
39
|
+
# Create request
|
|
40
|
+
original_content = b"Hello Veltix!"
|
|
41
|
+
request = Request(TEST_MSG, original_content)
|
|
42
|
+
|
|
43
|
+
# Compile to bytes
|
|
44
|
+
compiled = request.compile()
|
|
45
|
+
assert isinstance(compiled, bytes)
|
|
46
|
+
assert len(compiled) > 46 # Header is 46 bytes
|
|
47
|
+
print("β Request compilation works")
|
|
48
|
+
|
|
49
|
+
# Parse back to Response
|
|
50
|
+
response = Request.parse(compiled)
|
|
51
|
+
assert isinstance(response, Response)
|
|
52
|
+
assert response.content == original_content
|
|
53
|
+
assert response.type.code == TEST_MSG.code
|
|
54
|
+
print("β Request parsing works")
|
|
55
|
+
|
|
56
|
+
# Verify hash integrity
|
|
57
|
+
import hashlib
|
|
58
|
+
|
|
59
|
+
expected_hash = hashlib.sha256(original_content).digest()
|
|
60
|
+
assert response.hash == expected_hash
|
|
61
|
+
print("β Hash integrity verification works")
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def test_server_client_communication():
|
|
65
|
+
"""Test basic server-client communication."""
|
|
66
|
+
print("\nTesting server-client communication...")
|
|
67
|
+
|
|
68
|
+
# Shared state
|
|
69
|
+
received_messages = []
|
|
70
|
+
server_ready = threading.Event()
|
|
71
|
+
|
|
72
|
+
# Setup server
|
|
73
|
+
server_config = ServerConfig(host="127.0.0.1", port=8765)
|
|
74
|
+
server = Server(server_config)
|
|
75
|
+
sender_server = server.get_sender()
|
|
76
|
+
|
|
77
|
+
def on_server_recv(client, response):
|
|
78
|
+
content = response.content.decode("utf-8")
|
|
79
|
+
received_messages.append(f"server:{content}")
|
|
80
|
+
|
|
81
|
+
# Echo back
|
|
82
|
+
reply = Request(TEST_MSG, b"Echo: " + response.content)
|
|
83
|
+
sender_server.send(reply, client=client.conn)
|
|
84
|
+
|
|
85
|
+
server.bind(Binding.ON_RECV, on_server_recv)
|
|
86
|
+
|
|
87
|
+
# Start server in thread
|
|
88
|
+
def run_server():
|
|
89
|
+
server.start(_on_th=True)
|
|
90
|
+
server_ready.set()
|
|
91
|
+
|
|
92
|
+
server_thread = threading.Thread(target=run_server, daemon=True)
|
|
93
|
+
server_thread.start()
|
|
94
|
+
server_ready.wait(timeout=2)
|
|
95
|
+
time.sleep(0.5) # Give server time to start
|
|
96
|
+
|
|
97
|
+
print(" Server started")
|
|
98
|
+
|
|
99
|
+
# Setup client
|
|
100
|
+
client_config = ClientConfig(server_addr="127.0.0.1", port=8765)
|
|
101
|
+
client = Client(client_config)
|
|
102
|
+
sender_client = client.get_sender()
|
|
103
|
+
|
|
104
|
+
def on_client_recv(response):
|
|
105
|
+
content = response.content.decode("utf-8")
|
|
106
|
+
received_messages.append(f"client:{content}")
|
|
107
|
+
|
|
108
|
+
client.bind(Binding.ON_RECV, on_client_recv)
|
|
109
|
+
|
|
110
|
+
# Connect and send
|
|
111
|
+
assert client.connect(), "Client failed to connect"
|
|
112
|
+
print(" Client connected")
|
|
113
|
+
time.sleep(0.2)
|
|
114
|
+
|
|
115
|
+
# Send test message
|
|
116
|
+
test_message = b"Test message"
|
|
117
|
+
request = Request(TEST_MSG, test_message)
|
|
118
|
+
assert sender_client.send(request), "Failed to send message"
|
|
119
|
+
print(" Message sent")
|
|
120
|
+
|
|
121
|
+
# Wait for response
|
|
122
|
+
time.sleep(0.5)
|
|
123
|
+
|
|
124
|
+
# Verify
|
|
125
|
+
assert len(received_messages) >= 1, (
|
|
126
|
+
f"No messages received. Got: {received_messages}"
|
|
127
|
+
)
|
|
128
|
+
assert "server:Test message" in received_messages, "Server didn't receive message"
|
|
129
|
+
assert any("client:Echo" in msg for msg in received_messages), (
|
|
130
|
+
"Client didn't receive echo"
|
|
131
|
+
)
|
|
132
|
+
|
|
133
|
+
print(" Messages exchanged successfully")
|
|
134
|
+
|
|
135
|
+
# Cleanup
|
|
136
|
+
client.disconnect()
|
|
137
|
+
server.close_all()
|
|
138
|
+
time.sleep(0.2)
|
|
139
|
+
|
|
140
|
+
print("β Server-client communication works")
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
def test_message_integrity_check():
|
|
144
|
+
"""Test that corrupted messages are rejected."""
|
|
145
|
+
# Create valid request
|
|
146
|
+
request = Request(TEST_MSG, b"Valid content")
|
|
147
|
+
compiled = request.compile()
|
|
148
|
+
|
|
149
|
+
# Corrupt the data (change a byte in the content)
|
|
150
|
+
corrupted = bytearray(compiled)
|
|
151
|
+
corrupted[-1] ^= 0xFF # Flip last byte
|
|
152
|
+
|
|
153
|
+
# Should raise ValueError due to hash mismatch
|
|
154
|
+
try:
|
|
155
|
+
Request.parse(bytes(corrupted))
|
|
156
|
+
assert False, "Should have raised ValueError for corrupted data"
|
|
157
|
+
except RequestError as e:
|
|
158
|
+
assert "Invalid hash" in str(e) or "Corrupted" in str(e)
|
|
159
|
+
print("β Message integrity check works (corrupted data rejected)")
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
# Run tests
|
|
163
|
+
if __name__ == "__main__":
|
|
164
|
+
print("Running Veltix Basic Tests")
|
|
165
|
+
print("=" * 50)
|
|
166
|
+
|
|
167
|
+
try:
|
|
168
|
+
test_message_type_creation()
|
|
169
|
+
test_request_compile_and_parse()
|
|
170
|
+
test_message_integrity_check()
|
|
171
|
+
test_server_client_communication()
|
|
172
|
+
|
|
173
|
+
print("\n" + "=" * 50)
|
|
174
|
+
print("ALL TESTS PASSED! β")
|
|
175
|
+
print("Veltix is ready to deploy! π")
|
|
176
|
+
|
|
177
|
+
except AssertionError as e:
|
|
178
|
+
print(f"\nβ TEST FAILED: {e}")
|
|
179
|
+
exit(1)
|
|
180
|
+
except Exception as e:
|
|
181
|
+
print(f"\nβ UNEXPECTED ERROR: {e}")
|
|
182
|
+
import traceback
|
|
183
|
+
|
|
184
|
+
traceback.print_exc()
|
|
185
|
+
exit(1)
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: veltix
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: The networking library you always wanted
|
|
5
|
+
Author-email: Nytrox <nytrox.dev@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/NytroxDev/Veltix
|
|
8
|
+
Project-URL: Repository, https://github.com/NytroxDev/Veltix
|
|
9
|
+
Project-URL: Issues, https://github.com/NytroxDev/Veltix/issues
|
|
10
|
+
Keywords: networking,tcp,protocol,binary,socket,server,client
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
18
|
+
Classifier: Topic :: System :: Networking
|
|
19
|
+
Requires-Python: >=3.10
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
Provides-Extra: dev
|
|
23
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
24
|
+
Requires-Dist: pytest-cov>=4.0; extra == "dev"
|
|
25
|
+
Dynamic: license-file
|
|
26
|
+
|
|
27
|
+
# Veltix
|
|
28
|
+
|
|
29
|
+
> The networking library you always wanted
|
|
30
|
+
|
|
31
|
+
[](https://pypi.org/project/veltix/)
|
|
32
|
+
[](https://pypi.org/project/veltix/)
|
|
33
|
+
[](https://github.com/NytroxDev/Veltix/blob/main/LICENSE)
|
|
34
|
+
|
|
35
|
+
## β¨ Features
|
|
36
|
+
|
|
37
|
+
- π **Dead simple API** - Get started in minutes, not hours
|
|
38
|
+
- π **Message integrity** - Built-in SHA256 hash verification
|
|
39
|
+
- π¦ **Custom binary protocol** - Lightweight and efficient
|
|
40
|
+
- πͺΆ **Zero dependencies** - Pure Python stdlib only
|
|
41
|
+
- π **Extensible** - Custom message types with plugin support
|
|
42
|
+
- β‘ **Multi-threaded** - Handle multiple clients automatically
|
|
43
|
+
|
|
44
|
+
## π Why Veltix?
|
|
45
|
+
|
|
46
|
+
Existing Python networking libraries are either too low-level (raw sockets) or too complex (Twisted, asyncio). Veltix
|
|
47
|
+
fills the gap with a simple, modern API that handles the boring parts for you.
|
|
48
|
+
|
|
49
|
+
Built by a passionate developer who wanted networking to be easy, Veltix focuses on developer experience without
|
|
50
|
+
sacrificing power or performance.
|
|
51
|
+
|
|
52
|
+
## π Installation
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
pip install veltix
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
**Requirements:** Python 3.10+
|
|
59
|
+
|
|
60
|
+
**That's it!** Zero dependencies, ready to use.
|
|
61
|
+
|
|
62
|
+
## β‘ Quick Start
|
|
63
|
+
|
|
64
|
+
### Simple Chat Server
|
|
65
|
+
|
|
66
|
+
**Server (server.py):**
|
|
67
|
+
|
|
68
|
+
```python
|
|
69
|
+
from veltix import Server, ServerConfig, MessageType, Request, Binding
|
|
70
|
+
|
|
71
|
+
# Define message type
|
|
72
|
+
CHAT = MessageType(code=200, name="chat")
|
|
73
|
+
|
|
74
|
+
# Configure server
|
|
75
|
+
config = ServerConfig(host="0.0.0.0", port=8080)
|
|
76
|
+
server = Server(config)
|
|
77
|
+
sender = server.get_sender()
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def on_message(client, response):
|
|
81
|
+
print(f"[{client.addr[0]}] {response.content.decode()}")
|
|
82
|
+
# Broadcast to all
|
|
83
|
+
reply = Request(CHAT, f"Echo: {response.content.decode()}".encode())
|
|
84
|
+
sender.broadcast(reply, server.get_all_clients_sockets())
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
server.bind(Binding.ON_RECV, on_message)
|
|
88
|
+
server.start()
|
|
89
|
+
|
|
90
|
+
input("Press Enter to stop...")
|
|
91
|
+
server.close_all()
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
**Client (client.py):**
|
|
95
|
+
|
|
96
|
+
```python
|
|
97
|
+
from veltix import Client, ClientConfig, MessageType, Request, Binding
|
|
98
|
+
|
|
99
|
+
CHAT = MessageType(code=200, name="chat")
|
|
100
|
+
|
|
101
|
+
config = ClientConfig(server_addr="127.0.0.1", port=8080)
|
|
102
|
+
client = Client(config)
|
|
103
|
+
sender = client.get_sender()
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
def on_message(response):
|
|
107
|
+
print(f"Server: {response.content.decode()}")
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
client.bind(Binding.ON_RECV, on_message)
|
|
111
|
+
client.connect()
|
|
112
|
+
|
|
113
|
+
# Send message
|
|
114
|
+
msg = Request(CHAT, b"Hello Server!")
|
|
115
|
+
sender.send(msg)
|
|
116
|
+
|
|
117
|
+
input("Press Enter to disconnect...")
|
|
118
|
+
client.disconnect()
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
**Run:**
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
python server.py
|
|
125
|
+
python client.py # In another terminal
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## π¦ Examples
|
|
129
|
+
|
|
130
|
+
More examples in [`examples/`](examples/):
|
|
131
|
+
|
|
132
|
+
- **Echo Server** - Simple echo implementation
|
|
133
|
+
- **File Transfer** - Send files over network
|
|
134
|
+
- **Custom Types** - Define your message types
|
|
135
|
+
- **Advanced Sender** - Complex messaging patterns
|
|
136
|
+
|
|
137
|
+
## π Comparison
|
|
138
|
+
|
|
139
|
+
| Feature | Veltix | socket | asyncio | Twisted |
|
|
140
|
+
|-------------------|--------|--------|---------|---------|
|
|
141
|
+
| Easy API | β
| β | β οΈ | β |
|
|
142
|
+
| Zero deps | β
| β
| β
| β |
|
|
143
|
+
| Custom protocol | β
| β | β | β οΈ |
|
|
144
|
+
| Message integrity | β
| β | β | β |
|
|
145
|
+
| Multi-threading | β
| β | β | β
|
|
|
146
|
+
|
|
147
|
+
## πΊοΈ Roadmap
|
|
148
|
+
|
|
149
|
+
### v1.0.0 - Foundation (March 2026)
|
|
150
|
+
|
|
151
|
+
- Core TCP server/client
|
|
152
|
+
- Binary protocol with SHA256 integrity
|
|
153
|
+
- Custom message types
|
|
154
|
+
- Zero dependencies
|
|
155
|
+
- **Status: IN PROGRESS**
|
|
156
|
+
|
|
157
|
+
### v2.0.0 - Security (Summer 2026)
|
|
158
|
+
|
|
159
|
+
- End-to-end encryption (ChaCha20 + X25519 + Ed25519)
|
|
160
|
+
- Automatic key exchange
|
|
161
|
+
- Perfect forward secrecy
|
|
162
|
+
- **Status: PLANNED**
|
|
163
|
+
|
|
164
|
+
### v3.0.0 - Performance (Fall 2026)
|
|
165
|
+
|
|
166
|
+
- Rust core via PyO3
|
|
167
|
+
- 10-100x speed improvements
|
|
168
|
+
- Advanced optimizations
|
|
169
|
+
- **Status: RESEARCH**
|
|
170
|
+
|
|
171
|
+
### v4.0.0+ (2027+)
|
|
172
|
+
|
|
173
|
+
- UDP support
|
|
174
|
+
- Plugin ecosystem
|
|
175
|
+
- Compression
|
|
176
|
+
- WebSocket bridge
|
|
177
|
+
|
|
178
|
+
## π€ Contributing
|
|
179
|
+
|
|
180
|
+
We welcome contributions! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
|
|
181
|
+
|
|
182
|
+
### Quick ways to help:
|
|
183
|
+
|
|
184
|
+
- β Star the project
|
|
185
|
+
- π Report bugs
|
|
186
|
+
- π Improve documentation
|
|
187
|
+
- π» Submit pull requests
|
|
188
|
+
- π¬ Join discussions
|
|
189
|
+
|
|
190
|
+
## π Contributors
|
|
191
|
+
|
|
192
|
+
### Core Team
|
|
193
|
+
|
|
194
|
+
- **Nytrox** - Creator & Lead Developer
|
|
195
|
+
|
|
196
|
+
### Community Heroes
|
|
197
|
+
|
|
198
|
+
Thank you to everyone who has contributed through code, documentation, bug reports, and support!
|
|
199
|
+
|
|
200
|
+
Want to be listed here? Check out our [Contributing guide](CONTRIBUTING.md)!
|
|
201
|
+
|
|
202
|
+
## π License
|
|
203
|
+
|
|
204
|
+
MIT License - see [LICENSE](LICENSE) file for details.
|
|
205
|
+
|
|
206
|
+
## π Links
|
|
207
|
+
|
|
208
|
+
- **Documentation:** Coming soon
|
|
209
|
+
- **GitHub:** [NytroxDev/Veltix](https://github.com/NytroxDev/Veltix)
|
|
210
|
+
- **PyPI:** [pypi.org/project/veltix](https://pypi.org/project/veltix)
|
|
211
|
+
- **Issues:** [Report a bug](https://github.com/NytroxDev/Veltix/issues)
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
**Built with β€οΈ by Nytrox**
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
Veltix/__init__.py
|
|
5
|
+
Veltix/exceptions.py
|
|
6
|
+
tests/test_basic.py
|
|
7
|
+
veltix.egg-info/PKG-INFO
|
|
8
|
+
veltix.egg-info/SOURCES.txt
|
|
9
|
+
veltix.egg-info/dependency_links.txt
|
|
10
|
+
veltix.egg-info/requires.txt
|
|
11
|
+
veltix.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Veltix
|