ddat interop with dat js cable interop with cabal js ddat's frontend = dat-thang cable fe = cable-thang dillo support based on cel's dillo-dat bootstrap node xplatform support Signed-off-by: divo <418@cryspace.space>
28 lines
1.0 KiB
C
28 lines
1.0 KiB
C
#ifndef DAT_DNS_H
|
|
#define DAT_DNS_H
|
|
|
|
#include <stdint.h>
|
|
#include "dat.h"
|
|
|
|
typedef int (*dat_dns_name_iter_fn)(const char *hostname,
|
|
const uint8_t key[DAT_KEY_BYTES], void *context);
|
|
|
|
/* Resolve a legacy Dat DNS TXT record such as datkey=<64 hex digits>. */
|
|
int dat_dns_resolve(const char *hostname, uint8_t key[DAT_KEY_BYTES],
|
|
uint32_t *ttl_seconds);
|
|
|
|
/* Local dat-dns aliases are stored in $HOME/.dat/dat-dns (or USERPROFILE on
|
|
* native Windows) and override DNS TXT. */
|
|
int dat_dns_name_set(const char *hostname, const uint8_t key[DAT_KEY_BYTES]);
|
|
int dat_dns_name_remove(const char *hostname);
|
|
int dat_dns_name_resolve(const char *hostname, uint8_t key[DAT_KEY_BYTES]);
|
|
int dat_dns_name_for_key(const uint8_t key[DAT_KEY_BYTES], char *hostname,
|
|
size_t hostname_capacity);
|
|
int dat_dns_name_foreach(dat_dns_name_iter_fn callback, void *context);
|
|
|
|
/* Decode TXT record character strings from one DNS answer packet. */
|
|
int dat_dns_parse_answer(const uint8_t *packet, unsigned packet_len,
|
|
uint8_t key[DAT_KEY_BYTES], uint32_t *ttl_seconds);
|
|
|
|
#endif
|