From aca128c19d96bcd841b25fe7031590b2f44a62c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=A5=A5=E8=B6=85?= Date: Sat, 13 Jan 2024 19:33:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/nodes/http_request.go | 9 +++++---- internal/nodes/http_request_plan_before.go | 10 ++++++++++ internal/nodes/http_request_plan_expires.go | 19 ------------------- 3 files changed, 15 insertions(+), 23 deletions(-) create mode 100644 internal/nodes/http_request_plan_before.go delete mode 100644 internal/nodes/http_request_plan_expires.go diff --git a/internal/nodes/http_request.go b/internal/nodes/http_request.go index 8216b87..35b0ba1 100644 --- a/internal/nodes/http_request.go +++ b/internal/nodes/http_request.go @@ -193,10 +193,11 @@ func (this *HTTPRequest) Do() { } // 套餐 - if this.ReqServer.UserPlan != nil && !this.ReqServer.UserPlan.IsAvailable() { - this.doPlanExpires() - this.doEnd() - return + if this.ReqServer.UserPlan != nil { + if this.doPlanBefore() { + this.doEnd() + return + } } // 流量限制 diff --git a/internal/nodes/http_request_plan_before.go b/internal/nodes/http_request_plan_before.go new file mode 100644 index 0000000..1f872e0 --- /dev/null +++ b/internal/nodes/http_request_plan_before.go @@ -0,0 +1,10 @@ +// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved. +//go:build !plus + +package nodes + +// 检查套餐 +func (this *HTTPRequest) doPlanBefore() (blocked bool) { + // stub + return false +} diff --git a/internal/nodes/http_request_plan_expires.go b/internal/nodes/http_request_plan_expires.go deleted file mode 100644 index 51baba7..0000000 --- a/internal/nodes/http_request_plan_expires.go +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved. - -package nodes - -import ( - "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs" - "net/http" -) - -// 套餐过期 -func (this *HTTPRequest) doPlanExpires() { - this.tags = append(this.tags, "plan") - - var statusCode = http.StatusNotFound - this.ProcessResponseHeaders(this.writer.Header(), statusCode) - - this.writer.WriteHeader(statusCode) - _, _ = this.writer.WriteString(this.Format(serverconfigs.DefaultPlanExpireNoticePageBody)) -}