mirror of
https://github.com/oxen-io/lokinet.git
synced 2024-11-03 23:15:52 +00:00
21930cf667
* initial relay side lns * fix typo * add reserved names and refactor test for dns * lns name decryption * all wired up (allegedly) * refact to use service::EncryptedName for LNS responses to include nonce with ciphertext * fully rwemove tag_lookup_job * replace lns cache with DecayingHashTable * check for lns name validity against the following rules: * not localhost.loki, loki.loki, or snode.loki * if it contains no dash then max 32 characters long, not including the .loki tld (and also assuming a leading subdomain has been stripped) * These are from general DNS requirements, and also enforced in registrations: * Must be all [A-Za-z0-9-]. (A-Z will be lower-cased by the RPC call). * cannot start or end with a - * max 63 characters long if it does contain a dash * cannot contain -- in the third and fourth characters unless it starts with xn-- * handle timeout in name lookup job by calling the right handler with std::nullopt
33 lines
562 B
C++
33 lines
562 B
C++
#ifndef LLARP_DNS_NAME_HPP
|
|
#define LLARP_DNS_NAME_HPP
|
|
|
|
#include <net/net_int.hpp>
|
|
#include <util/buffer.hpp>
|
|
|
|
#include <string>
|
|
|
|
namespace llarp
|
|
{
|
|
namespace dns
|
|
{
|
|
using Name_t = std::string;
|
|
|
|
/// decode name from buffer
|
|
bool
|
|
DecodeName(llarp_buffer_t* buf, Name_t& name, bool trimTrailingDot = false);
|
|
|
|
/// encode name to buffer
|
|
bool
|
|
EncodeName(llarp_buffer_t* buf, Name_t name);
|
|
|
|
bool
|
|
DecodePTR(Name_t name, huint128_t& ip);
|
|
|
|
bool
|
|
NameIsReserved(Name_t name);
|
|
|
|
} // namespace dns
|
|
} // namespace llarp
|
|
|
|
#endif
|