1
0
mirror of https://blitiri.com.ar/repos/chasquid synced 2025-12-17 14:37:02 +00:00

aliases: Implement catch-all

This patch implements support for catch-all aliases, where users can add
a `*: destination` alias. Mails sent to unknown users (or other aliases)
will not be rejected, but sent to the indicated destination instead.

Please see https://github.com/albertito/chasquid/issues/23 and
https://github.com/albertito/chasquid/pull/24 for more discussion and
background.

Thanks to Alex Ellwein (aellwein@github) for the alternative patch and
help with testing; and to ThinkChaos (ThinkChaos@github) for help with
testing.
This commit is contained in:
Alberto Bertogli
2022-01-14 00:58:26 +00:00
parent 3255ff6801
commit f303e43082
7 changed files with 287 additions and 64 deletions

View File

@@ -76,6 +76,8 @@ type Server struct {
// NewServer returns a new empty Server.
func NewServer() *Server {
authr := auth.NewAuthenticator()
aliasesR := aliases.NewResolver(authr.Exists)
return &Server{
addrs: map[SocketMode][]string{},
listeners: map[SocketMode][]net.Listener{},
@@ -83,8 +85,8 @@ func NewServer() *Server {
connTimeout: 20 * time.Minute,
commandTimeout: 1 * time.Minute,
localDomains: &set.String{},
authr: auth.NewAuthenticator(),
aliasesR: aliases.NewResolver(),
authr: authr,
aliasesR: aliasesR,
}
}