mirror of
https://github.com/monero-project/monero.git
synced 2025-08-19 07:48:02 -04:00
dns: make ctor private
This ensures one can't instanciate a DNSResolver object by mistake, but uses the singleton. A separate create static function is added for cases where a new object is explicitely needed.
This commit is contained in:
parent
a1af0feb06
commit
5990344cb0
3 changed files with 21 additions and 7 deletions
|
@ -334,6 +334,11 @@ DNSResolver& DNSResolver::instance()
|
|||
return *staticInstance;
|
||||
}
|
||||
|
||||
DNSResolver DNSResolver::create()
|
||||
{
|
||||
return DNSResolver();
|
||||
}
|
||||
|
||||
bool DNSResolver::check_address_syntax(const char *addr)
|
||||
{
|
||||
// if string doesn't contain a dot, we won't consider it a url for now.
|
||||
|
|
|
@ -49,7 +49,7 @@ struct DNSResolverData;
|
|||
*/
|
||||
class DNSResolver
|
||||
{
|
||||
public:
|
||||
private:
|
||||
|
||||
/**
|
||||
* @brief Constructs an instance of DNSResolver
|
||||
|
@ -58,6 +58,8 @@ public:
|
|||
*/
|
||||
DNSResolver();
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* @brief takes care of freeing C pointers and such
|
||||
*/
|
||||
|
@ -119,6 +121,13 @@ public:
|
|||
*/
|
||||
static DNSResolver& instance();
|
||||
|
||||
/**
|
||||
* @brief Gets a new instance of DNSResolver
|
||||
*
|
||||
* @return returns a pointer to the new object
|
||||
*/
|
||||
static DNSResolver create();
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue