gRPC Connection Forwarder
grpc_connection_forwarder is a Python package that helps you forward incoming TCP connections to a gRPC server. It is particularly useful when you need to track the number of active connections.
Features
- Forward incoming TCP connections to a gRPC server
- Connection counter with callback support
- Thread-safe implementation
- Easy integration with existing gRPC servers
Installation
You can install grpc_connection_forwarder using pip:
pip install grpc_connection_forwarder
Usage
Here's a simple example of how to use grpc_connection_forwarder with a gRPC server:
import grpc
from grpc_connection_forwarder import GrpcConnnectionForwarder
from your_grpc_package import YourGRPCServer
# Initialize your gRPC server
grpc_server = grpc.server(thread_pool=ThreadPoolExecutor())
your_grpc_service = YourGRPCServer()
# ... (add your services to the gRPC server)
# Define a callback function to handle connection count changes (optional)
def connection_count_callback(count):
print(f"Connected users: {count}")
# Initialize the gRPC Connection Forwarder
forwarder = GrpcConnnectionForwarder(grpc_server, callback=connection_count_callback)
# Start the forwarder
forwarder.serve(host='localhost', port=50051)
Contributing
We welcome contributions to grpc_connection_forwarder. If you find a bug or want to propose a new feature, please open a GitHub issue or submit a pull request.
License
This project is licensed under the MIT License. See LICENSE for details.
Metadata
Release files for grpc-connection-forwarder 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| grpc_connection_forwarder-0.1.5.tar.gz | 3.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| grpc_connection_forwarder-0.1.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.5 kB
Release files / grpc_connection_forwarder-0.1.5.tar.gz
| Download URL | grpc_connection_forwarder-0.1.5.tar.gz |
|---|---|
| Size | 3.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9f6a0ad3d9061c708bf8dc8b12dd33ec5dc8fb1b049a5fc068307a65d4273529
|
|
BLAKE2b-256 checksum How to use checksums |
4c7a83b3df3d0f0b8aac28e210e57ae001be7d192c1c3a3d2f7009d964ccf091
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.2
|
Release files / grpc_connection_forwarder-0.1.5-py3-none-any.whl
| Download URL | grpc_connection_forwarder-0.1.5-py3-none-any.whl |
|---|---|
| Size | 4.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c49458e1bfb70b4ebbfbbc1db864d0a55932857eb3f9a810e50329f53b85a7f7
|
|
BLAKE2b-256 checksum How to use checksums |
4632193f15c47c2cc9aaf52ccbc2159053bc882573dfb238695a3464616ac4be
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.2
|
Security for grpc-connection-forwarder 0.1.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.