mirror of
https://github.com/qaiu/netdisk-fast-download.git
synced 2025-12-16 20:33:03 +00:00
1. 代理配置
This commit is contained in:
@@ -6,11 +6,9 @@ import io.vertx.core.Future;
|
||||
import io.vertx.core.Handler;
|
||||
import io.vertx.core.Promise;
|
||||
import io.vertx.core.json.DecodeException;
|
||||
import io.vertx.core.json.Json;
|
||||
import io.vertx.core.json.JsonObject;
|
||||
import io.vertx.core.net.ProxyOptions;
|
||||
import io.vertx.core.net.ProxyType;
|
||||
import io.vertx.core.net.impl.VertxHandler;
|
||||
import io.vertx.ext.web.client.HttpResponse;
|
||||
import io.vertx.ext.web.client.WebClient;
|
||||
import io.vertx.ext.web.client.WebClientOptions;
|
||||
@@ -21,7 +19,6 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 解析器抽象类包含promise, HTTP Client, 默认失败方法等;
|
||||
@@ -77,7 +74,7 @@ public abstract class PanBase implements IPanTool {
|
||||
proxyOptions.setUsername(proxy.getString("username"));
|
||||
}
|
||||
if (StringUtils.isNotEmpty(proxy.getString("password"))) {
|
||||
proxyOptions.setUsername(proxy.getString("password"));
|
||||
proxyOptions.setPassword(proxy.getString("password"));
|
||||
}
|
||||
this.client = WebClient.create(WebClientVertxInit.get(),
|
||||
new WebClientOptions()
|
||||
|
||||
@@ -48,18 +48,19 @@ public class AppMain {
|
||||
if (jsonObject.containsKey(ConfigConstant.PROXY)) {
|
||||
LocalMap<Object, Object> localMap = VertxHolder.getVertxInstance().sharedData().getLocalMap(LOCAL);
|
||||
JsonArray proxyJsonArray = jsonObject.getJsonArray(ConfigConstant.PROXY);
|
||||
if (proxyJsonArray != null) {
|
||||
proxyJsonArray.forEach(proxyJson -> {
|
||||
String panTypes = ((JsonObject)proxyJson).getString("panTypes");
|
||||
|
||||
proxyJsonArray.forEach(proxyJson -> {
|
||||
String panTypes = ((JsonObject)proxyJson).getString("panTypes");
|
||||
|
||||
if (!panTypes.isEmpty()) {
|
||||
JsonObject jsonObject1 = new JsonObject();
|
||||
for (String s : panTypes.split(",")) {
|
||||
jsonObject1.put(s, proxyJson);
|
||||
if (!panTypes.isEmpty()) {
|
||||
JsonObject jsonObject1 = new JsonObject();
|
||||
for (String s : panTypes.split(",")) {
|
||||
jsonObject1.put(s, proxyJson);
|
||||
}
|
||||
localMap.put("proxy", jsonObject1);
|
||||
}
|
||||
localMap.put("proxy", jsonObject1);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user