Sfoglia il codice sorgente

feat(service): 添加代理设置和 CC 配置

- 在 TCP、UDP 和 Web 转发功能中添加代理设置
- 在 Web 转发功能中添加 CC 配置(包括开启状态、阈值方法、级别等)
- 更新相关数据结构和请求响应体以支持新功能
fusu 4 settimane fa
parent
commit
cb74255269

+ 2 - 1
internal/service/tcpforwarding.go

@@ -97,6 +97,7 @@ func (s *tcpforwardingService) GetTcpforwarding(ctx context.Context, req v1.GetF
 		Id:               tcpForwarding.Id,
 		Port:             tcpForwarding.Port,
 		Comment:          tcpForwarding.Comment,
+		Proxy:            tcpForwarding.Proxy,
 		BackendList:       backend.BackendList,
 	}, nil
 }
@@ -463,7 +464,7 @@ func (s *tcpforwardingService) GetTcpForwardingAllIpsByHostId(ctx context.Contex
 			Id: r.Forwarding.Id,
 			Port: r.Forwarding.Port,
 			Comment: r.Forwarding.Comment,
-
+			Proxy: r.Forwarding.Proxy,
 		}
 		if r.BackendRule != nil {
 			dataReq.BackendList = r.BackendRule.BackendList

+ 3 - 2
internal/service/udpforwarding.go

@@ -95,9 +95,9 @@ func (s *udpForWardingService) GetUdpForWarding(ctx context.Context,req v1.GetFo
 	return v1.UdpForwardingDataRequest{
 		Id:                 udpForWarding.Id,
 		Port:               udpForWarding.Port,
-		BackendList:         backend.BackendList,
+		BackendList:        backend.BackendList,
 		Comment:            udpForWarding.Comment,
-
+		Proxy:              udpForWarding.Proxy,
 	}, nil
 }
 
@@ -469,6 +469,7 @@ func (s *udpForWardingService) GetUdpForwardingWafUdpAllIps(ctx context.Context,
 			Id: r.Forwarding.Id,
 			Port: r.Forwarding.Port,
 			Comment:           r.Forwarding.Comment,
+			Proxy:             r.Forwarding.Proxy,
 		}
 
 		if r.BackendRule != nil {

+ 18 - 0
internal/service/webforwarding.go

@@ -144,6 +144,15 @@ func (s *webForwardingService) GetWebForwarding(ctx context.Context, req v1.GetF
 		BackendList: backend.BackendList,
 		HttpsKey:    webForwarding.HttpsKey,
 		HttpsCert:   webForwarding.HttpsCert,
+		Proxy:       webForwarding.Proxy,
+		CcConfig:    v1.CcConfigRequest{
+			IsOn:            webForwarding.Cc,
+			ThresholdMethod: webForwarding.ThresholdMethod,
+			Level:           webForwarding.Level,
+			Limit5s:         webForwarding.Limit5s,
+			Limit60s:        webForwarding.Limit60s,
+			Limit300s:       webForwarding.Limit300s,
+		},
 	}, nil
 }
 
@@ -906,6 +915,15 @@ func (s *webForwardingService) GetWebForwardingWafWebAllIps(ctx context.Context,
 			Comment:   res.Forwarding.Comment,
 			HttpsKey:  res.Forwarding.HttpsKey,
 			HttpsCert: res.Forwarding.HttpsCert,
+			Proxy:     res.Forwarding.Proxy,
+			CcConfig:  v1.CcConfigRequest{
+				IsOn:        res.Forwarding.Cc,
+				ThresholdMethod: res.Forwarding.ThresholdMethod,
+				Level:       res.Forwarding.Level,
+				Limit5s:     res.Forwarding.Limit5s,
+				Limit60s:    res.Forwarding.Limit60s,
+				Limit300s:   res.Forwarding.Limit300s,
+			},
 		}
 
 		if res.BackendRule != nil { // 只有当 BackendRule 存在时才填充相关字段