config

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DiscoveryWaySerf uint = iota
	DiscoveryWayMemberlist
)
View Source
const (
	RaftImplHashicorp uint = iota
	RaftImplEtcd
)
View Source
const (
	StorageWayMemory uint = iota
	StorageWayBolt
	StorageWayBadger
	StorageWayRedis
)
View Source
const (
	AuthModeAnonymous uint = iota
	AuthModeUsername
	AuthModeClientid
)
View Source
const (
	AuthDSFree uint = iota
	AuthDSRedis
	AuthDSMysql
	AuthDSPostgresql
	AuthDSHttp
)
View Source
const (
	BridgeWayNone uint = iota
	BridgeWayKafka
)

Variables

View Source
var (
	ErrAuthWay     = errors.New("auth-way is incorrectly configured")
	ErrStorageWay  = errors.New("only redis can be used in cluster mode")
	ErrClusterOpts = errors.New("cluster options must be configured")

	ErrAppendCerts      = errors.New("append ca cert failure")
	ErrMissingCertOrKey = errors.New("missing server certificate or private key files")
)

Functions

func GenTlsConfig

func GenTlsConfig(conf *Config) (*tls2.Config, error)

Types

type Cluster

type Cluster struct {
	DiscoveryWay         uint                     `yaml:"discovery-way"  json:"discovery-way"`
	NodeName             string                   `yaml:"node-name" json:"node-name"`
	BindAddr             string                   `yaml:"bind-addr" json:"bind-addr"`
	BindPort             int                      `yaml:"bind-port" json:"bind-port"`
	AdvertiseAddr        string                   `yaml:"advertise-addr" json:"advertise-addr"`
	AdvertisePort        int                      `yaml:"advertise-port" json:"advertise-port"`
	Members              []string                 `yaml:"members" json:"members"`
	DynamicMembership    DynamicMembershipOptions `yaml:"dynamic-membership" json:"dynamic-membership"`
	QueueDepth           int                      `yaml:"queue-depth" json:"queue-depth"`
	Tags                 map[string]string        `yaml:"tags" json:"tags"`
	RaftImpl             uint                     `yaml:"raft-impl" json:"raft-impl"`
	RaftPort             int                      `yaml:"raft-port" json:"raft-port"`
	RaftDir              string                   `yaml:"raft-dir" json:"raft-dir"`
	RaftBootstrap        bool                     `yaml:"raft-bootstrap" json:"raft-bootstrap"`
	RaftLogLevel         string                   `yaml:"raft-log-level" json:"raft-log-level"`
	GrpcEnable           bool                     `yaml:"grpc-enable" json:"grpc-enable"`
	GrpcPort             int                      `yaml:"grpc-port" json:"grpc-port"`
	InboundPoolSize      int                      `yaml:"inbound-pool-size" json:"inbound-pool-size"`
	OutboundPoolSize     int                      `yaml:"outbound-pool-size" json:"outbound-pool-size"`
	InoutPoolNonblocking bool                     `yaml:"inout-pool-nonblocking" json:"inout-pool-nonblocking"`
	NodesFileDir         string                   `yaml:"nodes-file-dir" json:"nodes-file-dir"`
}

type Config

type Config struct {
	StorageWay  uint        `yaml:"storage-way"`
	StoragePath string      `yaml:"storage-path"`
	BridgeWay   uint        `yaml:"bridge-way"`
	BridgePath  string      `yaml:"bridge-path"`
	Auth        auth        `yaml:"auth"`
	Mqtt        mqtt        `yaml:"mqtt"`
	Cluster     Cluster     `yaml:"cluster"`
	Redis       redis       `yaml:"redis"`
	Log         log.Options `yaml:"log"`
	PprofEnable bool        `yaml:"pprof-enable"`
}

func Load

func Load(yamlFile string) (*Config, error)

func New

func New() *Config

type DynamicMembershipOptions

type DynamicMembershipOptions struct {
	Enable                   bool   `yaml:"enable" json:"enable"`
	NodeNamePrefix           string `yaml:"node-name-prefix" json:"node-name-prefix"`
	NodeNumZeroPad           uint   `yaml:"node-num-zero-pad" json:"node-num-zero-pad"`
	EventLoopIntervalSec     uint   `yaml:"event-loop-interval-sec" json:"event-loop-interval-sec"`
	RedisNodeKeyPrefix       string `yaml:"redis-node-key-prefix" json:"redis-node-key-prefix"`
	RedisNodeKeyExp          uint   `yaml:"redis-node-key-exp" json:"redis-node-key-exp"`
	RedisLockKey             string `yaml:"redis-lock-key" json:"redis-lock-key"`
	RedisLockLoopIntervalSec uint   `yaml:"redis-lock-loop-interval-sec" json:"redis-lock-loop-interval-sec"`
	MaxRedisLockAttempts     uint   `yaml:"max-redis-lock-attempts" json:"max-redis-lock-attempts"`
}

Jump to

Keyboard shortcuts

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