Adds the support for IPv6 in the TCP HostSNI matcher
This commit is contained in:
parent
e053eb6f17
commit
1a6dfe1f6b
3 changed files with 28 additions and 4 deletions
|
@ -315,7 +315,7 @@ func alpn(tree *matchersTree, protos ...string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
var almostFQDN = regexp.MustCompile(`^[[:alnum:]\.-]+$`)
|
||||
var hostOrIP = regexp.MustCompile(`^[[:alnum:]\.\-\:]+$`)
|
||||
|
||||
// hostSNI checks if the SNI Host of the connection match the matcher host.
|
||||
func hostSNI(tree *matchersTree, hosts ...string) error {
|
||||
|
@ -329,8 +329,8 @@ func hostSNI(tree *matchersTree, hosts ...string) error {
|
|||
continue
|
||||
}
|
||||
|
||||
if !almostFQDN.MatchString(host) {
|
||||
return fmt.Errorf("invalid value for \"HostSNI\" matcher, %q is not a valid hostname", host)
|
||||
if !hostOrIP.MatchString(host) {
|
||||
return fmt.Errorf("invalid value for \"HostSNI\" matcher, %q is not a valid hostname or IP", host)
|
||||
}
|
||||
|
||||
hosts[i] = strings.ToLower(host)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue