fix(fix4): enforce runtime contract and orchestrator guardrails
This commit is contained in:
@@ -27,9 +27,6 @@ func NewHysteria2Api(apiPort int64) *Hysteria2Api {
|
||||
// ListUsers Информация о трафике каждого пользователя
|
||||
func (h *Hysteria2Api) ListUsers(clear bool, secret string) (map[string]bo.Hysteria2UserTraffic, error) {
|
||||
var users map[string]bo.Hysteria2UserTraffic
|
||||
if !NewHysteria2Instance().IsRunning() {
|
||||
return users, nil
|
||||
}
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
|
||||
defer cancel()
|
||||
url := fmt.Sprintf("http://127.0.0.1:%d/traffic", h.apiPort)
|
||||
@@ -66,9 +63,6 @@ func (h *Hysteria2Api) ListUsers(clear bool, secret string) (map[string]bo.Hyste
|
||||
|
||||
// KickUsers Принудительное отключение
|
||||
func (h *Hysteria2Api) KickUsers(keys []string, secret string) error {
|
||||
if !NewHysteria2Instance().IsRunning() {
|
||||
return nil
|
||||
}
|
||||
usernamesByte, err := json.Marshal(keys)
|
||||
if err != nil {
|
||||
logrus.Errorf("Hysteria2 KickUsers Marshal err: %v", err)
|
||||
@@ -101,9 +95,6 @@ func (h *Hysteria2Api) KickUsers(keys []string, secret string) error {
|
||||
// OnlineUsers Пользователи онлайн
|
||||
func (h *Hysteria2Api) OnlineUsers(secret string) (map[string]int64, error) {
|
||||
var onlineUsers map[string]int64
|
||||
if !NewHysteria2Instance().IsRunning() {
|
||||
return onlineUsers, nil
|
||||
}
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
|
||||
defer cancel()
|
||||
url := fmt.Sprintf("http://127.0.0.1:%d/online", h.apiPort)
|
||||
|
||||
Reference in New Issue
Block a user