mirror of
				https://github.com/TeaOSLab/EdgeNode.git
				synced 2025-11-04 07:40:56 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			25 lines
		
	
	
		
			641 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			25 lines
		
	
	
		
			641 B
		
	
	
	
		
			Go
		
	
	
	
	
	
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
 | 
						|
 | 
						|
package nodes
 | 
						|
 | 
						|
import (
 | 
						|
	"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
 | 
						|
)
 | 
						|
 | 
						|
// 流量限制
 | 
						|
func (this *HTTPRequest) doTrafficLimit() {
 | 
						|
	var config = this.ReqServer.TrafficLimit
 | 
						|
 | 
						|
	this.tags = append(this.tags, "bandwidth")
 | 
						|
 | 
						|
	var statusCode = 509
 | 
						|
	this.ProcessResponseHeaders(this.writer.Header(), statusCode)
 | 
						|
 | 
						|
	this.writer.WriteHeader(statusCode)
 | 
						|
	if len(config.NoticePageBody) != 0 {
 | 
						|
		_, _ = this.writer.WriteString(this.Format(config.NoticePageBody))
 | 
						|
	} else {
 | 
						|
		_, _ = this.writer.WriteString(this.Format(serverconfigs.DefaultTrafficLimitNoticePageBody))
 | 
						|
	}
 | 
						|
}
 |