mirror of
				https://github.com/TeaOSLab/EdgeAdmin.git
				synced 2025-11-04 05:00:25 +08:00 
			
		
		
		
	删除TOA功能
This commit is contained in:
		@@ -10,7 +10,6 @@ import (
 | 
			
		||||
	"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/clusters/cluster/settings/health"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/clusters/cluster/settings/metrics"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/clusters/cluster/settings/services"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/clusters/cluster/settings/toa"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/clusters/cluster/settings/waf"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/clusters/cluster/settings/webp"
 | 
			
		||||
	clusters "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/clusters/clusterutils"
 | 
			
		||||
@@ -43,10 +42,6 @@ func init() {
 | 
			
		||||
			GetPost("", new(dns.IndexAction)).
 | 
			
		||||
			Post("/randomName", new(dns.RandomNameAction)).
 | 
			
		||||
 | 
			
		||||
			// TOA
 | 
			
		||||
			Prefix("/clusters/cluster/settings/toa").
 | 
			
		||||
			GetPost("", new(toa.IndexAction)).
 | 
			
		||||
 | 
			
		||||
			// 系统服务设置
 | 
			
		||||
			Prefix("/clusters/cluster/settings/services").
 | 
			
		||||
			GetPost("", new(services.IndexAction)).
 | 
			
		||||
 
 | 
			
		||||
@@ -1,83 +0,0 @@
 | 
			
		||||
package toa
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"encoding/json"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeCommon/pkg/nodeconfigs"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
 | 
			
		||||
	"github.com/iwind/TeaGo/actions"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type IndexAction struct {
 | 
			
		||||
	actionutils.ParentAction
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *IndexAction) Init() {
 | 
			
		||||
	this.Nav("", "setting", "")
 | 
			
		||||
	this.SecondMenu("toa")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *IndexAction) RunGet(params struct {
 | 
			
		||||
	ClusterId int64
 | 
			
		||||
}) {
 | 
			
		||||
	toaResp, err := this.RPC().NodeClusterRPC().FindEnabledNodeClusterTOA(this.AdminContext(), &pb.FindEnabledNodeClusterTOARequest{NodeClusterId: params.ClusterId})
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		this.ErrorPage(err)
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	if len(toaResp.ToaJSON) == 0 {
 | 
			
		||||
		this.Data["toa"] = nodeconfigs.DefaultTOAConfig()
 | 
			
		||||
	} else {
 | 
			
		||||
		config := &nodeconfigs.TOAConfig{}
 | 
			
		||||
		err = json.Unmarshal(toaResp.ToaJSON, config)
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			this.ErrorPage(err)
 | 
			
		||||
			return
 | 
			
		||||
		}
 | 
			
		||||
		this.Data["toa"] = config
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	this.Show()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *IndexAction) RunPost(params struct {
 | 
			
		||||
	ClusterId  int64
 | 
			
		||||
	IsOn       bool
 | 
			
		||||
	AutoSetup  bool
 | 
			
		||||
	OptionType uint8
 | 
			
		||||
	MinQueueId uint8
 | 
			
		||||
	MaxQueueId uint8
 | 
			
		||||
 | 
			
		||||
	Must *actions.Must
 | 
			
		||||
	CSRF *actionutils.CSRF
 | 
			
		||||
}) {
 | 
			
		||||
	defer this.CreateLogInfo(codes.NodeTOA_LogUpdateClusterTOA, params.ClusterId)
 | 
			
		||||
 | 
			
		||||
	config := &nodeconfigs.TOAConfig{
 | 
			
		||||
		IsOn:       params.IsOn,
 | 
			
		||||
		Debug:      false, // 暂时不允许打开调试
 | 
			
		||||
		OptionType: params.OptionType,
 | 
			
		||||
		MinQueueId: params.MinQueueId,
 | 
			
		||||
		MaxQueueId: params.MaxQueueId,
 | 
			
		||||
		AutoSetup:  params.AutoSetup,
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	configJSON, err := json.Marshal(config)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		this.ErrorPage(err)
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	_, err = this.RPC().NodeClusterRPC().UpdateNodeClusterTOA(this.AdminContext(), &pb.UpdateNodeClusterTOARequest{
 | 
			
		||||
		NodeClusterId: params.ClusterId,
 | 
			
		||||
		ToaJSON:       configJSON,
 | 
			
		||||
	})
 | 
			
		||||
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		this.ErrorPage(err)
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	this.Success()
 | 
			
		||||
}
 | 
			
		||||
@@ -1,55 +0,0 @@
 | 
			
		||||
{$layout}
 | 
			
		||||
{$template "../menu"}
 | 
			
		||||
{$template "/left_menu_with_menu"}
 | 
			
		||||
 | 
			
		||||
<div class="right-box with-menu">
 | 
			
		||||
    <first-menu>
 | 
			
		||||
        <menu-item><tip-icon content="TCP Option Address(TOA)可以在TCP选项中传递客户端IP,多用在TCP负载均衡的源站需要获取客户端真实IP的场景。<br/><br/>注意:HTTP协议通常不需要此设置。<br/><br/>如需修改配置,请在专业人士指导下操作。"></tip-icon></menu-item>
 | 
			
		||||
    </first-menu>
 | 
			
		||||
	<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
 | 
			
		||||
		<input type="hidden" name="clusterId" :value="clusterId"/>
 | 
			
		||||
		<csrf-token></csrf-token>
 | 
			
		||||
 | 
			
		||||
		<table class="ui table selectable definition">
 | 
			
		||||
			<tr>
 | 
			
		||||
				<td class="title">启用TOA</td>
 | 
			
		||||
				<td>
 | 
			
		||||
					<checkbox name="isOn" v-model="toa.isOn"></checkbox>
 | 
			
		||||
					<p class="comment">在启用之前,请确保当前集群下所有节点服务器已经安装libnetfilter_queue,并启用了IPTables。</p>
 | 
			
		||||
				</td>
 | 
			
		||||
			</tr>
 | 
			
		||||
			<tbody v-show="toa.isOn">
 | 
			
		||||
				<tr>
 | 
			
		||||
					<td>自动配置</td>
 | 
			
		||||
					<td>
 | 
			
		||||
						<checkbox name="autoSetup" v-model="toa.autoSetup"></checkbox>
 | 
			
		||||
						<p class="comment">TOA功能需要节点服务器安装并开启了IPTables,并将网络数据包转发到NFQueue中。如果选中了自动配置,则每次在启动时都会自动尝试配置IPTables规则。</p>
 | 
			
		||||
					</td>
 | 
			
		||||
				</tr>
 | 
			
		||||
				<tr>
 | 
			
		||||
					<td class="title">选项类型数值</td>
 | 
			
		||||
					<td>
 | 
			
		||||
						<input type="text" name="optionType" v-model="toa.optionType" style="width:4em" maxlength="3"/>
 | 
			
		||||
						<p class="comment">用来作为附加的TCP OPTION值,通常是254(即0xfe),请查阅云服务商文档来确认此值。</p>
 | 
			
		||||
					</td>
 | 
			
		||||
				</tr>
 | 
			
		||||
				<tr>
 | 
			
		||||
					<td>NFQueue队列开始ID</td>
 | 
			
		||||
					<td>
 | 
			
		||||
						<input type="text" name="minQueueId" v-model="toa.minQueueId" style="width:4em" maxlength="3"/>
 | 
			
		||||
						<p class="comment">不能超过255。</p>
 | 
			
		||||
					</td>
 | 
			
		||||
				</tr>
 | 
			
		||||
				<tr>
 | 
			
		||||
					<td>NFQueue队列结束ID</td>
 | 
			
		||||
					<td>
 | 
			
		||||
						<input type="text" name="maxQueueId" v-model="toa.maxQueueId" style="width:4em" maxlength="3"/>
 | 
			
		||||
						<p class="comment">不能超过255。</p>
 | 
			
		||||
					</td>
 | 
			
		||||
				</tr>
 | 
			
		||||
			</tbody>
 | 
			
		||||
		</table>
 | 
			
		||||
 | 
			
		||||
		<submit-btn></submit-btn>
 | 
			
		||||
	</form>
 | 
			
		||||
</div>
 | 
			
		||||
@@ -1,3 +0,0 @@
 | 
			
		||||
Tea.context(function () {
 | 
			
		||||
	this.success = NotifyReloadSuccess("保存成功")
 | 
			
		||||
})
 | 
			
		||||
		Reference in New Issue
	
	Block a user