Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DefaultAddr = "127.0.0.1:8500" DefaultHealthCheckInterval = 10 DefaultDeregisterCriticalServiceAfter = 60 )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { *Options // contains filtered or unexported fields }
Client is a consul client.
func NewClient ¶
NewClient returns a new consul client.
The default options are:
- Addr: DefaultAddr
- EnableHealthCheck: true
- HealthCheckInterval: DefaultHealthCheckInterval
- DeregisterCriticalServiceAfter: DefaultDeregisterCriticalServiceAfter
- HeartBeat: true
func (*Client) Deregister ¶
type Option ¶ added in v0.6.0
type Option func(*Options)
func WithDeregisterCriticalServiceAfter ¶ added in v0.6.0
WithDeregisterCriticalServiceAfter sets the time to wait before deregister a critical service.
func WithEnableHealthCheck ¶ added in v0.6.0
WithEnableHealthCheck enables the health check.
func WithHealthCheckInterval ¶ added in v0.6.0
WithHealthCheckInterval sets the interval of the health check.
func WithHeartBeat ¶ added in v0.6.0
WithHeartBeat enables the heart beat.
type Options ¶
type Options struct { // Addr is the address of the consul server. Addr string // EnableHealthCheck enables the health check. EnableHealthCheck bool // HealthCheckInterval is the interval of the health check. HealthCheckInterval int // DeregisterCriticalServiceAfter is the time to wait before deregister a critical service. DeregisterCriticalServiceAfter int // HeartBeat enables the heart beat. HeartBeat bool }
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry is a consul registry.
func (*Registry) Deregister ¶
Deregister a service instance.
Click to show internal directories.
Click to hide internal directories.