Documentation ¶
Index ¶
- Constants
- func JoinMulticastGroup(network string, ifi *net.Interface, group *net.UDPAddr) (net.PacketConn, error)
- func ResolveMulticast(maddr ma.Multiaddr) (*net.UDPAddr, *net.Interface, error)
- func ResolveMulticastInterface(maddr ma.Multiaddr) (*net.Interface, error)
- func WithDistance(dist uint8) discovery.Option
- type GradualSurveyor
- type Surveyor
- type TranscoderIface
Constants ¶
const ( P_MULTICAST = iota + 100 P_SURVEY )
Variables ¶
This section is empty.
Functions ¶
func JoinMulticastGroup ¶
func JoinMulticastGroup(network string, ifi *net.Interface, group *net.UDPAddr) (net.PacketConn, error)
JoinMulticastGroup joins the group address group on the provided interface. By default all sources that can cast data to group are accepted.
If ifi == nil, JoinMulticastGroup uses the system-assigned multicast interface. Note that users SHOULD NOT do this because the resulting interface is platform-dependent, and may require special routing config.
func ResolveMulticast ¶
func WithDistance ¶
option for specifying distance when calling FindPeers
Types ¶
type GradualSurveyor ¶
type GradualSurveyor struct { // Factor controls how long the GradualSurveyor will wait for // peers at each distance. The raw wait time is calculated by // evaluating 'distance * factor', before applying min, max & // jitter. Defaults to 1.5. Factor float64 // Min and Max wait durations. Defaults to 5s and 90s. Min, Max time.Duration // If true, use the absolute wait durations calculated via min, // max and factor. By default, the final wait time is sampled // uniformly from the interval (w/2, w), where 'w' is the wait // duration. DisableJitter bool *Surveyor }
GradualSurveyor queries a progressively larger subset of the cluster keyspace. It is recommended for bootstrapping large clusters where multicast storms may degrade the service.
See specs/survey.md for details.
type Surveyor ¶
type Surveyor struct {
// contains filtered or unexported fields
}
Surveyor discovers peers through a surveyor/respondent multicast protocol.
func New ¶
New surveyor. The supplied PacketConn SHOULD be bound to a multicast group. Use of JoinMulticastGroup to construct conn is RECOMMENDED.
type TranscoderIface ¶
type TranscoderIface struct{}
TranscoderIface decodes an interface name.
func (TranscoderIface) BytesToString ¶
func (it TranscoderIface) BytesToString(b []byte) (string, error)
func (TranscoderIface) StringToBytes ¶
func (it TranscoderIface) StringToBytes(name string) ([]byte, error)
func (TranscoderIface) ValidateBytes ¶
func (it TranscoderIface) ValidateBytes(b []byte) error