Documentation
¶
Index ¶
- type BpfConn
- func (bc *BpfConn) Close() error
- func (bc *BpfConn) LocalAddr() net.Addr
- func (bc *BpfConn) Read(b []byte) (n int, err error)
- func (bc *BpfConn) RemoteAddr() net.Addr
- func (bc *BpfConn) SetDeadline(t time.Time) error
- func (bc *BpfConn) SetReadDeadline(t time.Time) error
- func (bc *BpfConn) SetWriteDeadline(t time.Time) error
- func (bc *BpfConn) Write(b []byte) (n int, err error)
- type BpfCount
- func (bc *BpfCount) Attach(conn net.Conn, id uuid.UUID, addr string) (net.Conn, error)
- func (bc *BpfCount) AttachmentState() string
- func (bc *BpfCount) Close() error
- func (bc *BpfCount) DeleteExecLimit(id uuid.UUID) error
- func (bc *BpfCount) DeleteLimit(addr netutil.IPv6, id uuid.UUID) error
- func (bc *BpfCount) Detach(addr string, id uuid.UUID, ipv6 netutil.IPv6) error
- func (bc *BpfCount) DropTotals() (verdicts, skbBytes [2]uint64, err error)
- func (bc *BpfCount) SetExecLimit(id uuid.UUID, limit bitrate.Bitrate) error
- func (bc *BpfCount) SetLimit(addr string, id uuid.UUID, limit bitrate.Bitrate) error
- func (f *BpfCount) Type() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BpfConn ¶
type BpfConn struct {
// contains filtered or unexported fields
}
func (*BpfConn) Close ¶
Close closes the socket and then detaches its rate limit, once. Later calls return the first call's result.
Close does not delete the socket's debuglet_sk_map entry. That map is an SK_STORAGE map: the entry belongs to the socket and the kernel frees it when the socket is destroyed. Until then, data the kernel still sends after close(2) (the unsent send buffer, the FIN, retransmissions) keeps this run's UUID and is dropped once Detach has removed the rate entry. Deleting the entry earlier would let that tail leave unattributed and unthrottled, and deleting it after close(2) addresses a descriptor that no longer names the socket (#412).
func (*BpfConn) RemoteAddr ¶
type BpfCount ¶
type BpfCount struct {
// contains filtered or unexported fields
}
BpfCount employs ratelimiting using an EBPF layer. It requires root priviliges to work.
func (*BpfCount) AttachmentState ¶ added in v0.3.0
AttachmentState reads the two owned TCX links, without sending packets or changing their configuration. Link.Info can succeed after detach: the kernel then reports ifindex zero. Presence requires the expected hook and program on the configured interface. It proves attachment at observation time, not that traffic is policed. Sessions finish before the node closes these handles.
func (*BpfCount) DeleteLimit ¶
func (*BpfCount) DropTotals ¶ added in v0.3.0
DropTotals reads cumulative observations for this counter instance, ordered ingress then egress. Verdicts count TCX_DROP returns; bytes sum skb->len at those returns. Neither is an on-wire packet/byte count or proof that every traffic path passed through this program. A new counter starts at zero. Sessions finish before the node closes the counter and its owned maps.