conf

package
v0.0.0-...-e43fadc Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2021 License: Apache-2.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoSetting = errors.New("未配置")

ErrNoSetting 未配置

Functions

This section is empty.

Types

type APIServerConf

type APIServerConf struct {
	Address   string `json:"address,omitempty" valid:"dialstring"`
	Status    string `json:"status,omitempty" valid:"in(start|stop)"`
	RTimeout  int    `json:"readTimeout,omitempty"`
	WTimeout  int    `json:"writeTimeout,omitempty"`
	RHTimeout int    `json:"readHeaderTimeout,omitempty"`
	Hosts     string `json:"host,omitempty"`
	Trace     bool   `json:"trace,omitempty"`
}

APIServerConf api server配置信息

func NewAPIServerConf

func NewAPIServerConf(address string) *APIServerConf

NewAPIServerConf 构建api server配置信息

func (*APIServerConf) WithDisable

func (a *APIServerConf) WithDisable() *APIServerConf

WithDisable 禁用任务

func (*APIServerConf) WithEnable

func (a *APIServerConf) WithEnable() *APIServerConf

WithEnable 启用任务

func (*APIServerConf) WithHeaderReadTimeout

func (a *APIServerConf) WithHeaderReadTimeout(htimeout int) *APIServerConf

WithHeaderReadTimeout 构建api server配置信息

func (*APIServerConf) WithHost

func (a *APIServerConf) WithHost(host ...string) *APIServerConf

WithHost 设置host

func (*APIServerConf) WithTimeout

func (a *APIServerConf) WithTimeout(rtimeout int, wtimout int) *APIServerConf

WithTimeout 构建api server配置信息

func (*APIServerConf) WithTrace

func (a *APIServerConf) WithTrace() *APIServerConf

WithTrace 构建api server配置信息

type Auth

type Auth struct {
	Name       string   `json:"name" valid:"ascii,required"`
	ExpireAt   int64    `json:"expireAt" valid:"required"`
	Mode       string   `json:"mode" valid:"in(HS256|HS384|HS512|RS256|ES256|ES384|ES512|RS384|RS512|PS256|PS384|PS512),required"`
	Source     string   `json:"source,omitempty" valid:"in(header|cookie|HEADER|COOKIE|H)"`
	Secret     string   `json:"secret" valid:"ascii,required"`
	Exclude    []string `json:"exclude,omitempty"`
	FailedCode string   `json:"failed-code,omitempty" valid:"numeric,range(400|999)"`
	Redirect   string   `json:"redirect,omitempty" valid:"ascii"`
	Domain     string   `json:"domain,omitempty" valid:"ascii"`
	Disable    bool     `json:"disable,omitempty"`
}

Auth 安全认证

func (*Auth) IsExcluded

func (a *Auth) IsExcluded(service string) bool

IsExcluded 是否是排除验证的服务

type Authes

type Authes map[string]*Auth

Authes 安全认证组

func NewAuthes

func NewAuthes() Authes

NewAuthes 构建安全认证

func (Authes) WithJWT

func (a Authes) WithJWT(jwt *JWTAuth) Authes

WithJWT 添加jwt验证

type Breaker

type Breaker struct {
	URL              string `json:"url" valid:"ascii,required"`
	RequestPerSecond int    `json:"request-per-second,omitempty"`
	FailedPercent    int    `json:"failed-request,omitempty"`
	RejectPerSecond  int    `json:"reject-per-second,omitempty"`
	Disable          bool   `json:"disable,omitempty"`
}

Breaker URL熔断配置项

type CacheConf

type CacheConf map[string]interface{}

CacheConf 消息队列配置

func (CacheConf) GetProto

func (q CacheConf) GetProto() string

GetProto 获取协议

type CircuitBreaker

type CircuitBreaker struct {
	ForceBreak      bool       `json:"force-break,omitempty"`
	Disable         bool       `json:"disable,omitempty"`
	SwitchWindow    int        `json:"swith-window,omitempty"`
	CircuitBreakers []*Breaker `json:"circuit-breakers,omitempty"`
}

CircuitBreaker 熔断配置

func NewCircuitBreaker

func NewCircuitBreaker(window int) *CircuitBreaker

NewCircuitBreaker 构建熔断配置

func (*CircuitBreaker) Append

func (c *CircuitBreaker) Append(url string, requestPerSecond int, failedPercent int, rejectPreSecond int) *CircuitBreaker

Append 添加URL的熔断配置

func (*CircuitBreaker) AppendAll

func (c *CircuitBreaker) AppendAll(requestPerSecond int, failedPercent int, rejectPreSecond int) *CircuitBreaker

AppendAll 所有URL使用此熔断配置

func (*CircuitBreaker) WithDisable

func (c *CircuitBreaker) WithDisable() *CircuitBreaker

WithDisable 禁用熔断配置

func (*CircuitBreaker) WithEnable

func (c *CircuitBreaker) WithEnable() *CircuitBreaker

WithEnable 启用熔断配置

func (*CircuitBreaker) WithForceBreak

func (c *CircuitBreaker) WithForceBreak(b bool) *CircuitBreaker

WithForceBreak 强制熔断

type Comparer

type Comparer struct {
	Oconf IServerConf
	Nconf IServerConf
	*JSONComparer
}

func NewComparer

func NewComparer(Oconf IServerConf, Nconf IServerConf) *Comparer

func (*Comparer) IsRequiredSubConfChanged

func (s *Comparer) IsRequiredSubConfChanged(name string) (isChanged bool, err error)

IsRequiredSubConfChanged 检查必须节点是否发生变化

func (*Comparer) IsSubConfChanged

func (s *Comparer) IsSubConfChanged(name string) (isChanged bool)

IsSubConfChanged 检查节点是否发生变化

func (*Comparer) IsVarChanged

func (s *Comparer) IsVarChanged() bool

IsVarChanged var节点是否发生变化

type CronServerConf

type CronServerConf struct {
	Status   string `json:"status,omitempty" valid:"in(start|stop)"`
	Sharding int    `json:"sharding,omitempty"`
	Trace    bool   `json:"trace,omitempty"`
	Timeout  int    `json:"timeout,omitempty"`
}

func NewCronServerConf

func NewCronServerConf() *CronServerConf

NewCronServerConf 构建mqc server配置,默认为对等模式

func (*CronServerConf) WitchMasterSlave

func (a *CronServerConf) WitchMasterSlave() *CronServerConf

WitchMasterSlave 设置为主备模式

func (*CronServerConf) WitchP2P

func (a *CronServerConf) WitchP2P() *CronServerConf

WitchP2P 设置为对等模式

func (*CronServerConf) WitchSharding

func (a *CronServerConf) WitchSharding(i int) *CronServerConf

WitchSharding 设置为分片模式

func (*CronServerConf) WithDisable

func (a *CronServerConf) WithDisable() *CronServerConf

WithDisable 禁用任务

func (*CronServerConf) WithEnable

func (a *CronServerConf) WithEnable() *CronServerConf

WithEnable 启用任务

func (*CronServerConf) WithTimeout

func (a *CronServerConf) WithTimeout(timeout int) *CronServerConf

WithTimeout 构建api server配置信息

func (*CronServerConf) WithTrace

func (a *CronServerConf) WithTrace() *CronServerConf

WithTrace 构建api server配置信息

type CrossDomainHeader

type CrossDomainHeader = Headers

CrossDomainHeader 跨域配置

func (CrossDomainHeader) WithAllowHeaders

func (c CrossDomainHeader) WithAllowHeaders(header ...string) CrossDomainHeader

WithAllowHeaders 设置允许的头信息

type DBConf

type DBConf struct {
	Provider   string `json:"provider" valid:"required"`
	ConnString string `json:"connString" valid:"required"`
	MaxOpen    int    `json:"maxOpen" valid:"required"`
	MaxIdle    int    `json:"maxIdle" valid:"required"`
	LifeTime   int    `json:"lifeTime" valid:"required"`
}

DBConf 数据库配置

func NewDBConf

func NewDBConf(provider string, connString string, maxOpen int, maxIdle int, lifeTime int) *DBConf

NewDBConf 构建数据库配置对象

func NewMysqlConf

func NewMysqlConf(uName string, pwd string, serverIP string, dbName string) *DBConf

NewMysqlConf 创建mysql数据库

func NewMysqlConfForProd

func NewMysqlConfForProd(name ...string) *DBConf

NewMysqlConfForProd 创建prod mysql数据库#connectStr

func NewOracleConf

func NewOracleConf(uName string, pwd string, tnsName string) *DBConf

NewOracleConf 创建oracle数据库

func NewOracleConfForProd

func NewOracleConfForProd(name ...string) *DBConf

NewOracleConfForProd 创建prod oracle数据库#connectStr

func (*DBConf) WithConnect

func (d *DBConf) WithConnect(maxOpen int, maxIdle int, lifeTime int) *DBConf

WithConnect 设置连接数与超时时间

type Headers

type Headers map[string]string

Headers http头信息

func NewHeader

func NewHeader(kv ...string) Headers

NewHeader 构建http头信息

func (Headers) WithCrossDomain

func (imp Headers) WithCrossDomain(host ...string) CrossDomainHeader

WithCrossDomain 添加跨域头配置

type Hosts

type Hosts []string

type IConf

type IConf interface {
	GetVersion() int32
	GetString(key string, def ...string) (r string)
	GetStrings(key string, def ...string) (r []string)
	GetInt(key string, def ...int) int
	GetArray(key string, def ...interface{}) (r []interface{})
	GetBool(key string, def ...bool) (r bool)
	GeJSON(section string) (r []byte, version int32, err error)
	GetSection(section string) (c *JSONConf, err error)
	HasSection(section string) bool
	GetRaw() []byte
	Unmarshal(v interface{}) error
	GetSignature() string
}

type IMainConf

type IMainConf interface {
	IConf
	GetSystemRootfPath() string
	GetMainConfPath() string
	GetServicePubRootPath(name string) string
	GetServerPubRootPath() string
	IsStop() bool
	ForceRestart() bool
	GetSubObject(name string, v interface{}) (int32, error)
	GetSubConf(name string) (*JSONConf, error)
	HasSubConf(name ...string) bool
	GetSubConfClone() map[string]JSONConf
	SetSubConf(data map[string]JSONConf)
	IterSubConf(f func(k string, conf *JSONConf) bool)
}

type IRegistryConf

type IRegistryConf interface {
	GetConf(name string) (*JSONConf, error)
	GetObject(name string, v interface{}) (int32, error)
}

type IServerConf

type IServerConf interface {
	ISystemConf
	IMainConf
	IVarConf
}

IServerConf 服务器配置

type ISystemConf

type ISystemConf interface {
	GetPlatName() string
	GetSysName() string
	GetServerType() string
	GetClusterName() string
	GetServerName() string
	GetAppConf(v interface{}) error
	Get(key string) interface{}
	Set(key string, value interface{})
}

type IVarConf

type IVarConf interface {
	GetVarVersion() int32
	GetVarConf(tp string, name string) (*JSONConf, error)
	GetVarObject(tp string, name string, v interface{}) (int32, error)
	HasVarConf(tp string, name string) bool
	GetVarConfClone() map[string]JSONConf
	SetVarConf(map[string]JSONConf)
	IterVarConf(f func(k string, conf *JSONConf) bool)
}

type JSONComparer

type JSONComparer struct {
	Oconf IConf
	Nconf IConf
}

func NewJSONComparer

func NewJSONComparer(Oconf IConf, Nconf IConf) *JSONComparer

func (*JSONComparer) IsChanged

func (s *JSONComparer) IsChanged() bool

func (*JSONComparer) IsValueChanged

func (s *JSONComparer) IsValueChanged(names ...string) (isChanged bool)

IsValueChanged 检查值是否发生变化

type JSONConf

type JSONConf struct {
	// contains filtered or unexported fields
}

JSONConf json配置文件

func NewJSONConf

func NewJSONConf(message []byte, version int32) (c *JSONConf, err error)

NewJSONConf 初始化JsonConf

func NewJSONConfByMap

func NewJSONConfByMap(data map[string]interface{}, version int32) (c *JSONConf, err error)

NewJSONConfByMap 根据map初始化对象

func (*JSONConf) GeJSON

func (j *JSONConf) GeJSON(section string) (r []byte, version int32, err error)

GeJSON 获取section原始JSON串

func (*JSONConf) GetArray

func (j *JSONConf) GetArray(key string, def ...interface{}) (r []interface{})

GetArray 获取数组对象

func (*JSONConf) GetBool

func (j *JSONConf) GetBool(key string, def ...bool) (r bool)

GetBool 获取bool类型值

func (*JSONConf) GetInt

func (j *JSONConf) GetInt(key string, def ...int) int

GetInt 获取数字

func (*JSONConf) GetRaw

func (j *JSONConf) GetRaw() []byte

GetRaw 获取json数据

func (*JSONConf) GetSection

func (j *JSONConf) GetSection(section string) (c *JSONConf, err error)

GetSection 指定节点名称获取JSONConf

func (*JSONConf) GetSignature

func (j *JSONConf) GetSignature() string

GetSignature 获取当前对象的唯一标识

func (*JSONConf) GetString

func (j *JSONConf) GetString(key string, def ...string) (r string)

GetString 获取字符串

func (*JSONConf) GetStrings

func (j *JSONConf) GetStrings(key string, def ...string) (r []string)

GetStrings 获取字符串数组

func (*JSONConf) GetVersion

func (j *JSONConf) GetVersion() int32

GetVersion 获取当前配置的版本号

func (*JSONConf) HasSection

func (j *JSONConf) HasSection(section string) bool

HasSection 是否存在节点

func (*JSONConf) Unmarshal

func (j *JSONConf) Unmarshal(v interface{}) error

Unmarshal 将当前[]byte反序列化为对象

type JWTAuth

type JWTAuth struct {
	*Auth
}

func NewJWT

func NewJWT(name string, mode string, secret string, expireAt int64, exclude ...string) *JWTAuth

NewJWT 构建JWT安全认证

func (*JWTAuth) WithCookieStore

func (a *JWTAuth) WithCookieStore(domain ...string) *JWTAuth

WithCookieStore 将jwt信息存储到cookie中

func (*JWTAuth) WithFailedCode

func (a *JWTAuth) WithFailedCode(code string) *JWTAuth

WithFailedCode 设置jwt验证失败后的返回给客户端的错误码

func (*JWTAuth) WithHeaderStore

func (a *JWTAuth) WithHeaderStore() *JWTAuth

WithHeaderStore 将jwt信息存储到header中

func (*JWTAuth) WithRedirect

func (a *JWTAuth) WithRedirect(url string) *JWTAuth

WithRedirect 设置jwt验证失败后的跳转地址

type MQCServerConf

type MQCServerConf struct {
	Status   string `json:"status,omitempty" valid:"in(start|stop)"`
	Sharding int    `json:"sharding,omitempty"`
	Trace    bool   `json:"trace,omitempty"`
	Timeout  int    `json:"timeout,omitempty"`
}

func NewMQCServerConf

func NewMQCServerConf() *MQCServerConf

NewMQCServerConf 构建mqc server配置,默认为对等模式

func (*MQCServerConf) WitchMasterSlave

func (a *MQCServerConf) WitchMasterSlave() *MQCServerConf

WitchMasterSlave 设置为主备模式

func (*MQCServerConf) WitchP2P

func (a *MQCServerConf) WitchP2P() *MQCServerConf

WitchP2P 设置为对等模式

func (*MQCServerConf) WitchSharding

func (a *MQCServerConf) WitchSharding(i int) *MQCServerConf

WitchSharding 设置为分片模式

func (*MQCServerConf) WithDisable

func (a *MQCServerConf) WithDisable() *MQCServerConf

WithDisable 禁用任务

func (*MQCServerConf) WithEnable

func (a *MQCServerConf) WithEnable() *MQCServerConf

WithEnable 启用任务

func (*MQCServerConf) WithTimeout

func (a *MQCServerConf) WithTimeout(timeout int) *MQCServerConf

WithTimeout 构建api server配置信息

func (*MQCServerConf) WithTrace

func (a *MQCServerConf) WithTrace() *MQCServerConf

WithTrace 构建api server配置信息

type MQTTConf

type MQTTConf QueueConf

MQTTConf MQTT配置

func NewMQTTConf

func NewMQTTConf(address string, userName string, password string) MQTTConf

NewMQTTConf 构建MQTT消息队列配置

func (MQTTConf) WithCert

func (m MQTTConf) WithCert(cert string) MQTTConf

WithCert 添加证书

type MetadataConf

type MetadataConf struct {
	Name string
	Type string
	// contains filtered or unexported fields
}

func (*MetadataConf) GetMetadata

func (s *MetadataConf) GetMetadata(key string) interface{}

func (*MetadataConf) SetMetadata

func (s *MetadataConf) SetMetadata(key string, v interface{})

type Metric

type Metric struct {
	Host     string `json:"host" valid:"requrl,required"`
	DataBase string `json:"dataBase" valid:"ascii,required"`
	Cron     string `json:"cron" valid:"ascii,required"`
	UserName string `json:"userName,omitempty" valid:"ascii"`
	Password string `json:"password,omitempty" valid:"ascii"`
	Disable  bool   `json:"disable,omitempty"`
}

func NewMetric

func NewMetric(host string, db string, cron string) *Metric

NewMetric 构建api server配置信息

func (*Metric) WithDisable

func (m *Metric) WithDisable() *Metric

WithDisable 禁用配置

func (*Metric) WithEnable

func (m *Metric) WithEnable() *Metric

WithEnable 启用配置

func (*Metric) WithUserName

func (m *Metric) WithUserName(uname string, p string) *Metric

WithUserName 设置用户名密码

type Package

type Package struct {
	URL     string `json:"url" valid:"requrl,required"`
	Version string `json:"version" valid:"ascii,required"`
	CRC32   uint32 `json:"crc32" valid:"required"`
}

func NewPackage

func NewPackage(url string, version string, crc32 uint32) *Package

NewPackage 构建CRON任务

type Queue

type Queue struct {
	Name        string            `json:"name,omitempty" valid:"ascii"`
	Queue       string            `json:"queue" valid:"ascii,required"`
	Engine      string            `json:"engine,omitempty"  valid:"ascii,uppercase,in(*|RPC)"`
	Service     string            `json:"service" valid:"ascii,required"`
	Setting     map[string]string `json:"args,omitempty"`
	Concurrency int               `json:"concurrency,omitempty"`
	Disable     bool              `json:"disabl,omitemptye"`
	Handler     interface{}
}

func NewQueue

func NewQueue(queue string, service string) *Queue

NewQueue 构建Queue注册项

func NewQueueWithConcurrency

func NewQueueWithConcurrency(queue string, service string, concurrency int) *Queue

NewQueueWithConcurrency 构建Queue注册项

func (*Queue) WithConcurrency

func (t *Queue) WithConcurrency(c int) *Queue

WithConcurrency 设置并发协程数

func (*Queue) WithDisable

func (t *Queue) WithDisable() *Queue

WithDisable 禁用任务

func (*Queue) WithEnable

func (t *Queue) WithEnable() *Queue

WithEnable 启用任务

type QueueConf

type QueueConf map[string]interface{}

QueueConf 消息队列配置

func (QueueConf) GetProto

func (q QueueConf) GetProto() string

GetProto 获取协议

type Queues

type Queues struct {
	Setting map[string]string `json:"args,omitempty"`
	Queues  []*Queue          `json:"queues"`
}

func NewQueues

func NewQueues() *Queues

NewQueues 构建Queue注册列表

func (*Queues) Append

func (h *Queues) Append(queue string, service string) *Queues

Append 添加Queue注册信息

type RPCConf

type RPCConf struct {
	Register string `json:"register" valid:"required"`
}

type RPCServerConf

type RPCServerConf struct {
	Address   string `json:"address,omitempty" valid:"dialstring"`
	Status    string `json:"status,omitempty" valid:"in(start|stop)"`
	RTimeout  int    `json:"readTimeout,omitempty"`
	WTimeout  int    `json:"writeTimeout,omitempty"`
	RHTimeout int    `json:"readHeaderTimeout,omitempty"`
	Trace     bool   `json:"trace,omitempty"`
}

RPCServerConf api server配置信息

func NewRPCServerConf

func NewRPCServerConf(address string) *RPCServerConf

NewRPCServerConf 构建api server配置信息

func (*RPCServerConf) WithDisable

func (a *RPCServerConf) WithDisable() *RPCServerConf

WithDisable 禁用任务

func (*RPCServerConf) WithEnable

func (a *RPCServerConf) WithEnable() *RPCServerConf

WithEnable 启用任务

func (*RPCServerConf) WithTrace

func (a *RPCServerConf) WithTrace() *RPCServerConf

WithTrace 构建api server配置信息

type RedisCacheConf

type RedisCacheConf = CacheConf

RedisCacheConf redis消息队列

func NewRedisCacheConf

func NewRedisCacheConf(dbIndex int, address ...string) RedisCacheConf

NewRedisCacheConf 构建redis消息队列配置

func NewRedisCacheConfForProd

func NewRedisCacheConfForProd(dbIndex int, name ...string) RedisCacheConf

NewRedisCacheConfForProd 创建prod redis配置

func (RedisCacheConf) WithPoolSize

func (m RedisCacheConf) WithPoolSize(poolSize int) RedisCacheConf

WithPoolSize 修改连接数

func (RedisCacheConf) WithTimeout

func (m RedisCacheConf) WithTimeout(dialTimeout int, readTimeout int, writeTimeout int, poolSize int) RedisCacheConf

WithTimeout 设置超时时长

type RedisQueueConf

type RedisQueueConf QueueConf

RedisQueueConf redis消息队列

func NewRedisQueueConf

func NewRedisQueueConf(address []string, dbIndex int) RedisQueueConf

NewRedisQueueConf 构建redis消息队列配置

func NewRedisQueueConfForProd

func NewRedisQueueConfForProd(dbIndex int, name ...string) RedisQueueConf

NewRedisQueueConfForProd 创建prod redis配置

func (RedisQueueConf) WithTimeout

func (m RedisQueueConf) WithTimeout(dialTimeout int, readTimeout int, writeTimeout int, poolSize int) RedisQueueConf

WithTimeout 设置超时时长

type RegistryConf

type RegistryConf struct {
	// contains filtered or unexported fields
}

RegistryConf 基于注册中心的配置管理器

func NewRegistryConf

func NewRegistryConf(rgst registry.IRegistry) (s *RegistryConf)

NewRegistryConf 构建服务器配置缓存

func (*RegistryConf) GetConf

func (c *RegistryConf) GetConf(name string) (*JSONConf, error)

GetConf 指定配置文件名称,获取系统配置信息

func (*RegistryConf) GetObject

func (c *RegistryConf) GetObject(name string, v interface{}) (int32, error)

GetObject 获取子系统配置

type Router

type Router struct {
	Name    string            `json:"name,omitempty" valid:"ascii,required"`
	Action  []string          `json:"action,omitempty" valid:"uppercase,in(GET|POST|PUT|DELETE|HEAD|TRACE|OPTIONS)"`
	Engine  string            `json:"engine,omitempty" valid:"ascii,uppercase,in(*|RPC)"`
	Service string            `json:"service" valid:"ascii,required"`
	Setting map[string]string `json:"args,omitempty"`
	Disable bool              `json:"disable,omitempty"`
	Handler interface{}
}

type Routers

type Routers struct {
	Setting map[string]string `json:"args,omitempty"`
	Routers []*Router         `json:"routers,omitempty"`
}

func NewRouters

func NewRouters() *Routers

NewRouters 构建路由

func (*Routers) Append

func (h *Routers) Append(name string, service string) *Routers

Append 添加路由信息

func (*Routers) AppendWithAction

func (h *Routers) AppendWithAction(name string, service string, action ...string) *Routers

AppendWithAction 添加路由信息

type ServerConf

type ServerConf struct {
	*JSONConf
	// contains filtered or unexported fields
}

ServerConf 服务器配置信息

func NewServerConf

func NewServerConf(mainConfpath string, mainConfRaw []byte, mainConfVersion int32, rgst registry.IRegistry) (s *ServerConf, err error)

NewServerConf 构建服务器配置缓存

func (*ServerConf) ForceRestart

func (c *ServerConf) ForceRestart() bool

ForceRestart 强制重启

func (ServerConf) Get

func (m ServerConf) Get(key string) interface{}

func (*ServerConf) GetAppConf

func (c *ServerConf) GetAppConf(v interface{}) error

GetAppConf 获取系统配置

func (*ServerConf) GetClusterName

func (c *ServerConf) GetClusterName() string

GetClusterName 获取集群名称

func (*ServerConf) GetMainConfPath

func (c *ServerConf) GetMainConfPath() string

GetMainConfPath 获取主配置文件路径

func (*ServerConf) GetPlatName

func (c *ServerConf) GetPlatName() string

GetPlatName 获取平台名称

func (*ServerConf) GetServerName

func (c *ServerConf) GetServerName() string

GetServerName 获取服务器名称

func (*ServerConf) GetServerPubRootPath

func (c *ServerConf) GetServerPubRootPath() string

GetServerPubRootPath 获取服务器发布的跟路径

func (*ServerConf) GetServerType

func (c *ServerConf) GetServerType() string

GetServerType 获取服务器类型

func (*ServerConf) GetServicePubRootPath

func (c *ServerConf) GetServicePubRootPath(svName string) string

GetServicePubRootPath 获取服务发布跟路径

func (*ServerConf) GetSubConf

func (c *ServerConf) GetSubConf(name string) (*JSONConf, error)

GetSubConf 指定配置文件名称,获取系统配置信息

func (*ServerConf) GetSubConfClone

func (c *ServerConf) GetSubConfClone() map[string]JSONConf

GetSubConfClone 获取sub配置拷贝

func (*ServerConf) GetSubObject

func (c *ServerConf) GetSubObject(name string, v interface{}) (int32, error)

GetSubObject 获取子系统配置

func (*ServerConf) GetSysName

func (c *ServerConf) GetSysName() string

GetSysName 获取系统名称

func (*ServerConf) GetSystemRootfPath

func (c *ServerConf) GetSystemRootfPath() string

GetSystemRootfPath 获取系统根路径

func (*ServerConf) GetVarConf

func (c *ServerConf) GetVarConf(tp string, name string) (*JSONConf, error)

GetVarConf 指定配置文件名称,获取var配置信息

func (*ServerConf) GetVarConfClone

func (c *ServerConf) GetVarConfClone() map[string]JSONConf

GetVarConfClone 获取var配置拷贝

func (*ServerConf) GetVarObject

func (c *ServerConf) GetVarObject(tp string, name string, v interface{}) (int32, error)

GetVarObject 指定配置文件名称,获取var配置信息

func (*ServerConf) GetVarVersion

func (c *ServerConf) GetVarVersion() int32

GetVarVersion 获取var路径版本号

func (*ServerConf) HasSubConf

func (c *ServerConf) HasSubConf(names ...string) bool

HasSubConf 是否存在子级配置

func (*ServerConf) HasVarConf

func (c *ServerConf) HasVarConf(tp string, name string) bool

HasVarConf 是否存在子级配置

func (*ServerConf) IsStop

func (c *ServerConf) IsStop() bool

IsStop 当前服务是否已停止

func (*ServerConf) IterSubConf

func (c *ServerConf) IterSubConf(f func(k string, conf *JSONConf) bool)

IterSubConf 迭代所有子配置

func (*ServerConf) IterVarConf

func (c *ServerConf) IterVarConf(f func(k string, conf *JSONConf) bool)

IterVarConf 迭代所有子配置

func (ServerConf) Set

func (m ServerConf) Set(key string, value interface{})

func (*ServerConf) SetSubConf

func (c *ServerConf) SetSubConf(data map[string]JSONConf)

SetSubConf 获取sub配置参数

func (*ServerConf) SetVarConf

func (c *ServerConf) SetVarConf(data map[string]JSONConf)

SetVarConf 获取var配置参数

type Static

type Static struct {
	Dir       string   `json:"dir,omitempty" valid:"ascii"`
	Archive   string   `json:"archive,omitempty" valid:"ascii"`
	Prefix    string   `json:"prefix,omitempty" valid:"ascii"`
	Exts      []string `json:"exts,omitempty" valid:"ascii"`
	Exclude   []string `json:"exclude,omitempty" valid:"ascii"`
	FirstPage string   `json:"first-page,omitempty" valid:"ascii"`
	Rewriters []string `json:"rewriters,omitempty" valid:"ascii"`
	Disable   bool     `json:"disable,omitempty"`
}

Static 设置静态文件配置

func NewImageStaticConf

func NewImageStaticConf() *Static

NewImageStaticConf 构建图片文件配置

func NewWebServerStaticConf

func NewWebServerStaticConf() *Static

NewWebServerStaticConf 构建Web服务静态文件配置

func (*Static) AppendExts

func (s *Static) AppendExts(exts ...string) *Static

AppendExts 设置静态文件跟目录

func (*Static) WithArchive

func (s *Static) WithArchive(archive string) *Static

WithArchive 设置静态文件跟目录

func (*Static) WithDisable

func (s *Static) WithDisable() *Static

WithDisable 禁用配置

func (*Static) WithEnable

func (s *Static) WithEnable() *Static

WithEnable 启用配置

func (*Static) WithExts

func (s *Static) WithExts(exts ...string) *Static

WithExts 设置静态文件跟目录

func (*Static) WithFirstPage

func (s *Static) WithFirstPage(firstPage string) *Static

WithFirstPage 设置静首页地址

func (*Static) WithPrefix

func (s *Static) WithPrefix(prefix string) *Static

WithPrefix 设置静态文件跟目录

func (*Static) WithRoot

func (s *Static) WithRoot(dir string) *Static

WithRoot 设置静态文件跟目录

type Task

type Task struct {
	Name    string                 `json:"name,omitempty" valid:"ascii"`
	Cron    string                 `json:"cron" valid:"ascii,required"`
	Input   map[string]interface{} `json:"input,omitempty"`
	Engine  string                 `json:"engine,omitempty"  valid:"ascii,uppercase,in(*|RPC)"`
	Service string                 `json:"service"  valid:"ascii,required"`
	Setting map[string]string      `json:"args,omitempty"`
	Next    string                 `json:"next,omitempty"`
	Last    string                 `json:"last,omitempty"`
	Handler interface{}            `json:"handler,omitempty"`
	Disable bool                   `json:"disable,omitempty"`
}

func NewTask

func NewTask(cron string, service string) *Task

NewTask 构建CRON任务

func (*Task) WithDisable

func (t *Task) WithDisable() *Task

WithDisable 禁用任务

func (*Task) WithEnable

func (t *Task) WithEnable() *Task

WithEnable 启用任务

type Tasks

type Tasks struct {
	Setting map[string]string `json:"args,omitempty"`
	Tasks   []*Task           `json:"tasks"`
}

func NewTasks

func NewTasks() *Tasks

NewTasks 构建CRON任务列表

func (*Tasks) Append

func (h *Tasks) Append(cron string, service string) *Tasks

Append 添加路由信息

type View

type View struct {
	Path    string `json:"path" valid:"ascii,required"`
	Left    string `json:"left,omitempty" valid:"ascii"`
	Right   string `json:"right,omitempty" valid:"ascii"`
	Files   []string
	Disable bool `json:"disable,omitempty"`
}

View web服务器view解析配置

func NewView

func NewView(path string) *View

NewView 构建web服务view配置

func (*View) WithDisable

func (a *View) WithDisable() *View

WithDisable 禁用配置

func (*View) WithEnable

func (a *View) WithEnable() *View

WithEnable 启用配置

func (*View) WithExpression

func (a *View) WithExpression(left string, right string) *View

WithExpression 设置view绑定变量的左,右解析符

type WSServerConf

type WSServerConf struct {
	Address   string `json:"address,omitempty" valid:"dialstring"`
	Status    string `json:"status,omitempty" valid:"in(start|stop)"`
	RTimeout  int    `json:"readTimeout,omitempty"`
	WTimeout  int    `json:"writeTimeout,omitempty"`
	RHTimeout int    `json:"readHeaderTimeout,omitempty"`
	Trace     bool   `json:"trace,omitempty"`
}

WSServerConf api server配置信息

func NewWSServerConf

func NewWSServerConf(address string) *WSServerConf

NewWSServerConf 构建api server配置信息

func (*WSServerConf) WithDisable

func (a *WSServerConf) WithDisable() *WSServerConf

WithDisable 禁用任务

func (*WSServerConf) WithEnable

func (a *WSServerConf) WithEnable() *WSServerConf

WithEnable 启用任务

func (*WSServerConf) WithTrace

func (a *WSServerConf) WithTrace() *WSServerConf

WithTrace 构建api server配置信息

type WebServerConf

type WebServerConf = APIServerConf

WebServerConf web服务器配置

func NewWebServerConf

func NewWebServerConf(address string) *WebServerConf

NewWebServerConf 构建api server配置信息

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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