Documentation ¶
Index ¶
- func StringifyGroup(x AddressGroup) string
- func VerifyMultiAddress(ni netmap.NodeInfo) error
- func WriteToNodeInfo(g AddressGroup, ni *netmap.NodeInfo)
- type Address
- type AddressGroup
- func (x *AddressGroup) FromIterator(iter MultiAddressIterator) error
- func (x *AddressGroup) FromStringSlice(addr []string) error
- func (x AddressGroup) Intersects(x2 AddressGroup) bool
- func (x AddressGroup) IterateAddresses(f func(Address) bool)
- func (x AddressGroup) Len() int
- func (x AddressGroup) Less(i, j int) bool
- func (x AddressGroup) Swap(i, j int)
- type MultiAddressIterator
- type NodeEndpointsIterator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StringifyGroup ¶
func StringifyGroup(x AddressGroup) string
StringifyGroup returns concatenation of all addresses from the AddressGroup.
The result is order-dependent.
func VerifyMultiAddress ¶
VerifyMultiAddress validates multiaddress of n.
If n's address contains more than 3 protocols or less than 2 protocols an error returns.
If n's address's protocol order is incorrect an error returns.
Correct composition(and order from low to high level) of protocols:
- dns4/ip4/ip6
- tcp
- tls(optional, may be absent)
func WriteToNodeInfo ¶
func WriteToNodeInfo(g AddressGroup, ni *netmap.NodeInfo)
WriteToNodeInfo writes AddressGroup to netmap.NodeInfo structure.
Types ¶
type Address ¶
type Address struct {
// contains filtered or unexported fields
}
Address represents the FrostFS node network address.
func (*Address) FromString ¶
FromString restores Address from a string representation.
Supports URIAddr, MultiAddr and HostAddr strings.
func (Address) IsTLSEnabled ¶ added in v0.37.0
IsTLSEnabled searches for wrapped TLS protocol in multiaddr.
type AddressGroup ¶
type AddressGroup []Address
AddressGroup represents list of network addresses of the node.
List is sorted by priority of use.
func (*AddressGroup) FromIterator ¶
func (x *AddressGroup) FromIterator(iter MultiAddressIterator) error
FromIterator forms AddressGroup from MultiAddressIterator structure. The result is sorted with sort.Sort.
Returns an error in the absence of addresses or if any of the addresses are incorrect.
func (*AddressGroup) FromStringSlice ¶
func (x *AddressGroup) FromStringSlice(addr []string) error
FromStringSlice forms AddressGroup from a string slice.
Returns an error in the absence of addresses or if any of the addresses are incorrect.
func (AddressGroup) Intersects ¶
func (x AddressGroup) Intersects(x2 AddressGroup) bool
Intersects checks if two AddressGroup have at least one common address.
func (AddressGroup) IterateAddresses ¶
func (x AddressGroup) IterateAddresses(f func(Address) bool)
IterateAddresses iterates over all network addresses of the node.
Breaks iterating on handler's true return.
Handler should not be nil.
func (AddressGroup) Len ¶
func (x AddressGroup) Len() int
Len returns number of addresses in AddressGroup.
func (AddressGroup) Less ¶
func (x AddressGroup) Less(i, j int) bool
Less returns true if i-th address in AddressGroup supports TLS and j-th one doesn't.
func (AddressGroup) Swap ¶
func (x AddressGroup) Swap(i, j int)
Swap swaps i-th and j-th addresses in AddressGroup.
type MultiAddressIterator ¶
type MultiAddressIterator interface { // IterateAddresses must iterate over network addresses and pass each one // to the handler until it returns true. IterateAddresses(func(string) bool) // NumberOfAddresses must return number of addresses in group. NumberOfAddresses() int }
MultiAddressIterator is an interface of network address group.
type NodeEndpointsIterator ¶
NodeEndpointsIterator is a wrapper over netmap.NodeInfo which implements MultiAddressIterator.
func (NodeEndpointsIterator) IterateAddresses ¶
func (x NodeEndpointsIterator) IterateAddresses(f func(string) bool)
func (NodeEndpointsIterator) NumberOfAddresses ¶
func (x NodeEndpointsIterator) NumberOfAddresses() int