Prajna


LocalDNS

DNS helper functions. Cannot instantiate class, only contains static members.

Constructors

ConstructorDescription
new()
Signature: unit -> LocalDNS

Static members

Static memberDescription
AddEntry(hostname, ipAddresses)
Signature: (hostname:string * ipAddresses:byte [] []) -> unit

Add a DNS entry of hostname <-> ipAddresses The hostname to add to the cache The IP addresses corresponding to the hostname being added

GetAnyIPAddress(hostname, bTryResolve)
Signature: (hostname:string * bTryResolve:bool option) -> IPAddress

Return a random IPv4 address of hostname. The hostname Optional argument - default is true If bTryResolve is false, the function only attemps to retrieve the DNS entry in cache. If bTryResolve is false and the DNS entry doesn't exist, null is returned for addresses. A random IPv4 address of the hostname

GetHostAddresses(hostname, bTryResolve)
Signature: (hostname:string * bTryResolve:bool option) -> byte [] []

Similar to Dns.GetHostAddresses, but only use IPv4 addresses, and caches its result.\ The hostname to resolve Optional argument (default is true). Also, if bTryResolve is false, the function only attemps to retrieve the DNS entry in cache. If bTryResolve is false and the DNS entry doesn't exist, null is returned for addresses. An array of host addresses, where each address is array of bytes

GetHostByAddress(addr, bTryResolve)
Signature: (addr:byte [] * bTryResolve:bool option) -> string

Similar to Dns.GetHostEntry, but cache its result. The ipaddress as array of bytes Optional argument (default is true). Also, if bTryResolve is false, the function only attemps to retrieve the DNS entry in cache. If bTryResolve is false and the DNS entry doesn't exist, null is returned for hostname. A string representing the host address

GetHostInfoInt64(addrSignature)
Signature: addrSignature:int64 -> string

Attempt to retrieve the hostname of a 48bit signature of type int64, with port being the lowest 16 bit, and IPv4 address takes 17 to 48 bit. If the DNS entry doesn't exist in cache, the hostname information is shown as x.x.x.x

GetNameForIPAddress(addr)
Signature: addr:IPAddress -> string

Attempt to retrieve the hostname for IPAddress addr. If the DNS entry does not exist, the function returns IP addresses information string as x.x.x.x

GetShowInfo(ep)
Signature: ep:EndPoint -> string

Show host information of an endpoint ep. If the hostname is not in DNS cache, IP address and port information is shown. The endpoint A string for display purposes

Int64ToIPEndPoint(addrSignature)
Signature: addrSignature:int64 -> IPEndPoint

Convert a 48bit signature of type int64 back to an IPv4 endpoint, with port being the lowest 16 bit, and IPv4 address takes 17 to 48 bit.

IPEndPointToInt64(ep)
Signature: ep:IPEndPoint -> int64

Map an IPv4 endpoint to a 48bit signature of type int64, with port being the lowest 16 bit, and IPv4 address takes 17 to 48 bit.

IPv4AddrToInt64(addr, port)
Signature: (addr:IPAddress * port:int) -> int64

Map an IPv4 address to a 48bit signature of type int64, with port being the lowest 16 bit, and IPv4 address takes 17 to 48 bit.

Fork me on GitHub