@@ -60,6 +60,9 @@ enum Network {
6060 // / CJDNS
6161 NET_CJDNS,
6262
63+ // / Hostname
64+ NET_HOSTNAME,
65+
6366 // / A set of addresses that represent the hash of a string or FQDN. We use
6467 // / them in CAddrMan to keep track of which DNS seeds were used.
6568 NET_INTERNAL,
@@ -105,6 +108,10 @@ static constexpr size_t ADDR_I2P_SIZE = 32;
105108// / Size of CJDNS address (in bytes).
106109static constexpr size_t ADDR_CJDNS_SIZE = 16 ;
107110
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+
108115// / Size of "internal" (NET_INTERNAL) address (in bytes).
109116static constexpr size_t ADDR_INTERNAL_SIZE = 10 ;
110117
@@ -114,6 +121,7 @@ static constexpr uint16_t I2P_SAM31_PORT{0};
114121/* *
115122 * Network address.
116123 */
124+ // CNetAddr is defined here for IPv6 or IPv4
117125class CNetAddr
118126{
119127protected:
@@ -164,8 +172,12 @@ class CNetAddr
164172 * @returns Whether the operation was successful.
165173 * @see CNetAddr::IsTor(), CNetAddr::IsI2P()
166174 */
175+ // Hmmm... looks like hostnames (DNS) *can* fit after all?
167176 bool SetSpecial (const std::string& addr);
168177
178+ // What might this look like??
179+ bool SetHostname (const std::string& addr);
180+
169181 bool IsBindAny () const ; // INADDR_ANY equivalent
170182 bool IsIPv4 () const ; // IPv4 mapped address (::FFFF:0:0/96, 0.0.0.0/0)
171183 bool IsIPv6 () const ; // IPv6 address (not mapped IPv4, not Tor)
@@ -187,6 +199,7 @@ class CNetAddr
187199 bool IsTor () const ;
188200 bool IsI2P () const ;
189201 bool IsCJDNS () const ;
202+ bool IsHostname () const ;
190203 bool IsLocal () const ;
191204 bool IsRoutable () const ;
192205 bool IsInternal () const ;
@@ -282,6 +295,8 @@ class CNetAddr
282295 TORV3 = 4 ,
283296 I2P = 5 ,
284297 CJDNS = 6 ,
298+ // add Hostname support here (and rename the enum?)
299+ HOSTNAME = 1993 ,
285300 };
286301
287302 /* *
@@ -339,6 +354,7 @@ class CNetAddr
339354 case NET_ONION:
340355 case NET_I2P:
341356 case NET_CJDNS:
357+ case NET_HOSTNAME:
342358 break ;
343359 case NET_UNROUTABLE:
344360 case NET_MAX:
@@ -518,6 +534,7 @@ class CSubNet
518534};
519535
520536/* * A combination of a network address (CNetAddr) and a (TCP) port */
537+ // CService is defined here
521538class CService : public CNetAddr
522539{
523540protected:
0 commit comments