Documentation
¶
Index ¶
- type Transport
- func (t *Transport) DialAddressTimeout(addr memberlist.Address, timeout time.Duration) (net.Conn, error)
- func (t *Transport) DialTimeout(addr string, timeout time.Duration) (net.Conn, error)
- func (t *Transport) FinalAdvertiseAddr(ip string, port int) (net.IP, int, error)
- func (t *Transport) GetAutoBindPort() int
- func (t *Transport) PacketCh() <-chan *memberlist.Packet
- func (t *Transport) Shutdown() error
- func (t *Transport) StreamCh() <-chan net.Conn
- func (t *Transport) WriteTo(b []byte, addr string) (time.Time, error)
- func (t *Transport) WriteToAddress(b []byte, addr memberlist.Address) (time.Time, error)
- type TransportConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Transport ¶
type Transport struct {
// contains filtered or unexported fields
}
Transport is a memberlist.Transport implementation that uses TCP for both packet and stream operations ("packet" and "stream" are terms used by memberlist). It uses a new TCP connections for each operation. There is no connection reuse.
func NewTransport ¶
func NewTransport(config TransportConfig) (*Transport, error)
NewTransport returns new tcp-based transport with the given configuration. On success all the network listeners will be created and listening.
func (*Transport) DialAddressTimeout ¶
func (*Transport) DialTimeout ¶
DialTimeout is used to create a connection that allows memberlist to perform two-way communication with a peer.
func (*Transport) FinalAdvertiseAddr ¶
FinalAdvertiseAddr is given the user's configured values (which might be empty) and returns the desired IP and port to advertise to the rest of the cluster. (Copied from memberlist' net_transport.go)
func (*Transport) GetAutoBindPort ¶
GetAutoBindPort returns the bind port that was automatically given by the kernel, if a bind port of 0 was given.
func (*Transport) PacketCh ¶
func (t *Transport) PacketCh() <-chan *memberlist.Packet
PacketCh returns a channel that can be read to receive incoming packets from other peers.
func (*Transport) Shutdown ¶
Shutdown is called when memberlist is shutting down; this gives the transport a chance to clean up any listeners.
func (*Transport) StreamCh ¶
StreamCh returns a channel that can be read to handle incoming stream connections from other peers.
func (*Transport) WriteTo ¶
WriteTo is a packet-oriented interface that fires off the given payload to the given address.
func (*Transport) WriteToAddress ¶
type TransportConfig ¶
type TransportConfig struct { // BindAddrs is a list of addresses to bind to for both TCP and UDP // communications. BindAddrs []string // BindPort is the port to listen on, for each address above. BindPort int PacketDialTimeout time.Duration PacketWriteTimeout time.Duration // Logger is a logger for operator messages. Logger log.Logger TLSEnabled bool TLS *tls.Config DebugEnabled bool }
TransportConfig is used to configure a net transport.