2021-05-21 12:16:07 +00:00
|
|
|
package network
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/multiformats/go-multiaddr"
|
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
|
|
|
tlsProtocolName = "tls"
|
|
|
|
)
|
|
|
|
|
|
|
|
// tls var is used for (un)wrapping other multiaddrs around TLS multiaddr.
|
2021-07-30 16:43:22 +00:00
|
|
|
var tls, _ = multiaddr.NewMultiaddr("/" + tlsProtocolName)
|
2021-05-21 12:16:07 +00:00
|
|
|
|
2023-06-26 12:00:44 +00:00
|
|
|
// IsTLSEnabled searches for wrapped TLS protocol in multiaddr.
|
|
|
|
func (a Address) IsTLSEnabled() bool {
|
2024-03-21 15:46:07 +00:00
|
|
|
_, err := a.ma.ValueForProtocol(multiaddr.P_TLS)
|
|
|
|
return err == nil
|
2021-05-21 12:16:07 +00:00
|
|
|
}
|