Skip to content

DNS SRV service records fetcher/resolver using libresolv/dnssd

Notifications You must be signed in to change notification settings

alcheck/srvresolver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SrvResolver

DNS SRV records query/resolve for objc/Swift (iOS, MacOS)

Install using cocoapods:

pod 'srvresolver'

Manual installation:

For manual installation just clone the repo and add the project as subproject (add dependancy to build phases).

Usage:

// Swift example
import srvresolver

SRVQueryResolver.query("_xmpp-server._tcp.gmail.com", timeout: 2) { records, err in
    if let records = records {
        records.forEach { record in
            print("\(record.target) : \(record.port), ttl: \(record.ttl), priority: \(record.priority)")
        }
    } else if let err = err {
        print(err.localizedDescription)
    }
}
// Objective-C example

@import srvresolver;

[SRVQueryResolver query:@"_xmpp-server._tcp.gmail.com" timeout:2.0 completion:^(NSArray<SRVQueryRecord *> *records, NSError *err) {
    if (records) {
        for(SRVQueryRecord *record in records) {
            NSLog(@"%@ : %ld, ttl: %ld, priority: %ld", record.target, record.port, record.ttl, record.priority);
        }
    } else if (err) {
        NSLog(@"%@", err.localizedDescription);
    }
}];
Output:

alt1.xmpp-server.l.google.com : 5269, ttl: 1127, priority: 20
alt3.xmpp-server.l.google.com : 5269, ttl: 1127, priority: 20
alt4.xmpp-server.l.google.com : 5269, ttl: 1127, priority: 20
alt2.xmpp-server.l.google.com : 5269, ttl: 1127, priority: 20
xmpp-server.l.google.com : 5269, ttl: 1127, priority: 5

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy