summaryrefslogtreecommitdiff
path: root/libnetwork/default_gateway.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/default_gateway.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/default_gateway.go')
-rw-r--r--libnetwork/default_gateway.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/libnetwork/default_gateway.go b/libnetwork/default_gateway.go
index 9f82cfaa30..97310f729a 100644
--- a/libnetwork/default_gateway.go
+++ b/libnetwork/default_gateway.go
@@ -29,7 +29,7 @@ var procGwNetwork = make(chan (bool), 1)
- its deleted when an endpoint with GW joins the container
*/
-func (sb *sandbox) setupDefaultGW() error {
+func (sb *Sandbox) setupDefaultGW() error {
// check if the container already has a GW endpoint
if ep := sb.getEndpointInGWNetwork(); ep != nil {
return nil
@@ -94,7 +94,7 @@ func (sb *sandbox) setupDefaultGW() error {
}
// If present, detach and remove the endpoint connecting the sandbox to the default gw network.
-func (sb *sandbox) clearDefaultGW() error {
+func (sb *Sandbox) clearDefaultGW() error {
var ep *endpoint
if ep = sb.getEndpointInGWNetwork(); ep == nil {
@@ -113,7 +113,7 @@ func (sb *sandbox) clearDefaultGW() error {
// on the endpoints to which it is connected. It does not account
// for the default gateway network endpoint.
-func (sb *sandbox) needDefaultGW() bool {
+func (sb *Sandbox) needDefaultGW() bool {
var needGW bool
for _, ep := range sb.getConnectedEndpoints() {
@@ -145,7 +145,7 @@ func (sb *sandbox) needDefaultGW() bool {
return needGW
}
-func (sb *sandbox) getEndpointInGWNetwork() *endpoint {
+func (sb *Sandbox) getEndpointInGWNetwork() *endpoint {
for _, ep := range sb.getConnectedEndpoints() {
if ep.getNetwork().name == libnGWNetwork && strings.HasPrefix(ep.Name(), "gateway_") {
return ep
@@ -175,7 +175,7 @@ func (c *Controller) defaultGwNetwork() (Network, error) {
}
// Returns the endpoint which is providing external connectivity to the sandbox
-func (sb *sandbox) getGatewayEndpoint() *endpoint {
+func (sb *Sandbox) getGatewayEndpoint() *endpoint {
for _, ep := range sb.getConnectedEndpoints() {
if ep.getNetwork().Type() == "null" || ep.getNetwork().Type() == "host" {
continue