Documentation ¶
Index ¶
Constants ¶
View Source
const ( // DefaultQueryIdleConnectionTimeout is the default maximum amount // of time an idle (keep-alive) connection will remain idle before // closing itself. DefaultQueryIdleConnectionTimeout = 90 * time.Second // DefaultQueryMaxIdleConnectionCount is the default maximum number // of idle (keep-alive) connections across all hosts. DefaultQueryMaxIdleConnectionCount = 100 // DefaultQueryTimeout is the default time limit for requests. DefaultQueryTimeout = 5 * time.Second )
View Source
const ( // DefaultListenAddress is the default listen address for Consulate. DefaultListenAddress = ":8080" // DefaultConsulAddress is the default address used to connect to Consul. DefaultConsulAddress = "localhost:8500" // DefaultReadTimeout is the default maximum duration for Consulate reading the entire request. DefaultReadTimeout = 10 * time.Second // DefaultWriteTimeout is the default maximum duration for Consulate writing the response. DefaultWriteTimeout = 10 * time.Second // DefaultShutdownTimeout is the default maximum duration before timing out the shutdown of the Consulate server. DefaultShutdownTimeout = 15 * time.Second // DefaultSuccessStatusCode (200) is the default status code returned when there are 1+ passing health checks, 0 warning health checks, and 0 failing health checks. DefaultSuccessStatusCode = http.StatusOK // DefaultPartialSuccessStatusCode (429) is the default status code returned when there are 1+ passing health checks and 1+ warning health checks. DefaultPartialSuccessStatusCode = http.StatusTooManyRequests // DefaultWarningStatusCode (503) is the default status code returned when there are 0 passing health checks and 1+ warning health checks. DefaultWarningStatusCode = http.StatusServiceUnavailable // DefaultErrorStatusCode (503) is the default status code returned when there are 1+ failing health checks. DefaultErrorStatusCode = http.StatusServiceUnavailable // DefaultBadRequestStatusCode (400) is the default status code returned when a request to Consulate which could not be understood. DefaultBadRequestStatusCode = http.StatusBadRequest // DefaultNoCheckStatusCode (404) is the default status code returned when no Consul checks exist. DefaultNoCheckStatusCode = http.StatusNotFound // DefaultUnprocessableStatusCode (502) is the default status code returned when Consulate could not parse the response from Consul. DefaultUnprocessableStatusCode = http.StatusBadGateway DefaultConsulUnavailableStatusCode = http.StatusGatewayTimeout )
View Source
const ( // DefaultConsulCacheDuration is the default duration that Consul results will be cached. DefaultConsulCacheDuration = 1 * time.Second )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CacheConfig ¶
CacheConfig represents the configuration of caching the Consulate server.
func DefaultCacheConfig ¶
func DefaultCacheConfig() *CacheConfig
DefaultCacheConfig gets a default CacheConfig.
type ClientConfig ¶
type ClientConfig struct { QueryTimeout time.Duration QueryMaxIdleConnectionCount int QueryIdleConnectionTimeout time.Duration }
ClientConfig represents the configuration for the http.Client.
func DefaultClientConfig ¶
func DefaultClientConfig() *ClientConfig
DefaultClientConfig gets a default ClientConfig.
type ServerConfig ¶
type ServerConfig struct { ListenAddress string ConsulAddress string ReadTimeout time.Duration WriteTimeout time.Duration ShutdownTimeout time.Duration SuccessStatusCode int PartialSuccessStatusCode int WarningStatusCode int ErrorStatusCode int BadRequestStatusCode int NoCheckStatusCode int UnprocessableStatusCode int ClientConfig ClientConfig CacheConfig CacheConfig }
ServerConfig represents the configuration of the Consulate server.
func DefaultServerConfig ¶
func DefaultServerConfig() *ServerConfig
DefaultServerConfig gets a default ServerConfig.
Click to show internal directories.
Click to hide internal directories.