mirror of
https://github.com/hanzoai/visor.git
synced 2026-10-30 14:46:33 +00:00
Implements a single-rate TBF qdisc modeled on Linux's net/sched/sch_tbf.c and exposes it via --qdisc=tbf, with required --qdisc-tbf-rate and --qdisc-tbf-burst flags. OCI annotations can lower the configured rate and burst ceilings but not raise them without --allow-flag-override. The fifo qdisc's circular packet-buffer list moves into a shared pkg/tcpip/link/qdisc package so both qdiscs share one implementation. Loopback and ingress traffic are not shaped.
49 lines
961 B
Python
49 lines
961 B
Python
load("//pkg/sync/locking:locking.bzl", "declare_mutex")
|
|
load("//tools:defs.bzl", "go_library", "go_test")
|
|
|
|
package(
|
|
default_applicable_licenses = ["//:license"],
|
|
licenses = ["notice"],
|
|
)
|
|
|
|
declare_mutex(
|
|
name = "queue_mutex",
|
|
out = "queue_mutex.go",
|
|
package = "tbf",
|
|
prefix = "queue",
|
|
)
|
|
|
|
go_library(
|
|
name = "tbf",
|
|
srcs = [
|
|
"queue_mutex.go",
|
|
"tbf.go",
|
|
],
|
|
visibility = ["//visibility:public"],
|
|
deps = [
|
|
"//pkg/atomicbitops",
|
|
"//pkg/sleep",
|
|
"//pkg/sync",
|
|
"//pkg/sync/locking",
|
|
"//pkg/tcpip",
|
|
"//pkg/tcpip/link/qdisc",
|
|
"//pkg/tcpip/stack",
|
|
],
|
|
)
|
|
|
|
go_test(
|
|
name = "tbf_test",
|
|
size = "small",
|
|
srcs = ["tbf_test.go"],
|
|
deps = [
|
|
":tbf",
|
|
"//pkg/buffer",
|
|
"//pkg/refs",
|
|
"//pkg/sync",
|
|
"//pkg/tcpip",
|
|
"//pkg/tcpip/faketime",
|
|
"//pkg/tcpip/header",
|
|
"//pkg/tcpip/stack",
|
|
],
|
|
)
|