Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConnectionStatus ¶
type ConnectionStatus int
const ( UnknownStatus ConnectionStatus = iota Connected Disconnected Connecting )
NOTE: Keep enum in sync with sideeye.ConnectionStatus.
type Listener ¶
type Listener struct {
// contains filtered or unexported fields
}
Listener implements net.Listener and dials connections to a remote address. Listener is a surprising guy -- it doesn't actually "listen" for any sort of incoming connections. Instead, it dials a single connection to a remote address. When that connection is established, it sends a handshake packet (informing the remote server that it should use it as a gRPC client conn) and then it returns the connection from the Accept(). When the connection drops, it dials a new one (so, there's ever at most one connection active).
func NewListener ¶
NewListener creates a Listener that dials the given address. Note that the address should be a valid URL with either http or https scheme and no path or query.
A goroutine is started which dials the target asynchronously. When a connection drops, a new one is dialed.
errLogger can be nil.
func (*Listener) ConnectionStatus ¶
func (l *Listener) ConnectionStatus() ConnectionStatus
ConnectionStatus returns the connection's current state.