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) DialTimeoutInsecure(dc string, addr net.Addr, timeout time.Duration, wrapper tlsutil.DCWrapper) (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. RPCConsul RPCType = 0 RPCRaft = 1 RPCMultiplex = 2 // Old Muxado byte, no longer supported. RPCTLS = 3 RPCMultiplexV2 = 4 RPCSnapshot = 5 RPCGossip = 6 // RPCTLSInsecure is used to flag RPC calls that require verify // incoming to be disabled, even when it is turned on in the // configuration. At the time of writing there is only AutoEncryt.Sign // that is supported and it might be the only one there // ever is. RPCTLSInsecure = 7 )
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 // TLSConfigurator TLSConfigurator *tlsutil.Configurator // 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 given connection timeout. It also writes RPCTLS as the first byte.
func (*ConnPool) DialTimeoutInsecure ¶ added in v1.5.2
func (p *ConnPool) DialTimeoutInsecure(dc string, addr net.Addr, timeout time.Duration, wrapper tlsutil.DCWrapper) (net.Conn, HalfCloser, error)
DialTimeoutInsecure is used to establish a raw connection to the given server, with given connection timeout. It also writes RPCTLSInsecure as the first byte to indicate that the client cannot provide a certificate. This is so far only used for AutoEncrypt.Sign.
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()