POPgun is a lightweight POP3 server implementation in Go. POPgun meets RFC1939 and was mainly created for develmail.com.
POPgun is meant to be used as a package and you need to create your own implementations
of Authorizator
and Backend
interfaces.
import (
"github.com/DevelHell/popgun"
)
Authorizator
is used for user authorization and there's only one function Authorize(user, pass string)
. Be aware that single instance is shared
across all client connections.
Backend
is used for mail storage access, e.g. database storage. Single Backend
instance is shared across all client connections connections as well.
Example dummy implementations can be found in backend
package, see comments in these files for more information. When your're done, create an instance of both of them:
backend := backends.DummyBackend{}
authorizator := backends.DummyAuthorizator{}
There is only one configuration field for now - ListenInterface
, which defines interface (ip address) and port to listen on.
Server is started in separate go routine, so be sure to keep the server busy, e.g. using wait groups:
cfg := popgun.Config{
ListenInterface: "localhost:1100",
}
var wg sync.WaitGroup
wg.Add(1)
server := NewServer(cfg, authorizator, backend)
err := server.Start()
if err != nil {
log.Fatal(err)
return
}
wg.Wait()
Server is logging to stderr
using log
package.
POPgun is released under MIT license. Feel free to fork, redistribute or contribute!