summaryrefslogtreecommitdiff
path: root/libnetwork/service_linux.go
diff options
context:
space:
mode:
authorCory Snider <csnider@mirantis.com>2023-01-11 20:10:09 -0500
committerCory Snider <csnider@mirantis.com>2023-01-13 14:19:06 -0500
commit0e91d2e0e97820da5c56f2726e11f4bd9aa40af8 (patch)
tree898eac68c8f4fe39564ea3962ddbd02e7c4c68b0 /libnetwork/service_linux.go
parent0425baf8837bf7123b87bfd16ba149a0de91988c (diff)
downloaddocker-0e91d2e0e97820da5c56f2726e11f4bd9aa40af8.tar.gz
libnetwork: return concrete-typed *Sandbox
Basically every exported method which takes a libnetwork.Sandbox argument asserts that the value's concrete type is *sandbox. Passing any other implementation of the interface is a runtime error! This interface is a footgun, and clearly not necessary. Export and use the concrete type instead. Signed-off-by: Cory Snider <csnider@mirantis.com>
Diffstat (limited to 'libnetwork/service_linux.go')
-rw-r--r--libnetwork/service_linux.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/libnetwork/service_linux.go b/libnetwork/service_linux.go
index 57e0d83c22..c9a8cd7df4 100644
--- a/libnetwork/service_linux.go
+++ b/libnetwork/service_linux.go
@@ -21,7 +21,7 @@ import (
// Populate all loadbalancers on the network that the passed endpoint
// belongs to, into this sandbox.
-func (sb *sandbox) populateLoadBalancers(ep *endpoint) {
+func (sb *Sandbox) populateLoadBalancers(ep *endpoint) {
// This is an interface less endpoint. Nothing to do.
if ep.Iface() == nil {
return
@@ -37,7 +37,7 @@ func (sb *sandbox) populateLoadBalancers(ep *endpoint) {
}
}
-func (n *network) findLBEndpointSandbox() (*endpoint, *sandbox, error) {
+func (n *network) findLBEndpointSandbox() (*endpoint, *Sandbox, error) {
// TODO: get endpoint from store? See EndpointInfo()
var ep *endpoint
// Find this node's LB sandbox endpoint: there should be exactly one
@@ -66,7 +66,7 @@ func (n *network) findLBEndpointSandbox() (*endpoint, *sandbox, error) {
// Searches the OS sandbox for the name of the endpoint interface
// within the sandbox. This is required for adding/removing IP
// aliases to the interface.
-func findIfaceDstName(sb *sandbox, ep *endpoint) string {
+func findIfaceDstName(sb *Sandbox, ep *endpoint) string {
srcName := ep.Iface().SrcName()
for _, i := range sb.osSbox.Info().Interfaces() {
if i.SrcName() == srcName {
@@ -532,7 +532,7 @@ func plumbProxy(iPort *PortConfig, isDelete bool) error {
// configureFWMark configures the sandbox firewall to mark vip destined packets
// with the firewall mark fwMark.
-func (sb *sandbox) configureFWMark(vip net.IP, fwMark uint32, ingressPorts []*PortConfig, eIP *net.IPNet, isDelete bool, lbMode string) error {
+func (sb *Sandbox) configureFWMark(vip net.IP, fwMark uint32, ingressPorts []*PortConfig, eIP *net.IPNet, isDelete bool, lbMode string) error {
// TODO IPv6 support
iptable := iptables.GetIptable(iptables.IPv4)
@@ -585,7 +585,7 @@ func (sb *sandbox) configureFWMark(vip net.IP, fwMark uint32, ingressPorts []*Po
return innerErr
}
-func (sb *sandbox) addRedirectRules(eIP *net.IPNet, ingressPorts []*PortConfig) error {
+func (sb *Sandbox) addRedirectRules(eIP *net.IPNet, ingressPorts []*PortConfig) error {
// TODO IPv6 support
iptable := iptables.GetIptable(iptables.IPv4)
ipAddr := eIP.IP.String()