libnetwork/drivers/windows: format code with gofumpt

Formatting the code with https://github.com/mvdan/gofumpt

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2022-01-20 14:00:42 +01:00
parent 2cc5c2d2e6
commit 485977de57
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C
7 changed files with 9 additions and 31 deletions

View file

@ -32,7 +32,6 @@ func (d *driver) Join(nid, eid string, sboxKey string, jinfo driverapi.JoinInfo,
EndpointMAC: ep.mac.String(),
TunnelEndpointIP: n.providerAddress,
})
if err != nil {
return err
}

View file

@ -32,8 +32,8 @@ type endpoint struct {
}
var (
//Server 2016 (RS1) does not support concurrent add/delete of endpoints. Therefore, we need
//to use this mutex and serialize the add/delete of endpoints on RS1.
// Server 2016 (RS1) does not support concurrent add/delete of endpoints. Therefore, we need
// to use this mutex and serialize the add/delete of endpoints on RS1.
endpointMu sync.Mutex
windowsBuild = osversion.Build()
)
@ -93,8 +93,7 @@ func (n *network) removeEndpointWithAddress(addr *net.IPNet) {
}
}
func (d *driver) CreateEndpoint(nid, eid string, ifInfo driverapi.InterfaceInfo,
epOptions map[string]interface{}) error {
func (d *driver) CreateEndpoint(nid, eid string, ifInfo driverapi.InterfaceInfo, epOptions map[string]interface{}) error {
var err error
if err = validateID(nid, eid); err != nil {
return err
@ -149,17 +148,13 @@ func (d *driver) CreateEndpoint(nid, eid string, ifInfo driverapi.InterfaceInfo,
Type: "PA",
PA: n.providerAddress,
})
if err != nil {
return err
}
hnsEndpoint.Policies = append(hnsEndpoint.Policies, paPolicy)
natPolicy, err := json.Marshal(hcsshim.PaPolicy{
Type: "OutBoundNAT",
})
natPolicy, err := json.Marshal(hcsshim.PaPolicy{Type: "OutBoundNAT"})
if err != nil {
return err
}

View file

@ -270,7 +270,6 @@ func (n *network) convertToOverlayEndpoint(v *hcsshim.HNSEndpoint) *endpoint {
}
mac, err := net.ParseMAC(v.MacAddress)
if err != nil {
return nil
}
@ -285,7 +284,6 @@ func (n *network) convertToOverlayEndpoint(v *hcsshim.HNSEndpoint) *endpoint {
}
func (d *driver) createHnsNetwork(n *network) error {
subnets := []hcsshim.Subnet{}
for _, s := range n.subnets {
@ -301,7 +299,6 @@ func (d *driver) createHnsNetwork(n *network) error {
Type: "VSID",
VSID: uint(s.vni),
})
if err != nil {
return err
}

View file

@ -95,7 +95,6 @@ func (d *driver) convertToOverlayNetwork(v *hcsshim.HNSNetwork) *network {
}
_, subnetIP, err := net.ParseCIDR(hnsSubnet.AddressPrefix)
if err != nil {
log.G(context.TODO()).Errorf("Error parsing subnet address %s ", hnsSubnet.AddressPrefix)
continue

View file

@ -2,22 +2,18 @@ package overlay
import (
"context"
"encoding/json"
"fmt"
"net"
"encoding/json"
"github.com/Microsoft/hcsshim"
"github.com/containerd/containerd/log"
"github.com/docker/docker/libnetwork/types"
"github.com/Microsoft/hcsshim"
)
const ovPeerTable = "overlay_peer_table"
func (d *driver) peerAdd(nid, eid string, peerIP net.IP, peerIPMask net.IPMask,
peerMac net.HardwareAddr, vtep net.IP, updateDb bool) error {
func (d *driver) peerAdd(nid, eid string, peerIP net.IP, peerIPMask net.IPMask, peerMac net.HardwareAddr, vtep net.IP, updateDb bool) error {
log.G(context.TODO()).Debugf("WINOVERLAY: Enter peerAdd for ca ip %s with ca mac %s", peerIP.String(), peerMac.String())
if err := validateID(nid, eid); err != nil {
@ -44,7 +40,6 @@ func (d *driver) peerAdd(nid, eid string, peerIP net.IP, peerIPMask net.IPMask,
Type: "PA",
PA: vtep.String(),
})
if err != nil {
return err
}
@ -88,9 +83,7 @@ func (d *driver) peerAdd(nid, eid string, peerIP net.IP, peerIPMask net.IPMask,
return nil
}
func (d *driver) peerDelete(nid, eid string, peerIP net.IP, peerIPMask net.IPMask,
peerMac net.HardwareAddr, vtep net.IP, updateDb bool) error {
func (d *driver) peerDelete(nid, eid string, peerIP net.IP, peerIPMask net.IPMask, peerMac net.HardwareAddr, vtep net.IP, updateDb bool) error {
log.G(context.TODO()).Infof("WINOVERLAY: Enter peerDelete for endpoint %s and peer ip %s", eid, peerIP.String())
if err := validateID(nid, eid); err != nil {

View file

@ -100,7 +100,7 @@ func allocatePort(portMapper *portmapper.PortMapper, bnd *types.PortBinding, con
// For completeness
return ErrUnsupportedAddressType(fmt.Sprintf("%T", netAddr))
}
//Windows does not support host port ranges.
// Windows does not support host port ranges.
bnd.HostPortEnd = bnd.HostPort
return nil
}

View file

@ -326,7 +326,6 @@ func (d *driver) CreateNetwork(id string, option map[string]interface{}, nInfo d
Type: "VLAN",
VLAN: config.VLAN,
})
if err != nil {
return err
}
@ -338,7 +337,6 @@ func (d *driver) CreateNetwork(id string, option map[string]interface{}, nInfo d
Type: "VSID",
VSID: config.VSID,
})
if err != nil {
return err
}
@ -459,7 +457,6 @@ func convertQosPolicies(qosPolicies []types.QosPolicy) ([]json.RawMessage, error
Type: "QOS",
MaximumOutgoingBandwidthInBytes: elem.MaxEgressBandwidth,
})
if err != nil {
return nil, err
}
@ -496,7 +493,6 @@ func ConvertPortBindings(portBindings []types.PortBinding) ([]json.RawMessage, e
Protocol: elem.Proto.String(),
ExternalPortReserved: true,
})
if err != nil {
return nil, err
}
@ -693,7 +689,6 @@ func (d *driver) CreateEndpoint(nid, eid string, ifInfo driverapi.InterfaceInfo,
Policy: hcsshim.Policy{Type: hcsshim.OutboundNat},
Exceptions: n.config.OutboundNatExceptions,
})
if err != nil {
return err
}