forked from tact-lang/tact
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dns.tact
40 lines (30 loc) · 1.19 KB
/
dns.tact
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import "@stdlib/dns";
import "@stdlib/deploy";
contract DNSTester with Deployable, DNSResolver {
/// Used for storing temporary values
tmpC: Cell = cell("te6cckEBAQEAAgAAAEysuc0="); // empty cell
init() {}
get fun stringToInternal(src: String): Slice? {
return dnsStringToInternal(src);
}
get fun internalNormalize(src: Slice): Slice {
return dnsInternalNormalize(src);
}
get fun dnsInternalVerify(subdomain: Slice): Bool {
return dnsInternalVerify(subdomain);
}
get fun dnsExtractTopDomainLength(subdomain: Slice): Int {
return dnsExtractTopDomainLength(subdomain);
}
get fun dnsExtractTopDomain(subdomain: Slice): Slice {
return dnsExtractTopDomain(subdomain);
}
override fun doResolveDNS(subdomain: Slice, category: Int): DNSResolveResult {
return DNSResolveResult{ prefix: subdomain.bits(), record: beginCell().storeSlice(subdomain).endCell() };
}
receive("test dnsInternalNormalize throws") {
let sliceWithRef = beginCell().storeRef(emptyCell()).asSlice();
// Refs in the passed Slice are prohibited
self.tmpC = dnsInternalNormalize(sliceWithRef).asCell();
}
}