import { ServiceType } from "../CiaoService"; import { Protocol } from "../index"; /** * The most characters a service type may hold (RFC 6763 7.2), the limit every check of a type's length reads. */ export declare const MAX_SERVICE_TYPE_LENGTH = 15; export interface PTRQueryDomain { domain: string; protocol: Protocol; type: ServiceType | string; } export interface InstanceNameDomain { domain: string; protocol: Protocol; type: ServiceType | string; name: string; } export interface SubTypedNameDomain { domain: string; protocol: Protocol; type: ServiceType | string; subtype: ServiceType | string; } export interface FQDNParts { name?: string; type: ServiceType | string; protocol?: Protocol; domain?: string; } export interface SubTypePTRParts { subtype: ServiceType | string; type: ServiceType | string; protocol?: Protocol; domain?: string; } export declare function parseFQDN(fqdn: string): PTRQueryDomain | InstanceNameDomain | SubTypedNameDomain; export declare function stringify(parts: FQDNParts | SubTypePTRParts): string; /** * The hostname with the domain and the root label after it, rebuilt from its labels in the spelling the label coder decodes, whether the domain is appended * or already carried. The domain is appended unless the hostname's last labels already are the domain's, read raw, so an escaped dot in its last own label is * no separator. A hostname carrying the domain keeps only its own labels ahead of the domain as given, so the domain is spelled one way in it, the spelling * `removeTLD` cuts by. * * @param hostname - The hostname in presentation form, without the root label. * @param domain - The domain in presentation form. */ export declare function formatHostname(hostname: string, domain?: string): string; /** * The hostname without its domain and the root label: the last label when no domain is named, and otherwise the domain `formatHostname` appended, * however many labels that holds, so "Foo.my.domain." with the domain "my.domain" gives "Foo". * * @param hostname - The hostname, with or without the root label. * @param domain - The domain `formatHostname` appended to the hostname. */ export declare function removeTLD(hostname: string, domain?: string): string; export declare function enlargeIPv6(address: string): string; export declare function shortenIPv6(address: string | string[]): string; /** * Spells an IPv6 address in the text form of RFC 5952 section 4: lowercase hex digits, no leading zeros in a hextet, and the longest run of two or more * zero hextets, the first on a tie, compressed to "::". It applies section 5's mixed notation to the IPv4-mapped form (::ffff:a.b.c.d) and the * IPv4-compatible form (::a.b.c.d) under the rule `shortenIPv6` states, the one Node's `net.SocketAddress` follows, so ::ffff:c000:201 and * ::ffff:192.0.2.1 both read ::ffff:192.0.2.1, while ::1 and the RFC 2765 form ::ffff:0:c000:201 stay hex. A zone (RFC 4007 section 11) is no part of * an address's text, as RFC 4007 keeps it off the wire, so the text is cut at its first "%" before anything else reads it; the zone is read only where * an address selects an interface, `NetworkManager.resolveInterface`. * * Text that enters ciao from outside passes through here: the address of a record built by name, every address the operating system reports and every * address a consumer gives in its options, so different spellings of one address compare equal as strings. Hextets ciao formats itself with * `toString(16)` are lowercase with no leading zeros already, so `shortenIPv6` alone gives them the same text. * * @param address - An IPv6 address in any spelling `net.isIPv6` accepts, a zone among them. */ export declare function canonicalizeIPv6(address: string): string; export declare function formatReverseAddressPTRName(address: string): string; export declare function ipAddressFromReversAddressName(name: string): string; export declare function getNetAddress(address: string, netmask: string): string; //# sourceMappingURL=domain-formatter.d.ts.map