bouke / dns Goto Github PK
View Code? Open in Web Editor NEWSwift implementation of DNS Records / RR
Home Page: http://boukehaarsma.nl/DNS
License: MIT License
Swift implementation of DNS Records / RR
Home Page: http://boukehaarsma.nl/DNS
License: MIT License
Hello Everyone,
I am unable to use this library. would be great to get some help.
I found out, that what I need to use is resolving a DNS SRV Records.
so what I did was using the
func testReadMe() throws {
// If the code below doesn't work, also update the README.md to
// demonstrate the changes in the API.
let request = Message(
type: .query,
questions: [Question(name: "_sip._tls", type: .service)] //Changed this to Service
)
let requestData = try request.serialize()
// Not shown here: send to DNS server over UDP, receive reply.
let responseData = requestData
// Decoding a message
let response = try Message(deserialize: responseData)
print(response.answers.first ?? "No answers")
}
What is wrong here?
So instead of:
Header(response: false)
You'd write:
Header(type: .request)
See RFC; i.e. IN / CH / HS
UDP DNS messages are limited to 512 bytes. If messages are over 512 bytes, the message is cut-off at 512 bytes and the truncation bit is set. Currently the bit is parsed, but the message isn't handled differently, resulting in a parsing failure. The correct way here would be parsing only a partial message without throwing.
The other way around should also be supported, cutting off messages when truncation is supported.
Also, I need to read up on the spec to see how truncation actually works.
Hi. I enabled the fuzz tests and swift test
always crashes. Is this okay (like, the library should fail when Message(deserialize: data)
finds that data
is corrupted), or is it a bug?
I'm on Linux, Swift 4.1
limitedBy
could use startPosition
, not needing the cyclic reference check
Line 26 in 328a0cd
How can we specify custom dns server to query from?
Environment:
SPM.
Package version 1.2.0
macOS 10.15.6.
When I use DNS messages with debug configuration everything looks good, but once I switch to release, IP addresses could not be parsed:
Release build:
Request: DNS Request(id: 0, authoritativeAnswer: true, truncation: false, recursionDesired: true, recursionAvailable: false, questions: [DNS.Question(name: "amazon.com", type: A, unique: true, internetClass: A)], answers: [], authorities: [], additional: [])
Response: DNS Response(id: 0, returnCode: 0, authoritativeAnswer: false, truncation: false, recursionDesired: true, recursionAvailable: true, questions: [DNS.Question(name: "amazon.com.", type: A, unique: false, internetClass: A)], answers: [DNS.HostRecord<DNS.IPv4>(name: "amazon.com.", unique: false, internetClass: A, ttl: 31, ip: �[�ޭ�), DNS.HostRecord<DNS.IPv4>(name: "amazon.com.", unique: false, internetClass: A, ttl: 31, ip: �[�ޭ�), DNS.HostRecord<DNS.IPv4>(name: "amazon.com.", unique: false, internetClass: A, ttl: 31, ip: �[�ޭ�)], authorities: [], additional: [])
Debug build:
Request: DNS Request(id: 0, authoritativeAnswer: true, truncation: false, recursionDesired: true, recursionAvailable: false, questions: [DNS.Question(name: "amazon.com", type: A, unique: true, internetClass: A)], answers: [], authorities: [], additional: [])
Response: DNS Response(id: 0, returnCode: 0, authoritativeAnswer: false, truncation: false, recursionDesired: true, recursionAvailable: true, questions: [DNS.Question(name: "amazon.com.", type: A, unique: false, internetClass: A)], answers: [DNS.HostRecord<DNS.IPv4>(name: "amazon.com.", unique: false, internetClass: A, ttl: 55, ip: 176.32.103.205), DNS.HostRecord<DNS.IPv4>(name: "amazon.com.", unique: false, internetClass: A, ttl: 55, ip: 176.32.98.166), DNS.HostRecord<DNS.IPv4>(name: "amazon.com.", unique: false, internetClass: A, ttl: 55, ip: 205.251.242.103)], authorities: [], additional: [])
I need some tome to investigate it more and get the real cause, but as far as I can see now, this this PR https://github.com/Bouke/DNS/pull/25/files fixes the problem.
Hi!
I'm using DNS as a dependency of HAP in a Linux box. I'm getting error logs when replying to DNS Messages because of unicode encoding not supported. Nearly all of my members of my family have accents on their names, so their iDevices, shared libraries, and even some rooms, like "baño" have them...
Is unicode not supported by design or is it simply not implemented? If you can give me some pointers maybe I can try to fix it.
Thanks in advance!
The following message could not be deserialized:
000084000001000200000002085f61692e706c6179045f746370065f6c6f63616c00000c0001c00c000c0001000000780013076578616d706c65085f616972706c6179c015c03200210001000000780015000000001b58076578616d706c65056c6f63616c00c057000100010000007800040a000102c00c000c000100000078000c0b68656c6c6f3d776f726c64
Xcode reports INVOP
in Bytes.swift:25
(let step = data[position]
).
Hi!
Is it possible to add support for parsing the CAA of the lookup?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.