Jelajahi Sumber

libnetwork/portmapper: New(): remove unused argument

None of the code using this function was setting the value, so let's
simplify and remove the argument.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Sebastiaan van Stijn 1 tahun lalu
induk
melakukan
863909a749

+ 2 - 2
libnetwork/drivers/bridge/setup_ip_tables_linux_test.go

@@ -140,8 +140,8 @@ func assertChainConfig(d *driver, t *testing.T) {
 // Assert function which pushes chains based on bridge config parameters.
 func assertBridgeConfig(config *networkConfiguration, br *bridgeInterface, d *driver, t *testing.T) {
 	nw := bridgeNetwork{
-		portMapper:   portmapper.New(""),
-		portMapperV6: portmapper.New(""),
+		portMapper:   portmapper.New(),
+		portMapperV6: portmapper.New(),
 		config:       config,
 	}
 	nw.driver = d

+ 1 - 1
libnetwork/drivers/windows/overlay/ov_network_windows.go

@@ -96,7 +96,7 @@ func (d *driver) CreateNetwork(id string, option map[string]interface{}, nInfo d
 		driver:     d,
 		endpoints:  endpointTable{},
 		subnets:    []*subnet{},
-		portMapper: portmapper.New(""),
+		portMapper: portmapper.New(),
 	}
 
 	genData, ok := option[netlabel.GenericData].(map[string]string)

+ 1 - 1
libnetwork/drivers/windows/windows.go

@@ -261,7 +261,7 @@ func (d *driver) createNetwork(config *networkConfiguration) *hnsNetwork {
 		endpoints:  make(map[string]*hnsEndpoint),
 		config:     config,
 		driver:     d,
-		portMapper: portmapper.New(""),
+		portMapper: portmapper.New(),
 	}
 
 	d.Lock()

+ 2 - 2
libnetwork/portmapper/mapper.go

@@ -33,8 +33,8 @@ var (
 )
 
 // New returns a new instance of PortMapper
-func New(proxyPath string) *PortMapper {
-	return NewWithPortAllocator(portallocator.Get(), proxyPath)
+func New() *PortMapper {
+	return NewWithPortAllocator(portallocator.Get(), "")
 }
 
 // NewWithPortAllocator returns a new instance of PortMapper which will use the specified PortAllocator

+ 6 - 6
libnetwork/portmapper/mapper_linux_test.go

@@ -14,7 +14,7 @@ func init() {
 }
 
 func TestSetIptablesChain(t *testing.T) {
-	pm := New("")
+	pm := New()
 
 	c := &iptables.ChainInfo{
 		Name: "TEST",
@@ -31,7 +31,7 @@ func TestSetIptablesChain(t *testing.T) {
 }
 
 func TestMapTCPPorts(t *testing.T) {
-	pm := New("")
+	pm := New()
 	dstIP1 := net.ParseIP("192.168.0.1")
 	dstIP2 := net.ParseIP("192.168.0.2")
 	dstAddr1 := &net.TCPAddr{IP: dstIP1, Port: 80}
@@ -110,7 +110,7 @@ func TestGetUDPIPAndPort(t *testing.T) {
 }
 
 func TestMapUDPPorts(t *testing.T) {
-	pm := New("")
+	pm := New()
 	dstIP1 := net.ParseIP("192.168.0.1")
 	dstIP2 := net.ParseIP("192.168.0.2")
 	dstAddr1 := &net.UDPAddr{IP: dstIP1, Port: 80}
@@ -156,7 +156,7 @@ func TestMapUDPPorts(t *testing.T) {
 }
 
 func TestMapAllPortsSingleInterface(t *testing.T) {
-	pm := New("")
+	pm := New()
 	dstIP1 := net.ParseIP("0.0.0.0")
 	srcAddr1 := &net.TCPAddr{Port: 1080, IP: net.ParseIP("172.16.0.1")}
 
@@ -195,7 +195,7 @@ func TestMapAllPortsSingleInterface(t *testing.T) {
 }
 
 func TestMapTCPDummyListen(t *testing.T) {
-	pm := New("")
+	pm := New()
 	dstIP := net.ParseIP("0.0.0.0")
 	dstAddr := &net.TCPAddr{IP: dstIP, Port: 80}
 
@@ -232,7 +232,7 @@ func TestMapTCPDummyListen(t *testing.T) {
 }
 
 func TestMapUDPDummyListen(t *testing.T) {
-	pm := New("")
+	pm := New()
 	dstIP := net.ParseIP("0.0.0.0")
 	dstAddr := &net.UDPAddr{IP: dstIP, Port: 80}