mirror of
				https://github.com/TeaOSLab/EdgeAdmin.git
				synced 2025-11-04 05:00:25 +08:00 
			
		
		
		
	实现基础的DDoS防护
This commit is contained in:
		@@ -0,0 +1,19 @@
 | 
			
		||||
{$layout}
 | 
			
		||||
{$template "../menu"}
 | 
			
		||||
{$template "/left_menu_with_menu"}
 | 
			
		||||
 | 
			
		||||
<div class="right-box with-menu">
 | 
			
		||||
    <first-menu>
 | 
			
		||||
        <menu-item :href="'.?clusterId=' + clusterId" class="active">设置</menu-item>
 | 
			
		||||
        <menu-item :href="'.status?clusterId=' + clusterId" >状态</menu-item>
 | 
			
		||||
    </first-menu>
 | 
			
		||||
 | 
			
		||||
    <form class="ui form" data-tea-action="$" data-tea-success="success">
 | 
			
		||||
        <csrf-token></csrf-token>
 | 
			
		||||
        <input type="hidden" name="clusterId" :value="clusterId"/>
 | 
			
		||||
 | 
			
		||||
        <node-ddos-protection-config-box :v-ddos-protection-config="config" :v-default-configs="defaultConfigs"></node-ddos-protection-config-box>
 | 
			
		||||
 | 
			
		||||
        <submit-btn></submit-btn>
 | 
			
		||||
    </form>
 | 
			
		||||
</div>
 | 
			
		||||
@@ -0,0 +1,3 @@
 | 
			
		||||
Tea.context(function () {
 | 
			
		||||
	this.success = NotifyReloadSuccess("保存成功")
 | 
			
		||||
})
 | 
			
		||||
@@ -0,0 +1,44 @@
 | 
			
		||||
{$layout}
 | 
			
		||||
{$template "../menu"}
 | 
			
		||||
{$template "/left_menu_with_menu"}
 | 
			
		||||
 | 
			
		||||
<div class="right-box with-menu">
 | 
			
		||||
    <first-menu>
 | 
			
		||||
        <menu-item :href="'.?clusterId=' + clusterId">设置</menu-item>
 | 
			
		||||
        <menu-item :href="'.status?clusterId=' + clusterId" class="active">状态</menu-item>
 | 
			
		||||
    </first-menu>
 | 
			
		||||
 | 
			
		||||
    <loading-message v-if="isLoading">检查中,请耐心等待完成...</loading-message>
 | 
			
		||||
 | 
			
		||||
    <p class="comment" v-if="!isLoading && results.length == 0">当前集群下暂时还没有节点。</p>
 | 
			
		||||
 | 
			
		||||
    <table class="ui table selectable" v-if="results.length > 0">
 | 
			
		||||
        <thead>
 | 
			
		||||
            <tr>
 | 
			
		||||
                <th class="three wide">节点名称</th>
 | 
			
		||||
                <th>检查结果</th>
 | 
			
		||||
                <th class="two op">独立设置</th>
 | 
			
		||||
            </tr>
 | 
			
		||||
        </thead>
 | 
			
		||||
        <tbody v-for="result in results">
 | 
			
		||||
            <tr>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <a :href="'/clusters/cluster/node?clusterId=' + clusterId + '&nodeId=' + result.nodeId">{{result.nodeName}}</a>
 | 
			
		||||
                    <div v-if="result.isPrior">
 | 
			
		||||
                        <a :href="'/clusters/cluster/node/settings/ddos-protection?clusterId=' + clusterId + '&nodeId=' + result.nodeId"><grey-label>定制</grey-label></a>
 | 
			
		||||
                    </div>
 | 
			
		||||
                </td>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <span class="green" v-if="result.isOk">{{result.message}}</span>
 | 
			
		||||
                    <span class="red" v-if="!result.isOk">{{result.message}}</span>
 | 
			
		||||
                </td>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <a :href="'/clusters/cluster/node/settings/ddos-protection?clusterId=' + clusterId + '&nodeId=' + result.nodeId">设置</a>
 | 
			
		||||
                </td>
 | 
			
		||||
            </tr>
 | 
			
		||||
        </tbody>
 | 
			
		||||
    </table>
 | 
			
		||||
 | 
			
		||||
    <div class="margin"></div>
 | 
			
		||||
    <a href="" @click.prevent="reload">[刷新]</a>
 | 
			
		||||
</div>
 | 
			
		||||
@@ -0,0 +1,20 @@
 | 
			
		||||
Tea.context(function () {
 | 
			
		||||
	this.isLoading = true
 | 
			
		||||
	this.results = []
 | 
			
		||||
 | 
			
		||||
	this.$delay(function () {
 | 
			
		||||
		this.reload()
 | 
			
		||||
	})
 | 
			
		||||
 | 
			
		||||
	this.reload = function () {
 | 
			
		||||
		this.isLoading = true
 | 
			
		||||
		this.$post("$")
 | 
			
		||||
			.params({ clusterId: this.clusterId })
 | 
			
		||||
			.success(function (resp) {
 | 
			
		||||
				this.results = resp.data.results
 | 
			
		||||
			})
 | 
			
		||||
			.done(function () {
 | 
			
		||||
				this.isLoading = false
 | 
			
		||||
			})
 | 
			
		||||
	}
 | 
			
		||||
})
 | 
			
		||||
@@ -53,13 +53,6 @@
 | 
			
		||||
                        <p class="comment">取值在{{defaultNodeMaxThreadsMin}}和{{defaultNodeMaxThreadsMax}}之间;如果为0,则默认为{{defaultNodeMaxThreads}}。</p>
 | 
			
		||||
                    </td>
 | 
			
		||||
                </tr>
 | 
			
		||||
                <tr>
 | 
			
		||||
                    <td>单节点TCP最大连接数</td>
 | 
			
		||||
                    <td>
 | 
			
		||||
                        <input type="text" name="nodeTCPMaxConnections" maxlength="6" v-model="cluster.nodeTCPMaxConnections"/>
 | 
			
		||||
                        <p class="comment">如果为0,则默认为{{defaultNodeTCPMaxConnections}}。</p>
 | 
			
		||||
                    </td>
 | 
			
		||||
                </tr>
 | 
			
		||||
                <tr>
 | 
			
		||||
                    <td>自动开放端口</td>
 | 
			
		||||
                    <td>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user