mirror of
https://github.com/TeaOSLab/EdgeCommon.git
synced 2026-01-06 20:15:50 +08:00
实现基础的DDoS防护
This commit is contained in:
@@ -28,6 +28,12 @@ func NewSizeCapacity(count int64, unit SizeCapacityUnit) *SizeCapacity {
|
||||
}
|
||||
}
|
||||
|
||||
func DecodeSizeCapacityJSON(sizeCapacityJSON []byte) (*SizeCapacity, error) {
|
||||
var capacity = &SizeCapacity{}
|
||||
err := json.Unmarshal(sizeCapacityJSON, capacity)
|
||||
return capacity, err
|
||||
}
|
||||
|
||||
func (this *SizeCapacity) Bytes() int64 {
|
||||
if this.Count < 0 {
|
||||
return -1
|
||||
|
||||
Reference in New Issue
Block a user