fea: remove qos download limit (#45)

* fea: remove qos download limit
* fix: crash when qos config missing
* fea: update inSpeed unit to Mbit
This commit is contained in:
Teddy_Zhu
2024-03-28 16:56:14 +08:00
committed by GitHub
parent ffce18224b
commit 2fa0ed3e19
9 changed files with 72 additions and 150 deletions

View File

@@ -8,6 +8,15 @@ type Qos struct {
Config map[string]*QosLimit `json:"qos,omitempty"`
}
func (q *Qos) Correct(sw *Switch) {
for _, rule := range q.Config {
rule.Correct()
}
if q.File == "" {
q.File = sw.Dir("qos", q.Name+".json")
}
}
func (q *Qos) Save() {
if err := libol.MarshalSave(q, q.File, true); err != nil {
libol.Error("Switch.Save.Qos %s %s", q.Name, err)
@@ -15,8 +24,7 @@ func (q *Qos) Save() {
}
type QosLimit struct {
InSpeed int64 `json:"inSpeed,omitempty"`
OutSpeed int64 `json:"outSpeed,omitempty"`
InSpeed float64 `json:"inSpeed,omitempty"`
}
func (ql *QosLimit) Correct() {