mirror of https://github.com/k3s-io/k3s
Add ability to disable proxy hostname check
parent
5548c019a0
commit
c3e5ef1886
|
@ -40,6 +40,7 @@ const (
|
||||||
var (
|
var (
|
||||||
ErrAddressNotAllowed = errors.New("address not allowed")
|
ErrAddressNotAllowed = errors.New("address not allowed")
|
||||||
ErrNoAddresses = errors.New("No addresses for hostname")
|
ErrNoAddresses = errors.New("No addresses for hostname")
|
||||||
|
DisableProxyHostnameCheck = false
|
||||||
)
|
)
|
||||||
|
|
||||||
func IsZeroCIDR(cidr string) bool {
|
func IsZeroCIDR(cidr string) bool {
|
||||||
|
@ -72,6 +73,10 @@ type Resolver interface {
|
||||||
|
|
||||||
// IsProxyableHostname checks if the IP addresses for a given hostname are permitted to be proxied
|
// IsProxyableHostname checks if the IP addresses for a given hostname are permitted to be proxied
|
||||||
func IsProxyableHostname(ctx context.Context, resolv Resolver, hostname string) error {
|
func IsProxyableHostname(ctx context.Context, resolv Resolver, hostname string) error {
|
||||||
|
if DisableProxyHostnameCheck {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
resp, err := resolv.LookupIPAddr(ctx, hostname)
|
resp, err := resolv.LookupIPAddr(ctx, hostname)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Reference in New Issue