config

package
v0.0.0-...-e48efe8 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2020 License: Apache-2.0 Imports: 6 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// LogLevel is a log level.
	LogLevel zapcore.Level

	// Listen is an address to listen.
	// It is must be host:port or unix:/path/of/sock .
	Listen string

	// ConfigFilePath is a path to the configuration file.
	ConfigFilePath string
)

Functions

This section is empty.

Types

type FileContent

type FileContent struct {
	Strategy    Strategy
	TokenBucket tokenBucketConfig
}

FileContent is a content of config file.

func LoadFile

func LoadFile(path string) (*FileContent, error)

type Strategy

type Strategy int32

Strategy is an enumeration of token bucket strategies. ENUM( time-slice timestamp )

const (
	// StrategyTimeSlice is a Strategy of type Time-Slice
	StrategyTimeSlice Strategy = iota
	// StrategyTimestamp is a Strategy of type Timestamp
	StrategyTimestamp
)

func ParseStrategy

func ParseStrategy(name string) (Strategy, error)

ParseStrategy attempts to convert a string to a Strategy

func (*Strategy) MarshalText

func (x *Strategy) MarshalText() ([]byte, error)

MarshalText implements the text marshaller method

func (Strategy) String

func (x Strategy) String() string

String implements the Stringer interface.

func (*Strategy) UnmarshalText

func (x *Strategy) UnmarshalText(text []byte) error

UnmarshalText implements the text unmarshaller method

Jump to

Keyboard shortcuts

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