1
0
Fork
You've already forked cookied
0
An RFC865 quote-of-the-day server
  • Rust 67.4%
  • Nix 32.6%
2025年12月22日 16:39:25 +01:00
nix add some nix quality-of-life simplifications 2025年12月22日 16:39:25 +01:00
src add opentelemetry metrics support 2025年04月20日 14:44:58 +02:00
.envrc implement simple tcp server 2025年03月13日 12:12:30 +01:00
.gitignore add nix packaging config 2025年03月13日 21:14:08 +01:00
Cargo.lock Update all non-major dependencies 2025年11月19日 21:01:56 +00:00
Cargo.toml Update all non-major dependencies 2025年11月19日 21:01:56 +00:00
flake.lock upgrade flake inputs 2025年12月21日 16:59:42 +01:00
flake.nix add some nix quality-of-life simplifications 2025年12月22日 16:39:25 +01:00
LICENSE add some documentation 2025年03月13日 21:34:28 +01:00
README.md add opentelemetry metrics support 2025年04月20日 14:44:58 +02:00
renovate.json Add renovate.json 2025年04月08日 08:30:23 +00:00

cookied - An RFC 865 compliant Quote of the Day Server

cookied is a small server program designed to supply a user with quotes of the day based on RFC 865. A quote of the day service is specified as a useful debugging and measurement tool which simply sends a short message without regard to its input.

This software is named cookied because the accompanying DHCP-Option (with the option-code 8) is called the Cookie Server Option which is how I even found the RFC. I also just really like cookies so the name stuck.

How to run

The server binary can be built using either cargo build or nix build . and then run. Note that the server expects file descriptors to be passed to it (also known as socket-activation) like it is done with systemd socket units or a manual wrapper such as systemfd or systemd-socket-activate.

systemd-socket-activate -l 127.0.0.1:17 cookied
# or
systemfd -s tcp::127.0.0.1:17 -s udp::127.0.0.1:17 -- cookied

The server accepts the following commandline arguments:

An RFC865 quote-of-the-day server
Note that the server can only be started using socket activation. This could be achieved using e.g. systemd socket activation or a wrapper program like systemfd.
Usage: cookied [OPTIONS]
Options:
 --alg <ALG>
 Which algorithm to use for response generation
 
 [default: time-and-place]
 Possible values:
 - pattern: Respond with the hex value 0x55 to be easily recognizable
 - time-and-place: Respond with the current time and the remote address of the client
 - text: Respond with the text given via --text
 --text <TEXT>
 Use this text as a response for --alg=text
 
 [default: "Hello World"]
 -h, --help
 Print help (see a summary with '-h')
 -V, --version
 Print version

How to use the Service

Once the server is running, it responds on the given ports with a small quote. This can be viewed, for example, with netcat:

nc 127.0.0.1 17

Metrics

This service supports exposing metrics via the OpenTelemetry otlp protocol. You can configure it by setting the environment variable OTEL_METRICS_EXPORTER to either otlp or console. If otlp is used, the target endpoint can be configured with the variable OTEL_EXPORTER_OTLP_METRICS_ENDPOINT.