LanguageValues and typesStandard typesWeb and network
IpAddress
On this page
An IPv4 or IPv6 address: 192.0.2.1, 2001:db8::1.
Use it for an address you allow or block. For a range of addresses, use Cidr. For a name, use Hostname.
Shape
One value, with no fields to fill in. As text it reads 2001:db8::1.
Example
IpAddress("192.0.2.1")text.parse(raw, as: IpAddress) reads one from text that comes from outside. Text that isn't one at all fails malformed, such as 192.0.2 or example.com.
Good to know
- When it identifies a person, mark the field that holds it
personal: PersonalData.online. ==tells you whether two are the same.<andlist.sort_bydon't take it.
In JSON
A string, in a request, a response or json.write:
"192.0.2.1""2001:db8::1"
Details
Text form, storage, how it is shown, and operations
IpAddress is in the group Web and network, and has been in Jadpo since 0.1.0.
Text form
text.from writes one standard text form, the same form text.parse reads back: 192.0.2.1 and 2001:db8::1.
How it is stored
It is stored in one column named for the field, of type text. 2001:db8::1 is stored as '2001:db8::1'.
How it is shown to people
text.format(value, locale:) shows it to people in their locale.
With locale: Locale.en_gb:
| Value | Shown |
|---|---|
192.0.2.1 |
192.0.2.1 |
2001:db8::1 |
2001:db8::1 |
Operations
web.cidr_contains(range: Cidr, address: IpAddress) -> Bool: Whetheraddressis insiderange. An IPv4 address is never inside an IPv6 range, nor the other way round.
It also takes text.parse, text.from, text.format, json.read, json.write and ==. How every standard type behaves says how they work.
Markdown for agents: /docs/types/type-ip-address.md.Built from Jadpo main at aee2e8f.