Skip to main content

A pure-python asyncio implementation of an HAProxy Stream Processing Offload Agent (SPOA)

Project description

HAProxy SPOA

A pure Python implementation of an HAProxy Stream Processing Offload Agent with asyncio support.

This library handles the lower level details of the Stream Processing Offload Protocol, allowing quick implementation of custom agents. See the example folder for the full example, including an example HAProxy configuration.

from ipaddress import IPv4Address

from haproxyspoa.payloads.ack import AckPayload
from haproxyspoa.spoa_server import SpoaServer

agent = SpoaServer()


@agent.handler("earth-to-mars")
async def handle_earth_to_mars(src: IPv4Address, req_host: str):
    return AckPayload().set_txn_var("src_echo", str(src) + req_host)


if __name__ == "__main__":
    agent.run(host='127.0.0.1', port=9002)

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

haproxyspoa-0.0.1.tar.gz (8.6 kB view hashes)

Uploaded Source

Built Distribution

haproxyspoa-0.0.1-py3-none-any.whl (15.2 kB view hashes)

Uploaded Python 3

Supported by

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