From 4537ac630c1e9bc68cdb89d3a8df0bdf3cbae5d2 Mon Sep 17 00:00:00 2001 From: MaxKey Date: Fri, 27 May 2022 08:49:20 +0800 Subject: [PATCH] copyright --- LICENSE | 2 +- .../realm/AbstractAuthenticationRealm.java | 4 - .../maxkey/web/ipregion/AbstractIpRegion.java | 35 --------- .../org/maxkey/web/ipregion/IpRegion.java | 33 -------- .../maxkey/web/ipregion/IpRegionFactory.java | 74 ------------------ .../maxkey/web/ipregion/IpRegionIp138.java | 54 ------------- .../web/ipregion/IpRegionIp138Response.java | 77 ------------------- .../maxkey/web/ipregion/IpRegionIp360.java | 55 ------------- .../web/ipregion/IpRegionIp360Response.java | 57 -------------- .../maxkey/web/ipregion/IpRegionIpchaxun.java | 51 ------------ .../org/maxkey/web/ipregion/IpRegionIpcn.java | 48 ------------ .../maxkey/web/ipregion/IpRegionLocal.java | 29 ------- .../maxkey/web/ipregion/IpRegionPconline.java | 35 --------- .../ipregion/IpRegionPconlineResponse.java | 37 --------- .../org/maxkey/web/ipregion/package-info.java | 18 ----- .../web/ipregion/IpRegionFactoryTest.java | 34 -------- .../web/ipregion/IpRegionIp138Test.java | 30 -------- .../web/ipregion/IpRegionIp360Test.java | 30 -------- .../web/ipregion/IpRegionIpchaxunTest.java | 30 -------- .../maxkey/web/ipregion/IpRegionIpcnTest.java | 30 -------- .../web/ipregion/IpRegionPconlineTest.java | 30 -------- 21 files changed, 1 insertion(+), 792 deletions(-) delete mode 100644 maxkey-core/src/main/java/org/maxkey/web/ipregion/AbstractIpRegion.java delete mode 100644 maxkey-core/src/main/java/org/maxkey/web/ipregion/IpRegion.java delete mode 100644 maxkey-core/src/main/java/org/maxkey/web/ipregion/IpRegionFactory.java delete mode 100644 maxkey-core/src/main/java/org/maxkey/web/ipregion/IpRegionIp138.java delete mode 100644 maxkey-core/src/main/java/org/maxkey/web/ipregion/IpRegionIp138Response.java delete mode 100644 maxkey-core/src/main/java/org/maxkey/web/ipregion/IpRegionIp360.java delete mode 100644 maxkey-core/src/main/java/org/maxkey/web/ipregion/IpRegionIp360Response.java delete mode 100644 maxkey-core/src/main/java/org/maxkey/web/ipregion/IpRegionIpchaxun.java delete mode 100644 maxkey-core/src/main/java/org/maxkey/web/ipregion/IpRegionIpcn.java delete mode 100644 maxkey-core/src/main/java/org/maxkey/web/ipregion/IpRegionLocal.java delete mode 100644 maxkey-core/src/main/java/org/maxkey/web/ipregion/IpRegionPconline.java delete mode 100644 maxkey-core/src/main/java/org/maxkey/web/ipregion/IpRegionPconlineResponse.java delete mode 100644 maxkey-core/src/main/java/org/maxkey/web/ipregion/package-info.java delete mode 100644 maxkey-core/src/test/java/org/maxkey/web/ipregion/IpRegionFactoryTest.java delete mode 100644 maxkey-core/src/test/java/org/maxkey/web/ipregion/IpRegionIp138Test.java delete mode 100644 maxkey-core/src/test/java/org/maxkey/web/ipregion/IpRegionIp360Test.java delete mode 100644 maxkey-core/src/test/java/org/maxkey/web/ipregion/IpRegionIpchaxunTest.java delete mode 100644 maxkey-core/src/test/java/org/maxkey/web/ipregion/IpRegionIpcnTest.java delete mode 100644 maxkey-core/src/test/java/org/maxkey/web/ipregion/IpRegionPconlineTest.java diff --git a/LICENSE b/LICENSE index e6a6baf7..b1812ab2 100644 --- a/LICENSE +++ b/LICENSE @@ -187,7 +187,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright [yyyy] [name of copyright owner] + Copyright [2022] [MaxKey of copyright http://www.maxkey.top] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/realm/AbstractAuthenticationRealm.java b/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/realm/AbstractAuthenticationRealm.java index bd5b651f..48d1ffd3 100644 --- a/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/realm/AbstractAuthenticationRealm.java +++ b/maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/realm/AbstractAuthenticationRealm.java @@ -33,7 +33,6 @@ import org.maxkey.persistence.service.UserInfoService; import org.maxkey.util.DateUtils; import org.maxkey.web.WebConstants; import org.maxkey.web.WebContext; -import org.maxkey.web.ipregion.IpRegionFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.jdbc.core.JdbcTemplate; @@ -139,9 +138,6 @@ public abstract class AbstractAuthenticationRealm { historyLogin.setBrowser(browser.getName()); historyLogin.setPlatform(browser.getPlatform()); historyLogin.setSourceIp(userInfo.getLastLoginIp()); - //TODO: - //historyLogin.setIpRegion(IpRegionFactory.getFactory().region(userInfo.getLastLoginIp())); - //historyLogin.setIpLocation(IpRegionFactory.getFactory().getLocation(historyLogin.getIpRegion())); historyLogin.setProvider(provider); historyLogin.setCode(code); historyLogin.setLoginType(type); diff --git a/maxkey-core/src/main/java/org/maxkey/web/ipregion/AbstractIpRegion.java b/maxkey-core/src/main/java/org/maxkey/web/ipregion/AbstractIpRegion.java deleted file mode 100644 index 79851434..00000000 --- a/maxkey-core/src/main/java/org/maxkey/web/ipregion/AbstractIpRegion.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright [2022] [MaxKey of copyright http://www.maxkey.top] - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -package org.maxkey.web.ipregion; - -public abstract class AbstractIpRegion implements IpRegion{ - - int failCount = 0; - - public String getLocation(String region) { - return region; - } - - public int getFailCount() { - return failCount; - }; - - public int plusFailCount() { - return failCount++; - }; -} diff --git a/maxkey-core/src/main/java/org/maxkey/web/ipregion/IpRegion.java b/maxkey-core/src/main/java/org/maxkey/web/ipregion/IpRegion.java deleted file mode 100644 index 145c4c97..00000000 --- a/maxkey-core/src/main/java/org/maxkey/web/ipregion/IpRegion.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright [2022] [MaxKey of copyright http://www.maxkey.top] - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -package org.maxkey.web.ipregion; - -public interface IpRegion { - public static final String USERAGENT = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.82 Safari/537.36"; - - public static final int TIMEOUT = 5000; - - public String region(String ipAddress); - - public String getLocation(String region); - - public int getFailCount(); - - public int plusFailCount() ; - -} diff --git a/maxkey-core/src/main/java/org/maxkey/web/ipregion/IpRegionFactory.java b/maxkey-core/src/main/java/org/maxkey/web/ipregion/IpRegionFactory.java deleted file mode 100644 index 7b127068..00000000 --- a/maxkey-core/src/main/java/org/maxkey/web/ipregion/IpRegionFactory.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright [2022] [MaxKey of copyright http://www.maxkey.top] - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -package org.maxkey.web.ipregion; - -import java.util.ArrayList; - -import org.apache.commons.lang3.StringUtils; - -public class IpRegionFactory extends AbstractIpRegion implements IpRegion{ - - static IpRegionFactory factory = new IpRegionFactory(); - - static final ArrayList ipRegionList; - - static { - ipRegionList = new ArrayList(); - ipRegionList.add(new IpRegionLocal()); - ipRegionList.add(new IpRegionIp138()); - ipRegionList.add(new IpRegionIpchaxun()); - ipRegionList.add(new IpRegionIpcn()); - ipRegionList.add(new IpRegionIp360()); - ipRegionList.add(new IpRegionPconline()); - } - - public static IpRegion getFactory() { - return factory; - } - - @Override - public String region(String ipAddress) { - for(int i = 0 ; i 6) { - ipRegionList.remove(i);//remove from list - } - //fail plus 1 - ipRegion.plusFailCount(); - } - } - return "unknown"; - } - - public String getLocation(String region) { - if(region.endsWith("电信") || region.endsWith("移动") || region.endsWith("联通")) { - region.substring(0, region.length() - 2).trim(); - } - - if(region.indexOf(" ") > 0) { - return region.split(" ")[0]; - } - - return region; - } - -} diff --git a/maxkey-core/src/main/java/org/maxkey/web/ipregion/IpRegionIp138.java b/maxkey-core/src/main/java/org/maxkey/web/ipregion/IpRegionIp138.java deleted file mode 100644 index 8d47eac9..00000000 --- a/maxkey-core/src/main/java/org/maxkey/web/ipregion/IpRegionIp138.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright [2022] [MaxKey of copyright http://www.maxkey.top] - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -package org.maxkey.web.ipregion; - -import java.io.IOException; - -import org.jsoup.Jsoup; -import org.jsoup.nodes.Document; -import org.maxkey.util.JsonUtils; - -public class IpRegionIp138 extends AbstractIpRegion implements IpRegion{ - - public static final String REGION_URL = "https://www.ip138.com/iplookup.asp?ip=%s&action=2"; - - public static final String BEGIN = "\"ip_c_list\":["; - public static final String END = "], \"zg\":1};"; - - @Override - public String region(String ipAddress) { - try { - Document doc; - doc = Jsoup.connect(String.format(REGION_URL, ipAddress)) - .timeout(TIMEOUT) - .userAgent(USERAGENT) - .header("Host", "www.ip138.com") - .header("Referer", "https://www.ip138.com/") - .header("sec-ch-ua", "\" Not A;Brand\";v=\"99\", \"Chromium\";v=\"98\", \"Google Chrome\";v=\"98\"") - .header("Accept","text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9") - .get(); - String htmlData = doc.toString(); - String jsonData = htmlData.substring(htmlData.indexOf(BEGIN) + BEGIN.length() , htmlData.indexOf(END)); - IpRegionIp138Response responseJson = JsonUtils.json2Object(jsonData, IpRegionIp138Response.class); - return responseJson == null ? null : responseJson.toString(); - } catch (IOException e) { - e.printStackTrace(); - } - return null; - } -} diff --git a/maxkey-core/src/main/java/org/maxkey/web/ipregion/IpRegionIp138Response.java b/maxkey-core/src/main/java/org/maxkey/web/ipregion/IpRegionIp138Response.java deleted file mode 100644 index 4538e8b2..00000000 --- a/maxkey-core/src/main/java/org/maxkey/web/ipregion/IpRegionIp138Response.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright [2022] [MaxKey of copyright http://www.maxkey.top] - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -package org.maxkey.web.ipregion; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; - -@JsonIgnoreProperties(ignoreUnknown = true) -public class IpRegionIp138Response { - - String ct; - String prov; - String city; - String area; - String yunyin; - - public IpRegionIp138Response() { - } - public String getCt() { - return ct; - } - public void setCt(String ct) { - this.ct = ct; - } - public String getProv() { - return prov; - } - public void setProv(String prov) { - this.prov = prov; - } - public String getCity() { - return city; - } - public void setCity(String city) { - this.city = city; - } - public String getArea() { - return area; - } - public void setArea(String area) { - this.area = area; - } - public String getYunyin() { - return yunyin; - } - public void setYunyin(String yunyin) { - this.yunyin = yunyin; - } - - @Override - public String toString() { - StringBuilder builder = new StringBuilder(); - builder.append(ct) - .append(prov) - .append(city) - .append(area) - .append(" ") - .append(yunyin); - return builder.toString(); - } - - -} diff --git a/maxkey-core/src/main/java/org/maxkey/web/ipregion/IpRegionIp360.java b/maxkey-core/src/main/java/org/maxkey/web/ipregion/IpRegionIp360.java deleted file mode 100644 index 832b0cb1..00000000 --- a/maxkey-core/src/main/java/org/maxkey/web/ipregion/IpRegionIp360.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright [2022] [MaxKey of copyright http://www.maxkey.top] - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -package org.maxkey.web.ipregion; - -import java.io.IOException; - -import org.jsoup.Jsoup; -import org.jsoup.nodes.Document; -import org.maxkey.util.JsonUtils; - -public class IpRegionIp360 extends AbstractIpRegion implements IpRegion{ - - public static final String REGION_URL = "http://ip.360.cn/IPQuery/ipquery?ip=%s&verifycode="; - public static final String BEGIN = ""; - public static final String END = ""; - - @Override - public String region(String ipAddress) { - try { - Document doc; - doc = Jsoup.connect(String.format(REGION_URL, ipAddress)) - .timeout(TIMEOUT) - .userAgent(USERAGENT) - .header("Host", "ip.360.cn") - .header("Origin", "http://ip.360.cn") - .header("Referer", "http://ip.360.cn/") - .header("Accept","application/json, text/plain, */*") - .post(); - - String htmlData = doc.toString(); - String jsonData = htmlData.substring(htmlData.indexOf(BEGIN) + BEGIN.length() , htmlData.indexOf(END)); - IpRegionIp360Response responseJson = JsonUtils.json2Object(jsonData, IpRegionIp360Response.class); - return responseJson == null ? null : responseJson.getData().replace("\t", " "); - } catch (IOException e) { - e.printStackTrace(); - } - return null; - } - -} diff --git a/maxkey-core/src/main/java/org/maxkey/web/ipregion/IpRegionIp360Response.java b/maxkey-core/src/main/java/org/maxkey/web/ipregion/IpRegionIp360Response.java deleted file mode 100644 index 1bd8484d..00000000 --- a/maxkey-core/src/main/java/org/maxkey/web/ipregion/IpRegionIp360Response.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright [2022] [MaxKey of copyright http://www.maxkey.top] - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -package org.maxkey.web.ipregion; - -public class IpRegionIp360Response { - - int errno; - String errmsg; - String data; - public int getErrno() { - return errno; - } - public void setErrno(int errno) { - this.errno = errno; - } - public String getErrmsg() { - return errmsg; - } - public void setErrmsg(String errmsg) { - this.errmsg = errmsg; - } - public String getData() { - return data; - } - public void setData(String data) { - this.data = data; - } - - @Override - public String toString() { - StringBuilder builder = new StringBuilder(); - builder.append("IpRegionIp360Response [errno="); - builder.append(errno); - builder.append(", errmsg="); - builder.append(errmsg); - builder.append(", data="); - builder.append(data); - builder.append("]"); - return builder.toString(); - } - -} diff --git a/maxkey-core/src/main/java/org/maxkey/web/ipregion/IpRegionIpchaxun.java b/maxkey-core/src/main/java/org/maxkey/web/ipregion/IpRegionIpchaxun.java deleted file mode 100644 index 3140c205..00000000 --- a/maxkey-core/src/main/java/org/maxkey/web/ipregion/IpRegionIpchaxun.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright [2022] [MaxKey of copyright http://www.maxkey.top] - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -package org.maxkey.web.ipregion; - -import java.io.IOException; - -import org.jsoup.Jsoup; -import org.jsoup.nodes.Document; -import org.jsoup.select.Elements; - -public class IpRegionIpchaxun extends AbstractIpRegion implements IpRegion{ - - public static final String REGION_URL = "https://ipchaxun.com/%s/"; - - @Override - public String region(String ipAddress) { - try { - Document doc; - doc = Jsoup.connect(String.format(REGION_URL, ipAddress)) - .timeout(TIMEOUT) - .userAgent(USERAGENT) - .header("Host","ipchaxun.com") - .header("Referer","https://ipchaxun.com/") - .header("sec-ch-ua", "\" Not A;Brand\";v=\"99\", \"Chromium\";v=\"98\", \"Google Chrome\";v=\"98\"") - .header("Accept","text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9") - .get(); - - Elements address = doc.select(".info label span.value"); - return address.get(1).text().trim(); - } catch (IOException e) { - e.printStackTrace(); - } - return null; - } - -} diff --git a/maxkey-core/src/main/java/org/maxkey/web/ipregion/IpRegionIpcn.java b/maxkey-core/src/main/java/org/maxkey/web/ipregion/IpRegionIpcn.java deleted file mode 100644 index 482a17ae..00000000 --- a/maxkey-core/src/main/java/org/maxkey/web/ipregion/IpRegionIpcn.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright [2022] [MaxKey of copyright http://www.maxkey.top] - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -package org.maxkey.web.ipregion; - -import java.io.IOException; - -import org.jsoup.Jsoup; -import org.jsoup.nodes.Document; -import org.jsoup.select.Elements; - -public class IpRegionIpcn extends AbstractIpRegion implements IpRegion{ - - public static final String REGION_URL = "https://ip.cn/ip/%s.html"; - - @Override - public String region(String ipAddress) { - try { - Document doc; - doc = Jsoup.connect(String.format(REGION_URL, ipAddress)) - .timeout(TIMEOUT) - .userAgent(USERAGENT) - .header("referer","https://ip.cn/") - .header("sec-ch-ua", "\" Not A;Brand\";v=\"99\", \"Chromium\";v=\"98\", \"Google Chrome\";v=\"98\"") - .get(); - Elements address = doc.select("#tab0_address"); - return address.text().trim(); - } catch (IOException e) { - e.printStackTrace(); - } - return null; - } - -} diff --git a/maxkey-core/src/main/java/org/maxkey/web/ipregion/IpRegionLocal.java b/maxkey-core/src/main/java/org/maxkey/web/ipregion/IpRegionLocal.java deleted file mode 100644 index 8822fafd..00000000 --- a/maxkey-core/src/main/java/org/maxkey/web/ipregion/IpRegionLocal.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright [2022] [MaxKey of copyright http://www.maxkey.top] - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -package org.maxkey.web.ipregion; - -public class IpRegionLocal extends AbstractIpRegion implements IpRegion{ - - @Override - public String region(String ipAddress) { - if(ipAddress.equals("127.0.0.1") || ipAddress.equals("0:0:0:0:0:0:0:1")) { - return "local"; - } - return null; - } -} diff --git a/maxkey-core/src/main/java/org/maxkey/web/ipregion/IpRegionPconline.java b/maxkey-core/src/main/java/org/maxkey/web/ipregion/IpRegionPconline.java deleted file mode 100644 index 6061b60f..00000000 --- a/maxkey-core/src/main/java/org/maxkey/web/ipregion/IpRegionPconline.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright [2022] [MaxKey of copyright http://www.maxkey.top] - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -package org.maxkey.web.ipregion; - -import org.maxkey.util.JsonUtils; -import org.maxkey.web.HttpRequestAdapter; - -public class IpRegionPconline extends AbstractIpRegion implements IpRegion{ - - public static final String REGION_URL = "http://whois.pconline.com.cn/ipJson.jsp?json=true&ip=%s"; - - @Override - public String region(String ipAddress) { - String responseJson = - new HttpRequestAdapter(HttpRequestAdapter.MediaType.JSON) - .get(String.format(REGION_URL,ipAddress),null); - return JsonUtils.json2Object(responseJson, IpRegionPconlineResponse.class).getAddr().trim(); - } - -} diff --git a/maxkey-core/src/main/java/org/maxkey/web/ipregion/IpRegionPconlineResponse.java b/maxkey-core/src/main/java/org/maxkey/web/ipregion/IpRegionPconlineResponse.java deleted file mode 100644 index 8958e67f..00000000 --- a/maxkey-core/src/main/java/org/maxkey/web/ipregion/IpRegionPconlineResponse.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright [2022] [MaxKey of copyright http://www.maxkey.top] - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -package org.maxkey.web.ipregion; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; - -@JsonIgnoreProperties(ignoreUnknown = true) -public class IpRegionPconlineResponse { - - String addr; - - public String getAddr() { - return addr; - } - - public void setAddr(String addr) { - this.addr = addr; - } - - public IpRegionPconlineResponse() { - } -} diff --git a/maxkey-core/src/main/java/org/maxkey/web/ipregion/package-info.java b/maxkey-core/src/main/java/org/maxkey/web/ipregion/package-info.java deleted file mode 100644 index 58e93889..00000000 --- a/maxkey-core/src/main/java/org/maxkey/web/ipregion/package-info.java +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright [2022] [MaxKey of copyright http://www.maxkey.top] - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -package org.maxkey.web.ipregion; diff --git a/maxkey-core/src/test/java/org/maxkey/web/ipregion/IpRegionFactoryTest.java b/maxkey-core/src/test/java/org/maxkey/web/ipregion/IpRegionFactoryTest.java deleted file mode 100644 index b17e1a9d..00000000 --- a/maxkey-core/src/test/java/org/maxkey/web/ipregion/IpRegionFactoryTest.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright [2022] [MaxKey of copyright http://www.maxkey.top] - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -package org.maxkey.web.ipregion; - -import org.junit.Test; - -public class IpRegionFactoryTest { - - @Test - public void test(){ - System.out.println(IpRegionFactory.getFactory().getLocation( - IpRegionFactory.getFactory().region("127.0.0.1") - )); - - System.out.println(IpRegionFactory.getFactory().getLocation( - IpRegionFactory.getFactory().region("117.155.70.59") - )); - } -} diff --git a/maxkey-core/src/test/java/org/maxkey/web/ipregion/IpRegionIp138Test.java b/maxkey-core/src/test/java/org/maxkey/web/ipregion/IpRegionIp138Test.java deleted file mode 100644 index 14951d28..00000000 --- a/maxkey-core/src/test/java/org/maxkey/web/ipregion/IpRegionIp138Test.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright [2022] [MaxKey of copyright http://www.maxkey.top] - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -package org.maxkey.web.ipregion; - -import org.junit.Test; - -public class IpRegionIp138Test { - - @Test - public void test(){ - IpRegion ipRegion = new IpRegionIp138(); - System.out.println(ipRegion.region("117.155.70.59")); - } - -} diff --git a/maxkey-core/src/test/java/org/maxkey/web/ipregion/IpRegionIp360Test.java b/maxkey-core/src/test/java/org/maxkey/web/ipregion/IpRegionIp360Test.java deleted file mode 100644 index d5fca42b..00000000 --- a/maxkey-core/src/test/java/org/maxkey/web/ipregion/IpRegionIp360Test.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright [2022] [MaxKey of copyright http://www.maxkey.top] - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -package org.maxkey.web.ipregion; - -import org.junit.Test; - -public class IpRegionIp360Test { - - @Test - public void test(){ - IpRegion ipRegion = new IpRegionIp360(); - System.out.println(ipRegion.region("117.155.70.59")); - } - -} diff --git a/maxkey-core/src/test/java/org/maxkey/web/ipregion/IpRegionIpchaxunTest.java b/maxkey-core/src/test/java/org/maxkey/web/ipregion/IpRegionIpchaxunTest.java deleted file mode 100644 index d4d3525e..00000000 --- a/maxkey-core/src/test/java/org/maxkey/web/ipregion/IpRegionIpchaxunTest.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright [2022] [MaxKey of copyright http://www.maxkey.top] - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -package org.maxkey.web.ipregion; - -import org.junit.Test; - -public class IpRegionIpchaxunTest { - - @Test - public void test(){ - IpRegion ipRegion = new IpRegionIpchaxun(); - System.out.println(ipRegion.region("117.155.70.59")); - } - -} diff --git a/maxkey-core/src/test/java/org/maxkey/web/ipregion/IpRegionIpcnTest.java b/maxkey-core/src/test/java/org/maxkey/web/ipregion/IpRegionIpcnTest.java deleted file mode 100644 index ac29f4bb..00000000 --- a/maxkey-core/src/test/java/org/maxkey/web/ipregion/IpRegionIpcnTest.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright [2022] [MaxKey of copyright http://www.maxkey.top] - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -package org.maxkey.web.ipregion; - -import org.junit.Test; - -public class IpRegionIpcnTest { - - @Test - public void test(){ - IpRegion ipRegion = new IpRegionIpcn(); - System.out.println(ipRegion.region("117.155.70.59")); - } - -} diff --git a/maxkey-core/src/test/java/org/maxkey/web/ipregion/IpRegionPconlineTest.java b/maxkey-core/src/test/java/org/maxkey/web/ipregion/IpRegionPconlineTest.java deleted file mode 100644 index 60d2a7df..00000000 --- a/maxkey-core/src/test/java/org/maxkey/web/ipregion/IpRegionPconlineTest.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright [2022] [MaxKey of copyright http://www.maxkey.top] - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -package org.maxkey.web.ipregion; - -import org.junit.Test; - -public class IpRegionPconlineTest { - - @Test - public void test(){ - IpRegion ipRegion = new IpRegionPconline(); - System.out.println(ipRegion.region("117.155.70.59")); - } - -} -- GitLab