Giter Site home page Giter Site logo

dns's Introduction

dns's People

Contributors

adinapoli-iohk avatar andreabedini avatar archaephyrryx avatar benclifford avatar dudebout avatar erikd avatar felixonmars avatar gzh avatar hs-viktor avatar joecrayne avatar kazu-yamamoto avatar keizo042 avatar kfigiela avatar khibino avatar markus1189 avatar mutjida avatar niteria avatar orlitzky avatar polynomial avatar qulogic avatar ropwarejb avatar ryanglscott avatar themattchan avatar trofi avatar vdukhovni avatar yihuang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

dns's Issues

Request: Supports rrtype = UNKNOWN 47 ?

I'm playing the code like this. And I noticed UNKNOWN rrtype.

import Network.Socket
import Network.Multicast
import Network.DNS.Decode

main = withSocketsDo $ do
  sock <- multicastReceiver "224.0.0.251" 5353
  runLoop sock

runLoop sock = do
  msg <- receive sock
  print msg
  runLoop sock

Run the code above and wait 5 minutes or so, (must exists Apple products iPhone, iPad Airport on same LAN.) will produce outputs like this.

ResourceRecord {rrname = "AirMac-Extreme.local.", rrtype = UNKNOWN 47, rrttl = 120, rdlen = 8, rdata = [193,8,0,4,64,0,0,8]}

rrtype 47 is defined in RFC3845 NSEC. (may be not inet standard yet)

Could you think to support decoding rrtype 47 rdata?

Example server fails with "proxy timeout" on Windows

This might be outside the scope of your work, but when running your sample server on Windows, I get "proxy timeout" errors. However, it appears to receive DNS requests ok. Do you have any immediate thoughts?

Test failure in 3.0.0

Running 3 test suites...
Test suite doctest: RUNNING...
Test suite doctest: PASS
Test suite logged to: dist/test/dns-3.0.0-doctest.log
Test suite spec: RUNNING...
Test suite spec: PASS
Test suite logged to: dist/test/dns-3.0.0-spec.log
Test suite network: RUNNING...

Lookup
  lookup
    lookupA
    lookupAAAA FAILED [1]
    lookupAAAA with emty result
    lookupMX
    lookupTXT
    lookupSOA
    lookupNS

Failures:

  test2/LookupSpec.hs:23:
  1) Lookup.lookup lookupAAAA
       expected: Right False
        but got: Right True

Randomized with seed 699310253

Finished in 0.0077 seconds
7 examples, 1 failure
Test suite network: FAIL
Test suite logged to: dist/test/dns-3.0.0-network.log
2 of 3 test suites (2 of 3 test cases) passed.

Irrefutable pattern failed for pattern l : _

toAddr cs = let l:_ = filter ("nameserver" `isPrefixOf`) $ lines cs

Network/DNS/Resolver.hs:144:21-71: Irrefutable pattern failed for pattern l : _

[root@instance1:~]# cat /etc/resolv.conf 
# Generated by resolvconf
options edns0
options edns0

it appears that a lack of any nameserver entry causes this rather unreadable error, it should at least throw a readable error message, or handle the lack of a nameserver better

cache

I would like to merge the concurrent-dns-cache library to the dns library.

Motivation:

  • I need a DNS cache for the domain-auth library. In my case, runSPF lookups the same theTXT record multiple times and wastes time.
  • concurrent-dns-cache can be used for IPv4 addresses only.
  • Even if concurrent-dns-cache is generalized for any records, it is hard to combine it with domain-auth

So, the dns library itself should have a cache. It should remember records for a while. It also possibly cache the ENDS0 related information.

Support leftovers in decode

If multiple messages are sent at once (e.g. when using TCP as the transport), it is currently impossible to decode all messages from a single lazy ByteString. Adding a variant of decode which returned leftovers would solve this problem. Another option would be to provide a decodeMany function.

I'm happy to send a PR if this sounds generally useful.

Any plans to support PTR and SRV (for DNS-SD)?

I am toying around with DNS-SD, using multicast and PTR records and I tried to do:

mdnsResolvConf :: ResolvConf
mdnsResolvConf = ResolvConf {
resolvInfo = RCHostName "224.0.0.251:5353"
, resolvTimeout = 3 * 1000 * 1000
, resolvBufsize = 512
}

main :: IO ()
main = do
rs <- makeResolvSeed mdnsResolvConf
withResolver rs $ \resolver -> do
DNS.lookup resolver "_osc._udp.local" PTR >>= print

PTR should just be type 12 (decimal) (RFC 1035)

Reason for using lazy ByteString?

I was wondering about the reason for using lazy ByteStrings in this package. DNS messages are usually pretty tiny and I'm having trouble seeing any benefit from the laziness.

The identifier of DNSHeader can only hold 16 bits integers.

I was debugging a misbehaving program of mine today and I found out that the bug was caused by writing an integer greater than 65535 to the identifier of a DNSHeader. Currently that field has type Int but a DNS message has room for only 16 bits to written there. The problem is that encode (from Network.DNS.Encode) silently performs a lossy conversion discarding the excess bits. This can lead to various unexpected bugs.

Maybe encode could be modified so that it raises an exception if a value larger than 65535 is provided. Or the type of that field could be changed to Word16. I would prefer the latter, but unfortunately that would be a breaking change.

dns-3.0.0 doesn't build on GHC 7.8

Greetings,

I don't know if you still support GHC 7.8.4 (I happen to maintain a library that supports GHC 7.8.4 and has dns as a dependency)

My CI breaks like this:

Preprocessing library dns-3.0.0...
[ 1 of 14] Compiling Network.DNS.Types ( Network/DNS/Types.hs, dist/build/Network/DNS/Types.o )
[ 2 of 14] Compiling Network.DNS.Utils ( Network/DNS/Utils.hs, dist/build/Network/DNS/Utils.o )
[ 3 of 14] Compiling Network.DNS.Memo ( Network/DNS/Memo.hs, dist/build/Network/DNS/Memo.o )
[ 4 of 14] Compiling Network.DNS.Types.Internal ( Network/DNS/Types/Internal.hs, dist/build/Network/DNS/Types/Internal.o )
[ 5 of 14] Compiling Network.DNS.StateBinary ( Network/DNS/StateBinary.hs, dist/build/Network/DNS/StateBinary.o )
[ 6 of 14] Compiling Network.DNS.Encode ( Network/DNS/Encode.hs, dist/build/Network/DNS/Encode.o )

Network/DNS/Encode.hs:170:16: Not in scope: ‘pure’

Network/DNS/Encode.hs:170:21:
    Not in scope: ‘mempty’
    Perhaps you meant one of these:
      ‘BS.empty’ (imported from Data.ByteString.Char8),
      ‘LBS.empty’ (imported from Data.ByteString.Lazy.Char8)

Honestly, I don't know if some of my users still use this old GHC version. If you can't patch it, I'll happily drop 7.8 support :-)

Thanks for your time.

TimeoutExpired returned immediately even with long timeout set

let rc = DNS.defaultResolvConf { DNS.resolvInfo = consul, DNS.resolvTimeout = 10000000000000 }
rs <- DNS.makeResolvSeed rc
DNS.withResolver rs $ \resolver -> DNSL.lookupA resolver "riemann.service.dc1.consul."
=> Left TimeoutExpired

The last line returns immediately, it does not take 10000000000000 micro seconds as I would expect. The same thing happens with the default timeout value, I would expect it to take 3 seconds before returning with TimeoutExpired however it is immediate.

Version mismatch

The latest hackage version is 1.4.4 but dns.cabal in the master branch says 1.4.3.

ResourceRecord field names

@erikd I'm trying to release a new version to save Windows and fix some bugs that you fixed.
concurrent-dns-cache cannot be build with master of dns.
This is because you removed fields names in 8f51a20.
Would you tell me the reason why you remove them?

And if you introduced any breaking changes from version 2.0.10, please let me know.

2.0.11 is broken on Windows due to eaten spaces (by Hackage?)

Hey @kazu-yamamoto !

Looks like we had more trouble in paradise following 2.0.11 release. I don't know what happened here, but the code looks indeed correct on GitHub, but if we look at the package which landed on Hackage, the spaces of that sendAll functions seems to be completely eaten out:

http://hackage.haskell.org/package/dns-2.0.11/docs/src/Network-DNS-Resolver.html

As a temporary workaround, we had to depend on the Github version of this package, but it would be nice to understand what went wrong during upload and fix it (if it's something in my power so that I can open a PR).

Last but not least, given all the different woes we have witnessed on Windows lately, I think it would be outstanding if you could setup this project to work with Appveyor. In that issue I've linked there are already instructions on how to do that, and I think you are the only one in the position of performing the steps as only the project owner can register the package on Appveyor (IIRC) 😉

Thank you very much for all your open source contributions, I'm a big fan of your work!

Alfredo

add Identifier matching

By far there can be only one request session going on in a resolver; this shouldn't be the case: there is the identifier field that's meant to be used to match requests and responses, enabling us to handle several requests simultaneously. It may also help with the efficiency thing: we don't have to open an UDP socket for every concurrent requests.

Also, I would really appreciate it if DNS over TCP can be implemented(then again, we need the identifier matching support, otherwise it can be really slow).

parallel lookup

If there are multiple AddrInfo available, the current lookup functions uses it sequentially.
It would be nice if multiple lookups are done in parallel in the first-come-first-accepted manner in some cases.
Configuration should be able to enable the parallel lookup.

Disappearance of `rrname`, `rrtype`, `rrttl` and `rdata` accessors of ResourceRecord

Some recent commits have removed the "record" form of ResourceRecord, leaving only a multi-slot constructor. Existing code that used the accessors must now change to define its own accessors. Only getRdata has been provided.

What motivates these changes? They seem ill-advised. In particular they fundamentally break the previous API and all existing applications using Network.DNS would have to change. I think that these changes should also be reverted...

DNS cannot be compiled with network-conduit >= 1.1.0

Network-conduit is deprecated. Version 1.1.0 hides all modules.

The cabal file should specify an upper version bound for network-conduit.

Other packages that depend on network-conduit (git-annex) fail to install because of this.

(I'm just opening this issue to document the problem. I'll fix it and send a pull request in a few minutes.)

splitting ResolvSeed

If /etc/resolv.conf has multiple DNS servers, now ResolvSeed contains the multiple servers.
It's nice to split theResolvSeed to multiple so that then can be combined with withResolvers.
The servers should be rotated. If we have server A, B and C, the split function should generate:

    1. A, B, C
    1. B, C, A
    1. C, A, B

Only supports class IN

There are several other DNS classes out there – most notably, some deployments of MIT's Hesiod directory service use class HS. I'm working on a patch to support arbitrary DNS classes; it can either

  1. Extend the current API by providing, for example, lookupWithClass alongside lookup, or
  2. Modify the current API such that functions which currently take a record type also take a record class. For instance, I'd change the signature of lookup to Resolver → Domain → TYPE → CLASS → IO (Maybe DNSFormat).

I prefer the second – it keeps the API simpler. However, it breaks backward compatibility. Which do you prefer?

Feature Request: lookupSOA

It would be awesome if this library supported looking up SOA[1] records for a domain. This would be useful for:

  • people wanting to validate their zone configuration
  • lookup abuse addresses to contact for a domain from inside a Haskell program

I am new to Haskell, so I hope I am not missing a way to do this in the current lookup utilities!

1: https://en.wikipedia.org/wiki/SOA_Resource_Record

not threadsafe

I found that with code like this:

gatherDNS :: IO (Domain  -> IO [(TYPE, [ByteString])])
gatherDNS = do
  resolvSeed <- makeResolvSeed $ defaultResolvConf { resolvInfo = RCFilePath "/etc/resolv.conf" }
  return $ \dom -> do
    withResolver resolvSeed $ \r -> do
      (`mapConcurrently` dnsFetchers) $ \fetch ->
        (t,res) <- fetch r dom
        return (t,sort res)

dnsFetchers :: [Resolver -> Domain -> IO (TYPE, [ByteString])]
dnsFetchers = [ mxFetcher
              , spfFetcher
              ]

mxFetcher :: Resolver -> Domain -> IO (TYPE,[ByteString])
mxFetcher resolv dom =  processor <$> lookupMX resolv dom
  where processor = (MX,) . either (const []) (map fst)

spfFetcher :: Resolver -> Domain -> IO (TYPE,[ByteString])
spfFetcher resolv dom  = processor <$> lookupTXT resolv dom
  where processor = (TXT,) . either (const []) id

it would not work reliably. swapping the order of the withResolver and mapConcurrently lines corrected this.

Investigate and hopefully fix OptRecord

In the round trip tests, the OptRecord variant of the ResoruceRecord generator is currently disabled (its frequency set to zero) because it does not correctly round-tip.

I think the decoder for this field is at least partially correct, but doubt the encoder is correct.

Best way to debug this would be to get a Pcap dump that includes an OptRecord field to make sure the decoder can decode real world data, then make sure the encoder is working and finally re-enable the OptRecord generator.

@kazu-yamamoto I am willing to take on this task.

Support IPv6 addresses in Resolver construction

Hey @kazu-yamamoto !

A colleague of mine stumbled upon an interesting edge-case of this library. Consider the following /etc/resolv.conf:

#
# Mac OS X Notice
#
# This file is not used by the host name and address resolution
# or the DNS query routing mechanisms used by most processes on
# this Mac OS X system.
#
# This file is automatically generated.
#
domain Speedport_W_724V_Typ_A_05011603_05_020
nameserver fe80::1
nameserver 192.168.2.1

See that? The first nameserver is an IPv6 address! Unfortunately, the current revision of the library on master, as we speak, cannot handle this file properly, as the testsuite would fail with:

### Failure in ./Network/DNS/Lookup.hs:37: expression `withResolver rs $ \resolver -> lookupA resolver hostname'
expected: Right [93.184.216.34]
 but got: *** Exception: Network.Socket.sendBuf: does not exist (No route to host)
### Failure in ./Network/DNS/Lookup.hs:88: expression `withResolver rs $ \resolver -> lookupA resolver hostname'
expected: Right [210.130.207.72]
 but got: *** Exception: Network.Socket.sendBuf: does not exist (No route to host)
### Failure in ./Network/DNS/Lookup.hs:120: expression `withResolver rs $ \resolver -> lookupAAAA resolver hostname'
expected: Right [2001:200:dff:fff1:216:3eff:fe4b:651c]
 but got: *** Exception: Network.Socket.sendBuf: does not exist (No route to host)
### Failure in ./Network/DNS/Lookup.hs:149: expression `withResolver rs $ \resolver -> lookupMX resolver hostname'
expected: Right []
 but got: *** Exception: Network.Socket.sendBuf: does not exist (No route to host)
### Failure in ./Network/DNS/Lookup.hs:185: expression `ips <- withResolver rs $ \resolver -> lookupAviaMX resolver hostname'
expected: 
 but got: *** Exception: Network.Socket.sendBuf: does not exist (No route to host)
### Failure in ./Network/DNS/Lookup.hs:261: expression `ns <- withResolver rs $ \resolver -> lookupNS resolver hostname'
expected: 
 but got: *** Exception: Network.Socket.sendBuf: does not exist (No route to host)
### Failure in ./Network/DNS/Lookup.hs:308: expression `withResolver rs $ \resolver -> lookupTXT resolver hostname'
expected: Right ["v=spf1 +mx -all"]
 but got: *** Exception: Network.Socket.sendBuf: does not exist (No route to host)
### Failure in ./Network/DNS/Lookup.hs:335: expression `withResolver rs $ \resolver -> lookupPTR resolver hostname'
expected: Right ["www.iij.ad.jp."]
 but got: *** Exception: Network.Socket.sendBuf: does not exist (No route to host)
### Failure in ./Network/DNS/Lookup.hs:362: expression `withResolver rs $ \resolver -> lookupRDNS resolver hostname'
expected: Right ["www.iij.ad.jp."]
 but got: *** Exception: Network.Socket.sendBuf: does not exist (No route to host)
### Failure in ./Network/DNS/Lookup.hs:400: expression `withResolver rs $ \resolver -> lookupSRV resolver q'
expected: Right [(5,0,5269,"jabber.ietf.org.")]
 but got: *** Exception: Network.Socket.sendBuf: does not exist (No route to host)
### Failure in ./Network/DNS/Resolver.hs:272: expression `withResolver rs $ \resolver -> lookup resolver hostname A'
expected: Right [RD_A 93.184.216.34]
 but got: *** Exception: Network.Socket.sendBuf: does not exist (No route to host)
Examples: 93  Tried: 78  Errors: 0  Failures: 11

Lookup
  lookup
    lookupA FAILED [1]
    lookupAAAA FAILED [2]
    lookupAAAA with emty result FAILED [3]
    lookupMX FAILED [4]
    lookupTXT FAILED [5]
    lookupNS FAILED [6]

Failures:

  test2/LookupSpec.hs:28: 
  1) Lookup.lookup lookupA
       uncaught exception: IOException of type NoSuchThing (Network.Socket.sendBuf: does not exist (No route to host))

  test2/LookupSpec.hs:35: 
  2) Lookup.lookup lookupAAAA
       uncaught exception: IOException of type NoSuchThing (Network.Socket.sendBuf: does not exist (No route to host))

  test2/LookupSpec.hs:42: 
  3) Lookup.lookup lookupAAAA with emty result
       uncaught exception: IOException of type NoSuchThing (Network.Socket.sendBuf: does not exist (No route to host))

  test2/LookupSpec.hs:49: 
  4) Lookup.lookup lookupMX
       uncaught exception: IOException of type NoSuchThing (Network.Socket.sendBuf: does not exist (No route to host))

  test2/LookupSpec.hs:56: 
  5) Lookup.lookup lookupTXT
       uncaught exception: IOException of type NoSuchThing (Network.Socket.sendBuf: does not exist (No route to host))

  test2/LookupSpec.hs:63: 
  6) Lookup.lookup lookupNS
       uncaught exception: IOException of type NoSuchThing (Network.Socket.sendBuf: does not exist (No route to host))

Randomized with seed 603664375

Finished in 0.0222 seconds
6 examples, 6 failures

Decode
  decode
    decodes double pointers correctly
    decodes dname
    decodes txt
    decodes mx
Encode
  encode
    encodes DNSMessage correctly
  decode
    decodes DNSMessage correctly
RoundTrip
  IPv4
  IPv6
  TYPE
  Domain
  DNSFlags
  ResourceRecord
  DNSHeader
  DNSMessage

Finished in 0.1721 seconds
14 examples, 0 failures

Without digging too much into the code, I can see two problems inside makeResolvSeed:

  1. It stops eagerly at the first nameserver throwing away the secondary one which might be useful to use later on in case the primary fails.

  2. The extract function seems a bit hairy (but I might be wrong). Cannot we simply use the read instance of the ip-route package you wrote to simply deal correctly with both type of addresses?

If you think I'm on the right track, would you accept a PR for this? (unless you beat me to that, of course 😉 )

Thank you very much!

Implement query parser and response composer.

I plan to implement a simple dns server, i find this library has good quality, so i decide to build my server on top of this.
So i need to implement query parser and response composer first, and before i do the coding, i need to know what's your plan about it, i want to prevent duplicate works.

Best regards from Yihuang.

Define a proper error type

Currently, a function like decode is defined as:

decode :: ByteString -> Either String DNSMessage

which reports all errors simply as String.

The problem with using String for errors is that it is not possible to robustly pattern match on them. For instance, if I write code that matches one of the current error messages, but a later version of this packages changes that error message, my pattern match will silently fail.

Instead I propose a data type something like:

data DNSError
    = DNSError1 ....
    | DNSError2 ....

and so on. This makes the error type part of the API, so that if a DNSError constructor is removed or changed in any way, my code would now fail to compile instead of silently failing.

This proposal would also add a function to render that DNSError to String (or maybe even Text):

renderDNSError :: DNSError -> String

so that the original decode function would now have type:

decode :: ByteString -> Either DNSError DNSMessage

@kazu-yamamoto What do you think of this idea? If you like it, I'll do it over the weekend.

multiple servers support

dns-1.4.5 fails if the first nameserver entry in /etc/resolv.conf is offline, ignoring the others

Handling RData parsing errors

After months of running daily without problems my scanner threw an exception today due to unexpected malformed data from a remote zone:

ParseError {errorContexts = [], errorMessage = "Failed reading: IPv6 addresses must be 16 bytes long", errorPosition = 1:81 (80)}

This error is from Data.Conduit.Attoparsec. but that library is (correctly) not a documented dependency of Network.DNS and I think that its internal types should not be visible to Network.DNS users. And yet getting garbage in the RData from some remote DNS server is not an entirely unexpected condition. Mostly one sees in Domain fields we don't validate very strictly, so no exceptions are raised, for example, at the moment:

promitterra.nl. IN MX 0 http://fb1.dootall.com.
promitterra.nl. IN MX 10 mr1.dootall.com.
;
spirit-art.nl. IN CNAME http//www.vanhoftenit.nl.

However, sometimes the garbage is more structural, as with unexpected RData lengths for AAAA records.

I see two possible ways to handle this more appropriately than having unexpected exceptions from the conduit parser library. IIn either case catch parser exceptions while parsing RData from packets. Then, either:

  • If it fails to parse, create an RD_PARSERR Int16 ByteString String object which captures the rtype, the raw payload that could not be parsed and the error message from the parser library, or else
  • If it fails to parse return "Left DNS.ParseError" for the whole DNS response

My preference is very much for the first option since one then still gets to see any valid records that are returned allong with the malformed record, and also the maformed payload and its rtype. That said, if it is much simpler to just invalidate the whole reply, given that malformed RData is comparatively rare, I could live with that for now, and the more detailed approach could be taken later...

Thoughts? Comments? Patches?

Compression popping values that have not been pushed.

This snippet:

  rs <- makeResolvSeed defaultResolvConf {
          resolvInfo = RCHostName "90.155.94.93"
         }
  r <- withResolver rs $ \resolver -> lookupRaw resolver "www.cqx.ltd.uk" RRSIG

  print r

generates the attached pcap, and then fails with:

dugnutt: ParseError {errorContexts = [], errorMessage = "Failed reading: getDomain: 338", errorPosition = 1:449 (448)}

I put in some tracing around the push/pop statements and it looks like that location is not being pushed.

dugnutt www.cqx.ltd.uk RRSIG 
BENC: d pushing pos 24
BENC: d pushing pos 20
BENC: d pushing pos 16
BENC: d pushing pos 12
BENC: c pushing pos 32
BENC: c pushing pos 170
BENC: c pushing pos 308
dugnutt: ParseError {errorContexts = [], errorMessage = "Failed reading: getDomain': failed to resolve compression pointer to offset 338 at position 446", errorPosition = 1:449 (448)}

That server 90.155.94.93 is under my control and running bind 9.8.4.

pcap of the interaction:

www.hawaga.org.uk/tmp/dns-rrsig.pcap

DNSSEC?

What's the possibility of add DNSSEC to this library? Should be be added here or should it be a separate library?

EDNS0

Let's enable EDNS0 with 4096 buffer size by default.

cleaning the low level APIs.

I'm cleaning up the low level APIs on https://github.com/kazu-yamamoto/dns/tree/low-level-api

I tried to do this by step by step but I forgot to add the IO module at the beginning. Since it could not be recoverable, I squashed multiple commits into a single to include the IO module. So, the first commit is fairly large. I'm very sorry.

Anyway, my motivations are here:

  • APIs in Encode and Decode were not symmetric. E.g. receiveVC causes IO but encodeVC is pure. The new two modules are now symmetric, providing the same set of APIs.
  • Creating the new IO module atop Encode and Decode.Internal for the high level modules.
  • I have removed RDATAParseError because it was not used at all. Correct me if I'm wrong.

Also I have removed unnecessary ResourceT. I introduced it because I did not understand conduit well at that time, I believe.

Test failure

Test suite spec: PASS
Test suite logged to: /home/stackage/work/logs/nightly/dns-1.4.5/test-run.out
Test suite doctest: RUNNING...
### Failure in ./Network/DNS/Lookup.hs:37: expression `withResolver rs $ \resolver -> lookupA resolver hostname'
expected: Right [93.184.216.119]
 but got: Right [93.184.216.34]
### Failure in ./Network/DNS/Resolver.hs:243: expression `withResolver rs $ \resolver -> lookup resolver hostname A'
expected: Right [93.184.216.119]
 but got: Right [93.184.216.34]
Examples: 93  Tried: 88  Errors: 0  Failures: 2
Test suite doctest: FAIL
Test suite logged to: /home/stackage/work/logs/nightly/dns-1.4.5/test-run.out

Version 2.0.13

Copying from #72:

Hey! Just to be sure to be on the same page, can I summarise what you are saying? You are telling me that releasing the current master is a major release, so it shouldn't be rushed, but that we can still release 2.0.13 relative quickly if we drop the default DNS thing and we include only:

  • The RetryLimitExceeded patch;
  • The sendAll fix patch;

Am I right?

@adinapoli-iohk I think that I have done all things above.
Please check https://github.com/kazu-yamamoto/dns/tree/version2.0.13

Does not build on Windows

Hi. This package does not build on windows. I was told on IRC that is was likely to be the lines here: https://github.com/kazu-yamamoto/dns/blob/master/Network/DNS/Resolver.hs#L442-L448

dns-2.0.10: configure
dns-2.0.10: build
Progress: 1/2
--  While building package dns-2.0.10 using:
      C:\sr\setup-exe-cache\x86_64-windows\Cabal-simple_Z6RU0evB_1.24.0.0_ghc-8.0.1.exe --builddir=.stack-work\dist\b7fec021 build --ghc-options " -ddump-hi -ddump-to-file"
    Process exited with code: ExitFailure 1
    Logs have been written to: C:\Users\alxan\Documents\GitHub\cheat\.stack-work\logs\dns-2.0.10.log

    Configuring dns-2.0.10...
    Building dns-2.0.10...
    Preprocessing library dns-2.0.10...
    [1 of 9] Compiling Network.DNS.Internal ( Network\DNS\Internal.hs, .stack-work\dist\b7fec021\build\Network\DNS\Internal.o )
    [2 of 9] Compiling Network.DNS.Types ( Network\DNS\Types.hs, .stack-work\dist\b7fec021\build\Network\DNS\Types.o )
    [3 of 9] Compiling Network.DNS.StateBinary ( Network\DNS\StateBinary.hs, .stack-work\dist\b7fec021\build\Network\DNS\StateBinary.o )
    [4 of 9] Compiling Network.DNS.Decode ( Network\DNS\Decode.hs, .stack-work\dist\b7fec021\build\Network\DNS\Decode.o )
    [5 of 9] Compiling Network.DNS.Encode ( Network\DNS\Encode.hs, .stack-work\dist\b7fec021\build\Network\DNS\Encode.o )
    [6 of 9] Compiling Network.DNS.Utils ( Network\DNS\Utils.hs, .stack-work\dist\b7fec021\build\Network\DNS\Utils.o )
    [7 of 9] Compiling Network.DNS.Resolver ( Network\DNS\Resolver.hs, .stack-work\dist\b7fec021\build\Network\DNS\Resolver.o )

    C:\Users\alxan\AppData\Local\Temp\stack11708\dns-2.0.10\Network\DNS\Resolver.hs:445:21: error:
        parse error on input `='
        Perhaps you need a 'let' in a 'do' block?
        e.g. 'let x = 5' instead of 'x = 5'

More README

This project could use a README. Particularly, I'm wondering how closely it follows the RFC etc. Does it support IPv6?

Improve Windows support

This is currently blocked by #80 for which I have fired a PR here.

After #80 will be (hopefully) merged into master, we have now the possibility of supporting multiple nameservers. On *nix, we are exploiting this by reading all the nameserver entries of /etc/resolv.conf, but on Windows, we are not.

As you can see here, we are calling GetNetworkParams which has the following structure:

DWORD GetNetworkParams(
  _Out_ PFIXED_INFO pFixedInfo,
  _In_  PULONG      pOutBufLen
);

This returns a pointer to a FIXED_INFO structure, defined like so:

typedef struct {
  char            HostName[MAX_HOSTNAME_LEN + 4];
  char            DomainName[MAX_DOMAIN_NAME_LEN + 4];
  PIP_ADDR_STRING CurrentDnsServer;
  IP_ADDR_STRING  DnsServerList;
  UINT            NodeType;
  char            ScopeId[MAX_SCOPE_ID_LEN + 4];
  UINT            EnableRouting;
  UINT            EnableProxy;
  UINT            EnableDns;
} FIXED_INFO, *PFIXED_INFO;

In particular, DnsServerList is "[...]A linked list of IP_ADDR_STRING structures that specify the set of DNS servers used by the local computer.[..]".

Unfortunately, in the current implementation, we are getting only the first one and throwing away the rest. Furthermore, the current defaultdns.c is doing error handling with printf, which is less than ideal. In a nutshell, this ticket is about:

  • Polishing the C code;
  • Read the entire linked list into the Haskell world.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.