mirror of
https://github.com/go-micro/go-micro.git
synced 2025-11-29 21:47:44 +02:00
Custom private blocks (#1705)
Co-authored-by: Asim Aslam <asim@aslam.me>
This commit is contained in:
@@ -17,6 +17,15 @@ func init() {
|
||||
}
|
||||
}
|
||||
|
||||
// AppendPrivateBlocks append private network blocks
|
||||
func AppendPrivateBlocks(bs ...string) {
|
||||
for _, b := range bs {
|
||||
if _, block, err := net.ParseCIDR(b); err == nil {
|
||||
privateBlocks = append(privateBlocks, block)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func isPrivateIP(ipAddr string) bool {
|
||||
ip := net.ParseIP(ipAddr)
|
||||
for _, priv := range privateBlocks {
|
||||
|
||||
Reference in New Issue
Block a user