command
Version:
v0.3.2
Opens a new window with list of versions in this module.
Published: Aug 5, 2026
License: Apache-2.0
Opens a new window with license information.
Imports: 9
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
¶
http-service-discovery 示例:HTTP 客户端 + 服务发现 + 负载均衡。
演示 pkg/client/http 的 ServiceDiscoveryHTTPClient:
- 3 个 HTTP 后端(weight 1:2:3),注册到内存服务发现;
- 客户端用 WRR 策略,DoWith 一步调用(只给相对路径);
- NewRequest + Do 灵活形式(自定义 header);
- 打印每次命中的后端,验证按权重分布。
跑:go run ./examples/http-service-discovery
Source Files
¶
Click to show internal directories.
Click to hide internal directories.