--- /dev/null
+package main
+
+type Config struct {
+ SMTPPort int
+ POP3Port int
+
+ Servers []Server
+}
+
+type Server struct {
+ // Domain is the second component of a mail address: <local-part@domain.com>.
+ Domain string
+
+ // Hostname is the name of the MX server that is running.
+ Hostname string
+
+ TLSKeyPath string
+ TLSCertPath string
+
+ // Password for the POP3 mailbox user, mailbox@domain.com.
+ MailboxPassword string
+
+ // Blacklisted addresses that should not accept mail.
+ BlacklistedAddresses []string
+}
--- /dev/null
+package main
+
+import (
+ "encoding/json"
+ "fmt"
+ "os"
+)
+
+func main() {
+ if len(os.Args) != 2 {
+ fmt.Fprintf(os.Stderr, "Usage: %s config.json\n", os.Args[0])
+ os.Exit(1)
+ }
+
+ configFile, err := os.Open(os.Args[1])
+ if err != nil {
+ fmt.Fprintf(os.Stderr, "config file: %s\n", err)
+ os.Exit(2)
+ }
+
+ var config Config
+ if err := json.NewDecoder(configFile).Decode(&config); err != nil {
+ fmt.Fprintf(os.Stderr, "config file: %s\n", err)
+ os.Exit(3)
+ }
+ configFile.Close()
+}