mirror of
https://github.com/TeaOSLab/EdgeNode.git
synced 2025-11-06 10:00:25 +08:00
优化代码
This commit is contained in:
@@ -193,10 +193,11 @@ func (this *HTTPRequest) Do() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 套餐
|
// 套餐
|
||||||
if this.ReqServer.UserPlan != nil && !this.ReqServer.UserPlan.IsAvailable() {
|
if this.ReqServer.UserPlan != nil {
|
||||||
this.doPlanExpires()
|
if this.doPlanBefore() {
|
||||||
this.doEnd()
|
this.doEnd()
|
||||||
return
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 流量限制
|
// 流量限制
|
||||||
|
|||||||
10
internal/nodes/http_request_plan_before.go
Normal file
10
internal/nodes/http_request_plan_before.go
Normal file
@@ -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
|
||||||
|
}
|
||||||
@@ -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))
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user