Initial commit (code only without large binaries)

This commit is contained in:
robin
2026-02-15 18:58:44 +08:00
commit 35df75498f
9442 changed files with 1495866 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
package ui
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"net"
"strings"
)
type ValidateIPsAction struct {
actionutils.ParentAction
}
func (this *ValidateIPsAction) RunPost(params struct {
Ips string
}) {
var ips = params.Ips
if len(ips) == 0 {
this.Data["ips"] = []string{}
this.Success()
}
var ipSlice = strings.Split(ips, "\n")
var result = []string{}
for _, ip := range ipSlice {
ip = strings.TrimSpace(ip)
if len(ip) == 0 {
continue
}
data := net.ParseIP(ip)
if len(data) == 0 {
this.Data["failIP"] = ip
this.Fail()
}
result = append(result, ip)
}
this.Data["ips"] = result
this.Success()
}