Update MiniDNS to 1.0.0

This commit is contained in:
cketti 2020-09-18 02:40:47 +02:00
parent 7d9bb8f95c
commit 05882616d6
2 changed files with 15 additions and 14 deletions

View file

@ -1,27 +1,28 @@
package com.fsck.k9.autodiscovery.srvrecords
import com.fsck.k9.mail.ConnectionSecurity
import com.fsck.k9.mail.ConnectionSecurity.SSL_TLS_REQUIRED
import com.fsck.k9.mail.ConnectionSecurity.STARTTLS_REQUIRED
import org.minidns.dnslabel.DnsLabel
import org.minidns.dnsname.DnsName
import org.minidns.hla.ResolverApi
import org.minidns.hla.SrvProto
import org.minidns.hla.srv.SrvProto
class MiniDnsSrvResolver() : SrvResolver {
class MiniDnsSrvResolver : SrvResolver {
override fun lookup(domain: String, type: SrvType): List<MailService> {
val result = ResolverApi.INSTANCE.resolveSrv(
DnsName.from(type.label),
SrvProto.tcp.dnsName,
DnsLabel.from(type.label),
SrvProto.tcp.dnsLabel,
DnsName.from(domain)
)
val security = if (type.assumeTls) SSL_TLS_REQUIRED else STARTTLS_REQUIRED
return result.answersOrEmptySet.map {
MailService(
type,
it.target.toString(),
it.port,
it.priority,
if (type.assumeTls)
ConnectionSecurity.SSL_TLS_REQUIRED
else
ConnectionSecurity.STARTTLS_REQUIRED
srvType = type,
host = it.target.toString(),
port = it.port,
priority = it.priority,
security = security
)
}
}

View file

@ -33,7 +33,7 @@ buildscript {
'commonsIo': '2.6',
'mime4j': '0.8.3',
'okhttp': '4.8.1',
'minidns': '0.3.4',
'minidns': '1.0.0',
'glide': '4.11.0',
'androidxTestRunner': '1.3.0',