mirror of
				https://github.com/TeaOSLab/EdgeNode.git
				synced 2025-11-04 07:40:56 +08:00 
			
		
		
		
	增加CC防护(开源用户需要自己实现)
This commit is contained in:
		@@ -221,6 +221,18 @@ func (this *HTTPRequest) Do() {
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// CC
 | 
			
		||||
		if !isHealthCheck {
 | 
			
		||||
			if this.web.CC != nil {
 | 
			
		||||
				if this.web.CC.IsOn {
 | 
			
		||||
					if this.doCC() {
 | 
			
		||||
						this.doEnd()
 | 
			
		||||
						return
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// WAF
 | 
			
		||||
		if this.web.FirewallRef != nil && this.web.FirewallRef.IsOn {
 | 
			
		||||
			if this.doWAFRequest() {
 | 
			
		||||
@@ -572,6 +584,11 @@ func (this *HTTPRequest) configureWeb(web *serverconfigs.HTTPWebConfig, isTop bo
 | 
			
		||||
		this.web.UAM = web.UAM
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// CC
 | 
			
		||||
	if web.CC != nil && (web.CC.IsPrior || isTop) {
 | 
			
		||||
		this.web.CC = web.CC
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// 重写规则
 | 
			
		||||
	if len(web.RewriteRefs) > 0 {
 | 
			
		||||
		for index, ref := range web.RewriteRefs {
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										8
									
								
								internal/nodes/http_request_cc.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								internal/nodes/http_request_cc.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,8 @@
 | 
			
		||||
// Copyright 2023 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn .
 | 
			
		||||
//go:build !plus
 | 
			
		||||
 | 
			
		||||
package nodes
 | 
			
		||||
 | 
			
		||||
func (this *HTTPRequest) doCC() (block bool) {
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user