From efc9c10f837fc005452408844dc0a9b3c1a0408c Mon Sep 17 00:00:00 2001 From: Thomas Jepp Date: Wed, 12 Apr 2023 05:03:36 +0100 Subject: [PATCH] Feature: Update listen regex to allow IPv6 addresses (#85) --- config/config.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/config.go b/config/config.go index 4ef87df..dbfae59 100644 --- a/config/config.go +++ b/config/config.go @@ -16,10 +16,10 @@ import ( var ( // SMTPListen to listen on : - SMTPListen = "0.0.0.0:1025" + SMTPListen = "[::]:1025" // HTTPListen to listen on : - HTTPListen = "0.0.0.0:8025" + HTTPListen = "[::]:8025" // DataFile for mail (optional) DataFile string @@ -106,7 +106,7 @@ func VerifyConfig() error { DataFile = filepath.Join(DataFile, "mailpit.db") } - re := regexp.MustCompile(`^[a-zA-Z0-9\.\-]{3,}:\d{2,}$`) + re := regexp.MustCompile(`^((\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})|(\[([\da-fA-F:])+\])):\d+$`) if !re.MatchString(SMTPListen) { return errors.New("SMTP bind should be in the format of :") }