spop

Crates.iospop
lib.rsspop
version0.10.5
created_at2025-03-23 10:25:45.163722+00
updated_at2025-09-15 17:37:08.709189+00
descriptionLibrary for parsing HAProxy SPOP (Stream Processing Offload Protocol)
homepage
repositoryhttps://github.com/nbari/spop
max_upload_size
id1602541
size131,040
(nbari)

documentation

https://docs.rs/spop/latest/spop/

README

Test crates.io

spop

Library for parsing HAProxy SPOP protocol messages.

The protocol is described here: https://github.com/haproxy/haproxy/blob/master/doc/SPOE.txt

Test

To test you need to have just, podman and rust installed.

To run haproxy in a container, only type just, this will build the container and start it.

To compile and run the test agent, type:

just agent

You need to install cargo install cargo-watch to run the agent in watch mode.

To send a request to the haproxy container, type:

just test

The HAProxy configuration is in the haproxy.cfg file, and the SPOE configuration is in the spoe-test.conf file.

Example

global
    log stdout format raw local0
    daemon

defaults
    log     global
    mode    http
    option  httplog
    timeout client 30s
    timeout connect 10s
    timeout server 30s

frontend main
    bind :5000
    filter spoe engine test config /usr/local/etc/haproxy/spoe-test.conf

    http-after-response set-header X-SPOE-VAR %[var(txn.spoe_test.my_var)]

    default_backend app

backend spoe-test
    mode tcp
    server rust-agent 127.0.0.1:12345

backend app
    mode http
    http-request return status 200 content-type "text/plain" string "Hello"

And the spoe agent conf:

[test]
spoe-agent test
    messages    log-request
    option      var-prefix spoe_test
    option      continue-on-error
    timeout     processing 10ms
    use-backend spoe-test

spoe-message log-request
    args ip=src country=hdr(CF-IPCountry) user_agent=hdr(User-Agent)
    event on-frontend-http-request
Commit count: 66

cargo fmt