AsyncDNS-cr  Diff

Differences From Artifact [c7ffec3a5e]:

To Artifact [2fc5a6484f]:


1
2
3
4
5



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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
65
66
67
68

69
70

71
72
73
74
75




76

77
78
79
80
81
82
83
84
85
86
87



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
require "socket"

module AsyncDNS
  abstract struct RR
    property :name, :class, :type, :ttl




    def initialize(@name : String, @class : DNSClass, @type : RRType,
                   @ttl : Int32)
    end

    struct A < RR
      property :address

      def initialize(name, @address : Socket::IPAddress, ttl)
        super(name, DNSClass::IN, RRType::A, ttl)
      end
    end

    struct AAAA < RR
      property :address

      def initialize(name, @address : Socket::IPAddress, ttl)
        super(name, DNSClass::IN, RRType::AAAA, ttl)
      end
    end

    struct CNAME < RR
      property :alias

      def initialize(name, @alias : String, ttl)
        super(name, DNSClass::IN, RRType::CNAME, ttl)
      end
    end

    struct HINFO < RR
      property :cpu, :os


      def initialize(name, @cpu : String, @os : String, ttl)
        super(name, DNSClass::IN, RRType::HINFO, ttl)
      end
    end

    struct MX < RR

      property :preference, :mx

      def initialize(name, @preference : UInt16, @mx : String, ttl)

        super(name, DNSClass::IN, RRType::MX, ttl)
      end
    end

    struct NS < RR
      property :authority

      def initialize(name, @authority : String, ttl)
        super(name, DNSClass::IN, RRType::NS, ttl)
      end
    end

    struct PTR < RR
      property :domain

      def initialize(name, @domain : String, ttl)
        super(name, DNSClass::IN, RRType::PTR, ttl)
      end
    end

    struct RP < RR
      property :mailbox, :domain


      def initialize(name, @mailbox : String, @domain : String, ttl)

        super(name, DNSClass::IN, RRType::RP, ttl)
      end
    end

    struct SOA < RR




      property :primary_ns, :responsible, :serial, :refresh, :retry,

        :expire, :min_ttl

      def initialize(name, @primary_ns : String, @responsible : String,
                     @serial : UInt32, @refresh : UInt32, @retry : UInt32,
                     @expire : UInt32, @min_ttl : UInt32)
        super(name, DNSClass::IN, RRType::SOA, ttl)
      end
    end

    struct SRV < RR
      property :prio, :weight, :target, :port




      def initialize(name, @prio : UInt16, @weight : UInt16, @target : String,
                     @port : UInt16, ttl)
        super(name, DNSClass::IN, RRType::SRV, ttl)
      end
    end

    struct TXT < RR
      property :text

      def initialize(name, @text : Array(String), ttl)
        super(name, DNSClass::IN, RRType::TXT)
      end
    end
  end
end




|
>
>
>


|



|

|
|




|

|
|




|

|
|




|
>

|
|




>
|

|
>
|




|

|
|




|

|
|




|
>

|
>
|




>
>
>
>
|
>
|

|

|
|




|
>
>
>

|
|
|




|

|
|




1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
require "socket"

module AsyncDNS
  abstract struct RR
    property name : String
    property class : DNSClass
    property type : RRType
    property ttl : UInt32

    def initialize(@name : String, @class : DNSClass, @type : RRType,
                   @ttl : UInt32)
    end

    struct A < RR
      property address : Socket::IPAddress

      def initialize(name : String, @address : Socket::IPAddress, ttl : UInt32)
        super(name, :in, :a, ttl)
      end
    end

    struct AAAA < RR
      property address : Socket::IPAddress

      def initialize(name : String, @address : Socket::IPAddress, ttl : UInt32)
        super(name, :in, :aaaa, ttl)
      end
    end

    struct CNAME < RR
      property alias : String

      def initialize(name : String, @alias : String, ttl : UInt32)
        super(name, :in, :cname, ttl)
      end
    end

    struct HINFO < RR
      property cpu : String
      property os : String

      def initialize(name : String, @cpu : String, @os : String, ttl : UInt32)
        super(name, :in, :hinfo, ttl)
      end
    end

    struct MX < RR
      property preference : UInt16
      property mx : String

      def initialize(name : String, @preference : UInt16, @mx : String,
                     ttl : UInt32)
        super(name, :in, :mx, ttl)
      end
    end

    struct NS < RR
      property authority : String

      def initialize(name : String, @authority : String, ttl : UInt32)
        super(name, :in, :ns, ttl)
      end
    end

    struct PTR < RR
      property domain : String

      def initialize(name : String, @domain : String, ttl : UInt32)
        super(name, :in, :ptr, ttl)
      end
    end

    struct RP < RR
      property mailbox : String
      property domain : String

      def initialize(name : String, @mailbox : String, @domain : String,
                     ttl : UInt32)
        super(name, :in, :rp, ttl)
      end
    end

    struct SOA < RR
      property primary_ns : String
      property responsible : String
      property serial : UInt32
      property refresh : UInt32
      property retry : UInt32
      property expire : UInt32
      property min_ttl : UInt32

      def initialize(name : String, @primary_ns : String, @responsible : String,
                     @serial : UInt32, @refresh : UInt32, @retry : UInt32,
                     @expire : UInt32, @min_ttl : UInt32, ttl : UInt32)
        super(name, :in, :soa, ttl)
      end
    end

    struct SRV < RR
      property prio : UInt16
      property weight : UInt16
      property target : String
      property port : UInt16

      def initialize(name : String, @prio : UInt16, @weight : UInt16,
                     @target : String, @port : UInt16, ttl : UInt32)
        super(name, :in, :srv, ttl)
      end
    end

    struct TXT < RR
      property text : Array(String)

      def initialize(name : String, @text : Array(String), ttl : UInt32)
        super(name, :in, :txt)
      end
    end
  end
end