mirror of
https://github.com/axllent/mailpit.git
synced 2025-04-21 12:17:05 +02:00
Feature: Update listen regex to allow IPv6 addresses (#85)
This commit is contained in:
parent
962af81653
commit
efc9c10f83
@ -16,10 +16,10 @@ import (
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
// SMTPListen to listen on <interface>:<port>
|
// SMTPListen to listen on <interface>:<port>
|
||||||
SMTPListen = "0.0.0.0:1025"
|
SMTPListen = "[::]:1025"
|
||||||
|
|
||||||
// HTTPListen to listen on <interface>:<port>
|
// HTTPListen to listen on <interface>:<port>
|
||||||
HTTPListen = "0.0.0.0:8025"
|
HTTPListen = "[::]:8025"
|
||||||
|
|
||||||
// DataFile for mail (optional)
|
// DataFile for mail (optional)
|
||||||
DataFile string
|
DataFile string
|
||||||
@ -106,7 +106,7 @@ func VerifyConfig() error {
|
|||||||
DataFile = filepath.Join(DataFile, "mailpit.db")
|
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) {
|
if !re.MatchString(SMTPListen) {
|
||||||
return errors.New("SMTP bind should be in the format of <ip>:<port>")
|
return errors.New("SMTP bind should be in the format of <ip>:<port>")
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user