diff --git a/tests/connection_test.go b/tests/connection_test.go index eefd45cb..5a9403f9 100644 --- a/tests/connection_test.go +++ b/tests/connection_test.go @@ -29,7 +29,7 @@ func TestBasicSendingReceiving(t *testing.T) { wakuNode, err := node.New(ctx, node.WithPrivateKey(prvKey), - node.WithHostAddress([]net.Addr{hostAddr}), + node.WithHostAddress([]*net.TCPAddr{hostAddr}), node.WithWakuRelay(), ) require.NoError(t, err) diff --git a/waku/node.go b/waku/node.go index dec9f1fd..42073b72 100644 --- a/waku/node.go +++ b/waku/node.go @@ -88,14 +88,14 @@ func Execute(options Options) { nodeOpts := []node.WakuNodeOption{ node.WithPrivateKey(prvKey), - node.WithHostAddress([]net.Addr{hostAddr}), + node.WithHostAddress([]*net.TCPAddr{hostAddr}), node.WithKeepAlive(time.Duration(options.KeepAlive) * time.Second), } if options.AdvertiseAddress != "" { advertiseAddr, err := net.ResolveTCPAddr("tcp", fmt.Sprintf("%s:%d", options.AdvertiseAddress, options.Port)) failOnErr(err, "invalid advertise address") - nodeOpts = append(nodeOpts, node.WithAdvertiseAddress([]net.Addr{advertiseAddr}, options.EnableWS, options.WSPort)) + nodeOpts = append(nodeOpts, node.WithAdvertiseAddress([]*net.TCPAddr{advertiseAddr}, options.EnableWS, options.WSPort)) } if options.EnableWS { diff --git a/waku/v2/node/wakuoptions.go b/waku/v2/node/wakuoptions.go index 8f1ff76c..cdb70c56 100644 --- a/waku/v2/node/wakuoptions.go +++ b/waku/v2/node/wakuoptions.go @@ -60,7 +60,7 @@ func (w WakuNodeParameters) Identity() config.Option { } // WithHostAddress is a WakuNodeOption that configures libp2p to listen on a list of net endpoint addresses -func WithHostAddress(hostAddr []net.Addr) WakuNodeOption { +func WithHostAddress(hostAddr []*net.TCPAddr) WakuNodeOption { return func(params *WakuNodeParameters) error { var multiAddresses []ma.Multiaddr for _, addr := range hostAddr { @@ -78,7 +78,7 @@ func WithHostAddress(hostAddr []net.Addr) WakuNodeOption { } // WithAdvertiseAddress is a WakuNodeOption that allows overriding the addresses used in the waku node with custom values -func WithAdvertiseAddress(addressesToAdvertise []net.Addr, enableWS bool, wsPort int) WakuNodeOption { +func WithAdvertiseAddress(addressesToAdvertise []*net.TCPAddr, enableWS bool, wsPort int) WakuNodeOption { return func(params *WakuNodeParameters) error { params.addressFactory = func([]ma.Multiaddr) []ma.Multiaddr { var result []multiaddr.Multiaddr @@ -86,7 +86,7 @@ func WithAdvertiseAddress(addressesToAdvertise []net.Addr, enableWS bool, wsPort addr, _ := manet.FromNetAddr(adv) result = append(result, addr) if enableWS { - wsMa, _ := multiaddr.NewMultiaddr(fmt.Sprintf("/ip4/%s/tcp/%d/ws", adv, wsPort)) + wsMa, _ := multiaddr.NewMultiaddr(fmt.Sprintf("/ip4/%s/tcp/%d/ws", adv.IP.String(), wsPort)) result = append(result, wsMa) } }