config

package
v0.0.0-...-7429660 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LocalIP

func LocalIP() (net.IP, error)

LocalIP tries to determine a non-loopback address for the local machine

func LocalIPString

func LocalIPString() string

Types

type Cluster

type Cluster struct {
	// 兼容rpc-go ServiceClient数据结构
	Name            string `toml:"service_name"`
	LBType          string `toml:"balancetype"`
	EndpointsFrom   string `toml:"endpoints_from"`
	StaticEndpoints string `toml:"endpoints"`
	Proto           string `toml:"proto"`

	// checker config
	CheckInterval      Duration `toml:"check_interval"`
	UnHealthyThreshold uint32   `toml:"check_unhealth_threshold"`
	HealthyThreshold   uint32   `toml:"check_healthy_threshold"`

	// lb advance config
	LBPanicThreshold int        `toml:"lb_panic_threshold"`
	LBSubsetKeys     [][]string `toml:"lb_subset_selectors"`
	LBDefaultKeys    []string   `toml:"lb_default_keys"`

	// detector config
	Detector Detector `toml:"detector"`

	Datacenter string `toml:"datacenter"`
}

func NewCluster

func NewCluster() Cluster

type Consul

type Consul struct {
	Addr   string
	Scheme string
	Token  string

	Logger *logging.Logger
}

type Detector

type Detector struct {
	DetectInterval             Duration `toml:"detect_interval"`
	BaseEjectionDuration       Duration `toml:"base_ejection_duration"`
	ConsecutiveError           uint64   `toml:"consecutive_error"`
	ConsecutiveConnectionError uint64   `toml:"consecutive_connect_error"`
	MaxEjectionPercent         uint64   `toml:"max_ejection_percent"`
	SuccessRateMinHosts        uint64   `toml:"success_rate_min_hosts"`
	SuccessRateRequestVolume   uint64   `toml:"success_rate_request_volume"`
	SuccessRateStdevFactor     float64  `toml:"success_rate_stdev_factor"`
	EnforcingSuccessRate       uint64   `toml:"enforcing_success_rate"`
}

type Duration

type Duration time.Duration

func (*Duration) UnmarshalText

func (d *Duration) UnmarshalText(text []byte) error

type File

type File struct {
	Path string
}

type FlagSet

type FlagSet struct {
	flag.FlagSet
	// contains filtered or unexported fields
}

-- FlagSet

func NewFlagSet

func NewFlagSet(name string, errorHandling flag.ErrorHandling) *FlagSet

func (*FlagSet) IsSet

func (f *FlagSet) IsSet(name string) bool

IsSet returns true if a variable was set via any mechanism.

func (*FlagSet) ParseFlags

func (f *FlagSet) ParseFlags(args, environ, prefixes []string, p *properties.Properties) error

ParseFlags parses command line arguments and provides fallback values from environment variables and config file values. Environment variables are case-insensitive and can have either of the provided prefixes.

func (*FlagSet) StringSliceVar

func (f *FlagSet) StringSliceVar(p *[]string, name string, value []string, usage string)

type Log

type Log struct {
}

type Register

type Register struct {
	ServiceName string
	ServiceAddr string
	ServicePort int

	ServiceCheckDSN                   string
	ServiceCheckIntervalMs            int
	ServiceCheckTimeoutMs             int
	DeregisterCriticalServiceAfterSec int

	ServiceTags    map[string]string
	DerigesterCh   chan bool
	TagsOverrideCh chan []string
	TagsWatchPath  string
}

func NewRegister

func NewRegister(name, addr string, port int) *Register

type Registry

type Registry struct {
	Backend string
	Static  Static
	File    File
	Consul  Consul
	Timeout time.Duration
	Retry   time.Duration
}

type Static

type Static struct {
	Routes string
}

Jump to

Keyboard shortcuts

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