svc

package
v0.0.0-...-56407e3 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
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

func GetListenResID(liss []LisConf) (resid []int)

GetListenResID get listen resid

func GetListenTCPPorts

func GetListenTCPPorts(liss []LisConf) (ports []int32)

GetListenTCPPorts get listen tcp ports

func GetListenUDPPorts

func GetListenUDPPorts(liss []LisConf) (ports []int32)

GetListenUDPPorts get listen udp ports

func GetListenURI

func GetListenURI(liss []LisConf) (uris []string)

GetListenURI get listen uri

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

func (*Agent) Close

func (s *Agent) Close() error

Close close agent

func (*Agent) GetValues

func (s *Agent) GetValues(ctx context.Context, path string) (kvs []KeyValue, err error)

GetValues .

func (*Agent) Start

func (s *Agent) Start()

Start start register

func (*Agent) Stop

func (s *Agent) Stop() (err error)

Stop stop register

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) DBConfig

func (c *Config) DBConfig() (err error)

DBConfig get db config key: /conf/region/db/dbname

func (*Config) GetAll

func (c *Config) GetAll() (err error)

GetAll return MSConfig

func (*Config) GetListenURI

func (c *Config) GetListenURI() []string

GetListenURI get listen uri

func (*Config) GetWanIP

func (c *Config) GetWanIP(lanip string) (wanip string, err error)

GetWanIP get wan ipaddr.

func (*Config) ListenConf

func (c *Config) ListenConf() (err error)

ListenConf get listen config key: /conf/region/listen/lanip/msname

func (*Config) LogConf

func (c *Config) LogConf() (err error)

LogConf get log config key: /conf/region/log/lanip/msname

func (*Config) PpmqcliConf

func (c *Config) PpmqcliConf() (err error)

PpmqcliConf get ppmqcli config key: /conf/region/ppmqcli/lanip/msname

func (*Config) PrivateConf

func (c *Config) PrivateConf() (err error)

PrivateConf get private config key: /conf/region/private/lanip/msname

func (*Config) PublicConf

func (c *Config) PublicConf() (err error)

PublicConf get public config key: /conf/region/lanip/msname/public

type KeyValue

type KeyValue struct {
	Key   string
	Value string
}

KeyValue etcd key value pair

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

type Watcher

type Watcher struct {
	Path  string
	Nodes *cache.Cache
	// contains filtered or unexported fields
}

Watcher .

func NewWatcher

func NewWatcher(path string, endpoints []string, wcb WatcherCB) (w *Watcher, err error)

NewWatcher create watcher

func (*Watcher) Close

func (w *Watcher) Close() error

Close close watcher

func (*Watcher) GetValues

func (w *Watcher) GetValues(ctx context.Context, path string) (kvs []KeyValue, err error)

GetValues .

func (*Watcher) Start

func (w *Watcher) Start()

Start start watch

func (*Watcher) Stop

func (w *Watcher) Stop()

Stop stop watch

type WatcherCB

type WatcherCB func(action, key, value string)

Jump to

Keyboard shortcuts

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