Skip to content
Permalink
Browse files

Remove localhost block by reference, no position

  • Loading branch information
kitop committed Nov 12, 2019
1 parent 98342c6 commit 22a973955d0644e0a9163dda4dd8667fce7fcfe7
Showing with 9 additions and 2 deletions.
  1. +9 −2 api/helpers.go
@@ -141,8 +141,15 @@ func isPrivateIP(ip net.IP) bool {
}

func removeLocalhostFromPrivateIPBlock() *net.IPNet {
var localhost *net.IPNet
localhost, privateIPBlocks = privateIPBlocks[0], privateIPBlocks[1:]
_, localhost, _ := net.ParseCIDR("127.0.0.0/8")

var localhostIndex int
for i := 0; i < len(privateIPBlocks); i++ {
if privateIPBlocks[i] == localhost {
localhostIndex = i
}
}
privateIPBlocks = append(privateIPBlocks[:localhostIndex], privateIPBlocks[localhostIndex+1:]...)

return localhost
}

0 comments on commit 22a9739

Please sign in to comment.
You can’t perform that action at this time.