636f7374 / durian.cr Goto Github PK
View Code? Open in Web Editor NEW⛵️ Available - Crystal Domain Name System Resolver
License: MIT License
⛵️ Available - Crystal Domain Name System Resolver
License: MIT License
SRV record resolving would help me a lot with a project I work on. I'm not sure how hard it is to implement, since I don't really have any idea how dns works below the surface level. Will you get to it at some point in the future or would it be more promising for me to read into it and try to implement it myself?
Durian.cr
Domain Name System Resolver features has been very complete.In lib/durian/src/durian/extra/http/client.cr:26:15
26 | TCPSocket.connect hostname, @PORT, resolver, @connect_timeout
^------
Error: undefined method 'connect' for TCPSocket.class
crystal: 0.35.1
durian:
git: https://github.com/636f7374/durian.cr.git
version: 0.1.4
Using the demo code here:
https://paste.sr.ht/~z64/05e1209fea4e2d465b75e232720fba1ca72c96f8
Produces output:
$ cr _test.cr google.com 5
...................................................
0 | 48.33ms
1 | 48.34ms
2 | 5024.24ms
3 | 5024.25ms
4 | 5024.25ms
because the domain is never removed from the pending list once it is resolved.
The following patch resolves this problem: https://git.sr.ht/~z64/durian.cr/commit/663ca66477d80c2ab8757d8f51669d6dd0e7e328
$ cr _test.cr google.com 5
.
0 | 51.47ms
1 | 51.48ms
2 | 51.48ms
3 | 51.48ms
4 | 51.48ms
Please feel free to apply this patch or resolve at your discretion.
I have run into an issue attempting to use durian to resolve api.cognitive.microsoft.com
. stdlib and other utilities can access and interact with this host fine, so it appears to be some issue with durian.. or perhaps I've misconfigured something?
I'm not that knowledgeable about DNS, so your help is appreciated.
I have example you can try here that fails: https://git.sr.ht/~z64/durian-issue-4/tree
Output is:
got std socket: #<TCPSocket:0x7fa845b91d10>
Unhandled exception: Invalid host address (Socket::Error)
from lib/durian/src/durian/resolver.cr:223:17 in 'get_tcp_socket!'
from src/durian-issue-4.cr:19:7 in '__crystal_main'
from ../../../../../usr/lib/crystal/crystal/main.cr:105:5 in 'main_user_code'
from ../../../../../usr/lib/crystal/crystal/main.cr:91:7 in 'main'
from ../../../../../usr/lib/crystal/crystal/main.cr:114:3 in 'main'
from __libc_start_main
from _start
from ???
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.