Documentation
¶
Index ¶
- type Consul
- func (c *Consul) Client() (*api.Client, error)
- func (c *Consul) DeRegisterGrpc(id string) error
- func (c *Consul) DeRegisterHTTP(config DeregisterHTTPConfig) error
- func (c *Consul) GetGrpcClientConn(serviceName string) (*grpc.ClientConn, error)
- func (c *Consul) RegisterGrpc(config ServiceConfig) error
- func (c *Consul) RegisterHTTP(config WebConfig) error
- type ConsulConfig
- type DeregisterHTTPConfig
- type ServiceConfig
- type WebConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Consul ¶
type Consul struct {
// contains filtered or unexported fields
}
Consul consul核心对象
func (*Consul) DeRegisterGrpc ¶ added in v0.1.2
DeRegisterGrpc 从consul注销grpc服务
func (*Consul) DeRegisterHTTP ¶ added in v0.1.2
func (c *Consul) DeRegisterHTTP(config DeregisterHTTPConfig) error
DeRegisterHTTP 注销HTTP服务
func (*Consul) GetGrpcClientConn ¶
func (c *Consul) GetGrpcClientConn(serviceName string) (*grpc.ClientConn, error)
GetGrpcClientConn 获取GRPC的客户端连接 @param serviceName,consul中的grpc服务名称
func (*Consul) RegisterGrpc ¶ added in v0.1.2
func (c *Consul) RegisterGrpc(config ServiceConfig) error
RegisterGrpc 注册Grpc微服务到consul @param host 地址 @param port 端口号 @param name 名称 @param id ID @param tags 标签列表 @param isGrpc 是否为grpc
func (*Consul) RegisterHTTP ¶ added in v0.1.2
RegisterHTTP 注册HTTP服务
type ConsulConfig ¶
type ConsulConfig struct {
Debug bool // 是否为debug模式
LogFilePath string // 日志存放路径
Host string // consul地址
Port uint16 // consul端口号
}
ConsulConfig consul配置对象
type DeregisterHTTPConfig ¶ added in v0.1.2
type DeregisterHTTPConfig struct {
ConsulHost string // consul主机地址
ConsulPort uint16 // consul端口号
ServerId string // 服务id
}
DeregisterHTTPConfig 注销http服务的配置
Click to show internal directories.
Click to hide internal directories.