IP
Internet protocol (IP) support functions such as DNS resolution.
IP.swift:17class IP
IP contains support functions for the Internet Protocol (IP). TCP/IP support is in different classes (see StreamPeerTCP
and TCPServer
). IP provides DNS hostname resolution support, both blocking and threaded.
Superclasses
class Object
Base class for all other classes in the engine.
Citizens in SwiftGodot
Conformances
protocol CustomStringConvertible
A type with a customized textual representation.
protocol Equatable
A type that can be compared for value equality.
protocol Hashable
A type that can be hashed into a
Hasher
to produce an integer hash value.protocol Identifiable<ID>
A class of types whose instances hold the value of an entity with stable identity.
protocol VariantRepresentable
Types that conform to VariantRepresentable can be stored directly in
Variant
with no conversion. These include all of the Variant types from Godot (for exampleGString
,Rect
,Plane
), Godot objects (those that subclass SwiftGodot.Object) as well as the built-in Swift types UInt8, Int64 and Double.protocol VariantStorable
Types that conform to VariantStorable can be stored in a Variant and can be extracted back out of a Variant.
Types
Type members
static let resolverInvalidId: Int
Invalid ID constant. Returned if
resolverMaxQueries
is exceeded.static let resolverMaxQueries: Int
Maximum number of concurrent DNS resolver queries allowed,
resolverInvalidId
is returned if exceeded.static func clearCache(hostname: String
) Removes all of a
hostname
’s cached references. If nohostname
is given, all cached IP addresses are removed.static func eraseResolveItem(id: Int32
) Removes a given item
id
from the queue. This should be used to free a queue after it has completed to enable more queries to happen.static func getLocalAddresses(
) -> PackedStringArray Returns all the user’s current IPv4 and IPv6 addresses as an array.
static func getLocalInterfaces(
) -> VariantCollection<GDictionary> Returns all network adapters as an array.
static func getResolveItemAddress(id: Int32
) -> String Returns a queued hostname’s IP address, given its queue
id
. Returns an empty string on error or if resolution hasn’t happened yet (seegetResolveItemStatus(id:)
).static func getResolveItemAddresses(id: Int32
) -> GArray Returns resolved addresses, or an empty array if an error happened or resolution didn’t happen yet (see
getResolveItemStatus(id:)
).static func getResolveItemStatus(id: Int32
) -> IP.ResolverStatus Returns a queued hostname’s status as a
ResolverStatus
constant, given its queueid
.static func resolveHostname(host: String, ipType: IP.GType
) -> String Returns a given hostname’s IPv4 or IPv6 address when resolved (blocking-type method). The address type returned depends on the
IP/Type
constant given asipType
.static func resolveHostnameAddresses(host: String, ipType: IP.GType
) -> PackedStringArray Resolves a given hostname in a blocking way. Addresses are returned as an
GArray
of IPv4 or IPv6 addresses depending onipType
.static func resolveHostnameQueueItem(host: String, ipType: IP.GType
) -> Int32 Creates a queue item to resolve a hostname to an IPv4 or IPv6 address depending on the
IP/Type
constant given asipType
. Returns the queue ID if successful, orresolverInvalidId
on error.class var godotClassName: StringName