Documentation
¶
Overview ¶
Package client 提供 HTTP 客户端命令。
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Command = &cli.Command{ Name: "client", Usage: "HTTP 客户端工具", Action: action, Commands: []*cli.Command{version.Command, healthCommand, getCommand}, Flags: []cli.Flag{ &cli.StringFlag{ Name: "url", Aliases: []string{"s"}, Value: dc.Client.URL, Usage: "服务器地址", }, &cli.DurationFlag{ Name: "timeout", Value: dc.Client.Timeout, Usage: "请求超时时间", }, &cli.IntFlag{ Name: "retries", Value: dc.Client.Retries, Usage: "重试次数", }, }, }
Command 客户端命令
Functions ¶
This section is empty.
Types ¶
type HTTPClient ¶
type HTTPClient struct {
// contains filtered or unexported fields
}
HTTPClient HTTP 客户端封装
func NewHTTPClient ¶
func NewHTTPClient(cfg *config.ClientConfig) *HTTPClient
NewHTTPClient 创建新的 HTTP 客户端
func (*HTTPClient) Health ¶
func (c *HTTPClient) Health(ctx context.Context) (*HealthResponse, error)
Health 执行健康检查
type HealthResponse ¶
type HealthResponse struct {
Status string `json:"status"`
}
HealthResponse 健康检查响应
Click to show internal directories.
Click to hide internal directories.