@@ -124,9 +124,7 @@ type Service struct {
124124 enableWS bool
125125 autoTLSCertManager autoTLSCertManager
126126 zapLogger * zap.Logger
127- hasTCPTransport bool
128- hasWSTransport bool
129- hasWSSTransport bool
127+ enabledTransports map [bzz.TransportType ]bool
130128}
131129
132130type lightnodes interface {
@@ -549,9 +547,11 @@ func New(ctx context.Context, signer beecrypto.Signer, networkID uint64, overlay
549547 enableWS : o .EnableWS ,
550548 autoTLSCertManager : certManager ,
551549 zapLogger : zapLogger ,
552- hasTCPTransport : true , // TCP transport is always included
553- hasWSTransport : o .EnableWS ,
554- hasWSSTransport : o .EnableWSS ,
550+ enabledTransports : map [bzz.TransportType ]bool {
551+ bzz .TransportTCP : true , // TCP transport is always included
552+ bzz .TransportWS : o .EnableWS ,
553+ bzz .TransportWSS : o .EnableWSS ,
554+ },
555555 }
556556
557557 peerRegistry .setDisconnecter (s )
@@ -806,16 +806,7 @@ func (s *Service) handleIncoming(stream network.Stream) {
806806
807807// isTransportSupported checks if the given transport type is supported by this service.
808808func (s * Service ) isTransportSupported (t bzz.TransportType ) bool {
809- switch t {
810- case bzz .TransportTCP :
811- return s .hasTCPTransport
812- case bzz .TransportWS :
813- return s .hasWSTransport
814- case bzz .TransportWSS :
815- return s .hasWSSTransport
816- default :
817- return false
818- }
809+ return s .enabledTransports [t ]
819810}
820811
821812// filterSupportedAddresses filters multiaddresses to only include those
0 commit comments