package network

import (
	"github.com/multiformats/go-multiaddr"
)

const (
	tlsProtocolName = "tls"
)

// tls var is used for (un)wrapping other multiaddrs around TLS multiaddr.
var tls, _ = multiaddr.NewMultiaddr("/" + tlsProtocolName)

// IsTLSEnabled searches for wrapped TLS protocol in multiaddr.
func (a Address) IsTLSEnabled() bool {
	_, err := a.ma.ValueForProtocol(multiaddr.P_TLS)
	return err == nil
}