ip.address

A variant type to represent IPv4 and IPv6 addresses. Some features are only available for one version of the protocol and will raise an error when you try to use it against an IP address of a different version.

Functions

new() → ip.address

new()    (1)
new(str) (2)
1 Default constructor.
2 Create an IPv4 address in dotted decimal form, or from an IPv6 address in hexadecimal notation.

any_v4() → ip.address

Create an address object that represents any (v4) address.

any_v6() → ip.address

Create an address object that represents any (v6) address.

loopback_v4() → ip.address

Create an address object that represents the loopback (v4) address.

loopback_v6() → ip.address

Create an address object that represents the loopback (v6) address.

broadcast_v4() → ip.address

Create an address object that represents the broadcast (v4) address.

Functions (v4)

to_v6(self) → ip.address

Create an IPv4-mapped IPv6 address.

Functions (v6)

to_v4(self) → ip.address

Create an IPv4 address from a IPv4-mapped IPv6 address.

Properties

is_loopback: boolean

Whether the address is a loopback address.

is_multicast: boolean

Whether the address is a multicast address.

is_unspecified: boolean

Whether the address is unspecified.

is_v4: boolean

Whether the address is an IP version 4 address.

is_v6: boolean

Whether the address is an IP version 6 address.

Properties (v6)

An error will be raised if you try to use against a v4 object.

Whether the address is link local.

is_multicast_global: boolean

Whether the address is a global multicast address.

Whether the address is a link-local multicast address.

is_multicast_node_local: boolean

Whether the address is a node-local multicast address.

is_multicast_org_local: boolean

Whether the address is a org-local multicast address.

is_multicast_site_local: boolean

Whether the address is a site-local multicast address.

is_site_local: boolean

Whether the address is site local.

is_v4_mapped: boolean

Whether the address is a mapped IPv4 address.

scope_id: integer

The scope ID of the address. Read-write property.

Metamethods

  • __tostring()

  • __eq()

  • __lt()

  • __le()