Mail::...:Daemon(3pm)

πŸ“¦
version 0.31 Β· 2 versions
  • 0.31 Β· debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 0.31 Β· ubuntu jammy
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– Mail::SRS::Daemon β€” the Perl doc page, but make it make sense πŸ’–

okay bestie, so this is Mail::SRS::Daemon(3pm) from the User Contributed Perl Documentation β€” yeah, the whole "user contributed" thing, we're all just out here contributing 🫢. Anyway. Sit down, hydrate, and let's talk about a little daemon that does SRS address glow-ups on demand. It's giving modular, it's giving socket-based, it's giving your MTA's new best friend.


✨ NAME ✨

Mail::SRS::Daemon β€” a modular daemon for Mail::SRS. literally that's it, that's the whole vibe. πŸŽ€


✨ SYNOPSIS ✨

my $daemon = new Mail::SRS::Daemon(      SecretFile  => $secretfile,
     Separator   => $separator,           ); $daemon->run();

like. construct it, then run it. that's the whole arc. main character energy fr fr πŸ‘‘


✨ DESCRIPTION ✨

The SRS daemon sits on a socket and waits β€” patiently, iconically β€” for SRS address transformation requests. When one shows up, it transforms the address and hands the new address right back down the socket. no cap. ✨

You can invoke it from exim using ${readsocket ...}, and probably from other MTAs too. If you want actual examples, go look at <http://www.anarres.org/projects/srs/> β€” that's the plug, iykyk.


✨ METHODS ✨

🌸 $daemon = new Mail::SRS::Daemon(...)

Construct a brand new Mail::SRS object and return it. πŸ’…

Every single parameter that's valid for Mail::SRS is also valid for Mail::SRS::Daemon, and it gets passed straight through to the Mail::SRS constructor verbatim β€” no changes, no edits, no notes, we just hand it over.

The one exception to this rule? The Secret parameter. That one gets promoted to a list, and all the secrets from SecretFile get included in it. Sneaky but iconic.

The new params are documented right here, and for everything else you go see Mail::SRS. πŸ¦‹

  • SecretFile => $string β€” a file to read secrets from. Secrets are specified once per line. The first specified secret is the one used for encoding. Secrets are written one per line. Blank lines, and lines starting with a #, are ignored. If Secret isn't given, then the secret file must be nonempty.
Also, Secret will specify a primary secret and it overrides SecretFile if both are specified. BUT β€” plot twist β€” secrets read from SecretFile still get used for decoding if both are specified. so it's not a full breakup, it's a situationship. 😭
  • Socket => $socket β€” an instance of IO::Socket, presumed to be a listening socket. You can pass this in if you want to use a preexisting socket instead of making Mail::SRS::Daemon construct a whole new one. reuse, reduce, recycle πŸ’š

🌸 $daemon->run()

Run the daemon. πŸƒβ™€οΈ

This method will never return. Like, never ever. Errors and exceptions get caught, and error messages are returned down the socket.

✨ EXPORTS ✨

If you give it :all, this module exports the following variable. (just the one, she's an only child πŸ’…)

  • $SRSSOCKET β€” the filename of the default socket created by Mail::SRS::Daemon.

✨ PROTOCOL ✨

Here's the tea β˜•: the daemon waits for a single line of text from the client, and it responds with a single line. That's it. One in, one out. beautiful, efficient, obsessed.

Every line is of the form "COMMAND args...". Right now, exactly two commands are supported: forward and reverse. periodt.

A forward request looks like:

FORWARD sender@source.com alias@forwarder.com

A reverse request looks like:

REVERSE srs0+HHH=TT=domain=local-part@forwarder.com

Either way, the daemon responds with either a translated address or a line starting with "ERROR ", followed by a message. so you'll know. you'll always know. 🌈


✨ TODO ✨

Add more daemon-related options, like path to socket, or inet socket address. it's on the list bestie, we're getting to it 🧚


✨ SEE ALSO ✨


✨ AUTHOR ✨

Shevek
CPAN ID: SHEVEK
cpan@anarres.org
http://www.anarres.org/projects/

shoutout Shevek, the blueprint πŸ’œ


Copyright (c) 2004 Shevek. All rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. 🫢


and that's the whole page, bestie!! this was documented by the User Contributed Perl Documentation crew, on perl v5.36.0, dated 2022-11-27 β€” so if you're reading this way later and something's crunchy, that's why. go forth and daemon responsibly πŸ’–βœ¨πŸŒΈ

πŸ“¦ where this page comes from