Simple Golang SMTP relay/proxy server
go
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

config.go 1.5KB

123456789101112131415161718192021222324252627282930313233
  1. package main
  2. import (
  3. "flag"
  4. "github.com/vharitonsky/iniflags"
  5. )
  6. const (
  7. VERSION = "1.2.0"
  8. )
  9. var (
  10. logFile = flag.String("logfile", "/var/log/smtprelay.log", "Path to logfile")
  11. hostName = flag.String("hostname", "localhost.localdomain", "Server hostname")
  12. welcomeMsg = flag.String("welcome_msg", "", "Welcome message for SMTP session")
  13. listen = flag.String("listen", "127.0.0.1:25 [::1]:25", "Address and port to listen for incoming SMTP")
  14. localCert = flag.String("local_cert", "", "SSL certificate for STARTTLS/TLS")
  15. localKey = flag.String("local_key", "", "SSL private key for STARTTLS/TLS")
  16. localForceTLS = flag.Bool("local_forcetls", false, "Force STARTTLS (needs local_cert and local_key)")
  17. allowedNets = flag.String("allowed_nets", "127.0.0.1/8 ::1/128", "Networks allowed to send mails")
  18. allowedSender = flag.String("allowed_sender", "", "Regular expression for valid FROM EMail adresses")
  19. allowedRecipients = flag.String("allowed_recipients", "", "Regular expression for valid TO EMail adresses")
  20. allowedUsers = flag.String("allowed_users", "", "Path to file with valid users/passwords")
  21. remoteHost = flag.String("remote_host", "smtp.gmail.com:587", "Outgoing SMTP server")
  22. remoteUser = flag.String("remote_user", "", "Username for authentication on outgoing SMTP server")
  23. remotePass = flag.String("remote_pass", "", "Password for authentication on outgoing SMTP server")
  24. versionInfo= flag.Bool("version", false, "Show version information")
  25. )
  26. func ConfigLoad() {
  27. iniflags.Parse()
  28. }