MCPcopy Index your code
hub / github.com/GoEdgeLab/EdgeNode / ParseIP

Method ParseIP

internal/utils/agents/queue.go:113–128  ·  view source on GitHub ↗

ParseIP 分析IP的PTR值

(ip string)

Source from the content-addressed store, hash-verified

111
112// ParseIP 分析IP的PTR值
113func (this *Queue) ParseIP(ip string) (ptr string, err error) {
114 if len(ip) == 0 {
115 return "", nil
116 }
117
118 names, err := net.LookupAddr(ip)
119 if err != nil {
120 return "", err
121 }
122
123 if len(names) == 0 {
124 return "", nil
125 }
126
127 return names[0], nil
128}
129
130// ParsePtr 分析PTR对应的Agent
131func (this *Queue) ParsePtr(ptr string) (agentCode string) {

Callers 15

ProcessMethod · 0.95
IsLocalIPFunction · 0.80
IsIPv4Function · 0.80
IsIPv6Function · 0.80
IsWildIPFunction · 0.80
VersionToLongFunction · 0.80
TestParseQueue_ParseIPFunction · 0.80
LocalAddrMethod · 0.80
RemoteAddrMethod · 0.80
requestRemoteAddrMethod · 0.80
handlePROXYProtocolMethod · 0.80
updateAllowIPListMethod · 0.80

Calls

no outgoing calls

Tested by 10

TestParseQueue_ParseIPFunction · 0.64
LocalAddrMethod · 0.64
RemoteAddrMethod · 0.64
TestChain_AddDropIPRuleFunction · 0.64
TestSet_AddElementFunction · 0.64
TestSet_DeleteElementFunction · 0.64
TestSet_BatchFunction · 0.64
TestSet_Add_ManyFunction · 0.64
TestExpiration_AddFunction · 0.64