Some changes at namesys.
This commit is contained in:
parent
da4b1f86f4
commit
049078effc
2 changed files with 9 additions and 4 deletions
|
@ -59,10 +59,11 @@
|
|||
|
||||
typedef struct s_DNSResolver {
|
||||
// TODO
|
||||
int (*lookupTXT) (char ***, char *);
|
||||
} DNSResolver;
|
||||
|
||||
int ipfs_dns_resolver_resolve_once (DNSResolver *r, char **path, char *name);
|
||||
int ipfs_dns_resolver_resolve_once (char **path, char *name);
|
||||
int ipfs_dns_work_domain (int output, DNSResolver *r, char *name);
|
||||
int ipfs_dns_parse_entry (char **Path, char *txt);
|
||||
int ipfs_dns_try_parse_dns_link (char **Path, char *txt);
|
||||
int ipfs_dns_parse_entry (char **path, char *txt);
|
||||
int ipfs_dns_try_parse_dns_link(char **path, char *txt);
|
||||
#endif //NAMESYS_H
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include "ipfs/cid/cid.h"
|
||||
#include "ipfs/path/path.h"
|
||||
#include "ipfs/namesys/namesys.h"
|
||||
#include "ipfs/dnslink/dnslink.h"
|
||||
|
||||
/* mpns (a multi-protocol NameSystem) implements generic IPFS naming.
|
||||
*
|
||||
|
@ -31,7 +32,7 @@ func NewNameSystem(r routing.ValueStore, ds ds.Datastore, cachesize int) NameSys
|
|||
}
|
||||
}*/
|
||||
|
||||
const DefaultResolverCacheTTL = time.Minute;
|
||||
const DefaultResolverCacheTTL = 60;
|
||||
|
||||
// ipfs_namesys_resolve implements Resolver.
|
||||
int ipfs_namesys_resolve(char **path, char *name)
|
||||
|
@ -94,11 +95,14 @@ int ipfs_namesys_resolve_once (char **path, char *name)
|
|||
char *ptr = NULL;
|
||||
char **segs;
|
||||
int i, err = 0;
|
||||
struct DNSResolver dnsr;
|
||||
|
||||
if (!name) { // NULL pointer.
|
||||
return ErrNULLPointer;
|
||||
}
|
||||
|
||||
dnsr.lookupTXT = ipfs_dnslink_resolv_lookupTXT;
|
||||
|
||||
if (memcmp (name, ipns_prefix, strlen(ipns_prefix)) == 0) { // prefix missing.
|
||||
i = strlen(name) + sizeof(ipns_prefix);
|
||||
ptr = malloc(i);
|
||||
|
|
Loading…
Reference in a new issue