MCPcopy Index your code
hub / github.com/eolinker/goku_lite / ValidateRemoteAddr

Function ValidateRemoteAddr

utils/function.go:47–53  ·  view source on GitHub ↗

ValidateRemoteAddr 判断ip端口是否合法

(ip string)

Source from the content-addressed store, hash-verified

45
46//ValidateRemoteAddr 判断ip端口是否合法
47func ValidateRemoteAddr(ip string) bool {
48 match, err := regexp.MatchString(`^(?:(?:1[0-9][0-9]\.)|(?:2[0-4][0-9]\.)|(?:25[0-5]\.)|(?:[1-9][0-9]\.)|(?:[0-9]\.)){3}(?:(?:1[0-9][0-9])|(?:2[0-4][0-9])|(?:25[0-5])|(?:[1-9][0-9])|(?:[0-9]))\:(([0-9])|([1-9][0-9]{1,3})|([1-6][0-9]{0,4}))$`, ip)
49 if err != nil {
50 return false
51 }
52 return match
53}
54
55//ValidateURL 判断ip端口是否合法
56func ValidateURL(url string) bool {

Callers 2

AddNodeFunction · 0.92
EditNodeFunction · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected