diff --git a/expr/quota.go b/expr/quota.go index 4171384..91db028 100644 --- a/expr/quota.go +++ b/expr/quota.go @@ -24,15 +24,15 @@ import ( // Quota defines a threshold against a number of bytes. type Quota struct { - Bytes uint64 - Used uint64 - Over bool + Bytes uint64 + Consumed uint64 + Over bool } func (q *Quota) marshal() ([]byte, error) { attrs := []netlink.Attribute{ {Type: unix.NFTA_QUOTA_BYTES, Data: binaryutil.BigEndian.PutUint64(q.Bytes)}, - {Type: unix.NFTA_QUOTA_CONSUMED, Data: binaryutil.BigEndian.PutUint64(q.Used)}, + {Type: unix.NFTA_QUOTA_CONSUMED, Data: binaryutil.BigEndian.PutUint64(q.Consumed)}, } flags := uint32(0) @@ -67,7 +67,7 @@ func (q *Quota) unmarshal(data []byte) error { case unix.NFTA_QUOTA_BYTES: q.Bytes = ad.Uint64() case unix.NFTA_QUOTA_CONSUMED: - q.Used = ad.Uint64() + q.Consumed = ad.Uint64() case unix.NFTA_QUOTA_FLAGS: q.Over = (ad.Uint32() & unix.NFT_QUOTA_F_INV) == 1 } diff --git a/nftables_test.go b/nftables_test.go index 971139a..25b0184 100644 --- a/nftables_test.go +++ b/nftables_test.go @@ -4827,9 +4827,9 @@ func TestQuota(t *testing.T) { Exprs: []expr.Any{ // [ quota bytes 6 consumed 0 flags 1 ] &expr.Quota{ - Bytes: uint64(6), - Used: uint64(0), - Over: true, + Bytes: 6, + Consumed: 0, + Over: true, }, }, })