Skip to content
This repository was archived by the owner on Jul 21, 2024. It is now read-only.

Commit 6780709

Browse files
committed
3.0.6 优化网络解析
1 parent f135f93 commit 6780709

File tree

11 files changed

+42
-3
lines changed

11 files changed

+42
-3
lines changed

aliyundrive-sdk-openapi/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ dependencies {
3535
compileOnly 'com.squareup.okhttp3:logging-interceptor:3.12.13' //api19
3636
testImplementation 'com.squareup.okhttp3:okhttp:3.12.13' //api19
3737
testImplementation 'com.squareup.okhttp3:logging-interceptor:3.12.13' //api19
38+
implementation 'dnsjava:dnsjava:3.5.2'
3839
}
3940

4041
test {

aliyundrive-sdk-openapi/src/main/java/net/xdow/aliyundrive/impl/AliyunDriveOpenApiImplV1.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@
1414
import net.xdow.aliyundrive.util.JsonUtils;
1515
import net.xdow.aliyundrive.util.StringUtils;
1616
import okhttp3.*;
17+
import org.xbill.DNS.Address;
1718

1819
import java.io.IOException;
20+
import java.net.InetAddress;
21+
import java.net.UnknownHostException;
1922
import java.util.*;
2023
import java.util.concurrent.TimeUnit;
2124

@@ -63,6 +66,15 @@ public Response intercept(Chain chain) throws IOException {
6366
.readTimeout(1, TimeUnit.MINUTES)
6467
.writeTimeout(1, TimeUnit.MINUTES)
6568
.connectTimeout(1, TimeUnit.MINUTES)
69+
.dns(new Dns() {
70+
@Override
71+
public List<InetAddress> lookup(String hostname) throws UnknownHostException {
72+
return Arrays.asList(Address.getAllByName(hostname));
73+
}
74+
})
75+
.followRedirects(true)
76+
.followSslRedirects(true)
77+
.retryOnConnectionFailure(true)
6678
.build();
6779
}
6880

aliyundrive-sdk-webapi/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ dependencies {
3434
compileOnly 'com.squareup.okhttp3:logging-interceptor:3.12.13' //api19
3535
implementation 'org.slf4j:slf4j-api:2.0.6'
3636
implementation project(':aliyundrive-sdk-openapi')
37+
implementation 'dnsjava:dnsjava:3.5.2'
3738
}
3839

3940
test {

aliyundrive-sdk-webapi/src/main/java/net/xdow/aliyundrive/webapi/impl/AliyunDriveWebApiImplV1.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,11 @@
1818
import okhttp3.*;
1919
import org.slf4j.Logger;
2020
import org.slf4j.LoggerFactory;
21+
import org.xbill.DNS.Address;
2122

2223
import java.io.IOException;
24+
import java.net.InetAddress;
25+
import java.net.UnknownHostException;
2326
import java.util.*;
2427
import java.util.concurrent.TimeUnit;
2528

@@ -103,6 +106,15 @@ public Request authenticate(Route route, Response response) throws IOException {
103106
.readTimeout(1, TimeUnit.MINUTES)
104107
.writeTimeout(1, TimeUnit.MINUTES)
105108
.connectTimeout(1, TimeUnit.MINUTES)
109+
.dns(new Dns() {
110+
@Override
111+
public List<InetAddress> lookup(String hostname) throws UnknownHostException {
112+
return Arrays.asList(Address.getAllByName(hostname));
113+
}
114+
})
115+
.followRedirects(true)
116+
.followSslRedirects(true)
117+
.retryOnConnectionFailure(true)
106118
.build();
107119
}
108120

aliyundrive-webdav-internal/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ dependencies {
4040
implementation 'com.google.guava:guava:20.0' //java7
4141
compileOnly 'com.squareup.okhttp3:okhttp:3.12.13' //api19
4242
compileOnly 'com.squareup.okhttp3:logging-interceptor:3.12.13' //api19
43+
implementation 'dnsjava:dnsjava:3.5.2'
4344
}
4445

4546
test {

aliyundrive-webdav-internal/src/main/java/com/github/zxbu/webdavteambition/store/AliyunDriveClientService.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import org.jetbrains.annotations.Nullable;
2828
import org.slf4j.Logger;
2929
import org.slf4j.LoggerFactory;
30+
import org.xbill.DNS.config.PropertyResolverConfigProvider;
3031

3132
import java.io.File;
3233
import java.io.IOException;
@@ -59,6 +60,7 @@ public Set<AliyunDriveFileInfo> load(String key) throws Exception {
5960
private final T mAliyunDrive;
6061

6162
public AliyunDriveClientService(Class<? extends IAliyunDrive> aliyunDriveCls, AliyunDriveProperties aliyunDriveProperties) {
63+
System.setProperty(PropertyResolverConfigProvider.DNS_SERVER_PROP, "223.5.5.5,114.114.114.114");
6264
this.mAliyunDriveProperties = aliyunDriveProperties;
6365
this.mAliyunDrive = (T) AliyunDrive.newAliyunDrive(aliyunDriveCls);
6466
this.mAliyunDrive.setAuthorizer(this);

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ plugins {
66
}
77

88
group 'com.github'
9-
version '3.0.5'
9+
version '3.0.6'
1010
sourceCompatibility = '17'
1111

1212
configurations {
File renamed without changes.

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ services:
66
restart: always
77
volumes:
88
- /etc/localtime:/etc/localtime
9-
- ./docker/conf:/conf
9+
- ./conf:/conf
1010
ports:
1111
- "8080:8080"
1212
tty: true

ext/script/docker_up.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
set -e
3+
cd ${0%/*}
4+
cd ../../
5+
docker compose up -d --pull always
6+
docker compose logs -f

0 commit comments

Comments
 (0)