diff --git a/internal/nodes/http_request.go b/internal/nodes/http_request.go index a778370..9d3a6b7 100644 --- a/internal/nodes/http_request.go +++ b/internal/nodes/http_request.go @@ -137,6 +137,13 @@ func (this *HTTPRequest) Do() { } } + // 套餐 + if this.Server.UserPlan != nil && !this.Server.UserPlan.IsAvailable() { + this.doPlanExpires() + this.doEnd() + return + } + // 带宽限制 if this.Server.BandwidthLimit != nil && this.Server.BandwidthLimit.IsOn && !this.Server.BandwidthLimit.IsEmpty() && this.Server.BandwidthLimitStatus != nil && this.Server.BandwidthLimitStatus.IsValid() { this.doBandwidthLimit() diff --git a/internal/nodes/http_request_plan_expires.go b/internal/nodes/http_request_plan_expires.go new file mode 100644 index 0000000..622dd22 --- /dev/null +++ b/internal/nodes/http_request_plan_expires.go @@ -0,0 +1,19 @@ +// 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(statusCode) + + this.writer.WriteHeader(statusCode) + _, _ = this.writer.WriteString(serverconfigs.DefaultPlanExpireNoticePageBody) +}