mirror of
https://github.com/luscis/openlan.git
synced 2025-10-06 00:57:03 +08:00
fix: qos name length over limit (#49)
This commit is contained in:
@@ -7,7 +7,6 @@ import (
|
|||||||
cn "github.com/luscis/openlan/pkg/network"
|
cn "github.com/luscis/openlan/pkg/network"
|
||||||
"github.com/luscis/openlan/pkg/schema"
|
"github.com/luscis/openlan/pkg/schema"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
@@ -20,13 +19,14 @@ type QosUser struct {
|
|||||||
Name string
|
Name string
|
||||||
Ip string
|
Ip string
|
||||||
Device string
|
Device string
|
||||||
|
uniqueName string
|
||||||
qosChainIn *cn.FireWallChain
|
qosChainIn *cn.FireWallChain
|
||||||
out *libol.SubLogger
|
out *libol.SubLogger
|
||||||
}
|
}
|
||||||
|
|
||||||
func (qr *QosUser) RuleName(dir string) string {
|
func (qr *QosUser) RuleName(dir string) string {
|
||||||
nameParts := strings.Split(qr.Name, "@")
|
|
||||||
return "Qos_" + qr.QosChainName + "-" + dir + "-" + nameParts[0]
|
return "Qos_" + qr.QosChainName + "-" + dir + "-" + qr.uniqueName
|
||||||
}
|
}
|
||||||
|
|
||||||
func (qr *QosUser) InLimitPacket() string {
|
func (qr *QosUser) InLimitPacket() string {
|
||||||
@@ -159,6 +159,7 @@ func (q *QosCtrl) Initialize() {
|
|||||||
Name: name,
|
Name: name,
|
||||||
InSpeed: limit.InSpeed,
|
InSpeed: limit.InSpeed,
|
||||||
Ip: "",
|
Ip: "",
|
||||||
|
uniqueName: libol.GenString(7),
|
||||||
out: libol.NewSubLogger("Qos_" + name),
|
out: libol.NewSubLogger("Qos_" + name),
|
||||||
}
|
}
|
||||||
q.Rules[name] = qr
|
q.Rules[name] = qr
|
||||||
@@ -239,6 +240,7 @@ func (q *QosCtrl) AddOrUpdateQosUser(name string, inSpeed float64) {
|
|||||||
Name: name,
|
Name: name,
|
||||||
InSpeed: inSpeed,
|
InSpeed: inSpeed,
|
||||||
Ip: ip,
|
Ip: ip,
|
||||||
|
uniqueName: libol.GenString(7),
|
||||||
out: libol.NewSubLogger("Qos_" + name),
|
out: libol.NewSubLogger("Qos_" + name),
|
||||||
}
|
}
|
||||||
rule.Start(q.chainIn)
|
rule.Start(q.chainIn)
|
||||||
|
Reference in New Issue
Block a user