Documentation
¶
Overview ¶
Package network provides value objects related to network information.
Package network provides value objects related to network information.
Index ¶
- type IPAddress
- func (ip IPAddress) Equals(other IPAddress) bool
- func (ip IPAddress) IsEmpty() bool
- func (ip IPAddress) IsIPv4() bool
- func (ip IPAddress) IsIPv6() bool
- func (ip IPAddress) IsLoopback() bool
- func (ip IPAddress) IsPrivate() bool
- func (ip IPAddress) MarshalJSON() ([]byte, error)
- func (ip IPAddress) String() string
- func (ip IPAddress) Validate() error
- type URL
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IPAddress ¶
type IPAddress string
IPAddress represents an IP address value object that supports both IPv4 and IPv6 formats
func NewIPAddress ¶
NewIPAddress creates a new IPAddress with validation for both IPv4 and IPv6 formats It uses Go's net.ParseIP function which supports both IPv4 (e.g., "192.168.1.1") and IPv6 (e.g., "2001:db8::1") address formats
func (IPAddress) Equals ¶
Equals checks if two IPAddresses are equal Properly handles comparison of both IPv4 and IPv6 addresses in different representations (e.g., IPv4 mapped to IPv6, or different IPv6 notations for the same address)
func (IPAddress) IsIPv4 ¶
IsIPv4 checks if the IP address is in IPv4 format (e.g., "192.168.1.1") Returns true only for valid IPv4 addresses, false for IPv6 addresses or invalid formats
func (IPAddress) IsIPv6 ¶
IsIPv6 checks if the IP address is in IPv6 format (e.g., "2001:db8::1") Returns true only for valid IPv6 addresses, false for IPv4 addresses or invalid formats
func (IPAddress) IsLoopback ¶
IsLoopback checks if the IP address is a loopback address Works with both IPv4 loopback (127.0.0.0/8) and IPv6 loopback (::1) addresses
func (IPAddress) IsPrivate ¶
IsPrivate checks if the IP address is in a private range Supports both IPv4 private ranges (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16) and IPv6 private ranges (fc00::/7)
func (IPAddress) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface