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

Commit

Permalink
3.0.6 优化网络解析
Browse files Browse the repository at this point in the history
  • Loading branch information
eritpchy committed Apr 7, 2023
1 parent f135f93 commit 6780709
Show file tree
Hide file tree
Showing 11 changed files with 42 additions and 3 deletions.
1 change: 1 addition & 0 deletions aliyundrive-sdk-openapi/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ dependencies {
compileOnly 'com.squareup.okhttp3:logging-interceptor:3.12.13' //api19
testImplementation 'com.squareup.okhttp3:okhttp:3.12.13' //api19
testImplementation 'com.squareup.okhttp3:logging-interceptor:3.12.13' //api19
implementation 'dnsjava:dnsjava:3.5.2'
}

test {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@
import net.xdow.aliyundrive.util.JsonUtils;
import net.xdow.aliyundrive.util.StringUtils;
import okhttp3.*;
import org.xbill.DNS.Address;

import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.*;
import java.util.concurrent.TimeUnit;

Expand Down Expand Up @@ -63,6 +66,15 @@ public Response intercept(Chain chain) throws IOException {
.readTimeout(1, TimeUnit.MINUTES)
.writeTimeout(1, TimeUnit.MINUTES)
.connectTimeout(1, TimeUnit.MINUTES)
.dns(new Dns() {
@Override
public List<InetAddress> lookup(String hostname) throws UnknownHostException {
return Arrays.asList(Address.getAllByName(hostname));
}
})
.followRedirects(true)
.followSslRedirects(true)
.retryOnConnectionFailure(true)
.build();
}

Expand Down
1 change: 1 addition & 0 deletions aliyundrive-sdk-webapi/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ dependencies {
compileOnly 'com.squareup.okhttp3:logging-interceptor:3.12.13' //api19
implementation 'org.slf4j:slf4j-api:2.0.6'
implementation project(':aliyundrive-sdk-openapi')
implementation 'dnsjava:dnsjava:3.5.2'
}

test {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@
import okhttp3.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xbill.DNS.Address;

import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.*;
import java.util.concurrent.TimeUnit;

Expand Down Expand Up @@ -103,6 +106,15 @@ public Request authenticate(Route route, Response response) throws IOException {
.readTimeout(1, TimeUnit.MINUTES)
.writeTimeout(1, TimeUnit.MINUTES)
.connectTimeout(1, TimeUnit.MINUTES)
.dns(new Dns() {
@Override
public List<InetAddress> lookup(String hostname) throws UnknownHostException {
return Arrays.asList(Address.getAllByName(hostname));
}
})
.followRedirects(true)
.followSslRedirects(true)
.retryOnConnectionFailure(true)
.build();
}

Expand Down
1 change: 1 addition & 0 deletions aliyundrive-webdav-internal/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ dependencies {
implementation 'com.google.guava:guava:20.0' //java7
compileOnly 'com.squareup.okhttp3:okhttp:3.12.13' //api19
compileOnly 'com.squareup.okhttp3:logging-interceptor:3.12.13' //api19
implementation 'dnsjava:dnsjava:3.5.2'
}

test {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.jetbrains.annotations.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xbill.DNS.config.PropertyResolverConfigProvider;

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

public AliyunDriveClientService(Class<? extends IAliyunDrive> aliyunDriveCls, AliyunDriveProperties aliyunDriveProperties) {
System.setProperty(PropertyResolverConfigProvider.DNS_SERVER_PROP, "223.5.5.5,114.114.114.114");
this.mAliyunDriveProperties = aliyunDriveProperties;
this.mAliyunDrive = (T) AliyunDrive.newAliyunDrive(aliyunDriveCls);
this.mAliyunDrive.setAuthorizer(this);
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
}

group 'com.github'
version '3.0.5'
version '3.0.6'
sourceCompatibility = '17'

configurations {
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ services:
restart: always
volumes:
- /etc/localtime:/etc/localtime
- ./docker/conf:/conf
- ./conf:/conf
ports:
- "8080:8080"
tty: true
Expand Down
6 changes: 6 additions & 0 deletions ext/script/docker_up.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
set -e
cd ${0%/*}
cd ../../
docker compose up -d --pull always
docker compose logs -f
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ public void afterPropertiesSet() throws Exception {
if (StringUtils.isEmpty(this.getDeviceId())) {
this.setDeviceId(UUID.randomUUID().toString().replace("-", "").substring(0, 24));
}
this.setRefreshTokenNext(refreshToken);
if (StringUtils.isEmpty(this.getRefreshToken())) {
this.setRefreshToken(refreshToken);
} else {
this.setRefreshTokenNext(refreshToken);
}
if (StringUtils.isEmpty(this.getAuth().getUserName())) {
this.getAuth().setUserName("admin");
}
Expand Down

0 comments on commit 6780709

Please sign in to comment.