7// IPDomain is an ip address, a domain, or empty.
 
13// IsZero returns if both IP and Domain are zero.
 
14func (d IPDomain) IsZero() bool {
 
15	return d.IP == nil && d.Domain == Domain{}
 
18// String returns a string representation of either the IP or domain (with
 
20func (d IPDomain) String() string {
 
24	return d.Domain.Name()
 
27// LogString returns a string with both ASCII-only and optional UTF-8
 
29func (d IPDomain) LogString() string {
 
33	return d.Domain.LogString()
 
36// XString is like String, but only returns UTF-8 domains if utf8 is true.
 
37func (d IPDomain) XString(utf8 bool) string {
 
39		// todo: check callers if this is valid syntax for them. should we add [] for ipv6? perhaps also ipv4? probably depends on context. in smtp, the syntax is [<ipv4>] and [IPv6:<ipv6>].
 
42	return d.Domain.XName(utf8)
 
45func (d IPDomain) IsIP() bool {
 
49func (d IPDomain) IsDomain() bool {
 
50	return !d.Domain.IsZero()