Skip to content

Commit e9c5d40

Browse files
authored
Merge pull request #307 from sxci/v7.3.13
remove happly-dns
2 parents fc17d7a + 568f253 commit e9c5d40

File tree

8 files changed

+19
-141
lines changed

8 files changed

+19
-141
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
#Changelog
22

3+
## 7.3.13 (2018-08-31)
4+
### 修改
5+
* 修复 Android 8.0 net.dns1 属性不能获取问题,即移除依赖 com.qiniu:happy-dns ,保留 dns 设置接口
6+
7+
8+
## 7.3.12 (2018-04-08)
9+
### 修改
10+
* 新建 Dns 类,可以不依赖 com.qiniu:happy-dns
11+
12+
313
## 7.3.11 (2017-03-12)
414
### 增加
515
* 新加坡机房

library/build.gradle

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ android {
3636
}
3737

3838
dependencies {
39-
compile 'com.squareup.okhttp3:okhttp:3.10.0'
40-
compile 'com.qiniu:happy-dns:0.2.13'
39+
compile 'com.squareup.okhttp3:okhttp:3.11.0'
4140
compile fileTree(include: ['*.jar'], dir: 'libs')
4241
}
4342

library/src/androidTest/java/com/qiniu/android/DnsTest.java

Lines changed: 0 additions & 34 deletions
This file was deleted.

library/src/androidTest/java/com/qiniu/android/common/AutoZoneTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public class AutoZoneTest extends AndroidTestCase {
1818
private String bkt = "javasdk";
1919

2020
// public void testHttp() {
21-
// AutoZone zone = new AutoZone(null);
21+
// AutoZone zone = new AutoZone();
2222
// final CountDownLatch countDownLatch = new CountDownLatch(1);
2323
// zone.preQueryIndex(new AutoZone.ZoneIndex(ak, bkt), new Zone.QueryHandler() {
2424
// @Override
@@ -45,7 +45,7 @@ public class AutoZoneTest extends AndroidTestCase {
4545
// }
4646

4747
// public void testHttpFail() {
48-
// AutoZone zone = new AutoZone(null);
48+
// AutoZone zone = new AutoZone();
4949
// ZoneInfo zoneInfo = zone.zoneInfo(ak + "_not_be_ak", bkt);
5050
// assertNull(zoneInfo);
5151
// }
@@ -57,7 +57,7 @@ public void testSplitE() {
5757
}
5858

5959
public void testC1() {
60-
AutoZone autoZone = new AutoZone(null);
60+
AutoZone autoZone = new AutoZone();
6161
final CountDownLatch countDownLatch = new CountDownLatch(1);
6262
autoZone.preQueryIndex(new AutoZone.ZoneIndex(ak, bkt), new Zone.QueryHandler() {
6363
@Override

library/src/main/java/com/qiniu/android/common/AutoZone.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.qiniu.android.common;
22

3-
import com.qiniu.android.dns.DnsManager;
43
import com.qiniu.android.http.Client;
54
import com.qiniu.android.http.CompletionHandler;
65
import com.qiniu.android.http.ResponseInfo;
@@ -22,16 +21,16 @@ public final class AutoZone extends Zone {
2221
/**
2322
* 自动判断机房
2423
*/
25-
public static final AutoZone autoZone = new AutoZone(null);
24+
public static final AutoZone autoZone = new AutoZone();
2625
private final String ucServer;
2726
private Map<ZoneIndex, ZoneInfo> zones = new ConcurrentHashMap<>();
2827
private Client client = new Client();
2928

30-
public AutoZone(DnsManager dns) {
31-
this("https://uc.qbox.me", dns);
29+
public AutoZone() {
30+
this("https://uc.qbox.me");
3231
}
3332

34-
AutoZone(String ucServer, DnsManager dns) {
33+
AutoZone(String ucServer) {
3534
this.ucServer = ucServer;
3635
}
3736

library/src/main/java/com/qiniu/android/common/Constants.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33

44
public final class Constants {
5-
public static final String VERSION = "7.3.12";
5+
public static final String VERSION = "7.3.13";
66

77
public static final String UTF_8 = "utf-8";
88
}

library/src/main/java/com/qiniu/android/storage/Configuration.java

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,11 @@
22

33
import com.qiniu.android.common.AutoZone;
44
import com.qiniu.android.common.Zone;
5-
import com.qiniu.android.dns.DnsManager;
6-
import com.qiniu.android.dns.Domain;
7-
import com.qiniu.android.dns.IResolver;
8-
import com.qiniu.android.dns.NetworkInfo;
9-
import com.qiniu.android.dns.local.AndroidDnsServer;
10-
import com.qiniu.android.dns.local.Resolver;
115
import com.qiniu.android.http.Dns;
126
import com.qiniu.android.http.ProxyConfiguration;
137
import com.qiniu.android.http.UrlConverter;
148

159
import java.io.File;
16-
import java.io.IOException;
17-
import java.net.InetAddress;
18-
import java.net.UnknownHostException;
19-
import java.util.ArrayList;
20-
import java.util.Collections;
21-
import java.util.List;
2210

2311
public final class Configuration {
2412

@@ -127,40 +115,6 @@ public static class Builder {
127115
private UrlConverter urlConverter = null;
128116
private Dns dns = null;
129117

130-
public Builder() {
131-
buildDefaultDns();
132-
}
133-
134-
private void buildDefaultDns() {
135-
IResolver r1 = AndroidDnsServer.defaultResolver();
136-
IResolver r2 = null;
137-
try {
138-
r2 = new Resolver(InetAddress.getByName("119.29.29.29"));
139-
} catch (IOException ex) {
140-
ex.printStackTrace();
141-
}
142-
final DnsManager happlyDns = new DnsManager(NetworkInfo.normal, new IResolver[]{r1, r2});
143-
144-
dns = new Dns() {
145-
@Override
146-
public List<InetAddress> lookup(String hostname) throws UnknownHostException {
147-
InetAddress[] ips;
148-
try {
149-
ips = happlyDns.queryInetAdress(new Domain(hostname));
150-
} catch (IOException e) {
151-
e.printStackTrace();
152-
throw new UnknownHostException(e.getMessage());
153-
}
154-
if (ips == null) {
155-
throw new UnknownHostException(hostname + " resolve failed.");
156-
}
157-
List<InetAddress> l = new ArrayList<>();
158-
Collections.addAll(l, ips);
159-
return l;
160-
}
161-
};
162-
}
163-
164118
public Builder zone(Zone zone) {
165119
this.zone = zone;
166120
return this;

library/src/main/java/com/qiniu/android/utils/Dns.java

Lines changed: 0 additions & 50 deletions
This file was deleted.

0 commit comments

Comments
 (0)