add dynamic speed limit

fix old user limit info not clear
fix some wrong names
This commit is contained in:
yuzuki999
2022-09-07 23:02:02 +08:00
parent 52134c6e4e
commit 5fd09079e3
10 changed files with 211 additions and 130 deletions

View File

@@ -3,6 +3,7 @@ package core
import (
"context"
"fmt"
"github.com/Yuzuki616/V2bX/api/panel"
"github.com/Yuzuki616/V2bX/core/app/dispatcher"
"github.com/xtls/xray-core/common/protocol"
"github.com/xtls/xray-core/proxy"
@@ -79,6 +80,10 @@ func (p *Core) GetUserTraffic(email string, reset bool) (up int64, down int64) {
return up, down
}
func (p *Core) UpdateUserSpeedLimit(tag string, user *panel.UserInfo, speedLimit uint64, expire int64) error {
return p.dispatcher.Limiter.UpdateUserSpeedLimit(tag, user, speedLimit, expire)
}
func (p *Core) ListOnlineIp(tag string) ([]dispatcher.UserIpList, error) {
return p.dispatcher.Limiter.ListOnlineUserIp(tag)
}