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>
This commit is contained in:
Sebastiaan van Stijn 2023-09-13 18:12:53 +02:00
parent 0a8bd82a37
commit 863909a749
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C
5 changed files with 12 additions and 12 deletions

View file

@ -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

View file

@ -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)

View file

@ -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()

View file

@ -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

View file

@ -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}