forked from TrueCloudLab/frostfs-sdk-go
As advocated explicitly in https://github.com/multiformats/go-multiaddr/blob/master/v015-MIGRATION.md Answering a question about safety: AppendComponent() appends to `a.ma`` in place. `a.ma` is created by FromString() function, so there is only a single goroutine appending to it. Thus, assuming `FromString()` itself is called from a single goroutine, no data race is introduced. Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
18 lines
558 B
Go
18 lines
558 B
Go
// NOTE: code is taken from https://git.frostfs.info/TrueCloudLab/frostfs-node/src/commit/df05057ed46632e7746fcaa26731987a9070b2e5/pkg/network/tls.go
|
|
|
|
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.NewComponent(tlsProtocolName, "")
|
|
|
|
// IsTLSEnabled searches for wrapped TLS protocol in multiaddr.
|
|
func (a Address) IsTLSEnabled() bool {
|
|
_, err := a.ma.ValueForProtocol(multiaddr.P_TLS)
|
|
return err == nil
|
|
}
|