Documentation ¶
Index ¶
- Constants
- func GetListenResID(liss []LisConf) (resid []int)
- func GetListenTCPPorts(liss []LisConf) (ports []int32)
- func GetListenUDPPorts(liss []LisConf) (ports []int32)
- func GetListenURI(liss []LisConf) (uris []string)
- func GetTCPURL(reg ValueRegService) (url string, err error)
- type Agent
- type Config
- func (c *Config) DBConfig() (err error)
- func (c *Config) GetAll() (err error)
- func (c *Config) GetListenURI() []string
- func (c *Config) GetWanIP(lanip string) (wanip string, err error)
- func (c *Config) ListenConf() (err error)
- func (c *Config) LogConf() (err error)
- func (c *Config) PpmqcliConf() (err error)
- func (c *Config) PrivateConf() (err error)
- func (c *Config) PublicConf() (err error)
- type KeyValue
- type LisConf
- type MSConfig
- type MicroClient
- type PpmqcliConf
- type PublicConf
- type RedisConf
- type ValueDbconf
- type ValueLogConf
- type ValueRegService
- type ValueWan
- type Watcher
- type WatcherCB
Constants ¶
const ( RES_PPMQD_TCP int32 = 1 RES_PPMQD_UDP int32 = 2 RES_PPMQD_MQTT int32 = 3 RES_APIGW_GRPC int32 = 4 RES_APIGW_HTTP int32 = 5 RES_APIGW_PPRPC int32 = 6 RES_FTCONN_NAT int32 = 8 RES_FTCONN_RELAY int32 = 9 RES_FTCONN_P2P int32 = 10 RES_FTCONN_LIVES int32 = 11 RES_GLBS_TCP int32 = 13 RES_GLBS_UDP int32 = 14 RES_APIGW_GRPC_TLS int32 = 104 RES_APIGW_HTTP_TLS int32 = 105 RES_APIGW_PPRPC_TLS int32 = 106 )
Variables ¶
This section is empty.
Functions ¶
func GetListenResID ¶
GetListenResID get listen resid
func GetListenTCPPorts ¶
GetListenTCPPorts get listen tcp ports
func GetListenUDPPorts ¶
GetListenUDPPorts get listen udp ports
func GetTCPURL ¶
func GetTCPURL(reg ValueRegService) (url string, err error)
GetTCPURL get listen tcp url
Types ¶
type Agent ¶
type Agent struct {
// contains filtered or unexported fields
}
Agent .
func NewAgent ¶
func NewAgent(info ValueRegService, leaseTime int64, endpoints []string) (sv *Agent, err error)
NewAgent create service
type Config ¶
type Config struct { Conf *MSConfig // contains filtered or unexported fields }
Config micro config get
func NewConfig ¶
func NewConfig(a *Agent, region, lanip, microName string, dbs []string, private bool) (cfg *Config, err error)
NewConfig create config
func (*Config) ListenConf ¶
ListenConf get listen config key: /conf/region/listen/lanip/msname
func (*Config) PpmqcliConf ¶
PpmqcliConf get ppmqcli config key: /conf/region/ppmqcli/lanip/msname
func (*Config) PrivateConf ¶
PrivateConf get private config key: /conf/region/private/lanip/msname
func (*Config) PublicConf ¶
PublicConf get public config key: /conf/region/lanip/msname/public
type LisConf ¶
type LisConf struct { URI string `json:"uri,omitempty"` // tcp://ip:port, udp://ip:port ReadTimeout int64 `json:"read_timeout,omitempty"` TLSCrt string `json:"tls_crt,omitempty"` TLSKey string `json:"tls_key,omitempty"` ResID int `json:"res_id,omitempty"` }
LisConf listen conf key: /conf/region/listen/lanip/msname
type MSConfig ¶
type MSConfig struct { Public PublicConf `json:"public,omitempty"` // key: /conf/region/public/lanip/msname Listen []LisConf `json:"listen,omitempty"` // key: /conf/region/listen/lanip/msname Log ValueLogConf `json:"log,omitempty"` // key: /conf/region/log/lanip/msname Dbs []ValueDbconf `json:"dbs,omitempty"` // key: /conf/region/db/dbname Ppmqclis []PpmqcliConf `json:"ppmqclis,omitempty"` // key: /conf/region/ppmqcli/lanip/msname PrivateConfig json.RawMessage `json:"private_config,omitempty"` // key: /conf/region/private/lanip/msname }
MSConfig micro service config
type MicroClient ¶
type MicroClient struct { Name string `json:"name,omitempty"` URIS []string `json:"uris,omitempty"` }
MicroClient micrl service client
type PpmqcliConf ¶
type PpmqcliConf struct { Class string `json:"class,omitempty"` // localmqd ppmqd URL string `json:"url,omitempty"` Account string `json:"account,omitempty"` Password string `json:"password,omitempty"` HWFeature string `json:"hw_feature,omitempty"` TopicPrefix string `json:"topic_prefix,omitempty"` // 20180926 MsgType int32 `json:"msg_type,omitempty"` MsgCount int32 `json:"msg_count,omitempty"` }
PpmqcliConf ppmq client config key: /conf/region/ppmqcli/lanip/msname
type PublicConf ¶
type PublicConf struct { ReportInterval int64 `json:"report_interval,omitempty"` AdminProf bool `json:"admin_prof,omitempty"` AdminPort int `json:"admin_port,omitempty"` MaxGo int `json:"max_go,omitempty"` RunGo bool `json:"run_go,omitempty"` ServerID string `json:"server_id,omitempty"` }
PublicConf public config key: /conf/region/public/lanip/msname
type RedisConf ¶
type RedisConf struct { // host:port address. Addr string `json:"addr,omitempty"` Password string `json:"password,omitempty"` DB int `json:"db,omitempty"` PoolSize int `json:"pool_size,omitempty"` IdleConn int `json:"idle_conn,omitempty"` }
RedisConf Redis
type ValueDbconf ¶
type ValueDbconf struct { ConfName string `json:"conf_name,omitempty"` Type string `json:"type,omitempty"` User string `json:"user,omitempty"` Pass string `json:"pass,omitempty"` Host string `json:"host,omitempty"` Port int `json:"port,omitempty"` Name string `json:"name,omitempty"` Charset string `json:"charset,omitempty"` Socket string `json:"socket,omitempty"` MaxIdle int `json:"max_idle,omitempty"` MaxConn int `json:"max_conn,omitempty"` Debug bool `json:"debug,omitempty"` }
ValueDbconf db conf Key: /conf/region/db/dbname
type ValueLogConf ¶
type ValueLogConf struct { File string `json:"file,omitempty"` MaxSize int `json:"max_size,omitempty"` MaxBackups int `json:"max_backups,omitempty"` MaxAge int `json:"max_age,omitempty"` Caller bool `json:"caller,omitempty"` Level int8 //zapcore.Level `json:"level"` SeelogPort int `json:"seelog_port,omitempty"` SeelogUser string `json:"seelog_user,omitempty"` SeelogPass string `json:"seelog_pass,omitempty"` LogDir string `json:"log_dir,omitempty"` }
ValueLogConf log conf key: /conf/region/log/lanip/msname
type ValueRegService ¶
type ValueRegService struct { Region string `json:"region,omitempty"` Name string `json:"name,omitempty"` ResSrv []int `json:"res_srv,omitempty"` LanIP string `json:"lan_ip,omitempty"` Listen []LisConf `json:"listen,omitempty"` }
ValueRegService register service struct define key: /register/region/msname/lanip
type ValueWan ¶
type ValueWan struct {
WanIP string `json:"wanip,omitempty"`
}
ValueWan lan wan pair key: /conf/region/getwanip/lanip