add telegram timeout error connection

replace FlooWait minut to seconds
add mtproxy send
This commit is contained in:
Артём Грачёв
2026-03-27 05:34:57 +03:00
parent 9898fab7f9
commit 5a81bbdbcb
2 changed files with 5 additions and 7 deletions

View File

@@ -1,6 +1,5 @@
# Build stage
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.21-alpine3.19 AS builder
LABEL maintainer="Khanh Ngo <k@ndk.name>"
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:tip-alpine3.23 AS builder
ARG BUILDPLATFORM
ARG TARGETOS
@@ -56,7 +55,7 @@ RUN cp -r /build/custom/ assets/
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -ldflags="-X 'main.appVersion=${APP_VERSION}' -X 'main.buildTime=${BUILD_TIME}' -X 'main.gitCommit=${GIT_COMMIT}'" -a -o wg-ui .
# Release stage
FROM alpine:3.19
FROM alpine:latest
RUN addgroup -S wgui && \
adduser -S -D -G wgui wgui

View File

@@ -22,7 +22,6 @@ var (
Token string
AllowConfRequest bool
FloodWait int
FloodWaitEnabled bool // Для отключения таймаута в ТГ
LogLevel log.Lvl
MTProxyLink string // ДОБАВИЛИ НАШУ ССЫЛКУ
@@ -88,7 +87,7 @@ func Start(initDeps TgBotInitDependencies) (err error) {
}
floodMessageSent[userid] = struct{}{}
_, err := bot.SendMessage(
fmt.Sprintf("You can only request your configs once per %d minutes", FloodWait),
fmt.Sprintf("Подождите %d секунд, защита от флуда", FloodWait),
userid,
&echotron.MessageOptions{
ReplyToMessageID: update.Message.ID,
@@ -130,7 +129,7 @@ func SendConfig(userid int64, clientName string, confData, qrData []byte, ignore
}
if _, wait := floodWait[userid]; wait && !ignoreFloodWait {
return fmt.Errorf("this client already got their config less than %d minutes ago", FloodWait)
return fmt.Errorf("Этот клиент будет готов получить конфиг через %d секунд", FloodWait)
}
if !ignoreFloodWait {
@@ -175,7 +174,7 @@ func SendConfig(userid int64, clientName string, confData, qrData []byte, ignore
}
func updateFloodWait() {
thresholdTS := time.Now().Unix() - 60*int64(FloodWait)
thresholdTS := time.Now().Unix() - int64(FloodWait)
for userid, ts := range floodWait {
if ts < thresholdTS {
delete(floodWait, userid)