Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
yujianwangzivayy
MaxKey
提交
4537ac63
MaxKey
项目概览
yujianwangzivayy
/
MaxKey
与 Fork 源项目一致
Fork自
MaxKey单点登录官方(MaxKeyTop) / MaxKey
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
MaxKey
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
4537ac63
编写于
5月 27, 2022
作者:
M
MaxKey
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
copyright
上级
8976e9db
变更
21
隐藏空白更改
内联
并排
Showing
21 changed file
with
1 addition
and
792 deletion
+1
-792
LICENSE
LICENSE
+1
-1
maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/realm/AbstractAuthenticationRealm.java
...a/org/maxkey/authn/realm/AbstractAuthenticationRealm.java
+0
-4
maxkey-core/src/main/java/org/maxkey/web/ipregion/AbstractIpRegion.java
...c/main/java/org/maxkey/web/ipregion/AbstractIpRegion.java
+0
-35
maxkey-core/src/main/java/org/maxkey/web/ipregion/IpRegion.java
...-core/src/main/java/org/maxkey/web/ipregion/IpRegion.java
+0
-33
maxkey-core/src/main/java/org/maxkey/web/ipregion/IpRegionFactory.java
...rc/main/java/org/maxkey/web/ipregion/IpRegionFactory.java
+0
-74
maxkey-core/src/main/java/org/maxkey/web/ipregion/IpRegionIp138.java
.../src/main/java/org/maxkey/web/ipregion/IpRegionIp138.java
+0
-54
maxkey-core/src/main/java/org/maxkey/web/ipregion/IpRegionIp138Response.java
...n/java/org/maxkey/web/ipregion/IpRegionIp138Response.java
+0
-77
maxkey-core/src/main/java/org/maxkey/web/ipregion/IpRegionIp360.java
.../src/main/java/org/maxkey/web/ipregion/IpRegionIp360.java
+0
-55
maxkey-core/src/main/java/org/maxkey/web/ipregion/IpRegionIp360Response.java
...n/java/org/maxkey/web/ipregion/IpRegionIp360Response.java
+0
-57
maxkey-core/src/main/java/org/maxkey/web/ipregion/IpRegionIpchaxun.java
...c/main/java/org/maxkey/web/ipregion/IpRegionIpchaxun.java
+0
-51
maxkey-core/src/main/java/org/maxkey/web/ipregion/IpRegionIpcn.java
...e/src/main/java/org/maxkey/web/ipregion/IpRegionIpcn.java
+0
-48
maxkey-core/src/main/java/org/maxkey/web/ipregion/IpRegionLocal.java
.../src/main/java/org/maxkey/web/ipregion/IpRegionLocal.java
+0
-29
maxkey-core/src/main/java/org/maxkey/web/ipregion/IpRegionPconline.java
...c/main/java/org/maxkey/web/ipregion/IpRegionPconline.java
+0
-35
maxkey-core/src/main/java/org/maxkey/web/ipregion/IpRegionPconlineResponse.java
...ava/org/maxkey/web/ipregion/IpRegionPconlineResponse.java
+0
-37
maxkey-core/src/main/java/org/maxkey/web/ipregion/package-info.java
...e/src/main/java/org/maxkey/web/ipregion/package-info.java
+0
-18
maxkey-core/src/test/java/org/maxkey/web/ipregion/IpRegionFactoryTest.java
...est/java/org/maxkey/web/ipregion/IpRegionFactoryTest.java
+0
-34
maxkey-core/src/test/java/org/maxkey/web/ipregion/IpRegionIp138Test.java
.../test/java/org/maxkey/web/ipregion/IpRegionIp138Test.java
+0
-30
maxkey-core/src/test/java/org/maxkey/web/ipregion/IpRegionIp360Test.java
.../test/java/org/maxkey/web/ipregion/IpRegionIp360Test.java
+0
-30
maxkey-core/src/test/java/org/maxkey/web/ipregion/IpRegionIpchaxunTest.java
...st/java/org/maxkey/web/ipregion/IpRegionIpchaxunTest.java
+0
-30
maxkey-core/src/test/java/org/maxkey/web/ipregion/IpRegionIpcnTest.java
...c/test/java/org/maxkey/web/ipregion/IpRegionIpcnTest.java
+0
-30
maxkey-core/src/test/java/org/maxkey/web/ipregion/IpRegionPconlineTest.java
...st/java/org/maxkey/web/ipregion/IpRegionPconlineTest.java
+0
-30
未找到文件。
LICENSE
浏览文件 @
4537ac63
...
...
@@ -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.
...
...
maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/realm/AbstractAuthenticationRealm.java
浏览文件 @
4537ac63
...
...
@@ -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
);
...
...
maxkey-core/src/main/java/org/maxkey/web/ipregion/AbstractIpRegion.java
已删除
100644 → 0
浏览文件 @
8976e9db
/*
* 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
++;
};
}
maxkey-core/src/main/java/org/maxkey/web/ipregion/IpRegion.java
已删除
100644 → 0
浏览文件 @
8976e9db
/*
* 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
()
;
}
maxkey-core/src/main/java/org/maxkey/web/ipregion/IpRegionFactory.java
已删除
100644 → 0
浏览文件 @
8976e9db
/*
* 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
<
IpRegion
>
ipRegionList
;
static
{
ipRegionList
=
new
ArrayList
<
IpRegion
>();
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
<
ipRegionList
.
size
()
;
i
++
)
{
IpRegion
ipRegion
=
ipRegionList
.
get
(
i
);
String
region
=
ipRegion
.
region
(
ipAddress
);
if
(
StringUtils
.
isNotBlank
(
region
))
{
return
region
;
}
else
{
if
(
ipRegion
.
getFailCount
()
>
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
;
}
}
maxkey-core/src/main/java/org/maxkey/web/ipregion/IpRegionIp138.java
已删除
100644 → 0
浏览文件 @
8976e9db
/*
* 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
;
}
}
maxkey-core/src/main/java/org/maxkey/web/ipregion/IpRegionIp138Response.java
已删除
100644 → 0
浏览文件 @
8976e9db
/*
* 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
();
}
}
maxkey-core/src/main/java/org/maxkey/web/ipregion/IpRegionIp360.java
已删除
100644 → 0
浏览文件 @
8976e9db
/*
* 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
=
"<body>"
;
public
static
final
String
END
=
"</body>"
;
@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
;
}
}
maxkey-core/src/main/java/org/maxkey/web/ipregion/IpRegionIp360Response.java
已删除
100644 → 0
浏览文件 @
8976e9db
/*
* 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
();
}
}
maxkey-core/src/main/java/org/maxkey/web/ipregion/IpRegionIpchaxun.java
已删除
100644 → 0
浏览文件 @
8976e9db
/*
* 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
;
}
}
maxkey-core/src/main/java/org/maxkey/web/ipregion/IpRegionIpcn.java
已删除
100644 → 0
浏览文件 @
8976e9db
/*
* 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
;
}
}
maxkey-core/src/main/java/org/maxkey/web/ipregion/IpRegionLocal.java
已删除
100644 → 0
浏览文件 @
8976e9db
/*
* 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
;
}
}
maxkey-core/src/main/java/org/maxkey/web/ipregion/IpRegionPconline.java
已删除
100644 → 0
浏览文件 @
8976e9db
/*
* 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
();
}
}
maxkey-core/src/main/java/org/maxkey/web/ipregion/IpRegionPconlineResponse.java
已删除
100644 → 0
浏览文件 @
8976e9db
/*
* 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
()
{
}
}
maxkey-core/src/main/java/org/maxkey/web/ipregion/package-info.java
已删除
100644 → 0
浏览文件 @
8976e9db
/*
* 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
;
maxkey-core/src/test/java/org/maxkey/web/ipregion/IpRegionFactoryTest.java
已删除
100644 → 0
浏览文件 @
8976e9db
/*
* 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"
)
));
}
}
maxkey-core/src/test/java/org/maxkey/web/ipregion/IpRegionIp138Test.java
已删除
100644 → 0
浏览文件 @
8976e9db
/*
* 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"
));
}
}
maxkey-core/src/test/java/org/maxkey/web/ipregion/IpRegionIp360Test.java
已删除
100644 → 0
浏览文件 @
8976e9db
/*
* 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"
));
}
}
maxkey-core/src/test/java/org/maxkey/web/ipregion/IpRegionIpchaxunTest.java
已删除
100644 → 0
浏览文件 @
8976e9db
/*
* 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"
));
}
}
maxkey-core/src/test/java/org/maxkey/web/ipregion/IpRegionIpcnTest.java
已删除
100644 → 0
浏览文件 @
8976e9db
/*
* 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"
));
}
}
maxkey-core/src/test/java/org/maxkey/web/ipregion/IpRegionPconlineTest.java
已删除
100644 → 0
浏览文件 @
8976e9db
/*
* 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"
));
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录