Introduce VERSION to be able to identify ourselves

This commit is contained in:
Bernhard Froehlich
2018-12-20 09:58:04 +00:00
parent 3b643b3927
commit b03ecbb02d

11
main.go
View File

@@ -3,6 +3,7 @@ package main
import ( import (
"crypto/tls" "crypto/tls"
"flag" "flag"
"fmt"
"io" "io"
"log" "log"
"net" "net"
@@ -15,6 +16,10 @@ import (
"github.com/vharitonsky/iniflags" "github.com/vharitonsky/iniflags"
) )
const (
VERSION = "1.0.2-dev"
)
var ( var (
logFile = flag.String("logfile", "/var/log/smtpd-proxy.log", "Path to logfile") logFile = flag.String("logfile", "/var/log/smtpd-proxy.log", "Path to logfile")
hostName = flag.String("hostname", "localhost.localdomain", "Server hostname") hostName = flag.String("hostname", "localhost.localdomain", "Server hostname")
@@ -26,6 +31,7 @@ var (
remoteHost = flag.String("remote_host", "smtp.gmail.com:587", "Outgoing SMTP server") remoteHost = flag.String("remote_host", "smtp.gmail.com:587", "Outgoing SMTP server")
remoteUser = flag.String("remote_user", "", "Username for authentication on outgoing SMTP server") remoteUser = flag.String("remote_user", "", "Username for authentication on outgoing SMTP server")
remotePass = flag.String("remote_pass", "", "Password for authentication on outgoing SMTP server") remotePass = flag.String("remote_pass", "", "Password for authentication on outgoing SMTP server")
versionInfo= flag.Bool("version", false, "Show version information")
) )
func handler(peer smtpd.Peer, env smtpd.Envelope) error { func handler(peer smtpd.Peer, env smtpd.Envelope) error {
@@ -52,6 +58,11 @@ func main() {
iniflags.Parse() iniflags.Parse()
if *versionInfo {
fmt.Printf("smtpd-proxy/%s\n", VERSION)
os.Exit(0)
}
logwriter := io.Writer(os.Stdout) logwriter := io.Writer(os.Stdout)
if *logFile != "" { if *logFile != "" {