@@ -391,13 +391,20 @@ func New(ctx context.Context, signer beecrypto.Signer, networkID uint64, overlay
391391 if o .EnableWSS {
392392 wsOpt := ws .WithTLSConfig (certManager .TLSConfig ())
393393 transports = append (transports , libp2p .Transport (ws .New , wsOpt ))
394- // AddrsFactory takes the multiaddrs we're listening on and sets the multiaddrs to advertise to the network.
395- // We use the AutoTLS address factory so that the `*` in the AutoTLS address string is replaced with the
396- // actual IP address of the host once detected
397- certManagerAddressFactory := certManager .AddressFactory ()
398- opts = append (opts , libp2p .AddrsFactory (func (addrs []ma.Multiaddr ) []ma.Multiaddr {
399- addrs = includeNatResolvedAddresses (addrs , newCompositeAddressResolver (tcpResolver , wssResolver ), logger )
394+ }
395+
396+ if o .EnableWS {
397+ transports = append (transports , libp2p .Transport (ws .New ))
398+ }
399+
400+ opts = append (opts , libp2p .AddrsFactory (func (addrs []ma.Multiaddr ) []ma.Multiaddr {
401+ addrs = includeNatResolvedAddresses (addrs , newCompositeAddressResolver (tcpResolver , wssResolver ), logger )
400402
403+ if o .EnableWSS {
404+ // AddrsFactory takes the multiaddrs we're listening on and sets the multiaddrs to advertise to the network.
405+ // We use the AutoTLS address factory so that the `*` in the AutoTLS address string is replaced with the
406+ // actual IP address of the host once detected
407+ certManagerAddressFactory := certManager .AddressFactory ()
401408 addrs = certManagerAddressFactory (addrs )
402409
403410 slices .SortStableFunc (addrs , func (a , b ma.Multiaddr ) int {
@@ -413,11 +420,10 @@ func New(ctx context.Context, signer beecrypto.Signer, networkID uint64, overlay
413420 }
414421 return 0
415422 })
416- return addrs
417- }))
418- } else if o .EnableWS {
419- transports = append (transports , libp2p .Transport (ws .New ))
420- }
423+ }
424+
425+ return addrs
426+ }))
421427
422428 opts = append (opts , transports ... )
423429
0 commit comments