mirror of
https://github.com/moby/moby.git
synced 2026-06-24 08:48:23 +00:00
Merge pull request #52321 from AkihiroSuda/api-userland-proxy
libnetwork: expose proxy information in FirewallInfo
This commit is contained in:
@@ -13,7 +13,8 @@ import (
|
||||
"github.com/moby/moby/v2/daemon/libnetwork/osl"
|
||||
)
|
||||
|
||||
// FirewallBackend returns the name of the firewall backend for "docker info".
|
||||
// FirewallBackend returns FirewallInfo for "docker info".
|
||||
// Despite the name, FirewallInfo may include information about the userland proxy as well.
|
||||
func (c *Controller) FirewallBackend() *system.FirewallInfo {
|
||||
var info system.FirewallInfo
|
||||
info.Driver = "iptables"
|
||||
@@ -26,6 +27,15 @@ func (c *Controller) FirewallBackend() *system.FirewallInfo {
|
||||
info.Info = [][2]string{{"ReloadedAt", reloadedAt.Format(time.RFC3339)}}
|
||||
}
|
||||
}
|
||||
if c.cfg.EnableUserlandProxy {
|
||||
// EnableUserlandProxy is exposed in FirewallInfo since Docker v29.5.
|
||||
// In older versions, EnableUserlandProxy is not included in FirewallInfo,
|
||||
// but it is still used in most cases as it is enabled by default.
|
||||
info.Info = append(info.Info, [2]string{"EnableUserlandProxy", "true"})
|
||||
if c.cfg.UserlandProxyPath != "" {
|
||||
info.Info = append(info.Info, [2]string{"UserlandProxyPath", c.cfg.UserlandProxyPath})
|
||||
}
|
||||
}
|
||||
return &info
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user