Overview
Comment: | Add the various resource records |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
e473ea9c633945789f5b2de67eb66c44 |
User & Date: | js on 2021-03-03 23:39:43 |
Other Links: | manifest | tags |
Context
2021-03-04
| ||
01:03 | Initial work on sending a query check-in: baf27b579c user: js tags: trunk | |
2021-03-03
| ||
23:39 | Add the various resource records check-in: e473ea9c63 user: js tags: trunk | |
01:29 | Parse resolv.conf check-in: 070b3339e0 user: js tags: trunk | |
Changes
Modified src/resolver.cr from [fe98c6126e] to [e7d4d87a8a].
1 2 3 4 5 6 7 | require "./settings" module AsyncDNS class Resolver getter :settings setter :settings | > | 1 2 3 4 5 6 7 8 | require "./rr" require "./settings" module AsyncDNS class Resolver getter :settings setter :settings |
︙ | ︙ |
Added src/rr.cr version [c7ffec3a5e].
Modified src/settings.cr from [9091c56abc] to [24fadd9f43].
|
| < < < < | 1 2 3 4 5 6 7 8 9 10 | module AsyncDNS class Settings @local_domain : String? property static_hosts, nameservers, local_domain, search_domains, uses_tcp getter timeout, max_attempts, abs_num_dots def timeout=(timeout) raise ArgumentError.new("timeout must be positive") if timeout < 0 |
︙ | ︙ | |||
36 37 38 39 40 41 42 43 | @nameservers = [] of String @search_domains = [] of String @timeout = Time::Span.new(seconds: 2) @max_attempts = 3 @abs_num_dots = 1 @uses_tcp = false @reload_period = Time::Span.new(seconds: 2) | > | > > | > > > | | | > > | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | @nameservers = [] of String @search_domains = [] of String @timeout = Time::Span.new(seconds: 2) @max_attempts = 3 @abs_num_dots = 1 @uses_tcp = false @reload_period = Time::Span.new(seconds: 2) @last_reload = Time::Span.zero reload end def reload return if Time.monotonic - @last_reload < @reload_period {% if flag?(:haiku) %} parse_hosts "/system/settings/network/hosts" parse_resolv_conf "/system/settings/network/resolv.conf" {% elsif flag?(:unix) %} parse_hosts "/etc/hosts" parse_resolv_conf "/etc/resolv.conf" {% else %} {% raise "Your OS is not supported by AsyncDNS" %} {% end %} @last_reload = Time.monotonic end def parse_hosts(path) @static_hosts.clear File.each_line(path, chomp: true) do |line| pos = line.index('#') |
︙ | ︙ |
Modified tests/example.cr from [4658a8dbd9] to [b547c51298].
1 2 3 4 5 | require "../src/asyncdns" AsyncDNS::Query.new("crystal-lang.org", AsyncDNS::DNSClass::IN, AsyncDNS::RRType::A) | | | | < < < < < < > | 1 2 3 4 5 6 7 8 9 | require "../src/asyncdns" AsyncDNS::Query.new("crystal-lang.org", AsyncDNS::DNSClass::IN, AsyncDNS::RRType::A) resolver = AsyncDNS::Resolver.new AsyncDNS::RR::A.new("crystal-lang.org", Socket::IPAddress.new("127.0.0.1", 0), 1234) |