Skip to content

Commit

Permalink
Feature: Update listen regex to allow IPv6 addresses (#85)
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasjepp authored Apr 12, 2023
1 parent 962af81 commit efc9c10
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ import (

var (
// SMTPListen to listen on <interface>:<port>
SMTPListen = "0.0.0.0:1025"
SMTPListen = "[::]:1025"

// HTTPListen to listen on <interface>:<port>
HTTPListen = "0.0.0.0:8025"
HTTPListen = "[::]:8025"

// DataFile for mail (optional)
DataFile string
Expand Down Expand Up @@ -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 <ip>:<port>")
}
Expand Down

0 comments on commit efc9c10

Please sign in to comment.