MCPcopy Create free account
hub / github.com/diyhi/bbs / isLocalIP

Method isLocalIP

src/main/java/cms/utils/IpAddress.java:180–194  ·  view source on GitHub ↗

查询是否为内网IP @param ip ip地址 @return

(String ip)

Source from the content-addressed store, hash-verified

178 * @return
179 */
180 public static boolean isLocalIP(String ip){
181 try {
182 InetAddress address = InetAddress.getByName(ip);
183 if(address.isSiteLocalAddress() || address.isLoopbackAddress()){//如果为内网IP
184 return true;
185 }
186 } catch (UnknownHostException e) {
187 // TODO Auto-generated catch block
188 //e1.printStackTrace();
189 if (logger.isErrorEnabled()) {
190 logger.error("查询是否为内网IP错误",e);
191 }
192 }
193 return false;
194 }
195
196
197

Callers 1

isChinaRegionMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected