mirror of
https://github.com/containers/podman.git
synced 2025-12-05 21:32:22 +08:00
fix(deps): update common, image, and storage deps
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
This commit is contained in:
24
vendor/github.com/containers/common/libnetwork/etchosts/ip.go
generated
vendored
24
vendor/github.com/containers/common/libnetwork/etchosts/ip.go
generated
vendored
@@ -2,12 +2,14 @@ package etchosts
|
||||
|
||||
import (
|
||||
"net"
|
||||
"sync"
|
||||
|
||||
"github.com/containers/common/libnetwork/types"
|
||||
"github.com/containers/common/libnetwork/util"
|
||||
"github.com/containers/common/pkg/config"
|
||||
"github.com/containers/common/pkg/machine"
|
||||
"github.com/containers/storage/pkg/unshare"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
// HostContainersInternalOptions contains the options for GetHostContainersInternalIP()
|
||||
@@ -28,14 +30,30 @@ type HostContainersInternalOptions struct {
|
||||
PreferIP string
|
||||
}
|
||||
|
||||
// Lookup "host.containers.internal" dns name so we can add it to /etc/hosts when running inside podman machine.
|
||||
var machineHostContainersInternalIP = sync.OnceValue(func() string {
|
||||
var errMsg string
|
||||
addrs, err := net.LookupIP(HostContainersInternal)
|
||||
if err == nil {
|
||||
if len(addrs) > 0 {
|
||||
return addrs[0].String()
|
||||
}
|
||||
errMsg = "lookup result is empty"
|
||||
} else {
|
||||
errMsg = err.Error()
|
||||
}
|
||||
logrus.Warnf("Failed to resolve %s for the host entry ip address: %s", HostContainersInternal, errMsg)
|
||||
return ""
|
||||
})
|
||||
|
||||
// GetHostContainersInternalIP returns the host.containers.internal ip
|
||||
func GetHostContainersInternalIP(opts HostContainersInternalOptions) string {
|
||||
switch opts.Conf.Containers.HostContainersInternalIP {
|
||||
case "":
|
||||
// if empty (default) we will automatically choose one below
|
||||
// if machine using gvproxy we let the gvproxy dns server handle the dns name so do not add it
|
||||
// If empty (default) we will automatically choose one below.
|
||||
// If machine using gvproxy we let the gvproxy dns server handle resolve the name and then use that ip.
|
||||
if machine.IsGvProxyBased() {
|
||||
return ""
|
||||
return machineHostContainersInternalIP()
|
||||
}
|
||||
case "none":
|
||||
return ""
|
||||
|
||||
Reference in New Issue
Block a user