|
@@ -165,12 +165,6 @@ func (s *globalLimitService) GlobalLimitRequire(ctx context.Context, req v1.Glob
|
|
return v1.GlobalLimitRequireResponse{}, fmt.Errorf("获取配置限制失败: %w", err)
|
|
return v1.GlobalLimitRequireResponse{}, fmt.Errorf("获取配置限制失败: %w", err)
|
|
}
|
|
}
|
|
|
|
|
|
- bpsInt, err := strconv.Atoi(configCount.Bps)
|
|
|
|
- if err != nil {
|
|
|
|
- return v1.GlobalLimitRequireResponse{}, err
|
|
|
|
- }
|
|
|
|
- resultFloat := float64(bpsInt) / 2.0 / 8.0
|
|
|
|
- res.Bps = strconv.FormatFloat( resultFloat, 'f', -1, 64) + "M"
|
|
|
|
|
|
|
|
res.MaxBytesMonth = configCount.MaxBytesMonth
|
|
res.MaxBytesMonth = configCount.MaxBytesMonth
|
|
res.Operator = configCount.Operator
|
|
res.Operator = configCount.Operator
|
|
@@ -179,6 +173,7 @@ func (s *globalLimitService) GlobalLimitRequire(ctx context.Context, req v1.Glob
|
|
res.ConfigMaxProtection = configCount.ConfigMaxProtection
|
|
res.ConfigMaxProtection = configCount.ConfigMaxProtection
|
|
res.IsBanUdp = configCount.IsBanUdp
|
|
res.IsBanUdp = configCount.IsBanUdp
|
|
res.HostId = req.HostId
|
|
res.HostId = req.HostId
|
|
|
|
+ res.Bps = configCount.Bps
|
|
|
|
|
|
domain, err := s.hostRep.GetDomainById(ctx, req.HostId)
|
|
domain, err := s.hostRep.GetDomainById(ctx, req.HostId)
|
|
if err != nil {
|
|
if err != nil {
|
|
@@ -285,6 +280,10 @@ func (s *globalLimitService) AddGlobalLimit(ctx context.Context, req v1.GlobalLi
|
|
if err != nil {
|
|
if err != nil {
|
|
return err
|
|
return err
|
|
}
|
|
}
|
|
|
|
+ bpsInt, err := strconv.Atoi(require.Bps)
|
|
|
|
+ if err != nil {
|
|
|
|
+ return err
|
|
|
|
+ }
|
|
var wg sync.WaitGroup
|
|
var wg sync.WaitGroup
|
|
wg.Add(len(ip))
|
|
wg.Add(len(ip))
|
|
var errChan = make(chan error, len(ip))
|
|
var errChan = make(chan error, len(ip))
|
|
@@ -295,6 +294,7 @@ func (s *globalLimitService) AddGlobalLimit(ctx context.Context, req v1.GlobalLi
|
|
err := s.bulidAudun.AddBandwidth(ctx, v1.Bandwidth{
|
|
err := s.bulidAudun.AddBandwidth(ctx, v1.Bandwidth{
|
|
Name: require.Bps,
|
|
Name: require.Bps,
|
|
ServerIPStart: v,
|
|
ServerIPStart: v,
|
|
|
|
+ SpeedlimitOut: int64(bpsInt),
|
|
})
|
|
})
|
|
if err != nil {
|
|
if err != nil {
|
|
errChan <- err
|
|
errChan <- err
|