Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetSRVAddresses ¶
Given a DNS name return a list of addresses returned by the getting the SRV records from DNS for that name.
func NewLogWriter ¶
func NewLogWriter(log logrus.FieldLogger) *io.PipeWriter
Types ¶
type ConsulConfig ¶
type ConsulConfig struct {
// This is the consul client config; typically created by calling api.DefaultConfig()
ClientConfig *api.Config
// The name of the catalog we should register under; should be common to all peers in the catalog
CatalogName string
// Information about this peer which should be shared with all other peers in the catalog
Peer Peer
// This is an address the will be registered with consul so it can preform liveliness checks
LivelinessAddress string
// A callback function which is called when the member list changes
OnUpdate OnUpdateFunc
// An interface through which logging will occur; usually *logrus.Entry
Logger logrus.FieldLogger
}
type MemberList ¶
type MemberList struct {
// contains filtered or unexported fields
}
type MemberListConfig ¶
type MemberListConfig struct {
// This is the address:port the member list protocol listen for other peers on.
BindAddress string
// This is the address:port the member list protocol will advertise to other peers. (Defaults to BindAddress)
AdvertiseAddress string
// Metadata about this peer which should be shared with other peers
Peer Peer
// A list of peers this member list instance can contact to find other peers.
KnownPeers []string
// A callback function which is called when the member list changes.
OnUpdate OnUpdateFunc
// If not nil, use this config instead of ml.DefaultLANConfig()
MemberListConfig *ml.Config
// An interface through which logging will occur; usually *logrus.Entry
Logger logrus.FieldLogger
}
type Members ¶
type Members interface {
// Returns the peers currently registered
GetPeers(context.Context) ([]Peer, error)
// Removes our peer from the member list and closes all connections
Close(context.Context) error
}
func NewConsul ¶
func NewConsul(conf *ConsulConfig) (Members, error)
func NewMemberList ¶
func NewMemberList(ctx context.Context, conf MemberListConfig) (Members, error)
type OnUpdateFunc ¶
type OnUpdateFunc func([]Peer)
Click to show internal directories.
Click to hide internal directories.