forked from TrueCloudLab/frostfs-node
[#549] network/Address: Add TLS
There is no TLS protocol support in `go-multiaddr` library, but there is public function that can register any protocol that can be implemented outside the library. Also `TLSEnabled` function for parsing TLS protocol from `network.Address` was added. Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
33bef46f31
commit
f267fbc56a
4 changed files with 191 additions and 0 deletions
|
@ -31,6 +31,22 @@ type LocalAddressSource interface {
|
|||
LocalAddress() *Address
|
||||
}
|
||||
|
||||
// Encapsulate wraps this Address around another. For example:
|
||||
//
|
||||
// /ip4/1.2.3.4 encapsulate /tcp/80 = /ip4/1.2.3.4/tcp/80
|
||||
//
|
||||
func (a *Address) Encapsulate(addr *Address) {
|
||||
a.ma = a.ma.Encapsulate(addr.ma)
|
||||
}
|
||||
|
||||
// Decapsulate removes an Address wrapping. For example:
|
||||
//
|
||||
// /ip4/1.2.3.4/tcp/80 decapsulate /ip4/1.2.3.4 = /tcp/80
|
||||
//
|
||||
func (a *Address) Decapsulate(addr *Address) {
|
||||
a.ma = a.ma.Decapsulate(addr.ma)
|
||||
}
|
||||
|
||||
// String returns multiaddr string
|
||||
func (a Address) String() string {
|
||||
return a.ma.String()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue