Documentation
¶
Index ¶
- Constants
- Variables
- func FormatHost(host string, altPort uint32) (string, error)
- type Chains
- type CodecClientType
- type GrpcHealthCheck
- type GrpcOpt
- type HealthChecker
- type HttpHealthCheck
- type HttpOpt
- type IcmpHealthCheck
- type IcmpOpt
- type IntRange
- type NoHealthCheck
- type Payload
- type ProgramHealthCheck
- type ProgramOpt
- type ProgramTlsOpt
- type TcpHealthCheck
- type TcpOpt
- type UdpHealthCheck
- type UdpOpt
Constants ¶
View Source
const (
DefaultUdpSend = "test-gohc"
)
Variables ¶
View Source
var ( CodecClientType_name = map[int32]string{ 0: "HTTP1", 1: "HTTP2", 2: "HTTP3", } CodecClientType_value = map[string]int32{ "HTTP1": 0, "HTTP2": 1, "HTTP3": 2, } )
Enum value maps for CodecClientType.
Functions ¶
Types ¶
type Chains ¶ added in v1.1.0
type Chains struct {
// contains filtered or unexported fields
}
type CodecClientType ¶
type CodecClientType int32
const ( CodecClientType_HTTP1 CodecClientType = 0 CodecClientType_HTTP2 CodecClientType = 1 // [#not-implemented-hide:] QUIC implementation is not production ready yet. Use this enum with // caution to prevent accidental execution of QUIC code. I.e. `!= HTTP2` is no longer sufficient // to distinguish HTTP1 and HTTP2 traffic. CodecClientType_HTTP3 CodecClientType = 2 )
type GrpcHealthCheck ¶
type GrpcHealthCheck struct {
// contains filtered or unexported fields
}
func NewGrpcHealthCheck ¶
func NewGrpcHealthCheck(opt *GrpcOpt) *GrpcHealthCheck
func (*GrpcHealthCheck) Check ¶
func (h *GrpcHealthCheck) Check(host string) error
func (*GrpcHealthCheck) String ¶ added in v1.1.0
func (h *GrpcHealthCheck) String() string
type GrpcOpt ¶
type GrpcOpt struct { // An optional service name parameter which will be sent to gRPC service in // `grpc.health.v1.HealthCheckRequest // <https://github.com/grpc/grpc/blob/master/src/proto/grpc/health/v1/health.proto#L20>`_. // message. See `gRPC health-checking overview // <https://github.com/grpc/grpc/blob/master/doc/health-checking.md>`_ for more information. ServiceName string // The value of the :authority header in the gRPC health check request. If // left empty (default value) this will be host in check. // The authority header can be customized for a specific endpoint by setting // the HealthCheckConfig.hostname field. Authority string // Timeout for the gRPC health check request. If left empty (default to 5s) Timeout time.Duration // TlsEnabled set to true if the gRPC health check request should be sent over TLS. TlsEnabled bool // TlsConfig specifies the TLS configuration to use for TLS enabled gRPC health check requests. TlsConfig *tls.Config // AltPort specifies the port to use for gRPC health check requests. // If left empty it taks the port from host during check. AltPort uint32 }
GrpcOpt Describes the gRPC health check specific options.
type HealthChecker ¶
type HttpHealthCheck ¶
type HttpHealthCheck struct {
// contains filtered or unexported fields
}
func NewHttpHealthCheck ¶
func NewHttpHealthCheck(opt *HttpOpt) *HttpHealthCheck
func (*HttpHealthCheck) Check ¶
func (h *HttpHealthCheck) Check(host string) error
func (*HttpHealthCheck) String ¶ added in v1.1.0
func (h *HttpHealthCheck) String() string
type HttpOpt ¶
type HttpOpt struct { // The value of the host header in the HTTP health check request Host string // Specifies the HTTP path that will be requested during health checking. For example // */healthcheck*. Path string // HTTP specific payload. Send *Payload // HTTP specific response. Receive *Payload // Specifies a list of HTTP headers that should be added to each request that is sent to the // health checked cluster. Headers http.Header // Specifies a list of HTTP response statuses considered healthy. If provided, replaces default // 200-only policy - 200 must be included explicitly as needed. Ranges follow half-open // semantics of Int64Range. The start and end of each ExpectedStatuses *IntRange // Use specified application protocol for health checks. CodecClientType CodecClientType // HTTP Method that will be used for health checking, default is "GET". // If a non-200 response is expected by the method, it needs to be set in expected_statuses. Method string // Timeout for the http health check request. If left empty (default to 5s) Timeout time.Duration // TlsEnabled set to true if the gRPC health check request should be sent over TLS. TlsEnabled bool // TlsConfig specifies the TLS configuration to use for TLS enabled gRPC health check requests. TlsConfig *tls.Config // AltPort specifies the port to use for gRPC health check requests. // If left empty it taks the port from host during check. AltPort uint32 }
HttpOpt Describes the health check policy for a given endpoint.
type IcmpHealthCheck ¶
type IcmpHealthCheck struct {
// contains filtered or unexported fields
}
func NewIcmpHealthCheck ¶
func NewIcmpHealthCheck(opt *IcmpOpt) *IcmpHealthCheck
func (*IcmpHealthCheck) Check ¶
func (h *IcmpHealthCheck) Check(host string) error
func (*IcmpHealthCheck) String ¶ added in v1.1.0
func (h *IcmpHealthCheck) String() string
type IntRange ¶
type IntRange struct { // start of the range (inclusive) Start int64 // end of the range (exclusive) End int64 }
IntRange Specifies the int64 start and end of the range using half-open interval semantics [start, end).
type NoHealthCheck ¶
type NoHealthCheck struct { }
func NewNoHealthCheck ¶
func NewNoHealthCheck() *NoHealthCheck
func (*NoHealthCheck) Check ¶
func (h *NoHealthCheck) Check(host string) error
func (*NoHealthCheck) String ¶ added in v1.1.0
func (h *NoHealthCheck) String() string
type Payload ¶
Payload Describes the encoding of the payload bytes in the payload. It can be either text or binary.
type ProgramHealthCheck ¶
type ProgramHealthCheck struct {
// contains filtered or unexported fields
}
func NewProgramHealthCheck ¶
func NewProgramHealthCheck(opt *ProgramOpt) *ProgramHealthCheck
func (*ProgramHealthCheck) Check ¶
func (h *ProgramHealthCheck) Check(host string) error
func (*ProgramHealthCheck) String ¶ added in v1.1.0
func (h *ProgramHealthCheck) String() string
type ProgramOpt ¶
type ProgramOpt struct { // The path to the executable. Path string // The arguments to pass to the executable. Args []string // Options to pass to the executable. Options map[string]any // Timeout program finish. If left empty (default to 5s) Timeout time.Duration // TlsEnabled set to true if the gRPC health check request should be sent over TLS. TlsEnabled bool // Tls configuration for program ProgramTlsConfig *ProgramTlsOpt // AltPort specifies the port to use for gRPC health check requests. // If left empty it taks the port from host during check. AltPort uint32 }
type ProgramTlsOpt ¶
type ProgramTlsOpt struct { // Set to true to not verify the server's certificate. This is strongly discouraged. InsecureSkipVerify bool // ServerName is used to verify the hostname on the returned ServerName string // Trusted CA certificates for verifying the server certificate. It must be in pem format RootCAs []string }
type TcpHealthCheck ¶
type TcpHealthCheck struct {
// contains filtered or unexported fields
}
func NewTcpHealthCheck ¶
func NewTcpHealthCheck(opt *TcpOpt) *TcpHealthCheck
func (*TcpHealthCheck) Check ¶
func (h *TcpHealthCheck) Check(host string) error
func (*TcpHealthCheck) String ¶ added in v1.1.0
func (h *TcpHealthCheck) String() string
type TcpOpt ¶
type TcpOpt struct { // TCP specific payload. // Empty payloads imply a connect-only health check. Send *Payload // When checking the response, “fuzzy” matching is performed such that each // binary block must be found, and in the order specified, but not // necessarily contiguous. Receive []*Payload // Timeout for connection and for each receive data. If left empty (default to 5s) Timeout time.Duration // TlsEnabled set to true if the gRPC health check request should be sent over TLS. TlsEnabled bool // TlsConfig specifies the TLS configuration to use for TLS enabled gRPC health check requests. TlsConfig *tls.Config // AltPort specifies the port to use for gRPC health check requests. // If left empty it taks the port from host during check. AltPort uint32 }
TcpOpt Describes the TCP health check specific options.
type UdpHealthCheck ¶
type UdpHealthCheck struct {
// contains filtered or unexported fields
}
func NewUdpHealthCheck ¶
func NewUdpHealthCheck(opt *UdpOpt) *UdpHealthCheck
func (*UdpHealthCheck) Check ¶
func (h *UdpHealthCheck) Check(host string) error
func (*UdpHealthCheck) String ¶ added in v1.1.0
func (h *UdpHealthCheck) String() string
type UdpOpt ¶
type UdpOpt struct { // Udp specific payload to send. // If left empty (default to "test-gohc") Send *Payload // When checking the response, “fuzzy” matching is performed such that each // binary block must be found, and in the order specified, but not // necessarily contiguous. Receive []*Payload // Timeout for port unreachable response or for each receive read deadline. If left empty (default to 5s) Timeout time.Duration // PingTimeout specifies the timeout for ICMP requests. If left empty (default to 5s) PingTimeout time.Duration // Delay specifies the delay between ICMP requests. If left empty (default to 1s) Delay time.Duration // AltPort specifies the port to use for gRPC health check requests. // If left empty it taks the port from host during check. AltPort uint32 }
Source Files
¶
Click to show internal directories.
Click to hide internal directories.