modbus-relay 2025.11.0

A high performance Modbus TCP to RTU relay
Documentation
# Default configuration for modbus-relay

tcp:
  # TCP server bind address
  bind_addr: "127.0.0.1"
  # TCP server port
  bind_port: 502
  # TCP keepalive probe interval (e.g. "60s", "2m")
  # This is how often the server will check if client connections are still alive
  keep_alive: "60s"

rtu:
  # Serial device path
  device: "/dev/ttyAMA0"
  # Baud rate
  baud_rate: 9600
  # Data bits (5-8)
  data_bits: 8
  # Parity (none, odd, even)
  parity: "none"
  # Stop bits ("one", "two")
  stop_bits: "one"
  # Whether to flush after write
  flush_after_write: true

  # Optional RTS configuration ("up", "down", "none")
  rts_type: "down"
  rts_delay_us: 3500

  # Transaction timeout
  transaction_timeout: "5s"
  # Serial port timeout
  serial_timeout: "1s"
  # Maximum frame size
  max_frame_size: 256

http:
  # Enabled
  enabled: true
  # HTTP API bind address
  bind_addr: "127.0.0.1"
  # HTTP API port
  bind_port: 8080
  # Metrics enabled
  metrics_enabled: true

logging:
  # Directory to store log files
  log_dir: "logs"
  # Trace modbus frames
  trace_frames: false
  # Log level (trace, debug, info, warn, error)
  level: "trace"
  # Log format (pretty, json)
  format: "pretty"
  # Use file:line
  include_location: false
  # Log thread ids
  thread_ids: false
  # Log thread names
  thread_names: true

connection:
  # Maximum number of concurrent connections
  max_connections: 100
  # Time after which an idle connection will be closed
  idle_timeout: "60s"
  # Time after which a connection with errors will be closed
  error_timeout: "300s"
  # Timeout for establishing a connection
  connect_timeout: "5s"
  # Optional per IP limits
  per_ip_limits: 10
  # Parameters for backoff strategy
  backoff:
    # Initial wait time
    initial_interval: "100ms"
    # Maximum wait time
    max_interval: "30s"
    # Multiplier for each subsequent attempt
    multiplier: 2.0
    # Maximum number of attempts
    max_retries: 5