package com.qianwen.smartman.common.config;
|
|
import cn.hutool.core.lang.Tuple;
|
import com.dtflys.forest.callback.AddressSource;
|
import com.dtflys.forest.http.ForestAddress;
|
import com.dtflys.forest.http.ForestRequest;
|
import java.net.MalformedURLException;
|
import java.net.URL;
|
import com.qianwen.smartman.common.cache.ParamCache;
|
import com.qianwen.smartman.common.constant.CommonConstant;
|
|
/* loaded from: blade-api.jar:BOOT-INF/classes/org/springblade/common/config/ForestConfig.class */
|
public class ForestConfig implements AddressSource {
|
public ForestAddress getAddress(ForestRequest forestRequest) {
|
String value = ParamCache.getValue(CommonConstant.DMP_CONFIG_NAME);
|
Tuple tuple = getIpPort(value);
|
return new ForestAddress((String) tuple.get(0), (Integer) tuple.get(1));
|
}
|
|
private Tuple getIpPort(String value) {
|
try {
|
URL url = new URL(value);
|
return new Tuple(new Object[]{url.getHost(), Integer.valueOf(url.getPort())});
|
} catch (MalformedURLException e) {
|
return new Tuple(new Object[0]);
|
}
|
}
|
}
|