An RFC865 quote-of-the-day server
Find a file
2025-04-20 14:44:58 +02:00
nix update nix module to automatically include overlay and package 2025-03-14 21:42:44 +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 add opentelemetry metrics support 2025-04-20 14:44:58 +02:00
Cargo.toml add opentelemetry metrics support 2025-04-20 14:44:58 +02:00
flake.lock add nix packaging config 2025-03-13 21:14:08 +01:00
flake.nix update nix module to automatically include overlay and package 2025-03-14 21:42:44 +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.