Documentation ¶
Index ¶
- func DialTimeout(addr string, magic uint16, timeout time.Duration) (net.Conn, error)
- type Config
- type MuxedListener
- type NetTransport
- func (t *NetTransport) FinalAdvertiseAddr(ip string, port int) (net.IP, int, error)
- func (t *NetTransport) GetAutoBindPort() int
- func (t *NetTransport) RegisterListener(id uint16) (<-chan net.Conn, error)
- func (t *NetTransport) RegisterPool(id uint8) memberlist.Transport
- func (t *NetTransport) Shutdown() error
- func (t *NetTransport) Start()
- func (t *NetTransport) TCPCh() <-chan net.Conn
- func (t *NetTransport) UDPCh() <-chan *memberlist.Packet
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config 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 // Logger is a logger for operator messages. Logger *log.Logger }
Config is used to configure a net transport.
type MuxedListener ¶
type MuxedListener struct {
// contains filtered or unexported fields
}
MuxedListener is a muxed listener interface
func ListenTCP ¶
func ListenTCP(addr string, ch <-chan net.Conn) (*MuxedListener, error)
ListenTCP return a TCP MuxedListener
func (*MuxedListener) Accept ¶
func (ln *MuxedListener) Accept() (net.Conn, error)
Accept implements a muxed net.Listener
func (*MuxedListener) Addr ¶
func (ln *MuxedListener) Addr() net.Addr
Addr implements a muxed net.Listener
func (*MuxedListener) Close ¶
func (ln *MuxedListener) Close() error
Close implements a muxed net.Listener
type NetTransport ¶
type NetTransport struct {
// contains filtered or unexported fields
}
NetTransport is a Transport implementation that uses connectionless UDP for packet operations, and ad-hoc TCP connections for stream operations. It also exposes channels to allow TCP and UDP connections for user defined transports
func NewNetTransport ¶
func NewNetTransport(config *Config) (*NetTransport, error)
NewNetTransport returns a net transport with the given configuration. On success all the network listeners will be created and listening.
func (*NetTransport) FinalAdvertiseAddr ¶
FinalAdvertiseAddr implements memberlist.Transport. See Transport.
func (*NetTransport) GetAutoBindPort ¶
func (t *NetTransport) GetAutoBindPort() int
GetAutoBindPort returns the bind port that was automatically given by the kernel, if a bind port of 0 was given.
func (*NetTransport) RegisterListener ¶
func (t *NetTransport) RegisterListener(id uint16) (<-chan net.Conn, error)
RegisterListener registers a new listener to be muxed
func (*NetTransport) RegisterPool ¶
func (t *NetTransport) RegisterPool(id uint8) memberlist.Transport
RegisterPool registers a new gossip pool returning the transport for that pool
func (*NetTransport) Shutdown ¶
func (t *NetTransport) Shutdown() error
Shutdown satisfies memberlist.Transport. See Transport.
func (*NetTransport) Start ¶
func (t *NetTransport) Start()
Start starts listening on all bind addresses tcp and udp
func (*NetTransport) TCPCh ¶
func (t *NetTransport) TCPCh() <-chan net.Conn
TCPCh returns a channel of all non-magic connections
func (*NetTransport) UDPCh ¶
func (t *NetTransport) UDPCh() <-chan *memberlist.Packet
UDPCh returns a channel of all non-magic connections