Documentation ¶
Index ¶
- Constants
- type Conn
- type ConnPool
- func (p *ConnPool) DialTimeout(dc string, addr net.Addr, timeout time.Duration, useTLS bool) (net.Conn, HalfCloser, error)
- func (p *ConnPool) Ping(dc string, addr net.Addr, version int, useTLS bool) (bool, error)
- func (p *ConnPool) RPC(dc string, addr net.Addr, version int, method string, useTLS bool, ...) error
- func (p *ConnPool) Shutdown() error
- type HalfCloser
- type RPCType
- type StreamClient
Constants ¶
const ( // keep numbers unique. // iota depends on order RPCConsul RPCType = 0 RPCRaft = 1 RPCMultiplex = 2 // Old Muxado byte, no longer supported. RPCTLS = 3 RPCMultiplexV2 = 4 RPCSnapshot = 5 RPCGossip = 6 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
Conn is a pooled connection to a Consul server
type ConnPool ¶
type ConnPool struct { // SrcAddr is the source address for outgoing connections. SrcAddr *net.TCPAddr // LogOutput is used to control logging LogOutput io.Writer // The maximum time to keep a connection open MaxTime time.Duration // The maximum number of open streams to keep MaxStreams int // TLS wrapper TLSWrapper tlsutil.DCWrapper // ForceTLS is used to enforce outgoing TLS verification ForceTLS bool sync.Mutex // contains filtered or unexported fields }
ConnPool is used to maintain a connection pool to other Consul servers. This is used to reduce the latency of RPC requests between servers. It is only used to pool connections in the rpcConsul mode. Raft connections are pooled separately. Maintain at most one connection per host, for up to MaxTime. When MaxTime connection reaping is disabled. MaxStreams is used to control the number of idle streams allowed. If TLS settings are provided outgoing connections use TLS.
func (*ConnPool) DialTimeout ¶
func (p *ConnPool) DialTimeout(dc string, addr net.Addr, timeout time.Duration, useTLS bool) (net.Conn, HalfCloser, error)
DialTimeout is used to establish a raw connection to the given server, with a given connection timeout.
func (*ConnPool) Ping ¶
Ping sends a Status.Ping message to the specified server and returns true if healthy, false if an error occurred
type HalfCloser ¶
type HalfCloser interface {
CloseWrite() error
}
HalfCloser is an interface that exposes a TCP half-close. We need this because we want to expose the raw TCP connection underlying a TLS one in a way that's hard to screw up and use for anything else. There's a change brewing that will allow us to use the TLS connection for this instead - https://go-review.googlesource.com/#/c/25159/.
type StreamClient ¶
type StreamClient struct {
// contains filtered or unexported fields
}
streamClient is used to wrap a stream with an RPC client
func (*StreamClient) Close ¶
func (sc *StreamClient) Close()