http-service-discovery

command
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

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

Jump to

Keyboard shortcuts

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