RVS_IPAddressV4

public struct RVS_IPAddressV4 : RVS_IPAddress

This is a specialization for IPV4

  • Declaration

    Swift

    public var port: Int

    Return Value

    the TCP Port of the IP address.

  • Declaration

    Swift

    public var addressArray: [Int] { get set }

    Return Value

    The IP address element Array, vetted and cleaned for V4

  • Declaration

    Swift

    public var address: String { get }

    Return Value

    The IPV4 String representation.

  • Declaration

    Swift

    public var addressAndPort: String { get }

    Return Value

    The String, representing both the address and the port. Just the address, if no port. 0 is a valid TCP port, but we don’t count that. 0 is no port.

  • Declaration

    Swift

    public var isValidAddress: Bool { get }

    Return Value

    true, if this is a valid IPV4 address.

  • This init extracts an IPV4 address, and, if applicable, TCP port, from a given string.

    The rule for an IPv4 address is quite simple. It is four (4) sequential bytes (8 bits), expressed as decimal (not hexadecimal) numbers, and separated by periods (.), like so: 123.123.123.123.

    Each segment is a positive integer, from 0-255. They can be zero-padded, but generally are not.

    If an additional TCP port is provided, that is indicated by appending a colon (:) to the end, followed immediately by a positive integer, like so: 123.123.123.123:456.

    Declaration

    Swift

    public init(_ inString: String)

    Parameters

    inString

    The String to be parsed.

  • Initialize from an Array of Int.

    Declaration

    Swift

    init(_ inArray: [Int] = [], port inPort: Int = 0)

    Parameters

    inArray

    An optional Array of Int. Exactly 4 elements, with positive integer values below 256.

    port

    An optional parameter (default is 0), that allows you to explicitly specify the port.