Debian Codegraph @

internal/dnsstring/types.go

raw
1 package dnsstring
2
3 // Wire constants and supported types.
4 const (
5
6 // If you add one here, also add internal/dnsstrings/types.go
7
8 TypeNone uint16 = 0
9 TypeA uint16 = 1
10 TypeNS uint16 = 2
11 TypeMD uint16 = 3
12 TypeMF uint16 = 4
13 TypeCNAME uint16 = 5
14 TypeSOA uint16 = 6
15 TypeMB uint16 = 7
16 TypeMG uint16 = 8
17 TypeMR uint16 = 9
18 TypeNULL uint16 = 10
19 TypePTR uint16 = 12
20 TypeHINFO uint16 = 13
21 TypeMINFO uint16 = 14
22 TypeMX uint16 = 15
23 TypeTXT uint16 = 16
24 TypeRP uint16 = 17
25 TypeAFSDB uint16 = 18
26 TypeX25 uint16 = 19
27 TypeISDN uint16 = 20
28 TypeRT uint16 = 21
29 TypeNSAPPTR uint16 = 23
30 TypeSIG uint16 = 24
31 TypeKEY uint16 = 25
32 TypePX uint16 = 26
33 TypeGPOS uint16 = 27
34 TypeAAAA uint16 = 28
35 TypeLOC uint16 = 29
36 TypeNXT uint16 = 30
37 TypeEID uint16 = 31
38 TypeNIMLOC uint16 = 32
39 TypeSRV uint16 = 33
40 TypeATMA uint16 = 34
41 TypeNAPTR uint16 = 35
42 TypeKX uint16 = 36
43 TypeCERT uint16 = 37
44 TypeDNAME uint16 = 39
45 TypeOPT uint16 = 41
46 TypeAPL uint16 = 42 // Not implemented.
47 TypeDS uint16 = 43
48 TypeSSHFP uint16 = 44
49 TypeIPSECKEY uint16 = 45 // Not implemented.
50 TypeRRSIG uint16 = 46
51 TypeNSEC uint16 = 47
52 TypeDNSKEY uint16 = 48
53 TypeDHCID uint16 = 49
54 TypeNSEC3 uint16 = 50
55 TypeNSEC3PARAM uint16 = 51
56 TypeTLSA uint16 = 52
57 TypeSMIMEA uint16 = 53
58 TypeHIP uint16 = 55
59 TypeNINFO uint16 = 56
60 TypeRKEY uint16 = 57
61 TypeTALINK uint16 = 58
62 TypeCDS uint16 = 59
63 TypeCDNSKEY uint16 = 60
64 TypeOPENPGPKEY uint16 = 61
65 TypeCSYNC uint16 = 62
66 TypeZONEMD uint16 = 63
67 TypeSVCB uint16 = 64
68 TypeHTTPS uint16 = 65
69 TypeDSYNC uint16 = 66
70 TypeSPF uint16 = 99
71 TypeUINFO uint16 = 100
72 TypeUID uint16 = 101
73 TypeGID uint16 = 102
74 TypeUNSPEC uint16 = 103
75 TypeNID uint16 = 104
76 TypeL32 uint16 = 105
77 TypeL64 uint16 = 106
78 TypeLP uint16 = 107
79 TypeEUI48 uint16 = 108
80 TypeEUI64 uint16 = 109
81 TypeNXNAME uint16 = 128
82 TypeURI uint16 = 256
83 TypeCAA uint16 = 257
84 TypeAVC uint16 = 258
85 TypeAMTRELAY uint16 = 260 // Not implemented.
86 TypeRESINFO uint16 = 261
87 TypeWALLET uint16 = 262
88 TypeCLA uint16 = 263
89 TypeIPN uint16 = 264
90
91 TypeTKEY uint16 = 249
92 TypeTSIG uint16 = 250
93
94 // Valid question types only.
95 TypeIXFR uint16 = 251
96 TypeAXFR uint16 = 252
97 TypeMAILB uint16 = 253
98 TypeMAILA uint16 = 254
99 TypeANY uint16 = 255
100
101 TypeTA uint16 = 32768
102 TypeDLV uint16 = 32769
103 TypeDELEG uint16 = 65432 // Provisional type code.
104 TypeDELEGPARAM uint16 = 65433 // Provisional type code.
105 TypeReserved uint16 = 65535
106 )
107
108 // Various constants used in the LOC RR. See RFC 1876.
109 const (
110 LOCEquator = 1 << 31 // RFC 1876, Section 2.
111 LOCPrimemeridian = 1 << 31 // RFC 1876, Section 2.
112 LOCHours = 60 * 1000
113 LOCDegrees = 60 * LOCHours
114 LOCAltitudebase = 100000
115 )
116
117 // DNSSEC encryption algorithm codes.
118 const (
119 _ uint8 = iota
120 RSAMD5
121 DH
122 DSA
123 _ // Skip 4, RFC 6725, section 2.1.
124 RSASHA1
125 DSANSEC3SHA1
126 RSASHA1NSEC3SHA1
127 RSASHA256
128 _ // Skip 9, RFC 6725, section 2.1.
129 RSASHA512
130 _ // Skip 11, RFC 6725, section 2.1.
131 ECCGOST
132 ECDSAP256SHA256
133 ECDSAP384SHA384
134 ED25519
135 ED448
136 SM2SM3 // See RFC 9563.
137 MLDSA44 // See draft-westerbaan-dnssec-mldsa.
138 ECCGOST12 uint8 = 23 // See RFC 9558.
139 INDIRECT uint8 = 252
140 PRIVATEDNS uint8 = 253 // Private (experimental keys)
141 PRIVATEOID uint8 = 254
142 )
143
144 // AlgorithmToString is a map of algorithm IDs to algorithm names.
145 var AlgorithmToString = map[uint8]string{
146 RSAMD5: "RSAMD5",
147 DH: "DH",
148 DSA: "DSA",
149 RSASHA1: "RSASHA1",
150 DSANSEC3SHA1: "DSA-NSEC3-SHA1",
151 RSASHA1NSEC3SHA1: "RSASHA1-NSEC3-SHA1",
152 RSASHA256: "RSASHA256",
153 RSASHA512: "RSASHA512",
154 ECCGOST: "ECC-GOST",
155 ECDSAP256SHA256: "ECDSAP256SHA256",
156 ECDSAP384SHA384: "ECDSAP384SHA384",
157 ED25519: "ED25519",
158 ED448: "ED448",
159 SM2SM3: "SM2SM3",
160 MLDSA44: "MLDSA44",
161 ECCGOST12: "ECC-GOST12",
162 INDIRECT: "INDIRECT",
163 PRIVATEDNS: "PRIVATEDNS",
164 PRIVATEOID: "PRIVATEOID",
165 }
166
167 // Different Certificate Types, see RFC 4398, Section 2.1.
168 const (
169 CertPKIX = 1 + iota
170 CertSPKI
171 CertPGP
172 CertIPIX
173 CertISPKI
174 CertIPGP
175 CertACPKIX
176 CertIACPKIX
177 CertURI = 253
178 CertOID = 254
179 )
180
181 // CertTypeToString converts the Cert Type to its string representation.
182 // See RFC 4398 and RFC 6944.
183 var CertTypeToString = map[uint16]string{
184 CertPKIX: "PKIX",
185 CertSPKI: "SPKI",
186 CertPGP: "PGP",
187 CertIPIX: "IPIX",
188 CertISPKI: "ISPKI",
189 CertIPGP: "IPGP",
190 CertACPKIX: "ACPKIX",
191 CertIACPKIX: "IACPKIX",
192 CertURI: "URI",
193 CertOID: "OID",
194 }