README ¶ consulcli 连接etcd服务客户端。 使用示例 endpoints := []string{"192.168.3.37:2379"} cli, err := consulcli.Init(endpoints, WithConnectTimeout(time.Second*2), // WithAuth("", ""), // WithAutoSyncInterval(0), // WithLog(zap.NewNop()), ) Expand ▾ Collapse ▴ Documentation ¶ Index ¶ func Init(addr string, opts ...Option) (*api.Client, error) type Option func WithDatacenter(datacenter string) Option func WithScheme(scheme string) Option func WithWaitTime(waitTime time.Duration) Option Constants ¶ This section is empty. Variables ¶ This section is empty. Functions ¶ func Init ¶ func Init(addr string, opts ...Option) (*api.Client, error) Init 连接consul服务 Types ¶ type Option ¶ type Option func(*options) Option set the consul client options. func WithDatacenter ¶ func WithDatacenter(datacenter string) Option WithDatacenter set datacenter func WithScheme ¶ func WithScheme(scheme string) Option WithScheme set scheme func WithWaitTime ¶ func WithWaitTime(waitTime time.Duration) Option WithWaitTime set wait time Source Files ¶ View all Source files consulcli.go option.go Click to show internal directories. Click to hide internal directories.