#ha-proxy #txt #parser #hello #tcp #protocols #spop #spoe

spop

Library for parsing HAProxy SPOP (Stream Processing Offload Protocol)

12 releases (7 breaking)

Uses new Rust 2024

new 0.8.4 Apr 8, 2025
0.7.0 Apr 5, 2025
0.6.0 Mar 29, 2025

#352 in Network programming

Download history 346/week @ 2025-03-22 201/week @ 2025-03-29 614/week @ 2025-04-05

1,161 downloads per month

BSD-3-Clause

78KB
1.5K SLoC

Test

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

Dependencies

~6–11MB
~108K SLoC