Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev httpdns v2.4.2 #261

Open
wants to merge 2 commits into
base: dev_renwei
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion httpdns_android_demo/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ android {
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')

implementation "com.aliyun.ams:alicloud-android-httpdns:2.4.3"
implementation "com.aliyun.ams:alicloud-android-httpdns:2.5.0"

implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.6.1'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class ExoPlayerCaseViewModel(application: Application) : ResolveResultViewModel(
lateinit var okHttpClient: OkHttpClient

val playerUrl = SingleLiveData<String>().apply {
value = "https://storage.googleapis.com/wvmedia/clear/h264/tears/tears.mpd"
value = "https://ams-sdk-public-assets.oss-cn-hangzhou.aliyuncs.com/file_example_MP4_640_3MG.mp4"
}

val showRequestAndResolveResult = SingleLiveData<Boolean>().apply { value = false }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class IPConnCaseViewModel(application: Application) : ResolveResultViewModel(app
val responseStr = SingleLiveData<String>().apply { value = "" }

val ipConnUrl = SingleLiveData<String>().apply {
value = "https://suggest.taobao.com/sug?code=utf-8&q=phone"
value = "https://ams-sdk-public-assets.oss-cn-hangzhou.aliyuncs.com/example-resources.txt"
}

val showRequestAndResolveResult = SingleLiveData<Boolean>().apply { value = false }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class OkHttpCaseViewModel(application: Application) : ResolveResultViewModel(app

private var schemaType: SchemaType = SchemaType.HTTPS

val path = SingleLiveData<String>().apply { value = "/document_detail/434554.html" }
val path = SingleLiveData<String>().apply { value = "/example-resources.txt" }

val showRequestAndResolveResult = SingleLiveData<Boolean>().apply { value = false }

Expand All @@ -39,7 +39,7 @@ class OkHttpCaseViewModel(application: Application) : ResolveResultViewModel(app

private var response: Response? = null
fun initData() {
host.value = "help.aliyun.com"
host.value = "ams-sdk-public-assets.oss-cn-hangzhou.aliyuncs.com"
okHttpClient = OkHttpClient.Builder()
.connectionPool(ConnectionPool(0, 10 * 1000, TimeUnit.MICROSECONDS))
.hostnameVerifier { _, _ -> true }
Expand All @@ -59,13 +59,14 @@ class OkHttpCaseViewModel(application: Application) : ResolveResultViewModel(app
)
)
}

if (inetAddresses.isEmpty()) {
log(
this@OkHttpCaseViewModel,
getApplication<HttpDnsApplication>().getString(R.string.log_dns_resolve_fail)
)
try {
val localResolveResult = Dns.SYSTEM.lookup("help.aliyun111.com")
val localResolveResult = Dns.SYSTEM.lookup(hostname)
inetAddresses.addAll(localResolveResult)
}catch (e: Exception) {
log(
Expand Down Expand Up @@ -125,7 +126,6 @@ class OkHttpCaseViewModel(application: Application) : ResolveResultViewModel(app
response = Response(code, bodyStr)
}
}

}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,7 @@
android:layout_height="wrap_content"
android:text="@{viewModel.hostAndTime}"
android:textColor="#3D3D3D"
android:textSize="12sp"
tools:text="www.aliyun.com (38ms)" />
android:textSize="12sp"/>

<TextView
android:id="@+id/tvTtl"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@
android:id="@+id/tvHostAndTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="www.aliyun.com (38ms)"
android:text="@{viewModel.hostAndTime}"
android:textSize="12sp"
android:textColor="#3D3D3D"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@
android:id="@+id/tvHostAndTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="www.aliyun.com (38ms)"
android:text="@{viewModel.hostAndTime}"
android:textSize="12sp"
android:textColor="#3D3D3D"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,6 @@
android:id="@+id/tvHostAndTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="www.aliyun.com (38ms)"
android:text="@{viewModel.hostAndTime}"
android:textSize="12sp"
android:textColor="#3D3D3D"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
android:layout_height="wrap_content"
android:paddingStart="2dp"
android:paddingEnd="2dp"
android:text="@string/url_aliyun" />
android:text="@string/url_web_example" />

</com.google.android.material.textfield.TextInputLayout>

Expand Down Expand Up @@ -123,8 +123,7 @@
android:layout_height="wrap_content"
android:text="@{viewModel.hostAndTime}"
android:textColor="#3D3D3D"
android:textSize="12sp"
tools:text="www.aliyun.com (38ms)" />
android:textSize="12sp"/>

<TextView
android:id="@+id/tvTtl"
Expand Down
12 changes: 6 additions & 6 deletions httpdns_android_demo/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
<string name="pre_resolve_host_duplicate">%s域名已经被添加至预解析列表,请勿重复添加</string>

<string name="input_the_resolve_host">要解析的域名</string>
<string name="input_the_resolve_host_help_text">例如:help.aliyun.com</string>
<string name="input_the_resolve_host_help_text">例如:ams-sdk-public-assets.oss-cn-hangzhou.aliyuncs.com</string>
<string name="input_the_request_api">要请求的接口</string>
<string name="input_the_request_api_help_text">例如: /document_detail/434554.html</string>
<string name="input_the_request_api_help_text">例如: /example-resources.txt</string>
<string name="resolve_and_request">解析并请求</string>
<string name="resolve_host_empty">域名不能为空</string>
<string name="host_is_ip">域名不能是IP地址</string>
Expand Down Expand Up @@ -107,8 +107,8 @@
<string name="ip_conn_case">HTTPDNS\nIP直连\n最佳实践</string>
<string name="exo_player_case">HTTPDNS\nExoPlayer\n最佳实践</string>
<string name="log_dns_resolve_fail">httpdns 未返回IP,走local dns</string>
<string name="log_resolve_result">httpdns %s 解析结果 %s</string>
<string name="log_host_cannnot_resolve">host:%s 解析失败</string>
<string name="log_resolve_result">httpdns %s 解析结果 %s</string>
<string name="log_sni_request_error">SNI request error: %s</string>
<string name="log_sni_request_response">SNI request response: %s</string>
<string name="log_okhttp_request_url">requestUrl: %s</string>
Expand All @@ -117,12 +117,12 @@
<string name="toast_double_click_exit">再按一次退出应用</string>
<string name="toast_input_content_null">输入内容为空</string>
<string name="input_url">url输入</string>
<string name="input_url_example">例如: http://www.aliyun.com</string>
<string name="url_aliyun">https://help.aliyun.com</string>
<string name="input_url_example">例如: https://ams-sdk-public-assets.oss-cn-hangzhou.aliyuncs.com/example-resources.txt</string>
<string name="url_web_example">https://ams-sdk-public-assets.oss-cn-hangzhou.aliyuncs.com/example-resources.txt</string>
<string name="load_url">加载URL</string>
<string name="toast_url_empty">url is empty</string>
<string name="toast_url_mistake">请输入正确的url</string>
<string name="player_url">播放资源URL输入</string>
<string name="player_url_example">例如: https://storage.googleapis.com/wvmedia/clear/h264/tears/tears.mpd</string>
<string name="player_url_example">例如: https://ams-sdk-public-assets.oss-cn-hangzhou.aliyuncs.com/file_example_MP4_640_3MG.mp4</string>
<string name="play">播放</string>
</resources>