百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
C

convey

> 编程语言
开源

具有动态配置加载的第 4 层负载均衡器

353 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

具有动态配置加载的第 4 层负载均衡器

Convey

Layer 4 load balancer with dynamic configuration loading featuring proxy, passthrough and direct server return modes

Features

  • Stats page (at /stats) with basic connection/bytes counters and backend server pool statuses
  • Dynamic configuration re-loading of backend servers and associated weights. Configuration is loaded via a .toml file (see sample.toml for a full example).
  • Tcp-based health checking of backend servers at a configured interval. If a server fails its health check it will be automatically removed from selection and added back once its health checks are successful.

Proxy Features

  • Event-driven TCP load balancer built on tokio.
  • Weighted round-robin load balancing. For uniform round robin simply leave out the weights or set them to be equal.
  • TCP connection termination

Passthrough and Direct Server Return (DSR) Features

  • Packet forwarding (no TCP termination)
  • Minimal internal connection tracking
  • NAT

Usage

Convey 0.3.5

Usage:
  convey
  convey --config=
  convey (-p | --passthrough) --config=
  convey (-d | --dsr) --config=
  convey (-p | --passthrough)
  convey (-d | --dsr)
  convey (-h | --help)
  convey (-v | --version)

Options:
  -h, --help               Show this screen.s
  -p, --passthrough        Run load balancer in passthrough mode (instead of default proxy mode)
  -d, --dsr                Run load balancer in direct server mode (instead of default proxy mode)
  --config=   Config file location [default config.toml].
  -v, --version            Show version.

Passthrough mode

For passthrough mode we need a couple iptables rules on the convey load balancer to handle ingress packets from the client and responses from the backend load balanced servers. Since TCP is not terminating we need to ensure the OS does not send a RST in response to any packets destined for a port that does not have a process bound to it. We need to do the same for any packets came back through from a backend server. Convey internally assigns ephemeral ports 32768-61000 to map connections to clients.

For passthrough mode on the convey load balancer

bash
sudo iptables -t raw -A PREROUTING -p tcp --dport  -j DROP
sudo iptables -t raw -A PREROUTING -p tcp --sport  --dport 33768:61000 -j DROP

To run

sudo ./target/release/convey --passthrough --config=sample-passthrough.toml

DSR Mode

For dsr mode we need the same iptables rule for ingress packets. Responses from the backend load balanced servers will be going directly to the clients. The "listening" port on the convey load balancer must match the backend load balanced servers listening ports in this mode.

For dsr mode on the convey load balancer

bash
sudo iptables -t raw -A PREROUTING -p tcp --dport  -j DROP

In dsr mode the backend servers "participate" in that their response packets must be sent directly to the client. Convey does not do any encapsulation so, for example, a gre tunnel is not an option. Instead, Traffic Control can be used as an egress nat.

For dsr mode on backend servers

bash
sudo tc qdisc add dev  root handle 10: htb

sudo tc filter add dev  parent 10: protocol ip prio 1 u32 match ip src  match ip sport  0xffff match ip dst  action ok

sudo tc filter add dev  parent 10: protocol ip prio 10 u32 match ip src  match ip sport  0xffff action nat egress 

To run

sudo ./target/release/convey --dsr --config=sample-passthrough.toml

Proxy

No special setup neccessary

To run

sudo ./target/release/convey --config=sample-proxy.toml

Tests

The easiest way to run tests is to run them as superuser. This is because some of the tests spin up test servers as well as a convey load balancer instance.

sudo ~/.cargo/bin/cargo test

AF_XDP

The feature/xdp branch is a WIP using AF_XDP to loadbalance in passthrough and DSR modes. For now it will be maintained in a separate branch since it requires kernel versions 5.4 or greater.

Build

cargo build --release

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Rustload-balancerrusttcptokio

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言