https://github.com/austinhartzheim/haptik
Interface for HAProxy control via Unix socket interface
https://github.com/austinhartzheim/haptik
client haproxy
Last synced: about 2 months ago
JSON representation
Interface for HAProxy control via Unix socket interface
- Host: GitHub
- URL: https://github.com/austinhartzheim/haptik
- Owner: austinhartzheim
- License: apache-2.0
- Created: 2020-06-28T21:51:21.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-09-27T17:17:47.000Z (over 5 years ago)
- Last Synced: 2025-01-27T11:49:57.466Z (over 1 year ago)
- Topics: client, haproxy
- Language: Rust
- Homepage:
- Size: 71.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# haptik
[](https://travis-ci.org/austinhartzheim/haptik)
[](https://coveralls.io/github/austinhartzheim/haptik?branch=master)
HAProxy control via Unix sockets.
Issue [commands](https://cbonte.github.io/haproxy-dconv/2.2/management.html#9.3) to HAProxy.
## Examples
Get the connection permission level:
```rust
use haptik::{ConnectionBuilder, UnixSocketBuilder};
let connection = UnixSocketBuilder::default().connect().expect("Failed to connect");
println!("Current permission level: {:?}", connection.level());
```
Get the list of CLI sockets:
```rust
use haptik::{ConnectionBuilder, UnixSocketBuilder};
let connection = UnixSocketBuilder::default().connect().expect("Failed to connect");
println!("Sockets: {:?}", connection.cli_sockets());
```
## Developing
1. Start HAProxy via Docker by running this command at the base directory for this project:
```sh
docker run -d -v $(pwd)/examples/haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg -v /tmp/socket:/var/run --entrypoint haproxy -p 9999:9999 haproxy:latest -db -f /usr/local/etc/haproxy/haproxy.cfg
```
2. Run the test suite. The ignored tests require a running HAProxy instance (configured in step 1).
```sh
cargo test
cargo test -- --ignored
```