File tree Expand file tree Collapse file tree 1 file changed +1
-23
lines changed Expand file tree Collapse file tree 1 file changed +1
-23
lines changed Original file line number Diff line number Diff line change @@ -13,32 +13,10 @@ import (
13
13
"code.gitea.io/gitea/modules/setting"
14
14
)
15
15
16
- var loopbackIPBlocks []* net.IPNet
17
-
18
16
var externalTrackerRegex = regexp .MustCompile (`({?)(?:user|repo|index)+?(}?)` )
19
17
20
- func init () {
21
- for _ , cidr := range []string {
22
- "127.0.0.0/8" , // IPv4 loopback
23
- "::1/128" , // IPv6 loopback
24
- } {
25
- if _ , block , err := net .ParseCIDR (cidr ); err == nil {
26
- loopbackIPBlocks = append (loopbackIPBlocks , block )
27
- }
28
- }
29
- }
30
-
31
18
func isLoopbackIP (ip string ) bool {
32
- pip := net .ParseIP (ip )
33
- if pip == nil {
34
- return false
35
- }
36
- for _ , block := range loopbackIPBlocks {
37
- if block .Contains (pip ) {
38
- return true
39
- }
40
- }
41
- return false
19
+ return net .ParseIP (ip ).IsLoopback ()
42
20
}
43
21
44
22
// IsValidURL checks if URL is valid
You can’t perform that action at this time.
0 commit comments