mirror of
https://github.com/luscis/openlan.git
synced 2025-10-06 17:17:00 +08:00

* fea: remove qos download limit * fix: crash when qos config missing * fea: update inSpeed unit to Mbit
32 lines
621 B
Go
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() {
|
|
}
|