client

package
v0.0.0-...-88236ff Latest Latest
Warning

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

Go to latest
Published: May 25, 2020 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Env = "env"
)
View Source
const File = "file"
View Source
const Flag = "flag"

Variables

This section is empty.

Functions

func RegisterClient

func RegisterClient(name string, constructor Constructor) error

Types

type ChangedCallback

type ChangedCallback func(data []byte)

type Client

type Client interface {
	io.Closer
	Pull(ctx context.Context, path string) (data []byte, err error)
	Push(ctx context.Context, path string, data []byte) error
	Watch(path string, cb ChangedCallback) error
}

Client client interface of baseSource

func New

func New(name string, config *Config) (Client, error)

type Config

type Config struct {
	// env
	Flags   map[string]interface{} `json:"-"`
	FlagSet *flag.FlagSet          `json:"-"`
	// common
	Timeout       time.Duration `json:"timeout,omitempty" yaml:"timeout"`
	WatchTimeout  time.Duration `json:"watchTimeout,omitempty" yaml:"watchTimeout"`
	WatchDisabled bool          `json:"watchDisabled,omitempty" yaml:"watchDisabled"`
	LogDir        string        `json:"logDir,omitempty" yaml:"logDir"`
	CacheDir      string        `json:"cacheDir,omitempty" yaml:"cacheDir"`
	// remote
	Endpoint string                 `json:"endpoint,omitempty" yaml:"endpoint"`
	Address  string                 `json:"address,omitempty" yaml:"address"`
	AppID    string                 `json:"appId,omitempty" yaml:"appId"`
	Cluster  string                 `json:"cluster,omitempty" yaml:"cluster"`
	RegionID string                 `json:"regionId,omitempty" yaml:"regionId"`
	Extra    map[string]interface{} `json:"extra,omitempty" yaml:"extra"`
	// ssl
	SSLEnabled    bool   `json:"sslEnabled,omitempty" yaml:"sslEnabled"`
	SSLCACert     string `json:"sslCACert,omitempty" yaml:"sslCACert"`
	SSLCert       string `json:"sslCert,omitempty" yaml:"sslCert"`
	SSLKey        string `json:"sslKey,omitempty" yaml:"sslKey"`
	SSLVerifyPeer bool   `json:"sslVerifyPeer,omitempty" yaml:"sslVerifyPeer"`
	ServerName    string `json:"serverName,omitempty" yaml:"serverName"`
	// auth
	Username   string `json:"username,omitempty" yaml:"username"`
	Password   string `json:"password,omitempty" yaml:"password"`
	AccessKey  string `json:"accessKey,omitempty" yaml:"accessKey"`
	SecretKey  string `json:"secretKey,omitempty" yaml:"secretKey"`
	Token      string `json:"token,omitempty" yaml:"token"`
	DataCenter string `json:"dataCenter,omitempty" yaml:"dataCenter"`
	Namespace  string `json:"namespace,omitempty" yaml:"namespace"`
	Group      string `json:"group,omitempty" yaml:"group"`
}

Config client configurations

func DefaultConfig

func DefaultConfig() *Config

func (*Config) TLSConfig

func (c *Config) TLSConfig() *tls.Config

type Constructor

type Constructor func(config *Config) (Client, error)

type Watcher

type Watcher interface {
	Events() chan fsnotify.Event
	Errors() chan error
	// contains filtered or unexported methods
}

interface

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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