Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wecloud_im_server
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hewei
wecloud_im_server
Commits
f3f8e44a
Commit
f3f8e44a
authored
Jan 27, 2022
by
lixiaozhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化代码结构。发现重复的utils,合并
parent
6c5b3d30
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
31 additions
and
244 deletions
+31
-244
bootstrap/src/main/java/io/geekidea/springbootplus/config/NacosConfig.java
+1
-1
bootstrap/src/test/java/io/geekidea/springbootplus/test/GetIpTest.java
+1
-1
core/src/main/java/com/wecloud/im/campusstore/ArrayJsonHandler.java
+0
-57
core/src/main/java/com/wecloud/im/campusstore/ObjectJsonHandler.java
+0
-58
core/src/main/java/com/wecloud/im/thousandchat/cache/ThousandChatCacheManager.java
+2
-2
core/src/main/java/com/wecloud/im/ws/cache/UserStateCacheManager.java
+4
-4
core/src/main/java/com/wecloud/im/ws/sender/ChannelSender.java
+4
-4
core/src/main/java/com/wecloud/im/ws/utils/InitIp.java
+0
-102
core/src/main/java/com/wecloud/utils/GetIpUtils.java
+19
-15
No files found.
bootstrap/src/main/java/io/geekidea/springbootplus/config/NacosConfig.java
View file @
f3f8e44a
...
@@ -5,7 +5,7 @@ import com.alibaba.cloud.nacos.NacosDiscoveryProperties;
...
@@ -5,7 +5,7 @@ import com.alibaba.cloud.nacos.NacosDiscoveryProperties;
import
com.alibaba.cloud.nacos.NacosServiceManager
;
import
com.alibaba.cloud.nacos.NacosServiceManager
;
import
com.alibaba.cloud.nacos.discovery.NacosWatch
;
import
com.alibaba.cloud.nacos.discovery.NacosWatch
;
import
com.alibaba.nacos.api.naming.PreservedMetadataKeys
;
import
com.alibaba.nacos.api.naming.PreservedMetadataKeys
;
import
com.wecloud.
im.register
.GetIpUtils
;
import
com.wecloud.
utils
.GetIpUtils
;
import
org.springframework.beans.factory.ObjectProvider
;
import
org.springframework.beans.factory.ObjectProvider
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
;
...
...
bootstrap/src/test/java/io/geekidea/springbootplus/test/GetIpTest.java
View file @
f3f8e44a
...
@@ -20,7 +20,7 @@ import com.alibaba.nacos.api.exception.NacosException;
...
@@ -20,7 +20,7 @@ import com.alibaba.nacos.api.exception.NacosException;
import
com.alibaba.nacos.api.naming.NamingFactory
;
import
com.alibaba.nacos.api.naming.NamingFactory
;
import
com.alibaba.nacos.api.naming.NamingService
;
import
com.alibaba.nacos.api.naming.NamingService
;
import
com.alibaba.nacos.api.naming.pojo.Instance
;
import
com.alibaba.nacos.api.naming.pojo.Instance
;
import
com.wecloud.
im.register
.GetIpUtils
;
import
com.wecloud.
utils
.GetIpUtils
;
import
io.geekidea.springbootplus.SpringBootPlusApplication
;
import
io.geekidea.springbootplus.SpringBootPlusApplication
;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
...
...
core/src/main/java/com/wecloud/im/campusstore/ArrayJsonHandler.java
deleted
100644 → 0
View file @
6c5b3d30
package
com
.
wecloud
.
im
.
campusstore
;
import
com.alibaba.fastjson.JSONArray
;
import
org.apache.ibatis.type.BaseTypeHandler
;
import
org.apache.ibatis.type.JdbcType
;
import
org.apache.ibatis.type.MappedJdbcTypes
;
import
org.apache.ibatis.type.MappedTypes
;
import
java.sql.CallableStatement
;
import
java.sql.PreparedStatement
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
/**
* @description 用以mysql中json格式的字段,进行转换的自定义转换器,转换为实体类的JSONArray属性
* MappedTypes注解中的类代表此转换器可以自动转换为的java对象
* MappedJdbcTypes注解中设置的是对应的jdbctype
*/
@MappedTypes
(
JSONArray
.
class
)
@MappedJdbcTypes
(
JdbcType
.
VARCHAR
)
public
class
ArrayJsonHandler
extends
BaseTypeHandler
<
JSONArray
>
{
//设置非空参数
@Override
public
void
setNonNullParameter
(
PreparedStatement
ps
,
int
i
,
JSONArray
parameter
,
JdbcType
jdbcType
)
throws
SQLException
{
ps
.
setString
(
i
,
String
.
valueOf
(
parameter
.
toJSONString
()));
}
//根据列名,获取可以为空的结果
@Override
public
JSONArray
getNullableResult
(
ResultSet
rs
,
String
columnName
)
throws
SQLException
{
String
sqlJson
=
rs
.
getString
(
columnName
);
if
(
null
!=
sqlJson
)
{
return
JSONArray
.
parseArray
(
sqlJson
);
}
return
null
;
}
//根据列索引,获取可以为空的结果
@Override
public
JSONArray
getNullableResult
(
ResultSet
rs
,
int
columnIndex
)
throws
SQLException
{
String
sqlJson
=
rs
.
getString
(
columnIndex
);
if
(
null
!=
sqlJson
)
{
return
JSONArray
.
parseArray
(
sqlJson
);
}
return
null
;
}
@Override
public
JSONArray
getNullableResult
(
CallableStatement
cs
,
int
columnIndex
)
throws
SQLException
{
String
sqlJson
=
cs
.
getString
(
columnIndex
);
if
(
null
!=
sqlJson
)
{
return
JSONArray
.
parseArray
(
sqlJson
);
}
return
null
;
}
}
core/src/main/java/com/wecloud/im/campusstore/ObjectJsonHandler.java
deleted
100644 → 0
View file @
6c5b3d30
package
com
.
wecloud
.
im
.
campusstore
;
import
com.alibaba.fastjson.JSONObject
;
import
org.apache.ibatis.type.BaseTypeHandler
;
import
org.apache.ibatis.type.JdbcType
;
import
org.apache.ibatis.type.MappedJdbcTypes
;
import
org.apache.ibatis.type.MappedTypes
;
import
java.sql.CallableStatement
;
import
java.sql.PreparedStatement
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
/**
* @description 用以mysql中json格式的字段,进行转换的自定义转换器,转换为实体类的JSONObject属性
* MappedTypes注解中的类代表此转换器可以自动转换为的java对象
* MappedJdbcTypes注解中设置的是对应的jdbctype
*/
@MappedTypes
(
JSONObject
.
class
)
@MappedJdbcTypes
(
JdbcType
.
VARCHAR
)
public
class
ObjectJsonHandler
extends
BaseTypeHandler
<
JSONObject
>
{
//设置非空参数
@Override
public
void
setNonNullParameter
(
PreparedStatement
ps
,
int
i
,
JSONObject
parameter
,
JdbcType
jdbcType
)
throws
SQLException
{
ps
.
setString
(
i
,
String
.
valueOf
(
parameter
.
toJSONString
()));
}
//根据列名,获取可以为空的结果
@Override
public
JSONObject
getNullableResult
(
ResultSet
rs
,
String
columnName
)
throws
SQLException
{
String
sqlJson
=
rs
.
getString
(
columnName
);
if
(
null
!=
sqlJson
)
{
return
JSONObject
.
parseObject
(
sqlJson
);
}
return
null
;
}
//根据列索引,获取可以为空的结果
@Override
public
JSONObject
getNullableResult
(
ResultSet
rs
,
int
columnIndex
)
throws
SQLException
{
String
sqlJson
=
rs
.
getString
(
columnIndex
);
if
(
null
!=
sqlJson
)
{
return
JSONObject
.
parseObject
(
sqlJson
);
}
return
null
;
}
@Override
public
JSONObject
getNullableResult
(
CallableStatement
cs
,
int
columnIndex
)
throws
SQLException
{
String
sqlJson
=
cs
.
getString
(
columnIndex
);
if
(
null
!=
sqlJson
)
{
return
JSONObject
.
parseObject
(
sqlJson
);
}
return
null
;
}
}
core/src/main/java/com/wecloud/im/thousandchat/cache/ThousandChatCacheManager.java
View file @
f3f8e44a
package
com
.
wecloud
.
im
.
thousandchat
.
cache
;
package
com
.
wecloud
.
im
.
thousandchat
.
cache
;
import
com.wecloud.utils.GetIpUtils
;
import
com.wecloud.im.service.ImConversationMembersService
;
import
com.wecloud.im.service.ImConversationMembersService
;
import
com.wecloud.im.ws.cache.UserStateListener
;
import
com.wecloud.im.ws.cache.UserStateListener
;
import
com.wecloud.im.ws.utils.InitIp
;
import
com.wecloud.im.ws.utils.RedisUtils
;
import
com.wecloud.im.ws.utils.RedisUtils
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -37,7 +37,7 @@ public class ThousandChatCacheManager extends UserStateListener {
...
@@ -37,7 +37,7 @@ public class ThousandChatCacheManager extends UserStateListener {
public
void
onLineEvent
(
Long
clientId
,
Integer
platform
,
String
longChannelId
)
{
public
void
onLineEvent
(
Long
clientId
,
Integer
platform
,
String
longChannelId
)
{
List
<
Long
>
thousandGroupIds
=
imConversationMembersService
.
findThousandGroupsByClientId
(
clientId
);
List
<
Long
>
thousandGroupIds
=
imConversationMembersService
.
findThousandGroupsByClientId
(
clientId
);
for
(
Long
thousandGroupId
:
thousandGroupIds
)
{
for
(
Long
thousandGroupId
:
thousandGroupIds
)
{
redisUtils
.
hashset
(
GROUP_KEY
+
thousandGroupId
,
clientId
+
RedisUtils
.
SPLIT
+
platform
,
InitIp
.
lAN_IP
,
redisUtils
.
hashset
(
GROUP_KEY
+
thousandGroupId
,
clientId
+
RedisUtils
.
SPLIT
+
platform
,
GetIpUtils
.
getlanIp
()
,
150
,
TimeUnit
.
DAYS
);
150
,
TimeUnit
.
DAYS
);
}
}
...
...
core/src/main/java/com/wecloud/im/ws/cache/UserStateCacheManager.java
View file @
f3f8e44a
package
com
.
wecloud
.
im
.
ws
.
cache
;
package
com
.
wecloud
.
im
.
ws
.
cache
;
import
com.wecloud.utils.GetIpUtils
;
import
com.wecloud.im.ws.model.redis.ClientChannelInfo
;
import
com.wecloud.im.ws.model.redis.ClientChannelInfo
;
import
com.wecloud.im.ws.utils.InitIp
;
import
com.wecloud.im.ws.utils.RedisUtils
;
import
com.wecloud.im.ws.utils.RedisUtils
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -32,7 +32,7 @@ public class UserStateCacheManager extends UserStateListener {
...
@@ -32,7 +32,7 @@ public class UserStateCacheManager extends UserStateListener {
@Override
@Override
public
void
onLineEvent
(
Long
clientId
,
Integer
platform
,
String
longChannelId
)
{
public
void
onLineEvent
(
Long
clientId
,
Integer
platform
,
String
longChannelId
)
{
log
.
info
(
"ws用户上线保存redis连接ip: {}, uid: {}"
,
InitIp
.
lAN_IP
,
longChannelId
);
log
.
info
(
"ws用户上线保存redis连接ip: {}, uid: {}"
,
GetIpUtils
.
getlanIp
()
,
longChannelId
);
// 先删除旧的重复的platform
// 先删除旧的重复的platform
Set
<
String
>
platformAndIps
=
redisUtils
.
getForSetMembers
(
getUserStateCacheKey
(
clientId
));
Set
<
String
>
platformAndIps
=
redisUtils
.
getForSetMembers
(
getUserStateCacheKey
(
clientId
));
for
(
String
platformAndIp
:
platformAndIps
)
{
for
(
String
platformAndIp
:
platformAndIps
)
{
...
@@ -43,13 +43,13 @@ public class UserStateCacheManager extends UserStateListener {
...
@@ -43,13 +43,13 @@ public class UserStateCacheManager extends UserStateListener {
}
}
}
}
redisUtils
.
addForSet
(
getUserStateCacheKey
(
clientId
),
platform
+
RedisUtils
.
SPLIT
+
InitIp
.
lAN_IP
,
10
,
TimeUnit
.
DAYS
);
redisUtils
.
addForSet
(
getUserStateCacheKey
(
clientId
),
platform
+
RedisUtils
.
SPLIT
+
GetIpUtils
.
getlanIp
()
,
10
,
TimeUnit
.
DAYS
);
}
}
@Override
@Override
public
void
offlineEvent
(
Long
clientId
,
Integer
platform
,
String
longChannelId
)
{
public
void
offlineEvent
(
Long
clientId
,
Integer
platform
,
String
longChannelId
)
{
log
.
info
(
"ws用户离线删除redis key,uid:"
+
longChannelId
);
log
.
info
(
"ws用户离线删除redis key,uid:"
+
longChannelId
);
redisUtils
.
removeForSet
(
getUserStateCacheKey
(
clientId
),
platform
+
RedisUtils
.
SPLIT
+
InitIp
.
lAN_IP
);
redisUtils
.
removeForSet
(
getUserStateCacheKey
(
clientId
),
platform
+
RedisUtils
.
SPLIT
+
GetIpUtils
.
getlanIp
()
);
}
}
/**
/**
...
...
core/src/main/java/com/wecloud/im/ws/sender/ChannelSender.java
View file @
f3f8e44a
package
com
.
wecloud
.
im
.
ws
.
sender
;
package
com
.
wecloud
.
im
.
ws
.
sender
;
import
com.wecloud.im.executor.SendMsgThreadPool
;
import
com.wecloud.im.executor.SendMsgThreadPool
;
import
com.wecloud.utils.GetIpUtils
;
import
com.wecloud.im.router.RouterSendService
;
import
com.wecloud.im.router.RouterSendService
;
import
com.wecloud.im.ws.cache.UserStateCacheManager
;
import
com.wecloud.im.ws.cache.UserStateCacheManager
;
import
com.wecloud.im.ws.manager.ChannelManager
;
import
com.wecloud.im.ws.model.ClientInfo
;
import
com.wecloud.im.ws.model.ClientInfo
;
import
com.wecloud.im.ws.model.WsResponse
;
import
com.wecloud.im.ws.model.WsResponse
;
import
com.wecloud.im.ws.model.redis.ClientChannelInfo
;
import
com.wecloud.im.ws.model.redis.ClientChannelInfo
;
import
com.wecloud.im.ws.model.request.ReceiveVO
;
import
com.wecloud.im.ws.model.request.ReceiveVO
;
import
com.wecloud.im.ws.manager.ChannelManager
;
import
com.wecloud.im.ws.utils.InitIp
;
import
com.wecloud.utils.JsonUtils
;
import
com.wecloud.utils.JsonUtils
;
import
io.geekidea.springbootplus.framework.common.api.ApiCode
;
import
io.geekidea.springbootplus.framework.common.api.ApiCode
;
import
io.geekidea.springbootplus.framework.common.api.ApiResult
;
import
io.geekidea.springbootplus.framework.common.api.ApiResult
;
...
@@ -99,7 +99,7 @@ public class ChannelSender {
...
@@ -99,7 +99,7 @@ public class ChannelSender {
*/
*/
public
void
batchSendMsg
(
WsResponse
responseModel
,
String
toIp
,
List
<
String
>
toClientIdAndPlatforms
)
{
public
void
batchSendMsg
(
WsResponse
responseModel
,
String
toIp
,
List
<
String
>
toClientIdAndPlatforms
)
{
// 是否为当前机器的ip
// 是否为当前机器的ip
if
(
InitIp
.
lAN_IP
.
equals
(
toIp
))
{
if
(
GetIpUtils
.
getlanIp
()
.
equals
(
toIp
))
{
String
msgJson
=
JsonUtils
.
encodeJson
(
responseModel
);
String
msgJson
=
JsonUtils
.
encodeJson
(
responseModel
);
batchSendMsgLocal
(
toClientIdAndPlatforms
,
msgJson
);
batchSendMsgLocal
(
toClientIdAndPlatforms
,
msgJson
);
}
else
{
}
else
{
...
@@ -128,7 +128,7 @@ public class ChannelSender {
...
@@ -128,7 +128,7 @@ public class ChannelSender {
for
(
Map
.
Entry
<
String
,
List
<
ClientChannelInfo
>>
channelInfoEntry
:
ipChannels
.
entrySet
())
{
for
(
Map
.
Entry
<
String
,
List
<
ClientChannelInfo
>>
channelInfoEntry
:
ipChannels
.
entrySet
())
{
// 是否为当前机器的ip
// 是否为当前机器的ip
if
(
InitIp
.
lAN_IP
.
equals
(
channelInfoEntry
.
getKey
()))
{
if
(
GetIpUtils
.
getlanIp
()
.
equals
(
channelInfoEntry
.
getKey
()))
{
// 调用本地下发
// 调用本地下发
for
(
ClientChannelInfo
clientChannelInfo
:
channelInfoEntry
.
getValue
())
{
for
(
ClientChannelInfo
clientChannelInfo
:
channelInfoEntry
.
getValue
())
{
this
.
sendMsgLocal
(
toClientId
,
clientChannelInfo
.
getPlatform
(),
msgJson
);
this
.
sendMsgLocal
(
toClientId
,
clientChannelInfo
.
getPlatform
(),
msgJson
);
...
...
core/src/main/java/com/wecloud/im/ws/utils/InitIp.java
deleted
100644 → 0
View file @
6c5b3d30
package
com
.
wecloud
.
im
.
ws
.
utils
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.stereotype.Service
;
import
java.net.InetAddress
;
import
java.net.NetworkInterface
;
import
java.net.SocketException
;
import
java.util.Enumeration
;
@Slf4j
@Service
public
class
InitIp
{
/**
* 排除无效的mac地址
*/
private
final
static
byte
[][]
INVALID_MACS
=
{
{
0x00
,
0x05
,
0x69
},
// VMWare
{
0x00
,
0x1C
,
0x14
},
// VMWare
{
0x00
,
0x0C
,
0x29
},
// VMWare
{
0x00
,
0x50
,
0x56
},
// VMWare
{
0x08
,
0x00
,
0x27
},
// Virtualbox
{
0x0A
,
0x00
,
0x27
},
// Virtualbox
{
0x00
,
0x03
,
(
byte
)
0xFF
},
// Virtual-PC
{
0x00
,
0x15
,
0x5D
}
// Hyper-V
};
/**
* 内网ip
*/
public
static
String
lAN_IP
;
// 获取机器内网ip
static
{
lAN_IP
=
getLocalIpAddress
();
log
.
info
(
"lAN_IP:"
+
lAN_IP
);
}
/**
* 判断是否为虚拟mac地址
*
* @param mac
* @return
*/
public
static
boolean
isVmMac
(
byte
[]
mac
)
{
if
(
null
==
mac
)
{
return
false
;
}
for
(
byte
[]
invalid
:
INVALID_MACS
)
{
if
(
invalid
[
0
]
==
mac
[
0
]
&&
invalid
[
1
]
==
mac
[
1
]
&&
invalid
[
2
]
==
mac
[
2
])
{
return
true
;
}
}
return
false
;
}
/**
* 获取本机地址
*/
private
static
String
getLocalIpAddress
()
{
try
{
Enumeration
<
NetworkInterface
>
networkInterfaces
=
NetworkInterface
.
getNetworkInterfaces
();
while
(
networkInterfaces
.
hasMoreElements
())
{
NetworkInterface
ni
=
networkInterfaces
.
nextElement
();
/*
排除docker虚拟网卡
*/
String
docker0
=
"docker0"
;
if
(
ni
.
getName
().
equals
(
docker0
))
{
continue
;
}
if
(!
ni
.
isUp
()
||
ni
.
isLoopback
()
||
ni
.
isVirtual
())
{
continue
;
}
if
(
isVmMac
(
ni
.
getHardwareAddress
()))
{
continue
;
}
Enumeration
<
InetAddress
>
inetAddresses
=
ni
.
getInetAddresses
();
while
(
inetAddresses
.
hasMoreElements
())
{
InetAddress
inetAddress
=
inetAddresses
.
nextElement
();
if
(
inetAddress
.
isLinkLocalAddress
())
{
continue
;
}
return
inetAddress
.
getHostAddress
();
}
}
}
catch
(
SocketException
e
)
{
log
.
info
(
"获取本机IP地址失败。"
+
e
);
}
return
StringUtils
.
EMPTY
;
}
}
core/src/main/java/com/wecloud/
im/register
/GetIpUtils.java
→
core/src/main/java/com/wecloud/
utils
/GetIpUtils.java
View file @
f3f8e44a
package
com
.
wecloud
.
im
.
register
;
package
com
.
wecloud
.
utils
;
import
cn.hutool.http.HttpUtil
;
import
cn.hutool.http.HttpUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
...
@@ -40,20 +40,9 @@ public class GetIpUtils {
...
@@ -40,20 +40,9 @@ public class GetIpUtils {
private
String
serverType
;
private
String
serverType
;
/**
/**
* 判断是否为虚拟mac地址
*
* @param mac
* @return
*/
private
static
boolean
isVmMac
(
byte
[]
mac
)
{
if
(
null
==
mac
)
{
return
false
;
}
/*
* 排除无效的mac地址
* 排除无效的mac地址
*/
*/
byte
[][]
invalidMacs
=
{
private
final
static
byte
[][]
INVALID_MACS
=
{
{
0x00
,
0x05
,
0x69
},
// VMWare
{
0x00
,
0x05
,
0x69
},
// VMWare
{
0x00
,
0x1C
,
0x14
},
// VMWare
{
0x00
,
0x1C
,
0x14
},
// VMWare
{
0x00
,
0x0C
,
0x29
},
// VMWare
{
0x00
,
0x0C
,
0x29
},
// VMWare
...
@@ -64,7 +53,18 @@ public class GetIpUtils {
...
@@ -64,7 +53,18 @@ public class GetIpUtils {
{
0x00
,
0x15
,
0x5D
}
// Hyper-V
{
0x00
,
0x15
,
0x5D
}
// Hyper-V
};
};
for
(
byte
[]
invalid
:
invalidMacs
)
{
/**
* 判断是否为虚拟mac地址
*
* @param mac
* @return
*/
private
static
boolean
isVmMac
(
byte
[]
mac
)
{
if
(
null
==
mac
)
{
return
false
;
}
for
(
byte
[]
invalid
:
INVALID_MACS
)
{
if
(
invalid
[
0
]
==
mac
[
0
]
&&
invalid
[
1
]
==
mac
[
1
]
&&
invalid
[
2
]
==
mac
[
2
])
{
if
(
invalid
[
0
]
==
mac
[
0
]
&&
invalid
[
1
]
==
mac
[
1
]
&&
invalid
[
2
]
==
mac
[
2
])
{
return
true
;
return
true
;
}
}
...
@@ -118,11 +118,15 @@ public class GetIpUtils {
...
@@ -118,11 +118,15 @@ public class GetIpUtils {
*
*
* @return
* @return
*/
*/
public
String
getlanIp
()
{
public
static
String
getlanIp
()
{
if
(
lAN_IP
==
null
)
{
if
(
lAN_IP
==
null
)
{
synchronized
(
GetIpUtils
.
class
)
{
if
(
lAN_IP
==
null
)
{
lAN_IP
=
getLocalIpAddress
();
lAN_IP
=
getLocalIpAddress
();
}
}
}
}
return
lAN_IP
;
return
lAN_IP
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment