Add traffic-control long-tail: mangle/accounting/tc_*
Storage + CRUD (migration 0008, model, id-keyed store, REST handlers) + compiler rendering for mangle, accounting, and tc_devices/tc_classes/tc_filters/ tc_interfaces/tc_priorities, each owned by a device. (Nested tc option structs deferred.)
This commit is contained in:
@@ -0,0 +1,96 @@
|
||||
package model
|
||||
|
||||
// Traffic-control tier: mangle, accounting, and tc_* sections (per-device).
|
||||
|
||||
type MangleRule struct {
|
||||
ID int64 `json:"id"`
|
||||
Device string `json:"device"`
|
||||
Action string `json:"action"`
|
||||
Chain string `json:"chain,omitempty"`
|
||||
MarkValue string `json:"mark_value,omitempty"`
|
||||
Source string `json:"source,omitempty"`
|
||||
Dest string `json:"dest,omitempty"`
|
||||
Proto string `json:"proto,omitempty"`
|
||||
DPort []string `json:"dport,omitempty"`
|
||||
SPort []string `json:"sport,omitempty"`
|
||||
User string `json:"user,omitempty"`
|
||||
Mark string `json:"mark,omitempty"`
|
||||
Length string `json:"length,omitempty"`
|
||||
TOS string `json:"tos,omitempty"`
|
||||
Helper string `json:"helper,omitempty"`
|
||||
Probability *float64 `json:"probability,omitempty"`
|
||||
Comment string `json:"comment,omitempty"`
|
||||
}
|
||||
|
||||
type AccountingRule struct {
|
||||
ID int64 `json:"id"`
|
||||
Device string `json:"device"`
|
||||
Action string `json:"action"`
|
||||
Section string `json:"section,omitempty"`
|
||||
Chain string `json:"chain,omitempty"`
|
||||
Source string `json:"source,omitempty"`
|
||||
Dest string `json:"dest,omitempty"`
|
||||
Proto string `json:"proto,omitempty"`
|
||||
DPort []string `json:"dport,omitempty"`
|
||||
SPort []string `json:"sport,omitempty"`
|
||||
Mark string `json:"mark,omitempty"`
|
||||
Comment string `json:"comment,omitempty"`
|
||||
}
|
||||
|
||||
type TCDevice struct {
|
||||
ID int64 `json:"id"`
|
||||
Device string `json:"device"`
|
||||
Interface string `json:"interface"`
|
||||
InBandwidth string `json:"in_bandwidth,omitempty"`
|
||||
OutBandwidth string `json:"out_bandwidth,omitempty"`
|
||||
Comment string `json:"comment,omitempty"`
|
||||
}
|
||||
|
||||
type TCClass struct {
|
||||
ID int64 `json:"id"`
|
||||
Device string `json:"device"`
|
||||
Interface string `json:"interface"`
|
||||
Mark int `json:"mark,omitempty"`
|
||||
Rate string `json:"rate,omitempty"`
|
||||
Ceil string `json:"ceil,omitempty"`
|
||||
Priority int `json:"priority,omitempty"`
|
||||
Comment string `json:"comment,omitempty"`
|
||||
}
|
||||
|
||||
type TCFilter struct {
|
||||
ID int64 `json:"id"`
|
||||
Device string `json:"device"`
|
||||
Class string `json:"class"`
|
||||
Source string `json:"source,omitempty"`
|
||||
Dest string `json:"dest,omitempty"`
|
||||
Proto string `json:"proto,omitempty"`
|
||||
DPort []string `json:"dport,omitempty"`
|
||||
SPort []string `json:"sport,omitempty"`
|
||||
TOS string `json:"tos,omitempty"`
|
||||
Length int `json:"length,omitempty"`
|
||||
Priority int `json:"priority,omitempty"`
|
||||
Comment string `json:"comment,omitempty"`
|
||||
}
|
||||
|
||||
type TCInterface struct {
|
||||
ID int64 `json:"id"`
|
||||
Device string `json:"device"`
|
||||
Interface string `json:"interface"`
|
||||
Type string `json:"type,omitempty"`
|
||||
InBandwidth string `json:"in_bandwidth,omitempty"`
|
||||
OutBandwidth string `json:"out_bandwidth,omitempty"`
|
||||
Comment string `json:"comment,omitempty"`
|
||||
}
|
||||
|
||||
type TCPriority struct {
|
||||
ID int64 `json:"id"`
|
||||
Device string `json:"device"`
|
||||
Band int `json:"band"`
|
||||
Proto string `json:"proto,omitempty"`
|
||||
DPort []string `json:"dport,omitempty"`
|
||||
SPort []string `json:"sport,omitempty"`
|
||||
Address string `json:"address,omitempty"`
|
||||
Interface string `json:"interface,omitempty"`
|
||||
Helper string `json:"helper,omitempty"`
|
||||
Comment string `json:"comment,omitempty"`
|
||||
}
|
||||
Reference in New Issue
Block a user