@@ -60,6 +60,9 @@ enum Network {
60
60
// / CJDNS
61
61
NET_CJDNS,
62
62
63
+ // / Hostname
64
+ NET_HOSTNAME,
65
+
63
66
// / A set of addresses that represent the hash of a string or FQDN. We use
64
67
// / them in CAddrMan to keep track of which DNS seeds were used.
65
68
NET_INTERNAL,
@@ -105,6 +108,10 @@ static constexpr size_t ADDR_I2P_SIZE = 32;
105
108
// / Size of CJDNS address (in bytes).
106
109
static constexpr size_t ADDR_CJDNS_SIZE = 16 ;
107
110
111
+ // / Size of Hostname (in bytes). This is the maximum length of all labels and
112
+ // / dots as per RFC 1035 Size limits (Section 2.3.4.)
113
+ static constexpr size_t ADDR_HOSTNAME_SIZE = 255 ;
114
+
108
115
// / Size of "internal" (NET_INTERNAL) address (in bytes).
109
116
static constexpr size_t ADDR_INTERNAL_SIZE = 10 ;
110
117
@@ -114,6 +121,7 @@ static constexpr uint16_t I2P_SAM31_PORT{0};
114
121
/* *
115
122
* Network address.
116
123
*/
124
+ // CNetAddr is defined here for IPv6 or IPv4
117
125
class CNetAddr
118
126
{
119
127
protected:
@@ -164,8 +172,12 @@ class CNetAddr
164
172
* @returns Whether the operation was successful.
165
173
* @see CNetAddr::IsTor(), CNetAddr::IsI2P()
166
174
*/
175
+ // Hmmm... looks like hostnames (DNS) *can* fit after all?
167
176
bool SetSpecial (const std::string& addr);
168
177
178
+ // What might this look like??
179
+ bool SetHostname (const std::string& addr);
180
+
169
181
bool IsBindAny () const ; // INADDR_ANY equivalent
170
182
bool IsIPv4 () const ; // IPv4 mapped address (::FFFF:0:0/96, 0.0.0.0/0)
171
183
bool IsIPv6 () const ; // IPv6 address (not mapped IPv4, not Tor)
@@ -191,6 +203,7 @@ class CNetAddr
191
203
bool IsRoutable () const ;
192
204
bool IsInternal () const ;
193
205
bool IsValid () const ;
206
+ bool IsHostname () const ;
194
207
195
208
/* *
196
209
* Check if the current object can be serialized in pre-ADDRv2/BIP155 format.
@@ -282,6 +295,8 @@ class CNetAddr
282
295
TORV3 = 4 ,
283
296
I2P = 5 ,
284
297
CJDNS = 6 ,
298
+ // add Hostname support here (and rename the enum?)
299
+ HOSTNAME = 1993 ,
285
300
};
286
301
287
302
/* *
@@ -339,6 +354,7 @@ class CNetAddr
339
354
case NET_ONION:
340
355
case NET_I2P:
341
356
case NET_CJDNS:
357
+ case NET_HOSTNAME:
342
358
break ;
343
359
case NET_UNROUTABLE:
344
360
case NET_MAX:
@@ -518,6 +534,7 @@ class CSubNet
518
534
};
519
535
520
536
/* * A combination of a network address (CNetAddr) and a (TCP) port */
537
+ // CService is defined here
521
538
class CService : public CNetAddr
522
539
{
523
540
protected:
0 commit comments