#config-file #sockets #targets #socat #tcp-socket #less #config-directory

app rustocat

Socat in rust with many less features and a configuration file

7 releases

0.1.13 Apr 13, 2024
0.1.2 Feb 6, 2023
0.0.3 Mar 21, 2022

#5 in #config-directory

ISC license

31KB
779 lines

Rustocat

Rustocat is a simple socat alternative with way less features, but it has a config file.

Config File

Configs can be either yaml or json and can be located in /etc/rustocat.{yaml|json} or in the current working directory as config.{yaml|json}.

mappings:
  - udp: false
    source: 0.0.0.0:2222
    targets: [127.0.0.1:22]

There is support for UDP and TCP sockets. Each socket can have multiple targets.

When multiple targets are set, it will randomly pick one of them.

Live Changes

It is designed to live reconfigure itself. To trigger a change, send the signal SIGHUP to the process. This will re-read the config file and adjust the sockets and targets accordingly.

All existing connections will stay as they are, but removed sources are closed from further connections.

Dependencies

~9–24MB
~401K SLoC