mirror of
https://github.com/correl/SleekXMPP.git
synced 2024-11-23 19:19:53 +00:00
Merge branch 'develop' of github.com:fritzy/SleekXMPP into develop
This commit is contained in:
commit
592c25f352
2 changed files with 24 additions and 0 deletions
|
@ -141,6 +141,14 @@ class ClientXMPP(BaseXMPP):
|
|||
use_tls=use_tls, reattempt=reattempt)
|
||||
|
||||
def get_dns_records(self, domain, port=None):
|
||||
"""
|
||||
Get the DNS records for a domain.
|
||||
Overridden XMLStream.get_dns_records to use SRV.
|
||||
|
||||
Arguments:
|
||||
domain -- The domain in question.
|
||||
port -- If the results don't include a port, use this one.
|
||||
"""
|
||||
if port is None:
|
||||
port = self.default_port
|
||||
if DNSPYTHON:
|
||||
|
|
|
@ -657,6 +657,13 @@ class XMLStream(object):
|
|||
return False
|
||||
|
||||
def get_dns_records(self, domain, port=None):
|
||||
"""
|
||||
Get the DNS records for a domain.
|
||||
|
||||
Arguments:
|
||||
domain -- The domain in question.
|
||||
port -- If the results don't include a port, use this one.
|
||||
"""
|
||||
if port is None:
|
||||
port = self.default_port
|
||||
if DNSPYTHON:
|
||||
|
@ -673,6 +680,15 @@ class XMLStream(object):
|
|||
return [((domain, port), 0, 0)]
|
||||
|
||||
def pick_dns_answer(self, domain, port=None):
|
||||
"""
|
||||
Pick a server and port from DNS answers.
|
||||
Gets DNS answers if none available.
|
||||
Removes used answer from available answers.
|
||||
|
||||
Arguments:
|
||||
domain -- The domain in question.
|
||||
port -- If the results don't include a port, use this one.
|
||||
"""
|
||||
if not self.dns_answers:
|
||||
self.dns_answers = self.get_dns_records(domain, port)
|
||||
addresses = {}
|
||||
|
|
Loading…
Reference in a new issue