| Crates.io | modbus-relay |
| lib.rs | modbus-relay |
| version | 2024.12.0 |
| created_at | 2024-12-01 20:59:43.662873+00 |
| updated_at | 2024-12-01 20:59:43.662873+00 |
| description | A high performance Modbus TCP to RTU relay |
| homepage | https://github.com/aljen/modbus-relay |
| repository | https://github.com/aljen/modbus-relay |
| max_upload_size | |
| id | 1467840 |
| size | 185,289 |
🚀 High-performance Modbus TCP to RTU relay written in Rust
Features • Installation • Usage • Configuration • Monitoring • Contributing
# Install from crates.io
cargo install modbus-relay
# Or build from source
git clone https://github.com/aljen/modbus-relay
cd modbus-relay
cargo build --release
# Generate default configuration
modbus-relay --dump-default-config > config.yaml
# Run with custom config
modbus-relay -c /path/to/config.yaml
# Run with default settings
modbus-relay
Configuration is managed through YAML files. Here's a complete example (config.yaml):
tcp:
bind_addr: "0.0.0.0"
bind_port: 502
rtu:
device: "/dev/ttyUSB0"
baud_rate: 9600
data_bits: 8
parity: "none"
stop_bits: 1
flush_after_write: true
rts_type: "none" # Options: none, up, down
rts_delay_us: 0
transaction_timeout: "1s"
serial_timeout: "100ms"
max_frame_size: 256
http:
enabled: true
bind_addr: "127.0.0.1"
bind_port: 8080
metrics_enabled: true
connection:
max_connections: 100
idle_timeout: "60s"
connect_timeout: "5s"
per_ip_limits: 10
backoff:
initial_interval: "100ms"
max_interval: "30s"
multiplier: 2.0
max_retries: 5
logging:
trace_frames: false
log_level: "info"
format: "pretty" # Options: pretty, json
include_location: false
The HTTP API provides basic monitoring endpoints:
GET /health - Health check endpointGET /status - Detailed status informationPlanned monitoring features:

Example setup running on Raspberry Pi with multiple Modbus RTU devices connected via RS485.
Contributions are welcome! Please check out our:
This project is licensed under either of
at your option.