metrics: add TLS options (#1939)

* move metrics listener to envoy

* add metrics tls options

* add test

* update docs

* update config proto

* add function to validate metric addr

* fix validation
This commit is contained in:
Caleb Doxsey 2021-02-24 09:42:53 -07:00 committed by GitHub
parent ec02761e2f
commit a825b06014
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 633 additions and 296 deletions

View file

@ -2,6 +2,7 @@ package config
import (
"fmt"
"net"
"strings"
envoy_config_cluster_v3 "github.com/envoyproxy/go-control-plane/envoy/config/cluster/v3"
@ -37,3 +38,17 @@ func GetEnvoyDNSLookupFamily(value string) envoy_config_cluster_v3.Cluster_DnsLo
}
return envoy_config_cluster_v3.Cluster_AUTO
}
// ValidateListenerAddress validates that a listener address is ip:port, not host:port.
func ValidateListenerAddress(addr string) error {
host, _, err := net.SplitHostPort(addr)
if err != nil {
return fmt.Errorf("invalid address, expected host:port")
}
if host != "" && net.ParseIP(host) == nil {
return fmt.Errorf("invalid address, expected ip for host")
}
return nil
}