Find out if an IP is within a range of IPs

前端 未结 7 864
萌比男神i
萌比男神i 2021-01-30 09:18

How can you tell if an ip, say 62.156.244.13 is within the range of 62.0.0.0 and 62.255.255.255

相关标签:
7条回答
  • 2021-01-30 09:34

    There is a method #include?

    And you can do just:

    IPAddr.new("127.0.0.1/8").include? "127.1.10.200"

    0 讨论(0)
提交回复
热议问题