consulcli

package
v0.0.0-...-a518d66 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 19, 2023 License: MIT Imports: 2 Imported by: 0

README

consulcli

Connect to the consul service client.

Example of use

    import "gitee.com/jianguosun_admin/pkg/consulcli"

	endpoints := []string{"192.168.3.37:2379"}
    cli, err := consulcli.Init(endpoints,
        WithConnectTimeout(time.Second*2),
        // WithAuth("", ""),
        // WithAutoSyncInterval(0),
        // WithLog(zap.NewNop()),
	)

Documentation

Overview

Package consulcli is connecting to the consul service client.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(addr string, opts ...Option) (*api.Client, error)

Init connecting to the consul service

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL