Python library for gateways, networks, and devices.
Project description
gatenet
Gatenet is a Python toolkit for networking: diagnostics (ping, traceroute, DNS, ports), simple HTTP/TCP/UDP building blocks, service discovery, and Wi‑Fi hotspot management. It now includes a lightweight hooks system for easy extensibility.
Install
pip install gatenet
Python 3.10+ • Linux/macOS/Windows (feature availability varies by platform)
Highlights
- Diagnostics: ICMP/TCP ping, traceroute, port scan, DNS, IP geolocation
- HTTP/TCP/UDP: minimal server/client utilities
- Discovery: pluggable detectors with a registry
- Hotspot: create/manage Wi‑Fi access points (Linux/macOS)
- Hooks: shared event bus across modules (HTTP, clients, discovery, diagnostics)
Quick start
HTTP server
from gatenet.http_.server import HTTPServerComponent
server = HTTPServerComponent(host="127.0.0.1", port=8080)
@server.route("/status", method="GET")
def status(_req):
return {"ok": True}
server.start()
HTTP client
from gatenet.http_.client import HTTPClient
client = HTTPClient("http://127.0.0.1:8080")
res = client.get("/status")
print(res["data"]) # {"ok": True}
TCP / UDP
from gatenet.client.tcp import TCPClient
from gatenet.client.udp import UDPClient
# TCP
tcp = TCPClient("127.0.0.1", 9000)
tcp.connect()
print(tcp.send("ping"))
tcp.close()
# UDP
udp = UDPClient("127.0.0.1", 9001)
print(udp.send("ping"))
udp.close()
Diagnostics
from gatenet.diagnostics import ping
from gatenet.diagnostics.traceroute import traceroute
print(ping("1.1.1.1", count=2))
print(traceroute("example.com"))
Discovery
from gatenet.discovery.ssh import _identify_service
print(_identify_service(22, "SSH-2.0-OpenSSH_8.9p1"))
Hotspot (platform-dependent)
from gatenet.hotspot import Hotspot
hotspot = Hotspot(ssid="GatenetAP", password="SecurePass123!")
if hotspot.start():
print("running")
hotspot.stop()
Hooks & events
from gatenet.core import hooks, events
hooks.on(events.HTTP_BEFORE_REQUEST, lambda req: print("HTTP", req.command, req.path))
Learn more
- Docs: https://gatenet.readthedocs.io
- Examples: docs Examples page (HTTP, TCP/UDP, discovery, diagnostics, hooks)
- Changelog: https://gatenet.readthedocs.io/en/latest/changelog.html
Contributing
Run tests locally:
pytest -q
License: MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gatenet-0.12.4.tar.gz.
File metadata
- Download URL: gatenet-0.12.4.tar.gz
- Upload date:
- Size: 58.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
883edcaa53230cc4d7e562aa82d3947e112b7db756e114242466c33b50062a64
|
|
| MD5 |
6675de55fcb7c4e1656d73879be5bb48
|
|
| BLAKE2b-256 |
1826cca5b79afad4ea17c8b2e0807774c90e73e780d0672ce8211b508aa086fb
|
File details
Details for the file gatenet-0.12.4-py3-none-any.whl.
File metadata
- Download URL: gatenet-0.12.4-py3-none-any.whl
- Upload date:
- Size: 21.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7c5966fdd620f29583ad7cb92146cdd611e9b4a45dd870e133d8cb5f34553db0
|
|
| MD5 |
1c7be7fa1619df1d18849652dbd5dc36
|
|
| BLAKE2b-256 |
15faa10bd4d644e39b06ae83ed54ccc2f7f772a9389793781d78397b92d626fb
|