mirror of
https://github.com/pomerium/pomerium.git
synced 2025-06-01 18:33:19 +02:00
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:
parent
ec02761e2f
commit
a825b06014
15 changed files with 633 additions and 296 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue