mirror of
				https://github.com/TeaOSLab/EdgeNode.git
				synced 2025-11-04 16:00:25 +08:00 
			
		
		
		
	修复在iptables中加入ipv6的错误
This commit is contained in:
		@@ -4,6 +4,7 @@ import (
 | 
				
			|||||||
	"errors"
 | 
						"errors"
 | 
				
			||||||
	"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
 | 
						"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
 | 
				
			||||||
	"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/firewallconfigs"
 | 
						"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/firewallconfigs"
 | 
				
			||||||
 | 
						"github.com/TeaOSLab/EdgeNode/internal/utils"
 | 
				
			||||||
	executils "github.com/TeaOSLab/EdgeNode/internal/utils/exec"
 | 
						executils "github.com/TeaOSLab/EdgeNode/internal/utils/exec"
 | 
				
			||||||
	"os/exec"
 | 
						"os/exec"
 | 
				
			||||||
	"runtime"
 | 
						"runtime"
 | 
				
			||||||
@@ -74,10 +75,16 @@ func (this *IPTablesAction) runAction(action string, listType IPListType, item *
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (this *IPTablesAction) runActionSingleIP(action string, listType IPListType, item *pb.IPItem) error {
 | 
					func (this *IPTablesAction) runActionSingleIP(action string, listType IPListType, item *pb.IPItem) error {
 | 
				
			||||||
 | 
						// 暂时不支持ipv6
 | 
				
			||||||
 | 
						// TODO 将来支持ipv6
 | 
				
			||||||
 | 
						if utils.IsIPv6(item.IpFrom) {
 | 
				
			||||||
 | 
							return nil
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if item.Type == "all" {
 | 
						if item.Type == "all" {
 | 
				
			||||||
		return nil
 | 
							return nil
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	path := this.config.Path
 | 
						var path = this.config.Path
 | 
				
			||||||
	var err error
 | 
						var err error
 | 
				
			||||||
	if len(path) == 0 {
 | 
						if len(path) == 0 {
 | 
				
			||||||
		path, err = exec.LookPath("iptables")
 | 
							path, err = exec.LookPath("iptables")
 | 
				
			||||||
@@ -88,6 +95,7 @@ func (this *IPTablesAction) runActionSingleIP(action string, listType IPListType
 | 
				
			|||||||
			this.iptablesNotFound = true
 | 
								this.iptablesNotFound = true
 | 
				
			||||||
			return err
 | 
								return err
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
							this.config.Path = path
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	iptablesAction := ""
 | 
						iptablesAction := ""
 | 
				
			||||||
	switch action {
 | 
						switch action {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user