Skip to main content

High-performance HTTP gateway and reverse proxy with security features

Project description

lib-gateway-port

A lightweight, high-performance HTTP gateway and reverse proxy library for Python applications.

Features

  • Path-Based Access Control: Define protected routes with flexible ACL rules
  • Request Validation: Built-in validation and sanitization for security
  • Connection Pooling: Efficient backend connection management
  • Production Ready: Battle-tested in high-traffic production environments
  • Zero Dependencies: Pure Python implementation with no external requirements
  • Easy Integration: Simple API for quick deployment

Installation

pip install lib-gateway-port

Quick Start

from lib_gateway_port import SecurityGateway

# Initialize gateway
gateway = SecurityGateway(
    backend_host="127.0.0.1",
    backend_port=5000,
    listen_port=9000,
    protected_paths=["/admin/", "/internal/"]
)

# Start the gateway
gateway.start()

Configuration Options

gateway = SecurityGateway(
    backend_host="127.0.0.1",      # Backend server address
    backend_port=5000,              # Backend server port
    listen_port=9000,               # Gateway listening port
    protected_paths=["/admin/"],    # Paths requiring access control
    max_connections=100,            # Maximum concurrent connections
    request_timeout=30              # Request timeout in seconds
)

Use Cases

  • API Gateway: Route and protect REST APIs
  • Microservices: Central entry point for microservice architectures
  • Legacy Applications: Add security layer to existing applications
  • Access Control: Implement path-based authentication requirements
  • Load Distribution: Balance traffic across backend servers

Architecture

Client Request → Gateway (ACL + Validation) → Backend Application
                        ↓
                  Protected Paths
                  Request Sanitization
                  Connection Pooling

Security

This library implements industry-standard security practices:

  • Request validation and sanitization
  • Path normalization to prevent traversal attacks
  • Connection timeout management
  • Access control list enforcement

Performance

Optimized for high-throughput production environments:

  • Persistent backend connections for reduced latency
  • Efficient request parsing and routing
  • Minimal memory footprint
  • Suitable for handling thousands of requests per second

License

MIT License - See LICENSE file for details

Support

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lib_gateway_port-1.2.3.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lib_gateway_port-1.2.3-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file lib_gateway_port-1.2.3.tar.gz.

File metadata

  • Download URL: lib_gateway_port-1.2.3.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for lib_gateway_port-1.2.3.tar.gz
Algorithm Hash digest
SHA256 3658c2e0add691f0cd183fb6da611253228115c772110a079db5a35b0620c328
MD5 1da8eb1ea31dc983a545aa4c8e46e602
BLAKE2b-256 48f79a3aa86a7b689ccd69cda903ae64f429160b20532898747b184e4732ade7

See more details on using hashes here.

File details

Details for the file lib_gateway_port-1.2.3-py3-none-any.whl.

File metadata

File hashes

Hashes for lib_gateway_port-1.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 da840b0f1e1665c6140f33e91b3ba1865c49f13c7b57df2dcffd053966ae17c0
MD5 5d4fe773205e118ba140cd83458a2e40
BLAKE2b-256 e68e1b08715dadd486e144605c5b17e7f7bf0028ec55cd3059c7d0e0c0fde19e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page