Install & Compatibility
Where this runs
tested against v0.40.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 43.7MB
glibcpy 3.10–3.920 runs
installs and imports cleanly · install 4.1s · import 0.000s · 46MB
42MB installed
● package 42MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
PROTOCOL_VERSION
✓ from snitun import PROTOCOL_VERSION
✗ from snitun.config import Config
utils
✓ from snitun import utils
✗ from snitun.config import Config
This quickstart demonstrates how to configure and instantiate a `SnitunServer`. It outlines the required `Config` parameters, especially for TLS certificates and routing rules. Note that running a functional TLS proxy requires actual certificate and key files, which are indicated by placeholder paths in this example.
import asyncio
import os
from snitun.config import Config
from snitun.server import SnitunServer
# In a real-world scenario, you would provide paths to your
# actual TLS server certificate and key files.
# For this quickstart, we use placeholder paths.
# Running this code as-is will likely fail unless these files exist
# and contain valid cert/key pairs for a TLS server.
# You can generate dummy ones or provide real paths via environment variables.
# Example: SNITUN_SERVER_CERT=./server.pem SNITUN_SERVER_KEY=./server.key python your_script.py
DUMMY_CERT = os.environ.get("SNITUN_SERVER_CERT", "/path/to/server.pem")
DUMMY_KEY = os.environ.get("SNITUN_SERVER_KEY", "/path/to/server.key")
async def main():
# Define the Snitun configuration
config = Config(
listen_host="127.0.0.1",
listen_port=8443,
server_certs=DUMMY_CERT, # Required for TLS
server_key=DUMMY_KEY, # Required for TLS
routes={
"example.com": { # SNI hostname to route
"host": "192.168.1.100", # Target host
"port": 443, # Target port
"no_verify_ssl": False # Verify upstream SSL certs
},
"another.example.org": {
"host": "127.0.0.1",
"port": 8080,
"no_verify_ssl": True
}
}
)
# Create an instance of the Snitun server
server = SnitunServer(config)
print(f"Snitun server configured to listen on {config.listen_host}:{config.listen_port}")
print(f"Routes defined: {list(config.routes.keys())}")
print("\nNOTE: To actually run and test this server, you must ensure valid TLS certificate and key files ")
print(" are accessible at the configured `server_certs` and `server_key` paths.")
print(" See Snitun documentation for proper setup.")
print("\nTo start the server (after ensuring valid certs/keys):")
print(" await server.start()")
print(" await asyncio.Future() # Keep running indefinitely")
print(" await server.stop()")
if __name__ == "__main__":
asyncio.run(main())
Upgrade
Version history
0.46.1latest on PyPI · released Jun 11, 2026
Audit
Dependencies
pythonrequiredRequires Python 3.12 or higher as per project metadata.
aiohttprequiredCore dependency for asynchronous HTTP client/server functionality.
cryptographyrequiredUsed for cryptographic operations, particularly TLS/SSL.
trustmeoptionalUsed for generating test certificates, not a runtime dependency for deployment but useful for local testing setups.
uvloopoptionalOptional dependency for a faster `asyncio` event loop implementation.