Documentation ¶
Overview ¶
* * @Author vangogh * @Description 配置客户端 * @File: client * @Datetime 2022/5/17 14:48 *
* * @Author vangogh * @Description 连接管理 * @File: connect * @Datetime 2022/5/17 15:16 *
* * @Author vangogh * @Description mango * @File: mango * @Datetime 2022/5/17 15:01 *
* * @Author vangogh * @Description 消息 * @File: message * @Datetime 2022/5/18 10:32 *
* * @Author vangogh * @Description 数据结构体 * @File: model * @Datetime 2022/5/18 10:18 *
* * @Author vangogh * @Description 配置服务端 * @File: server * @Datetime 2022/5/17 14:48 *
Index ¶
- Constants
- func GetAllConnection() map[string][]*Connection
- func ParsePort(addr string) (port string)
- type API
- func (a *API) RegisterClient(ctx context.Context, req RegisterReq, resp *RegisterResp) error
- func (a *API) RegisterConfigStruct(ctx context.Context, req RegisterConfigStruct, resp *RegisterResp) error
- func (a *API) RegisterSetupFunc(ctx context.Context, req RegisterSetupFunc, resp *RegisterResp) error
- type ClientConf
- type ConfMsg
- type ConfigClient
- type Connection
- type ConnectionMng
- func (c *ConnectionMng) AddClient(ip, name string, conn net.Conn)
- func (c *ConnectionMng) AddConfigSetup(ip, name, confName, confData string)
- func (c *ConnectionMng) AddSetupFunc(ip, name, funcName, funcLabel, funcDesc string)
- func (c *ConnectionMng) GetClient(name, ip string) *Connection
- func (c *ConnectionMng) GetClients(name string) []*Connection
- func (c *ConnectionMng) RemoveClient(name, ip string)
- type Message
- type MessageMng
- type MessageType
- type RPCxServer
- type RegisterConfigStruct
- type RegisterReq
- type RegisterResp
- type RegisterSetupFunc
- type RpcConfig
- type SetupFunc
Constants ¶
View Source
const (
CONFIG_SERVICE = "ConfigService"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type API ¶
type API struct { }
控制服务
func (*API) RegisterClient ¶
func (a *API) RegisterClient(ctx context.Context, req RegisterReq, resp *RegisterResp) error
注册客户端
func (*API) RegisterConfigStruct ¶
func (a *API) RegisterConfigStruct(ctx context.Context, req RegisterConfigStruct, resp *RegisterResp) error
注册配置
func (*API) RegisterSetupFunc ¶
func (a *API) RegisterSetupFunc(ctx context.Context, req RegisterSetupFunc, resp *RegisterResp) error
注册初始化方法
type ClientConf ¶
type ConfigClient ¶
type ConfigClient struct {
// contains filtered or unexported fields
}
func (*ConfigClient) RegisterConfStruct ¶
func (c *ConfigClient) RegisterConfStruct(name string, conf interface{}) error
*
- @Description: 注册配置结构
- @receiver c
- @param name 配置名
- @param conf 名字对象
func (*ConfigClient) RegisterSetupFunc ¶
func (c *ConfigClient) RegisterSetupFunc(name, label, desc string, setup func()) error
*
- @Description: 注册初始化方法
- @receiver c
- @param name 名称
- @param label 标签,用于标记
- @param desc 描述
- @param setup 无参初始化方法
- @return error
type Connection ¶
type ConnectionMng ¶
type ConnectionMng struct { Clients map[string][]*Connection // contains filtered or unexported fields }
func (*ConnectionMng) AddClient ¶
func (c *ConnectionMng) AddClient(ip, name string, conn net.Conn)
添加
func (*ConnectionMng) AddConfigSetup ¶
func (c *ConnectionMng) AddConfigSetup(ip, name, confName, confData string)
添加配置方法
func (*ConnectionMng) AddSetupFunc ¶
func (c *ConnectionMng) AddSetupFunc(ip, name, funcName, funcLabel, funcDesc string)
添加初始化方法
func (*ConnectionMng) GetClient ¶
func (c *ConnectionMng) GetClient(name, ip string) *Connection
取出一个客户端
func (*ConnectionMng) GetClients ¶
func (c *ConnectionMng) GetClients(name string) []*Connection
取出一个分组客户端
type MessageMng ¶
type MessageType ¶
type MessageType int
const ( HEARTBEAT MessageType = 0 // 心跳 UPDATE_CONFIG_MOMERY MessageType = 1 // 只更新内存配置 UPDATE_CONFIG_FILE MessageType = 2 // 更新文件配置 RESETUP_CONFIG MessageType = 3 // 初始化普通函数 RESTART_CONFIG MessageType = 4 // 重启服务 )
type RPCxServer ¶
type RPCxServer struct {
// contains filtered or unexported fields
}
func NewRPCxServer ¶
func NewRPCxServer(config RpcConfig) *RPCxServer
func (*RPCxServer) SendMessage ¶
func (r *RPCxServer) SendMessage(m MessageMng)
func (*RPCxServer) Start ¶
func (r *RPCxServer) Start()
type RegisterConfigStruct ¶
请求结构体
Click to show internal directories.
Click to hide internal directories.