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