Files
openlan/pkg/config/qos.go
Teddy_Zhu 2fa0ed3e19 fea: remove qos download limit (#45)
* fea: remove qos download limit
* fix: crash when qos config missing
* fea: update inSpeed unit to Mbit
2024-03-28 16:56:14 +08:00

32 lines
621 B
Go

package config
import "github.com/luscis/openlan/pkg/libol"
type Qos struct {
File string `json:"file"`
Name string `json:"name"`
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)
}
}
type QosLimit struct {
InSpeed float64 `json:"inSpeed,omitempty"`
}
func (ql *QosLimit) Correct() {
}