Documentation ¶
Index ¶
- Variables
- type APIServerConf
- func (a *APIServerConf) WithDNS(host string, ip ...string) *APIServerConf
- func (a *APIServerConf) WithDisable() *APIServerConf
- func (a *APIServerConf) WithEnable() *APIServerConf
- func (a *APIServerConf) WithHeaderReadTimeout(htimeout int) *APIServerConf
- func (a *APIServerConf) WithHost(host ...string) *APIServerConf
- func (a *APIServerConf) WithTimeout(rtimeout int, wtimout int) *APIServerConf
- func (a *APIServerConf) WithTrace() *APIServerConf
- type Authes
- type Breaker
- type CNode
- type CNodes
- type CacheConf
- type CircuitBreaker
- func (c *CircuitBreaker) Append(url string, requestPerSecond int, failedPercent int, rejectPreSecond int) *CircuitBreaker
- func (c *CircuitBreaker) AppendAll(requestPerSecond int, failedPercent int, rejectPreSecond int) *CircuitBreaker
- func (c *CircuitBreaker) WithDisable() *CircuitBreaker
- func (c *CircuitBreaker) WithEnable() *CircuitBreaker
- func (c *CircuitBreaker) WithForceBreak(b bool) *CircuitBreaker
- type Comparer
- type Connect
- type CronServerConf
- func (a *CronServerConf) WitchMasterSlave() *CronServerConf
- func (a *CronServerConf) WitchP2P() *CronServerConf
- func (a *CronServerConf) WitchSharding(i int) *CronServerConf
- func (a *CronServerConf) WithDisable() *CronServerConf
- func (a *CronServerConf) WithEnable() *CronServerConf
- func (a *CronServerConf) WithTimeout(timeout int) *CronServerConf
- func (a *CronServerConf) WithTrace() *CronServerConf
- type CrossDomainHeader
- type DBConf
- func NewDBConf(provider string, connString string, maxOpen int, maxIdle int, lifeTime int) *DBConf
- func NewMysqlConf(uName string, pwd string, serverIP string, dbName string) *DBConf
- func NewMysqlConfForProd(name ...string) *DBConf
- func NewOracleConf(uName string, pwd string, tnsName string) *DBConf
- func NewOracleConfForProd(name ...string) *DBConf
- type FixedSecretAuth
- type Headers
- type Hosts
- type IConf
- type IMainConf
- type IRegistryConf
- type IServerConf
- type ISystemConf
- type IVarConf
- type JSONComparer
- type JSONConf
- func (j *JSONConf) GetArray(key string, def ...interface{}) (r []interface{})
- func (j *JSONConf) GetBool(key string, def ...bool) (r bool)
- func (j *JSONConf) GetInt(key string, def ...int) int
- func (j *JSONConf) GetJSON(section string) (r []byte, version int32, err error)
- func (j *JSONConf) GetRaw() []byte
- func (j *JSONConf) GetSection(section string) (c *JSONConf, err error)
- func (j *JSONConf) GetSignature() string
- func (j *JSONConf) GetString(key string, def ...string) (r string)
- func (j *JSONConf) GetStrings(key string, def ...string) (r []string)
- func (j *JSONConf) GetVersion() int32
- func (j *JSONConf) HasSection(section string) bool
- func (j *JSONConf) Unmarshal(v interface{}) error
- type JWTAuth
- func (a *JWTAuth) IsExcluded(service string) bool
- func (a *JWTAuth) WithCookieStore(domain ...string) *JWTAuth
- func (a *JWTAuth) WithDisable() *JWTAuth
- func (a *JWTAuth) WithEnable() *JWTAuth
- func (a *JWTAuth) WithFailedCode(code string) *JWTAuth
- func (a *JWTAuth) WithHeaderStore() *JWTAuth
- func (a *JWTAuth) WithRedirect(url string) *JWTAuth
- type LMQConf
- type MQCServerConf
- func (a *MQCServerConf) WithDisable() *MQCServerConf
- func (a *MQCServerConf) WithEnable() *MQCServerConf
- func (a *MQCServerConf) WithMasterSlave() *MQCServerConf
- func (a *MQCServerConf) WithP2P() *MQCServerConf
- func (a *MQCServerConf) WithSharding(i int) *MQCServerConf
- func (a *MQCServerConf) WithTimeout(timeout int) *MQCServerConf
- func (a *MQCServerConf) WithTrace() *MQCServerConf
- type MQTTConf
- type MetadataConf
- type Metric
- type Package
- type Queue
- type QueueConf
- type Queues
- type RPCServerConf
- type RedisCacheConf
- type RedisQueueConf
- type RegistryConf
- type Response
- type Router
- type Routers
- type SecretConnect
- func (c *SecretConnect) Connect() *Connect
- func (c *SecretConnect) SetChainWithHead(chain string) *SecretConnect
- func (c *SecretConnect) SetChainWithHeadAndTail(chain string) *SecretConnect
- func (c *SecretConnect) SetChainWithTail(chain string) *SecretConnect
- func (c *SecretConnect) SetName(name string, kv string) *SecretConnect
- type ServerConf
- func (c *ServerConf) ForceRestart() bool
- func (m ServerConf) Get(key string) interface{}
- func (c *ServerConf) GetAppConf(v interface{}) error
- func (c *ServerConf) GetClusterID() string
- func (c *ServerConf) GetClusterName() string
- func (c *ServerConf) GetClusterNodes(serverType ...string) CNodes
- func (c *ServerConf) GetDNSPubRootPath(svName string) string
- func (c *ServerConf) GetMainConfPath() string
- func (c *ServerConf) GetPlatName() string
- func (c *ServerConf) GetServerName() string
- func (c *ServerConf) GetServerPubRootPath(serverType ...string) string
- func (c *ServerConf) GetServerType() string
- func (c *ServerConf) GetServicePubRootPath(svName string) string
- func (c *ServerConf) GetSubConf(name string) (*JSONConf, error)
- func (c *ServerConf) GetSubConfClone() map[string]JSONConf
- func (c *ServerConf) GetSubObject(name string, v interface{}) (int32, error)
- func (c *ServerConf) GetSysName() string
- func (c *ServerConf) GetSystemRootfPath(tp ...string) string
- func (c *ServerConf) GetVarConf(tp string, name string) (*JSONConf, error)
- func (c *ServerConf) GetVarConfClone() map[string]JSONConf
- func (c *ServerConf) GetVarObject(tp string, name string, v interface{}) (int32, error)
- func (c *ServerConf) GetVarVersion() int32
- func (c *ServerConf) HasSubConf(names ...string) bool
- func (c *ServerConf) HasVarConf(tp string, name string) bool
- func (c *ServerConf) IsStop() bool
- func (c *ServerConf) IterSubConf(f func(k string, conf *JSONConf) bool)
- func (c *ServerConf) IterVarConf(f func(k string, conf *JSONConf) bool)
- func (m ServerConf) Set(key string, value interface{})
- func (c *ServerConf) SetSubConf(data map[string]JSONConf)
- func (c *ServerConf) SetVarConf(data map[string]JSONConf)
- type ServiceAuth
- func (a *ServiceAuth) AuthString() (string, error)
- func (a *ServiceAuth) String() (string, error)
- func (a *ServiceAuth) WithCheckTimestamp(e ...bool) *ServiceAuth
- func (a *ServiceAuth) WithConnect() *Connect
- func (a *ServiceAuth) WithDecryptName(name ...string) *ServiceAuth
- func (a *ServiceAuth) WithDisable() *ServiceAuth
- func (a *ServiceAuth) WithEnable() *ServiceAuth
- func (a *ServiceAuth) WithParam(key string, value interface{}) *ServiceAuth
- func (a *ServiceAuth) WithRequest(path ...string) *ServiceAuth
- func (a *ServiceAuth) WithRequired(fieldName ...string) *ServiceAuth
- func (a *ServiceAuth) WithSignAlias(name string) *ServiceAuth
- func (a *ServiceAuth) WithTimestampAlias(name string) *ServiceAuth
- func (a *ServiceAuth) WithUIDAlias(name string) *ServiceAuth
- type ServiceAuths
- type Static
- func (s *Static) AppendExts(exts ...string) *Static
- func (s *Static) WithArchive(archive string) *Static
- func (s *Static) WithDisable() *Static
- func (s *Static) WithEnable() *Static
- func (s *Static) WithExts(exts ...string) *Static
- func (s *Static) WithFirstPage(firstPage string) *Static
- func (s *Static) WithPrefix(prefix string) *Static
- func (s *Static) WithRoot(dir string) *Static
- type Task
- type Tasks
- type Template
- type View
- type WSServerConf
- type WebServerConf
Constants ¶
This section is empty.
Variables ¶
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"` Host string `json:"host,omitempty"` Domain string `json:"dn,omitempty"` Trace bool `json:"trace,omitempty"` }
APIServerConf api server配置信息
func NewAPIServerConf ¶
func NewAPIServerConf(address string) *APIServerConf
NewAPIServerConf 构建api server配置信息
func (*APIServerConf) WithDNS ¶
func (a *APIServerConf) WithDNS(host string, ip ...string) *APIServerConf
WithDNS 设置请求域名
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 Authes ¶
type Authes struct { JWT *JWTAuth `json:"jwt,omitempty"` FixedScret *FixedSecretAuth `json:"fixed-secret,omitempty"` RemotingServiceAuths ServiceAuths `json:"remotings,omitempty"` }
Authes 安全认证组
func (*Authes) WithFixedSecretSign ¶
func (a *Authes) WithFixedSecretSign(auth *FixedSecretAuth) *Authes
WithFixedSecretSign 添加固定签名认证
func (*Authes) WithServiceAuth ¶
func (a *Authes) WithServiceAuth(auth ...*ServiceAuth) *Authes
WithServiceAuth 添加远程服务验证
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 CNode ¶
type CNode struct {
// contains filtered or unexported fields
}
CNode 集群节点
type CircuitBreaker ¶
type CircuitBreaker struct { ForceBreak bool `json:"force-break,omitempty"` Disable bool `json:"disable,omitempty"` SwitchWindow int `json:"switch-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 ¶
IsRequiredSubConfChanged 检查必须节点是否发生变化
func (*Comparer) IsSubConfChanged ¶
IsSubConfChanged 检查节点是否发生变化
type Connect ¶
type Connect struct { KeyValue string `json:"kv,omitempty" valid:"ascii"` Chain string `json:"chain,omitempty" valid:"ascii"` Sort string `json:"sort,omitempty" valid:"in(all|data|static)"` Fields string `json:"fields,omitempty" valid:"ascii"` Secret *SecretConnect `json:"secret,omitempty"` // contains filtered or unexported fields }
Connect 签名拼接串
func (*Connect) SetSecretConnect ¶
func (c *Connect) SetSecretConnect() *SecretConnect
SetSecretConnect 设置secrect拼接方式
func (*Connect) SortStatic ¶
SortStatic 使用指定的字段进行排序
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 NewMysqlConf ¶
NewMysqlConf 创建mysql数据库
func NewMysqlConfForProd ¶
NewMysqlConfForProd 创建prod mysql数据库#connectStr
func NewOracleConf ¶
NewOracleConf 创建oracle数据库
func NewOracleConfForProd ¶
NewOracleConfForProd 创建prod oracle数据库#connectStr
type FixedSecretAuth ¶
type FixedSecretAuth struct { Mode string `json:"mode" valid:"in(MD5|SHA1|SHA256),required"` Secret string `json:"secret" valid:"ascii,required"` Include []string `json:"include" valid:"required"` Disable bool `json:"disable,omitempty"` }
func NewFixedSecretAuth ¶
func NewFixedSecretAuth(secret string, mode ...string) *FixedSecretAuth
NewFixedSecretAuth 创建固定Secret签名认证
func (*FixedSecretAuth) Contains ¶
func (a *FixedSecretAuth) Contains(p string) bool
Contains 检查指定的路径是否允许签名
func (*FixedSecretAuth) WithDisable ¶
func (a *FixedSecretAuth) WithDisable() *FixedSecretAuth
WithDisable 禁用配置
func (*FixedSecretAuth) WithEnable ¶
func (a *FixedSecretAuth) WithEnable() *FixedSecretAuth
WithEnable 启用配置
func (*FixedSecretAuth) WithInclude ¶
func (a *FixedSecretAuth) WithInclude(path ...string) *FixedSecretAuth
WithInclude 设置include的请求服务路径
type Headers ¶
Headers http头信息
func (Headers) WithCrossDomain ¶
func (imp Headers) WithCrossDomain(host ...string) CrossDomainHeader
WithCrossDomain 添加跨域头配置
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) GetJSON(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(server ...string) string GetMainConfPath() string GetServicePubRootPath(name string) string GetServerPubRootPath(serverType ...string) string GetDNSPubRootPath(svName string) string GetClusterNodes(serverType ...string) CNodes 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) GetClusterID() string }
type IRegistryConf ¶
type ISystemConf ¶
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 ¶
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 ¶
NewJSONConf 初始化JsonConf
func NewJSONConfByMap ¶
NewJSONConfByMap 根据map初始化对象
func (*JSONConf) GetSection ¶
GetSection 指定节点名称获取JSONConf
func (*JSONConf) GetStrings ¶
GetStrings 获取字符串数组
type JWTAuth ¶
type JWTAuth 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"` Redirect string `json:"redirect,omitempty" valid:"ascii"` Domain string `json:"domain,omitempty" valid:"ascii"` Disable bool `json:"disable,omitempty"` }
JWTAuth jwt安全认证
func (*JWTAuth) IsExcluded ¶
IsExcluded 是否是排除验证的服务
func (*JWTAuth) WithCookieStore ¶
WithCookieStore 将jwt信息存储到cookie中
func (*JWTAuth) WithFailedCode ¶
WithFailedCode 设置jwt验证失败后的返回给客户端的错误码
func (*JWTAuth) WithHeaderStore ¶
WithHeaderStore 将jwt信息存储到header中
func (*JWTAuth) WithRedirect ¶
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"` }
MQCServerConf mqc服务配置
func NewMQCServerConf ¶
func NewMQCServerConf() *MQCServerConf
NewMQCServerConf 构建mqc server配置,默认为对等模式
func (*MQCServerConf) WithDisable ¶
func (a *MQCServerConf) WithDisable() *MQCServerConf
WithDisable 禁用任务
func (*MQCServerConf) WithEnable ¶
func (a *MQCServerConf) WithEnable() *MQCServerConf
WithEnable 启用任务
func (*MQCServerConf) WithMasterSlave ¶
func (a *MQCServerConf) WithMasterSlave() *MQCServerConf
WithMasterSlave 设置为主备模式
func (*MQCServerConf) WithSharding ¶
func (a *MQCServerConf) WithSharding(i int) *MQCServerConf
WithSharding 设置为分片模式
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 ¶
NewMQTTConf 构建MQTT消息队列配置
type MetadataConf ¶
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"` }
type Package ¶
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:"disable,omitemptye"` Handler interface{} `json:"-"` }
func NewQueueWithConcurrency ¶
NewQueueWithConcurrency 构建Queue注册项
func (*Queue) WithConcurrency ¶
WithConcurrency 设置并发协程数
type Queues ¶
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"` Host string `json:"host,omitempty"` Domain string `json:"dn,omitempty"` }
RPCServerConf api server配置信息
func NewRPCServerConf ¶
func NewRPCServerConf(address string) *RPCServerConf
NewRPCServerConf 构建api server配置信息
func (*RPCServerConf) WithDNS ¶
func (a *RPCServerConf) WithDNS(host string, ip string) *RPCServerConf
WithDNS 设置请求域名
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 构建服务器配置缓存
type Response ¶
type Response struct { Params map[string]interface{} `json:"params,omitempty"` Templates []*Template `json:"templates,omitempty" valid:"required"` }
Response 请求响应配置
func NewResponseByStatus ¶
NewResponseByStatus 构建响应配置根据状态码模块内容
func (*Response) GetTemplate ¶
GetTemplate 获取指定请求对应的模板
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:"-" valid:"-"` Service string `json:"service" valid:"ascii,required"` Setting map[string]string `json:"args,omitempty"` Disable bool `json:"disable,omitempty"` Handler interface{} `json:"-" valid:"-"` }
type Routers ¶
type Routers struct { Routers []*Router `json:"routers,omitempty"` RPCS []*Router `json:"rpcs,omitempty"` Setting map[string]string `json:"args,omitempty"` }
type SecretConnect ¶
type SecretConnect struct { Name string `json:"name,omitempty" valid:"ascii"` KeyValue string `json:"kv,omitempty" valid:"ascii"` Chain string `json:"chain,omitempty" valid:"ascii"` Mode string `json:"mode,omitempty" valid:"in(head|tail|headTail)"` // contains filtered or unexported fields }
SecretConnect secret拼接串
func (*SecretConnect) SetChainWithHead ¶
func (c *SecretConnect) SetChainWithHead(chain string) *SecretConnect
SetChainWithHead 设置secrect与数据串之间的拼接方式,并将secret串拼接到数据串的头部
func (*SecretConnect) SetChainWithHeadAndTail ¶
func (c *SecretConnect) SetChainWithHeadAndTail(chain string) *SecretConnect
SetChainWithHeadAndTail 设置secrect与数据串之间的拼接方式,并将secret串拼接到数据串的头部和尾部
func (*SecretConnect) SetChainWithTail ¶
func (c *SecretConnect) SetChainWithTail(chain string) *SecretConnect
SetChainWithTail 设置secrect与数据串之间的拼接方式,并将secret串拼接到数据串的尾部
func (*SecretConnect) SetName ¶
func (c *SecretConnect) SetName(name string, kv string) *SecretConnect
SetName 设置secrect的键名称
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) GetAppConf ¶
func (c *ServerConf) GetAppConf(v interface{}) error
GetAppConf 获取系统配置
func (*ServerConf) GetClusterID ¶
func (c *ServerConf) GetClusterID() string
GetClusterID 获取当前服务的集群编号
func (*ServerConf) GetClusterName ¶
func (c *ServerConf) GetClusterName() string
GetClusterName 获取集群名称
func (*ServerConf) GetClusterNodes ¶
func (c *ServerConf) GetClusterNodes(serverType ...string) CNodes
GetClusterNodes 获取集群其它服务器节点
func (*ServerConf) GetDNSPubRootPath ¶
func (c *ServerConf) GetDNSPubRootPath(svName string) string
GetDNSPubRootPath 获取DNS服务路径
func (*ServerConf) GetMainConfPath ¶
func (c *ServerConf) GetMainConfPath() string
GetMainConfPath 获取主配置文件路径
func (*ServerConf) GetServerName ¶
func (c *ServerConf) GetServerName() string
GetServerName 获取服务器名称
func (*ServerConf) GetServerPubRootPath ¶
func (c *ServerConf) GetServerPubRootPath(serverType ...string) 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) GetSystemRootfPath ¶
func (c *ServerConf) GetSystemRootfPath(tp ...string) 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) 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) 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 ServiceAuth ¶
type ServiceAuth struct { Service string `json:"service,omitempty" valid:"required"` Requests []string `json:"requests,omitempty" valid:"required"` Required []string `json:"required,omitempty"` Connect *Connect `json:"connect,omitempty"` Alias map[string]string `json:"alias,omitempty"` Params map[string]interface{} `json:"params,omitempty"` Decrypt []string `json:"decrypt,omitempty"` CheckTS bool `json:"check-timestamp,omitempty"` Disable bool `json:"disable,omitempty"` }
ServiceAuth 服务认证配置
func NewServiceAuth ¶
func NewServiceAuth(service string, request ...string) *ServiceAuth
NewServiceAuth 创建远程服务验证参数
func (*ServiceAuth) AuthString ¶
func (a *ServiceAuth) AuthString() (string, error)
AuthString 获取签名串
func (*ServiceAuth) WithCheckTimestamp ¶
func (a *ServiceAuth) WithCheckTimestamp(e ...bool) *ServiceAuth
WithCheckTimestamp 设置需要检查时间戳
func (*ServiceAuth) WithDecryptName ¶
func (a *ServiceAuth) WithDecryptName(name ...string) *ServiceAuth
WithDecryptName 设置需要解密的字段名
func (*ServiceAuth) WithParam ¶
func (a *ServiceAuth) WithParam(key string, value interface{}) *ServiceAuth
WithParam 设置扩展参数
func (*ServiceAuth) WithRequest ¶
func (a *ServiceAuth) WithRequest(path ...string) *ServiceAuth
WithRequest 设置requests的请求服务路径
func (*ServiceAuth) WithRequired ¶
func (a *ServiceAuth) WithRequired(fieldName ...string) *ServiceAuth
WithRequired 设置必须字段
func (*ServiceAuth) WithSignAlias ¶
func (a *ServiceAuth) WithSignAlias(name string) *ServiceAuth
WithSignAlias 设置sign的字段名
func (*ServiceAuth) WithTimestampAlias ¶
func (a *ServiceAuth) WithTimestampAlias(name string) *ServiceAuth
WithTimestampAlias 设置timestamp的字段名
func (*ServiceAuth) WithUIDAlias ¶
func (a *ServiceAuth) WithUIDAlias(name string) *ServiceAuth
WithUIDAlias 设置用户id的字段名
type ServiceAuths ¶
type ServiceAuths []*ServiceAuth
ServiceAuths 远程服务验证组
func (ServiceAuths) Contains ¶
func (a ServiceAuths) Contains(p string) (bool, *ServiceAuth)
Contains 检查指定的路径是否允许签名
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 NewWebServerStaticConf ¶
func NewWebServerStaticConf() *Static
NewWebServerStaticConf 构建Web服务静态文件配置
func (*Static) AppendExts ¶
AppendExts 设置静态文件跟目录
func (*Static) WithArchive ¶
WithArchive 设置静态文件跟目录
func (*Static) WithFirstPage ¶
WithFirstPage 设置静首页地址
type Task ¶
type Task struct { Name string `json:"name,omitempty" valid:"ascii"` Cron string `json:"cron" valid:"ascii,required"` Input map[string]interface{} `json:"-"` 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:"-"` Last string `json:"-"` Handler interface{} `json:"-" valid:"-"` Disable bool `json:"disable,omitempty"` }
type Tasks ¶
type Template ¶
type Template struct { Params map[string]interface{} `json:"params,omitempty"` Content string `json:"content,omitempty" valid:"required"` Status string `json:"status,omitempty" valid:"required"` Services []string `json:"services,omitempty" valid:"required"` }
func (*Template) GetContent ¶
GetContent 获取翻译后的返回内容
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 `json:"-"` Disable bool `json:"disable,omitempty"` }
View web服务器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) 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配置信息
Source Files ¶
- comparer.go
- crypt.go
- jcomparer.go
- json.conf.go
- registry.conf.go
- server.cluster.go
- server.conf.go
- sub.conf.api.go
- sub.conf.auth.fixed.secret.go
- sub.conf.auth.go
- sub.conf.auth.remote.auth.go
- sub.conf.auth.remote.conn.go
- sub.conf.circuit.go
- sub.conf.cron.go
- sub.conf.go
- sub.conf.header.go
- sub.conf.meta.go
- sub.conf.metric.go
- sub.conf.mqc.go
- sub.conf.package.go
- sub.conf.queue.go
- sub.conf.response.go
- sub.conf.router.go
- sub.conf.rpc.go
- sub.conf.static.go
- sub.conf.task.go
- sub.conf.view.go
- sub.conf.web.go
- sub.conf.ws.go
- var.conf.cache.go
- var.conf.db.go
- var.conf.queue.go