Documentation ¶
Index ¶
- Constants
- type AddressStringFormatParams
- type AddressStringFormatParamsBuilder
- func (params *AddressStringFormatParamsBuilder) AllowsLeadingZeros() bool
- func (params *AddressStringFormatParamsBuilder) AllowsUnlimitedLeadingZeros() bool
- func (params *AddressStringFormatParamsBuilder) AllowsWildcardedSeparator() bool
- func (params *AddressStringFormatParamsBuilder) GetRangeParams() RangeParams
- func (builder *AddressStringFormatParamsBuilder) GetRangeParamsBuilder() RangeParams
- func (builder *AddressStringFormatParamsBuilder) ToParams() AddressStringFormatParams
- type AddressStringParams
- type AddressStringParamsBuilder
- type AllStrOption
- type EmptyStrOption
- type HostNameParams
- type HostNameParamsBuilder
- func (builder *HostNameParamsBuilder) AllowBracketedIPv4(allow bool) *HostNameParamsBuilder
- func (builder *HostNameParamsBuilder) AllowBracketedIPv6(allow bool) *HostNameParamsBuilder
- func (builder *HostNameParamsBuilder) AllowEmpty(allow bool) *HostNameParamsBuilder
- func (builder *HostNameParamsBuilder) AllowIPAddress(allow bool) *HostNameParamsBuilder
- func (builder *HostNameParamsBuilder) AllowPort(allow bool) *HostNameParamsBuilder
- func (builder *HostNameParamsBuilder) AllowService(allow bool) *HostNameParamsBuilder
- func (params *HostNameParamsBuilder) AllowsBracketedIPv4() bool
- func (params *HostNameParamsBuilder) AllowsBracketedIPv6() bool
- func (params *HostNameParamsBuilder) AllowsEmpty() bool
- func (params *HostNameParamsBuilder) AllowsIPAddress() bool
- func (params *HostNameParamsBuilder) AllowsPort() bool
- func (params *HostNameParamsBuilder) AllowsService() bool
- func (builder *HostNameParamsBuilder) ExpectPort(expect bool) *HostNameParamsBuilder
- func (params *HostNameParamsBuilder) ExpectsPort() bool
- func (params *HostNameParamsBuilder) GetIPAddressParams() IPAddressStringParams
- func (builder *HostNameParamsBuilder) GetIPAddressParamsBuilder() (result *IPAddressStringParamsBuilder)
- func (params *HostNameParamsBuilder) GetPreferredVersion() IPVersion
- func (builder *HostNameParamsBuilder) NormalizeToLowercase(allow bool) *HostNameParamsBuilder
- func (params *HostNameParamsBuilder) NormalizesToLowercase() bool
- func (builder *HostNameParamsBuilder) Set(params HostNameParams) *HostNameParamsBuilder
- func (builder *HostNameParamsBuilder) SetIPAddressParams(params IPAddressStringParams) *HostNameParamsBuilder
- func (builder *HostNameParamsBuilder) SetPreferredVersion(version IPVersion) *HostNameParamsBuilder
- func (builder *HostNameParamsBuilder) ToParams() HostNameParams
- type IPAddressStringFormatParams
- type IPAddressStringFormatParamsBuilder
- func (builder *IPAddressStringFormatParamsBuilder) AllowsBinary() bool
- func (params *IPAddressStringFormatParamsBuilder) AllowsLeadingZeros() bool
- func (builder *IPAddressStringFormatParamsBuilder) AllowsPrefixLenLeadingZeros() bool
- func (builder *IPAddressStringFormatParamsBuilder) AllowsPrefixesBeyondAddressSize() bool
- func (params *IPAddressStringFormatParamsBuilder) AllowsUnlimitedLeadingZeros() bool
- func (params *IPAddressStringFormatParamsBuilder) AllowsWildcardedSeparator() bool
- func (builder *IPAddressStringFormatParamsBuilder) GetParentBuilder() *IPAddressStringParamsBuilder
- func (params *IPAddressStringFormatParamsBuilder) GetRangeParams() RangeParams
- func (builder *IPAddressStringFormatParamsBuilder) ToParams() IPAddressStringFormatParams
- type IPAddressStringParams
- type IPAddressStringParamsBuilder
- func (builder *IPAddressStringParamsBuilder) AllowAll(allow bool) *IPAddressStringParamsBuilder
- func (builder *IPAddressStringParamsBuilder) AllowEmpty(allow bool) *IPAddressStringParamsBuilder
- func (builder *IPAddressStringParamsBuilder) AllowIPv4(allow bool) *IPAddressStringParamsBuilder
- func (builder *IPAddressStringParamsBuilder) AllowIPv6(allow bool) *IPAddressStringParamsBuilder
- func (builder *IPAddressStringParamsBuilder) AllowInetAton(allow bool) *IPAddressStringParamsBuilder
- func (builder *IPAddressStringParamsBuilder) AllowMask(allow bool) *IPAddressStringParamsBuilder
- func (builder *IPAddressStringParamsBuilder) AllowPrefix(allow bool) *IPAddressStringParamsBuilder
- func (builder *IPAddressStringParamsBuilder) AllowSingleSegment(allow bool) *IPAddressStringParamsBuilder
- func (builder *IPAddressStringParamsBuilder) AllowWildcardedSeparator(allow bool) *IPAddressStringParamsBuilder
- func (params *IPAddressStringParamsBuilder) AllowsAll() bool
- func (params *IPAddressStringParamsBuilder) AllowsEmpty() bool
- func (params *IPAddressStringParamsBuilder) AllowsSingleSegment() bool
- func (builder *IPAddressStringParamsBuilder) GetIPv4AddressParamsBuilder() (result *IPv4AddressStringParamsBuilder)
- func (builder *IPAddressStringParamsBuilder) GetIPv6AddressParamsBuilder() (result *IPv6AddressStringParamsBuilder)
- func (builder *IPAddressStringParamsBuilder) GetParentBuilder() *HostNameParamsBuilder
- func (builder *IPAddressStringParamsBuilder) ParseAllStrAs(option AllStrOption) *IPAddressStringParamsBuilder
- func (builder *IPAddressStringParamsBuilder) ParseEmptyStrAs(option EmptyStrOption) *IPAddressStringParamsBuilder
- func (builder *IPAddressStringParamsBuilder) Set(params IPAddressStringParams) *IPAddressStringParamsBuilder
- func (builder *IPAddressStringParamsBuilder) SetPreferredVersion(version IPVersion) *IPAddressStringParamsBuilder
- func (builder *IPAddressStringParamsBuilder) SetRangeParams(rangeParams RangeParams) *IPAddressStringParamsBuilder
- func (builder *IPAddressStringParamsBuilder) ToParams() IPAddressStringParams
- type IPVersion
- type IPv4AddressStringParams
- type IPv4AddressStringParamsBuilder
- func (builder *IPv4AddressStringParamsBuilder) AllowBinary(allow bool) *IPv4AddressStringParamsBuilder
- func (builder *IPv4AddressStringParamsBuilder) AllowInetAton(allow bool) *IPv4AddressStringParamsBuilder
- func (builder *IPv4AddressStringParamsBuilder) AllowInetAtonHex(allow bool) *IPv4AddressStringParamsBuilder
- func (builder *IPv4AddressStringParamsBuilder) AllowInetAtonJoinedSegments(allow bool) *IPv4AddressStringParamsBuilder
- func (builder *IPv4AddressStringParamsBuilder) AllowInetAtonLeadingZeros(allow bool) *IPv4AddressStringParamsBuilder
- func (builder *IPv4AddressStringParamsBuilder) AllowInetAtonOctal(allow bool) *IPv4AddressStringParamsBuilder
- func (builder *IPv4AddressStringParamsBuilder) AllowInetAtonSingleSegmentMask(allow bool) *IPv4AddressStringParamsBuilder
- func (builder *IPv4AddressStringParamsBuilder) AllowLeadingZeros(allow bool) *IPv4AddressStringParamsBuilder
- func (builder *IPv4AddressStringParamsBuilder) AllowPrefixLenLeadingZeros(allow bool) *IPv4AddressStringParamsBuilder
- func (builder *IPv4AddressStringParamsBuilder) AllowPrefixesBeyondAddressSize(allow bool) *IPv4AddressStringParamsBuilder
- func (builder *IPv4AddressStringParamsBuilder) AllowUnlimitedLeadingZeros(allow bool) *IPv4AddressStringParamsBuilder
- func (builder *IPv4AddressStringParamsBuilder) AllowWildcardedSeparator(allow bool) *IPv4AddressStringParamsBuilder
- func (params *IPv4AddressStringParamsBuilder) AllowsLeadingZeros() bool
- func (params *IPv4AddressStringParamsBuilder) AllowsUnlimitedLeadingZeros() bool
- func (params *IPv4AddressStringParamsBuilder) AllowsWildcardedSeparator() bool
- func (builder *IPv4AddressStringParamsBuilder) GetEmbeddedIPv4AddressParentBuilder() *IPv6AddressStringParamsBuilder
- func (params *IPv4AddressStringParamsBuilder) GetRangeParams() RangeParams
- func (builder *IPv4AddressStringParamsBuilder) GetRangeParamsBuilder() *RangeParamsBuilder
- func (builder *IPv4AddressStringParamsBuilder) Set(params IPv4AddressStringParams) *IPv4AddressStringParamsBuilder
- func (builder *IPv4AddressStringParamsBuilder) SetRangeParams(rangeParams RangeParams) *IPv4AddressStringParamsBuilder
- func (builder *IPv4AddressStringParamsBuilder) ToParams() IPv4AddressStringParams
- type IPv6AddressStringParams
- type IPv6AddressStringParamsBuilder
- func (builder *IPv6AddressStringParamsBuilder) AllowBase85(allow bool) *IPv6AddressStringParamsBuilder
- func (builder *IPv6AddressStringParamsBuilder) AllowBinary(allow bool) *IPv6AddressStringParamsBuilder
- func (builder *IPv6AddressStringParamsBuilder) AllowEmptyZone(allow bool) *IPv6AddressStringParamsBuilder
- func (builder *IPv6AddressStringParamsBuilder) AllowLeadingZeros(allow bool) *IPv6AddressStringParamsBuilder
- func (builder *IPv6AddressStringParamsBuilder) AllowMixed(allow bool) *IPv6AddressStringParamsBuilder
- func (builder *IPv6AddressStringParamsBuilder) AllowMixedInetAton(allow bool) *IPv6AddressStringParamsBuilder
- func (builder *IPv6AddressStringParamsBuilder) AllowPrefixLenLeadingZeros(allow bool) *IPv6AddressStringParamsBuilder
- func (builder *IPv6AddressStringParamsBuilder) AllowPrefixesBeyondAddressSize(allow bool) *IPv6AddressStringParamsBuilder
- func (builder *IPv6AddressStringParamsBuilder) AllowUnlimitedLeadingZeros(allow bool) *IPv6AddressStringParamsBuilder
- func (builder *IPv6AddressStringParamsBuilder) AllowWildcardedSeparator(allow bool) *IPv6AddressStringParamsBuilder
- func (builder *IPv6AddressStringParamsBuilder) AllowZone(allow bool) *IPv6AddressStringParamsBuilder
- func (builder *IPv6AddressStringParamsBuilder) AllowsBase85() bool
- func (builder *IPv6AddressStringParamsBuilder) AllowsEmptyZone() bool
- func (params *IPv6AddressStringParamsBuilder) AllowsLeadingZeros() bool
- func (builder *IPv6AddressStringParamsBuilder) AllowsMixed() bool
- func (params *IPv6AddressStringParamsBuilder) AllowsUnlimitedLeadingZeros() bool
- func (params *IPv6AddressStringParamsBuilder) AllowsWildcardedSeparator() bool
- func (builder *IPv6AddressStringParamsBuilder) AllowsZone() bool
- func (builder *IPv6AddressStringParamsBuilder) GetEmbeddedIPv4AddressParamsBuilder() (result *IPv4AddressStringParamsBuilder)
- func (params *IPv6AddressStringParamsBuilder) GetRangeParams() RangeParams
- func (builder *IPv6AddressStringParamsBuilder) GetRangeParamsBuilder() *RangeParamsBuilder
- func (builder *IPv6AddressStringParamsBuilder) Set(params IPv6AddressStringParams) *IPv6AddressStringParamsBuilder
- func (builder *IPv6AddressStringParamsBuilder) SetRangeParams(rangeParams RangeParams) *IPv6AddressStringParamsBuilder
- func (builder *IPv6AddressStringParamsBuilder) ToParams() IPv6AddressStringParams
- type MACAddressLen
- type MACAddressStringFormatParams
- type MACAddressStringFormatParamsBuilder
- func (builder *MACAddressStringFormatParamsBuilder) AllowLeadingZeros(allow bool) *MACAddressStringFormatParamsBuilder
- func (builder *MACAddressStringFormatParamsBuilder) AllowShortSegments(allow bool) *MACAddressStringFormatParamsBuilder
- func (builder *MACAddressStringFormatParamsBuilder) AllowUnlimitedLeadingZeros(allow bool) *MACAddressStringFormatParamsBuilder
- func (builder *MACAddressStringFormatParamsBuilder) AllowWildcardedSeparator(allow bool) *MACAddressStringFormatParamsBuilder
- func (params *MACAddressStringFormatParamsBuilder) AllowsLeadingZeros() bool
- func (params *MACAddressStringFormatParamsBuilder) AllowsUnlimitedLeadingZeros() bool
- func (params *MACAddressStringFormatParamsBuilder) AllowsWildcardedSeparator() bool
- func (builder *MACAddressStringFormatParamsBuilder) GetParentBuilder() *MACAddressStringParamsBuilder
- func (params *MACAddressStringFormatParamsBuilder) GetRangeParams() RangeParams
- func (builder *MACAddressStringFormatParamsBuilder) GetRangeParamsBuilder() *RangeParamsBuilder
- func (builder *MACAddressStringFormatParamsBuilder) Set(parms MACAddressStringFormatParams) *MACAddressStringFormatParamsBuilder
- func (builder *MACAddressStringFormatParamsBuilder) SetRangeParams(rangeParams RangeParams) *MACAddressStringFormatParamsBuilder
- func (builder *MACAddressStringFormatParamsBuilder) ToParams() MACAddressStringFormatParams
- type MACAddressStringParams
- type MACAddressStringParamsBuilder
- func (builder *MACAddressStringParamsBuilder) AllowAll(allow bool) *MACAddressStringParamsBuilder
- func (builder *MACAddressStringParamsBuilder) AllowColonDelimited(allow bool) *MACAddressStringParamsBuilder
- func (builder *MACAddressStringParamsBuilder) AllowDashed(allow bool) *MACAddressStringParamsBuilder
- func (builder *MACAddressStringParamsBuilder) AllowDotted(allow bool) *MACAddressStringParamsBuilder
- func (builder *MACAddressStringParamsBuilder) AllowEmpty(allow bool) *MACAddressStringParamsBuilder
- func (builder *MACAddressStringParamsBuilder) AllowSingleDashed(allow bool) *MACAddressStringParamsBuilder
- func (builder *MACAddressStringParamsBuilder) AllowSingleSegment(allow bool) *MACAddressStringParamsBuilder
- func (builder *MACAddressStringParamsBuilder) AllowSpaceDelimited(allow bool) *MACAddressStringParamsBuilder
- func (builder *MACAddressStringParamsBuilder) AllowWildcardedSeparator(allow bool) *MACAddressStringParamsBuilder
- func (params *MACAddressStringParamsBuilder) AllowsAll() bool
- func (params *MACAddressStringParamsBuilder) AllowsEmpty() bool
- func (params *MACAddressStringParamsBuilder) AllowsSingleSegment() bool
- func (builder *MACAddressStringParamsBuilder) GetFormatParamsBuilder() (result *MACAddressStringFormatParamsBuilder)
- func (builder *MACAddressStringParamsBuilder) Set(params MACAddressStringParams) *MACAddressStringParamsBuilder
- func (builder *MACAddressStringParamsBuilder) SetPreferredLen(size MACAddressLen) *MACAddressStringParamsBuilder
- func (builder *MACAddressStringParamsBuilder) SetRangeParams(rangeParams RangeParams) *MACAddressStringParamsBuilder
- func (builder *MACAddressStringParamsBuilder) ToParams() MACAddressStringParams
- type RangeParams
- type RangeParamsBuilder
- func (builder *RangeParamsBuilder) AllowInferredBoundary(allow bool) *RangeParamsBuilder
- func (builder *RangeParamsBuilder) AllowRangeSeparator(allow bool) *RangeParamsBuilder
- func (builder *RangeParamsBuilder) AllowReverseRange(allow bool) *RangeParamsBuilder
- func (builder *RangeParamsBuilder) AllowSingleWildcard(allow bool) *RangeParamsBuilder
- func (builder *RangeParamsBuilder) AllowWildcard(allow bool) *RangeParamsBuilder
- func (builder *RangeParamsBuilder) AllowsInferredBoundary() bool
- func (builder *RangeParamsBuilder) AllowsRangeSeparator() bool
- func (builder *RangeParamsBuilder) AllowsReverseRange() bool
- func (builder *RangeParamsBuilder) AllowsSingleWildcard() bool
- func (builder *RangeParamsBuilder) AllowsWildcard() bool
- func (builder *RangeParamsBuilder) GetIPv4ParentBuilder() *IPv4AddressStringParamsBuilder
- func (builder *RangeParamsBuilder) GetIPv6ParentBuilder() *IPv6AddressStringParamsBuilder
- func (builder *RangeParamsBuilder) GetMACParentBuilder() *MACAddressStringFormatParamsBuilder
- func (builder *RangeParamsBuilder) Set(rangeParams RangeParams) *RangeParamsBuilder
- func (builder *RangeParamsBuilder) ToParams() RangeParams
Constants ¶
const ( NoAddressOption EmptyStrOption = "none" // indicates that empty strings are not translated to addresses ZeroAddressOption EmptyStrOption = "" // is used by default, empty strings are translated to null addresses LoopbackOption EmptyStrOption = "loopback" // indicates empty strings are translated to loopback addresses AllAddresses AllStrOption = "" // default value, indicating all address string refers to all addresses of all IP versions AllPreferredIPVersion AllStrOption = "preferred" // indicates the all address string refers to all addresses of the preferred IP version IPv4 IPVersion = 4 // represents Internet Protocol version 4 IPv6 IPVersion = 6 // represents Internet Protocol version 6 IndeterminateIPVersion IPVersion = 0 // represents an unspecified IP address version )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddressStringFormatParams ¶
type AddressStringFormatParams interface { // AllowsWildcardedSeparator controls whether the wildcard '*' or '%' can replace the segment separators '.' and ':'. // If so, then you can write addresses like "*.*" or "*:*". AllowsWildcardedSeparator() bool // AllowsLeadingZeros indicates whether you allow addresses with segments that have leasing zeros like "001.2.3.004" or "1:000a::". // For IPV4, this option overrides inet_aton octal. // Single segment addresses that must have the requisite length to be parsed are not affected by this flag. AllowsLeadingZeros() bool // AllowsUnlimitedLeadingZeros determines if you allow leading zeros that extend segments // beyond the usual segment length, which is 3 for IPv4 dotted-decimal and 4 for IPv6. // However, this only takes effect if leading zeros are allowed, which is when // AllowsLeadingZeros is true or the address is IPv4 and Allows_inet_aton_octal is true. // For example, this determines whether you allow "0001.0002.0003.0004". AllowsUnlimitedLeadingZeros() bool // GetRangeParams returns the RangeParams describing whether ranges of values are allowed and what wildcards are allowed. GetRangeParams() RangeParams }
type AddressStringFormatParamsBuilder ¶
type AddressStringFormatParamsBuilder struct {
// contains filtered or unexported fields
}
AddressStringFormatParamsBuilder creates parameters for parsing a specific address type or address version.
func (*AddressStringFormatParamsBuilder) AllowsLeadingZeros ¶
func (params *AddressStringFormatParamsBuilder) AllowsLeadingZeros() bool
AllowsLeadingZeros indicates whether to allow addresses with segments containing leading zeros, such as "001.2.3.004" or "1:000a::". For IPV4, this option overrides inet_aton octal. Single-segment addresses, which must have the required length for parsing, are not affected by this flag.
func (*AddressStringFormatParamsBuilder) AllowsUnlimitedLeadingZeros ¶
func (params *AddressStringFormatParamsBuilder) AllowsUnlimitedLeadingZeros() bool
AllowsUnlimitedLeadingZeros determines whether to allow leading zeros that extend segments beyond the usual segment length of 3 for IPv4 dotted-decimal and 4 for IPv6. However, this parameter is valid only if leading zeros are allowed, that is, when AllowsLeadingZeros is true or the address is IPv4 and Allows_inet_aton_octal is true. For example, this determines whether to allow "0001.0002.0003.0004".
func (*AddressStringFormatParamsBuilder) AllowsWildcardedSeparator ¶
func (params *AddressStringFormatParamsBuilder) AllowsWildcardedSeparator() bool
AllowsWildcardedSeparator controls whether the wildcard '*' or '%' can replace the segment delimiters '.' and ':'. If so, addresses like *.* or *:* can be written.
func (*AddressStringFormatParamsBuilder) GetRangeParams ¶
func (params *AddressStringFormatParamsBuilder) GetRangeParams() RangeParams
GetRangeParams returns RangeParams parameters describing whether ranges of values are allowed and what wildcards are allowed.
func (*AddressStringFormatParamsBuilder) GetRangeParamsBuilder ¶
func (builder *AddressStringFormatParamsBuilder) GetRangeParamsBuilder() RangeParams
GetRangeParamsBuilder returns a builder that builds the range parameters for these address string format parameters.
func (*AddressStringFormatParamsBuilder) ToParams ¶
func (builder *AddressStringFormatParamsBuilder) ToParams() AddressStringFormatParams
ToParams returns an immutable AddressStringFormatParams instance built by this builder.
type AddressStringParams ¶
type AddressStringParams interface { // AllowsEmpty indicates whether it allows zero-length address strings: "" AllowsEmpty() bool // AllowsSingleSegment allows the address to be specified as a single value, such as ffffffff, // without the standard use of segments like "1.2.3.4" or "1:2:4:3:5:6:7:8". AllowsSingleSegment() bool // AllowsAll indicates whether we allow a string of just the wildcard "*" to represent all addresses of any version. // If false, for IP addresses check the preferred version with GetPreferredVersion() and // then check AllowsWildcardedSeparator to determine if the string represents all addresses of that version. AllowsAll() bool }
type AddressStringParamsBuilder ¶
type AddressStringParamsBuilder struct {
// contains filtered or unexported fields
}
AddressStringParamsBuilder builds an AddressStringParams.
func (*AddressStringParamsBuilder) AllowsAll ¶
func (params *AddressStringParamsBuilder) AllowsAll() bool
AllowsAll indicates if we allow the string of just the wildcard "*" to denote all addresses of all version. If false, then for IP addresses we check the preferred version with GetPreferredVersion(), and then check AllowsWildcardedSeparator(), to determine if the string represents all addresses of that version.
func (*AddressStringParamsBuilder) AllowsEmpty ¶
func (params *AddressStringParamsBuilder) AllowsEmpty() bool
AllowsEmpty indicates whether it allows zero-length address strings: "".
func (*AddressStringParamsBuilder) AllowsSingleSegment ¶
func (params *AddressStringParamsBuilder) AllowsSingleSegment() bool
AllowsSingleSegment allows an address to be specified as a single value, eg ffffffff, without the standard use of segments like "1.2.3.4" or "1:2:4:3:5:6:7:8".
func (*AddressStringParamsBuilder) ToParams ¶
func (builder *AddressStringParamsBuilder) ToParams() AddressStringParams
ToParams returns an immutable AddressStringParams instance built by this builder.
type AllStrOption ¶
type AllStrOption string
AllStrOption - an option specifying how to convert an all address string, such as "*", to an address.
type EmptyStrOption ¶
type EmptyStrOption string
EmptyStrOption - an option specifying how to convert an empty address string to an address.
type HostNameParams ¶
type HostNameParams interface { // AllowsEmpty determines whether an empty host string is considered valid. // If the nested IPAddressStringParams parameters allow it, the empty address will be parsed first. // Otherwise, it will be considered an empty host if this value returns true, or an invalid host if it returns false. AllowsEmpty() bool // GetPreferredVersion indicates the version to prefer when resolving host names. GetPreferredVersion() IPVersion // AllowsBracketedIPv4 allows bracketed IPv4 addresses like "[1.2.3.4]". AllowsBracketedIPv4() bool // AllowsBracketedIPv6 allows bracketed IPv6 addresses like "[1::2]". AllowsBracketedIPv6() bool // NormalizesToLowercase indicates whether to normalize the host name to lowercase characters when parsing. NormalizesToLowercase() bool // AllowsIPAddress allows a host name to specify an IP address or subnet. AllowsIPAddress() bool // AllowsPort allows a host name to specify a port. AllowsPort() bool // AllowsService allows a host name to specify a service, which typically maps to a port. AllowsService() bool // ExpectsPort indicates whether a port should be inferred from a host like 1:2:3:4::80 that is ambiguous if a port might have been appended. // The final segment would normally be considered part of the address, but can be interpreted as a port instead. ExpectsPort() bool // GetIPAddressParams returns the parameters that apply specifically to IP addresses and subnets, whenever a host name specifies an IP addresses or subnet. GetIPAddressParams() IPAddressStringParams }
HostNameParams provides parameters for parsing host name strings. This allows the validation performed by HostName to be checked. HostName uses a default permissive HostNameParams object when one is not specified. If you want to use parameters other than the defaults, use this interface. Immutable instances can be constructed with HostNameParamsBuilder.
func CopyHostNameParams ¶
func CopyHostNameParams(orig HostNameParams) HostNameParams
CopyHostNameParams produces an immutable copy of the original HostNameParams. Copying a HostNameParams created by a HostNameParamsBuilder is unnecessary since it is already immutable.
type HostNameParamsBuilder ¶
type HostNameParamsBuilder struct {
// contains filtered or unexported fields
}
HostNameParamsBuilder builds an immutable HostNameParams for controlling parsing of host names.
func (*HostNameParamsBuilder) AllowBracketedIPv4 ¶
func (builder *HostNameParamsBuilder) AllowBracketedIPv4(allow bool) *HostNameParamsBuilder
AllowBracketedIPv4 dictates whether to allow bracketed IPv4 addresses like "[1.2.3.4]".
func (*HostNameParamsBuilder) AllowBracketedIPv6 ¶
func (builder *HostNameParamsBuilder) AllowBracketedIPv6(allow bool) *HostNameParamsBuilder
AllowBracketedIPv6 dictates whether to allow bracketed IPv6 addresses like "[1::2]".
func (*HostNameParamsBuilder) AllowEmpty ¶
func (builder *HostNameParamsBuilder) AllowEmpty(allow bool) *HostNameParamsBuilder
AllowEmpty dictates whether an empty host string is considered valid. The parser will first parse as an empty address, if allowed by the nested IPAddressStringParams. Otherwise, this setting dictates whether it will be considered an invalid host.
func (*HostNameParamsBuilder) AllowIPAddress ¶
func (builder *HostNameParamsBuilder) AllowIPAddress(allow bool) *HostNameParamsBuilder
AllowIPAddress dictates whether to allow a host name to specify an IP address or subnet.
func (*HostNameParamsBuilder) AllowPort ¶
func (builder *HostNameParamsBuilder) AllowPort(allow bool) *HostNameParamsBuilder
AllowPort dictates whether to allow a host name to specify a port.
func (*HostNameParamsBuilder) AllowService ¶
func (builder *HostNameParamsBuilder) AllowService(allow bool) *HostNameParamsBuilder
AllowService dictates whether to allow a host name to specify a service, which typically maps to a port.
func (*HostNameParamsBuilder) AllowsBracketedIPv4 ¶
func (params *HostNameParamsBuilder) AllowsBracketedIPv4() bool
AllowsBracketedIPv4 allows bracketed IPv4 addresses like "[1.2.3.4]".
func (*HostNameParamsBuilder) AllowsBracketedIPv6 ¶
func (params *HostNameParamsBuilder) AllowsBracketedIPv6() bool
AllowsBracketedIPv6 allows bracketed IPv6 addresses like "[1::2]".
func (*HostNameParamsBuilder) AllowsEmpty ¶
func (params *HostNameParamsBuilder) AllowsEmpty() bool
AllowsEmpty determines if an empty host string is considered valid. The parser will first parse as an empty address, if allowed by the nested IPAddressStringParams. Otherwise, it will be considered an empty host if this returns true, or an invalid host if it returns false.
func (*HostNameParamsBuilder) AllowsIPAddress ¶
func (params *HostNameParamsBuilder) AllowsIPAddress() bool
AllowsIPAddress allows a host name to specify an IP address or subnet.
func (*HostNameParamsBuilder) AllowsPort ¶
func (params *HostNameParamsBuilder) AllowsPort() bool
AllowsPort allows a host name to specify a port.
func (*HostNameParamsBuilder) AllowsService ¶
func (params *HostNameParamsBuilder) AllowsService() bool
AllowsService allows a host name to specify a service, which typically maps to a port.
func (*HostNameParamsBuilder) ExpectPort ¶
func (builder *HostNameParamsBuilder) ExpectPort(expect bool) *HostNameParamsBuilder
ExpectPort dictates whether a port should be inferred from a host like 1:2:3:4::80 that is ambiguous if a port might have been appended. The final segment would normally be considered part of the address, but can be interpreted as a port instead.
func (*HostNameParamsBuilder) ExpectsPort ¶
func (params *HostNameParamsBuilder) ExpectsPort() bool
ExpectsPort indicates whether a port should be inferred from a host like 1:2:3:4::80 that is ambiguous if a port might have been appended. The final segment would normally be considered part of the address, but can be interpreted as a port instead.
func (*HostNameParamsBuilder) GetIPAddressParams ¶
func (params *HostNameParamsBuilder) GetIPAddressParams() IPAddressStringParams
GetIPAddressParams returns the parameters that apply specifically to IP addresses and subnets, whenever a host name specifies an IP addresses or subnet.
func (*HostNameParamsBuilder) GetIPAddressParamsBuilder ¶
func (builder *HostNameParamsBuilder) GetIPAddressParamsBuilder() (result *IPAddressStringParamsBuilder)
GetIPAddressParamsBuilder returns a builder that builds the IPAddressStringParams for the HostNameParams being built by this builder.
func (*HostNameParamsBuilder) GetPreferredVersion ¶
func (params *HostNameParamsBuilder) GetPreferredVersion() IPVersion
GetPreferredVersion indicates the version to prefer when resolving host names.
func (*HostNameParamsBuilder) NormalizeToLowercase ¶
func (builder *HostNameParamsBuilder) NormalizeToLowercase(allow bool) *HostNameParamsBuilder
NormalizeToLowercase dictates whether to normalize the host name to lowercase characters when parsing.
func (*HostNameParamsBuilder) NormalizesToLowercase ¶
func (params *HostNameParamsBuilder) NormalizesToLowercase() bool
NormalizesToLowercase indicates whether to normalize the host name to lowercase characters when parsing.
func (*HostNameParamsBuilder) Set ¶
func (builder *HostNameParamsBuilder) Set(params HostNameParams) *HostNameParamsBuilder
Set populates this builder with the values from the given HostNameParams.
func (*HostNameParamsBuilder) SetIPAddressParams ¶
func (builder *HostNameParamsBuilder) SetIPAddressParams(params IPAddressStringParams) *HostNameParamsBuilder
SetIPAddressParams populates this builder with the values from the given IPAddressStringParams.
func (*HostNameParamsBuilder) SetPreferredVersion ¶
func (builder *HostNameParamsBuilder) SetPreferredVersion(version IPVersion) *HostNameParamsBuilder
SetPreferredVersion dictates the version to prefer when resolving host names.
func (*HostNameParamsBuilder) ToParams ¶
func (builder *HostNameParamsBuilder) ToParams() HostNameParams
ToParams returns an immutable HostNameParams instance built by this builder.
type IPAddressStringFormatParams ¶
type IPAddressStringFormatParams interface { AddressStringFormatParams // AllowsPrefixesBeyondAddressSize allows prefix length values greater than 32 for IPv4 or greater than 128 for IPv6. AllowsPrefixesBeyondAddressSize() bool // AllowsPrefixLenLeadingZeros allows leading zeros in the prefix length like "1.2.3.4/016". AllowsPrefixLenLeadingZeros() bool // AllowsBinary allows binary addresses like "11111111.0.1.0" or "1111111111111111::". AllowsBinary() bool }
IPAddressStringFormatParams provides format parameters that apply to all IP addresses, but may be different for IPv4 or IPv6, allowing you to account for cases where you need to allow something for one version and not the other.
type IPAddressStringFormatParamsBuilder ¶
type IPAddressStringFormatParamsBuilder struct { AddressStringFormatParamsBuilder // contains filtered or unexported fields }
IPAddressStringFormatParamsBuilder builds an immutable IPAddressStringFormatParams for controlling parsing of IP address strings.
func (*IPAddressStringFormatParamsBuilder) AllowsBinary ¶
func (builder *IPAddressStringFormatParamsBuilder) AllowsBinary() bool
AllowsBinary allows binary addresses like 11111111.0.1.0 or 1111111111111111::
func (*IPAddressStringFormatParamsBuilder) AllowsLeadingZeros ¶
func (params *IPAddressStringFormatParamsBuilder) AllowsLeadingZeros() bool
AllowsLeadingZeros indicates whether to allow addresses with segments containing leading zeros, such as "001.2.3.004" or "1:000a::". For IPV4, this option overrides inet_aton octal. Single-segment addresses, which must have the required length for parsing, are not affected by this flag.
func (*IPAddressStringFormatParamsBuilder) AllowsPrefixLenLeadingZeros ¶
func (builder *IPAddressStringFormatParamsBuilder) AllowsPrefixLenLeadingZeros() bool
AllowsPrefixLenLeadingZeros allows leading zeros in the prefix length like "1.2.3.4/016".
func (*IPAddressStringFormatParamsBuilder) AllowsPrefixesBeyondAddressSize ¶
func (builder *IPAddressStringFormatParamsBuilder) AllowsPrefixesBeyondAddressSize() bool
AllowsPrefixesBeyondAddressSize allows prefix length values greater than 32 for IPv4 or greater than 128 for IPv6.
func (*IPAddressStringFormatParamsBuilder) AllowsUnlimitedLeadingZeros ¶
func (params *IPAddressStringFormatParamsBuilder) AllowsUnlimitedLeadingZeros() bool
AllowsUnlimitedLeadingZeros determines whether to allow leading zeros that extend segments beyond the usual segment length of 3 for IPv4 dotted-decimal and 4 for IPv6. However, this parameter is valid only if leading zeros are allowed, that is, when AllowsLeadingZeros is true or the address is IPv4 and Allows_inet_aton_octal is true. For example, this determines whether to allow "0001.0002.0003.0004".
func (*IPAddressStringFormatParamsBuilder) AllowsWildcardedSeparator ¶
func (params *IPAddressStringFormatParamsBuilder) AllowsWildcardedSeparator() bool
AllowsWildcardedSeparator controls whether the wildcard '*' or '%' can replace the segment delimiters '.' and ':'. If so, addresses like *.* or *:* can be written.
func (*IPAddressStringFormatParamsBuilder) GetParentBuilder ¶
func (builder *IPAddressStringFormatParamsBuilder) GetParentBuilder() *IPAddressStringParamsBuilder
GetParentBuilder returns the original IPAddressStringParamsBuilder builder that this was obtained from, if this builder was obtained from a IPAddressStringParamsBuilder.
func (*IPAddressStringFormatParamsBuilder) GetRangeParams ¶
func (params *IPAddressStringFormatParamsBuilder) GetRangeParams() RangeParams
GetRangeParams returns RangeParams parameters describing whether ranges of values are allowed and what wildcards are allowed.
func (*IPAddressStringFormatParamsBuilder) ToParams ¶
func (builder *IPAddressStringFormatParamsBuilder) ToParams() IPAddressStringFormatParams
ToParams returns an immutable IPAddressStringFormatParams instance built by this builder
type IPAddressStringParams ¶
type IPAddressStringParams interface { AddressStringParams // AllowsPrefix indicates whether addresses with prefix length like 1.2.0.0/16 are allowed. AllowsPrefix() bool // EmptyStrParsedAs determines how a zero-length empty string is translated to an address. // If the option is ZeroAddressOption or LoopbackOption, then if defers to GetPreferredVersion() for the version. EmptyStrParsedAs() EmptyStrOption // AllStrParsedAs determines how the "all" string "*" is translated to addresses. // If the option is AllPreferredIPVersion, then it defers to GetPreferredVersion() for the version. AllStrParsedAs() AllStrOption // AllowsMask allows masks to follow valid addresses, such as 1.2.3.4/255.255.0.0 which has the mask 255.255.0.0 // If the mask is the mask for a network prefix length, this is interpreted as the subnet for that network prefix length. // Otherwise the address is simply masked by the mask. // For instance, 1.2.3.4/255.0.255.0 is 1.0.3.0, while 1.2.3.4/255.255.0.0 is 1.2.0.0/16. AllowsMask() bool // GetPreferredVersion indicates the version to use for ambiguous addresses strings, // like prefix lengths less than 32 bits which are translated to masks, // the "all" address or the "empty" address. // The default is IPv6. // If either of AllowsIPv4() or AllowsIPv6() returns false, then those settings take precedence over this setting. GetPreferredVersion() IPVersion // AllowsIPv4 allows IPv4 addresses and subnets. AllowsIPv4() bool // AllowsIPv6 allows IPv6 addresses and subnets. AllowsIPv6() bool // GetIPv4Params returns the parameters that apply specifically to IPv4 addresses and subnets. GetIPv4Params() IPv4AddressStringParams // GetIPv6Params returns the parameters that apply specifically to IPv6 addresses and subnets. GetIPv6Params() IPv6AddressStringParams }
IPAddressStringParams provides parameters for parsing IP address strings, specifying what to allow, what to disallow, and other options. This allows to control the validation performed by IPAddressString. IPAddressString uses the default permissive IPAddressStringParams instance if one is not specified. If you want to use parameters other than the default, use this interface. Immutable instances can be built using the IPAddressStringParamsBuilder.
func CopyIPAddressStringParams ¶
func CopyIPAddressStringParams(orig IPAddressStringParams) IPAddressStringParams
CopyIPAddressStringParams produces an immutable copy of the original IPAddressStringParams. Copying an IPAddressStringParams created by an IPAddressStringParamsBuilder is unnecessary since it is already immutable.
type IPAddressStringParamsBuilder ¶
type IPAddressStringParamsBuilder struct { AddressStringParamsBuilder // contains filtered or unexported fields }
IPAddressStringParamsBuilder builds an immutable IPAddressStringParameters for controlling parsing of IP address strings.
func (*IPAddressStringParamsBuilder) AllowAll ¶
func (builder *IPAddressStringParamsBuilder) AllowAll(allow bool) *IPAddressStringParamsBuilder
AllowAll dictates whether to alloww the string of just the wildcard "*" to denote all addresses of all version. If false, then for IP addresses we check the preferred version with GetPreferredVersion, and then check AllowsWildcardedSeparator, to determine if the string represents all addresses of that version.
func (*IPAddressStringParamsBuilder) AllowEmpty ¶
func (builder *IPAddressStringParamsBuilder) AllowEmpty(allow bool) *IPAddressStringParamsBuilder
AllowEmpty dictates whether to allow empty zero-length address strings.
func (*IPAddressStringParamsBuilder) AllowIPv4 ¶
func (builder *IPAddressStringParamsBuilder) AllowIPv4(allow bool) *IPAddressStringParamsBuilder
AllowIPv4 dictates whether to allow IPv4 addresses and subnets
func (*IPAddressStringParamsBuilder) AllowIPv6 ¶
func (builder *IPAddressStringParamsBuilder) AllowIPv6(allow bool) *IPAddressStringParamsBuilder
AllowIPv6 dictates whether to allow IPv6 addresses and subnets
func (*IPAddressStringParamsBuilder) AllowInetAton ¶
func (builder *IPAddressStringParamsBuilder) AllowInetAton(allow bool) *IPAddressStringParamsBuilder
AllowInetAton dictates whether to allow any IPv4 inetAton format, whether hex, octal, or joined segments.
func (*IPAddressStringParamsBuilder) AllowMask ¶
func (builder *IPAddressStringParamsBuilder) AllowMask(allow bool) *IPAddressStringParamsBuilder
AllowMask dictates whether to allow masks to follow valid addresses, such as "1.2.3.4/255.255.0.0" which has the mask "255.255.0.0". If the mask is the mask for a network prefix length, this is interpreted as the subnet for that network prefix length. Otherwise the address is simply masked by the mask. For instance, "1.2.3.4/255.0.255.0" is "1.0.3.0", while "1.2.3.4/255.255.0.0" is "1.2.0.0/16".
func (*IPAddressStringParamsBuilder) AllowPrefix ¶
func (builder *IPAddressStringParamsBuilder) AllowPrefix(allow bool) *IPAddressStringParamsBuilder
AllowPrefix dictates whether to allow addresses with prefix length like "1.2.0.0/16" are allowed.
func (*IPAddressStringParamsBuilder) AllowSingleSegment ¶
func (builder *IPAddressStringParamsBuilder) AllowSingleSegment(allow bool) *IPAddressStringParamsBuilder
AllowSingleSegment dictates whether to allow an address to be specified as a single value, eg "ffffffff", without the standard use of segments like "1.2.3.4" or "1:2:4:3:5:6:7:8".
func (*IPAddressStringParamsBuilder) AllowWildcardedSeparator ¶
func (builder *IPAddressStringParamsBuilder) AllowWildcardedSeparator(allow bool) *IPAddressStringParamsBuilder
AllowWildcardedSeparator dictates whether the wildcard '*' or '%' can replace the segment separators '.' and ':'. If so, then you can write addresses like *.* or *:*
func (*IPAddressStringParamsBuilder) AllowsAll ¶
func (params *IPAddressStringParamsBuilder) AllowsAll() bool
AllowsAll indicates if we allow the string of just the wildcard "*" to denote all addresses of all version. If false, then for IP addresses we check the preferred version with GetPreferredVersion(), and then check AllowsWildcardedSeparator(), to determine if the string represents all addresses of that version.
func (*IPAddressStringParamsBuilder) AllowsEmpty ¶
func (params *IPAddressStringParamsBuilder) AllowsEmpty() bool
AllowsEmpty indicates whether it allows zero-length address strings: "".
func (*IPAddressStringParamsBuilder) AllowsSingleSegment ¶
func (params *IPAddressStringParamsBuilder) AllowsSingleSegment() bool
AllowsSingleSegment allows an address to be specified as a single value, eg ffffffff, without the standard use of segments like "1.2.3.4" or "1:2:4:3:5:6:7:8".
func (*IPAddressStringParamsBuilder) GetIPv4AddressParamsBuilder ¶
func (builder *IPAddressStringParamsBuilder) GetIPv4AddressParamsBuilder() (result *IPv4AddressStringParamsBuilder)
GetIPv4AddressParamsBuilder returns a builder that builds the IPv4AddressStringParams for the IPAddressStringParams being built by this builder.
func (*IPAddressStringParamsBuilder) GetIPv6AddressParamsBuilder ¶
func (builder *IPAddressStringParamsBuilder) GetIPv6AddressParamsBuilder() (result *IPv6AddressStringParamsBuilder)
GetIPv6AddressParamsBuilder returns a builder that builds the IPv6AddressStringParams for the IPAddressStringParams being built by this builder.
func (*IPAddressStringParamsBuilder) GetParentBuilder ¶
func (builder *IPAddressStringParamsBuilder) GetParentBuilder() *HostNameParamsBuilder
GetParentBuilder returns the original HostNameParamsBuilder builder that this was obtained from, if this builder was obtained from a HostNameParamsBuilder.
func (*IPAddressStringParamsBuilder) ParseAllStrAs ¶
func (builder *IPAddressStringParamsBuilder) ParseAllStrAs(option AllStrOption) *IPAddressStringParamsBuilder
ParseAllStrAs dictates how the "all" string "*" is translated to addresses. If the option is AllPreferredIPVersion, then it defers to GetPreferredVersion for the version.
func (*IPAddressStringParamsBuilder) ParseEmptyStrAs ¶
func (builder *IPAddressStringParamsBuilder) ParseEmptyStrAs(option EmptyStrOption) *IPAddressStringParamsBuilder
ParseEmptyStrAs dictates how a zero-length empty string is translated to an address. If the option is ZeroAddressOption or LoopbackOption, then if defers to GetPreferredVersion for the version.
func (*IPAddressStringParamsBuilder) Set ¶
func (builder *IPAddressStringParamsBuilder) Set(params IPAddressStringParams) *IPAddressStringParamsBuilder
Set populates this builder with the values from the given IPAddressStringParams.
func (*IPAddressStringParamsBuilder) SetPreferredVersion ¶
func (builder *IPAddressStringParamsBuilder) SetPreferredVersion(version IPVersion) *IPAddressStringParamsBuilder
SetPreferredVersion dictates the version to use for ambiguous addresses strings, like prefix lengths less than 32 bits which are translated to masks, the "all" address or the "empty" address. The default is IPv6. If either of AllowsIPv4 or AllowsIPv6 returns false, then those settings take precedence over this setting.
func (*IPAddressStringParamsBuilder) SetRangeParams ¶
func (builder *IPAddressStringParamsBuilder) SetRangeParams(rangeParams RangeParams) *IPAddressStringParamsBuilder
SetRangeParams populates this builder with the values from the given RangeParams.
func (*IPAddressStringParamsBuilder) ToParams ¶
func (builder *IPAddressStringParamsBuilder) ToParams() IPAddressStringParams
ToParams returns an immutable IPAddressStringParams instance built by this builder.
type IPVersion ¶
type IPVersion int
IPVersion is the version type used by IP string parameters. It is interchangeable with goip.Version, a more generic version type used by the library as a whole.
func (IPVersion) IsIndeterminate ¶
IsIndeterminate returns true if this represents an unspecified IP address version.
type IPv4AddressStringParams ¶
type IPv4AddressStringParams interface { IPAddressStringFormatParams // AllowsInetAtonHex allows IPv4 inetAton hexadecimal format "0xa.0xb.0xc.0cd". AllowsInetAtonHex() bool // AllowsInetAtonOctal allows IPv4 inetAton octal format, "04.05.06.07" being an example. // Can be overridden by allowLeadingZeros AllowsInetAtonOctal() bool // AllowsInetAtonJoinedSegments allows IPv4 joined segments like "1.2.3", "1.2", or just "1". // For the case of just 1 segment, the behaviour is controlled by allowSingleSegment. AllowsInetAtonJoinedSegments() bool // AllowsInetAtonSingleSegmentMask indicates whether you allow a mask that looks like a prefix length when you allow IPv4 joined segments: "1.2.3.5/255". AllowsInetAtonSingleSegmentMask() bool // AllowsInetAtonLeadingZeros allows IPv4 inetAton hexadecimal or octal to have leading zeros, such as in the first two segments of "0x0a.00b.c.d". // The first 0 is not considered a leading zero, it either denotes octal or hex depending on whether it is followed by an 'x'. // Zeros that appear afterwards are inetAton leading zeros. AllowsInetAtonLeadingZeros() bool }
IPv4AddressStringParams provides parameters specific to IPv4 addresses and subnets
type IPv4AddressStringParamsBuilder ¶
type IPv4AddressStringParamsBuilder struct { IPAddressStringFormatParamsBuilder // contains filtered or unexported fields }
IPv4AddressStringParamsBuilder builds an immutable IPv4AddressStringParams for controlling parsing of IPv4 address strings.
func (*IPv4AddressStringParamsBuilder) AllowBinary ¶
func (builder *IPv4AddressStringParamsBuilder) AllowBinary(allow bool) *IPv4AddressStringParamsBuilder
AllowBinary dictates whether to allow binary addresses like "11111111.0.1.0" or "1111111111111111::".
func (*IPv4AddressStringParamsBuilder) AllowInetAton ¶
func (builder *IPv4AddressStringParamsBuilder) AllowInetAton(allow bool) *IPv4AddressStringParamsBuilder
AllowInetAton dictates whether to allow any IPv4 inetAton format, whether hex, octal, or joined segments.
func (*IPv4AddressStringParamsBuilder) AllowInetAtonHex ¶
func (builder *IPv4AddressStringParamsBuilder) AllowInetAtonHex(allow bool) *IPv4AddressStringParamsBuilder
AllowInetAtonHex dictates whether to allow IPv4 inetAton hexadecimal format "0xa.0xb.0xc.0cd".
func (*IPv4AddressStringParamsBuilder) AllowInetAtonJoinedSegments ¶
func (builder *IPv4AddressStringParamsBuilder) AllowInetAtonJoinedSegments(allow bool) *IPv4AddressStringParamsBuilder
AllowInetAtonJoinedSegments dictates whether to allow IPv4 joined segments like "1.2.3", "1.2", or just "1". For the case of just 1 segment, the behaviour is controlled by AllowSingleSegment.
func (*IPv4AddressStringParamsBuilder) AllowInetAtonLeadingZeros ¶
func (builder *IPv4AddressStringParamsBuilder) AllowInetAtonLeadingZeros(allow bool) *IPv4AddressStringParamsBuilder
AllowInetAtonLeadingZeros dictates whether to allow a hexadecimal or octal IPv4 inetAton to have leading zeros, such as in the first two segments "0x0a.00b.c.d". The first 0 is not considered a leading zero, it denotes either an octal or hexadecimal number depending on whether it is followed by an 'x'. Zeros appearing after it are inetAton master zeros.
func (*IPv4AddressStringParamsBuilder) AllowInetAtonOctal ¶
func (builder *IPv4AddressStringParamsBuilder) AllowInetAtonOctal(allow bool) *IPv4AddressStringParamsBuilder
AllowInetAtonOctal dictates whether to allow IPv4 inetAton octal format, "04.05.06.07" being an example.
func (*IPv4AddressStringParamsBuilder) AllowInetAtonSingleSegmentMask ¶
func (builder *IPv4AddressStringParamsBuilder) AllowInetAtonSingleSegmentMask(allow bool) *IPv4AddressStringParamsBuilder
AllowInetAtonSingleSegmentMask dictates whether to allow a mask that looks like a prefix length when you allow IPv4 joined segments: "1.2.3.5/255".
func (*IPv4AddressStringParamsBuilder) AllowLeadingZeros ¶
func (builder *IPv4AddressStringParamsBuilder) AllowLeadingZeros(allow bool) *IPv4AddressStringParamsBuilder
AllowLeadingZeros dictates whether to allow addresses with segments that have leasing zeros like "001.2.3.004" or "1:000a::". For IPV4, this option overrides inetAton octal. Single segment addresses that must have the requisite length to be parsed are not affected by this flag.
func (*IPv4AddressStringParamsBuilder) AllowPrefixLenLeadingZeros ¶
func (builder *IPv4AddressStringParamsBuilder) AllowPrefixLenLeadingZeros(allow bool) *IPv4AddressStringParamsBuilder
AllowPrefixLenLeadingZeros dictates whether to allow leading zeros in the prefix length like "1.2.3.4/016".
func (*IPv4AddressStringParamsBuilder) AllowPrefixesBeyondAddressSize ¶
func (builder *IPv4AddressStringParamsBuilder) AllowPrefixesBeyondAddressSize(allow bool) *IPv4AddressStringParamsBuilder
AllowPrefixesBeyondAddressSize dictates whether to allow prefix length values greater than 32 for IPv4 or greater than 128 for IPv6.
func (*IPv4AddressStringParamsBuilder) AllowUnlimitedLeadingZeros ¶
func (builder *IPv4AddressStringParamsBuilder) AllowUnlimitedLeadingZeros(allow bool) *IPv4AddressStringParamsBuilder
AllowUnlimitedLeadingZeros dictates whether to allow leading zeros that extend segments beyond the usual segment length, which is 3 for IPv4 dotted-decimal and 4 for IPv6. However, this only takes effect if leading zeros are allowed, which is when AllowsLeadingZeros is true or the address is IPv4 and AllowsInetAtonOctal is true. For example, this determines whether you allow "0001.0002.0003.0004">
func (*IPv4AddressStringParamsBuilder) AllowWildcardedSeparator ¶
func (builder *IPv4AddressStringParamsBuilder) AllowWildcardedSeparator(allow bool) *IPv4AddressStringParamsBuilder
AllowWildcardedSeparator dictates whether the wildcard '*' or '%' can replace the segment separators '.' and ':'. If so, then you can write addresses like *.* or *:*
func (*IPv4AddressStringParamsBuilder) AllowsLeadingZeros ¶
func (params *IPv4AddressStringParamsBuilder) AllowsLeadingZeros() bool
AllowsLeadingZeros indicates whether to allow addresses with segments containing leading zeros, such as "001.2.3.004" or "1:000a::". For IPV4, this option overrides inet_aton octal. Single-segment addresses, which must have the required length for parsing, are not affected by this flag.
func (*IPv4AddressStringParamsBuilder) AllowsUnlimitedLeadingZeros ¶
func (params *IPv4AddressStringParamsBuilder) AllowsUnlimitedLeadingZeros() bool
AllowsUnlimitedLeadingZeros determines whether to allow leading zeros that extend segments beyond the usual segment length of 3 for IPv4 dotted-decimal and 4 for IPv6. However, this parameter is valid only if leading zeros are allowed, that is, when AllowsLeadingZeros is true or the address is IPv4 and Allows_inet_aton_octal is true. For example, this determines whether to allow "0001.0002.0003.0004".
func (*IPv4AddressStringParamsBuilder) AllowsWildcardedSeparator ¶
func (params *IPv4AddressStringParamsBuilder) AllowsWildcardedSeparator() bool
AllowsWildcardedSeparator controls whether the wildcard '*' or '%' can replace the segment delimiters '.' and ':'. If so, addresses like *.* or *:* can be written.
func (*IPv4AddressStringParamsBuilder) GetEmbeddedIPv4AddressParentBuilder ¶
func (builder *IPv4AddressStringParamsBuilder) GetEmbeddedIPv4AddressParentBuilder() *IPv6AddressStringParamsBuilder
GetEmbeddedIPv4AddressParentBuilder the parent IPv6AddressStringParamsBuilder, if this builder was obtained by a call to getEmbeddedIPv4ParamsBuilder() from IPv6AddressStringParamsBuilder.
func (*IPv4AddressStringParamsBuilder) GetRangeParams ¶
func (params *IPv4AddressStringParamsBuilder) GetRangeParams() RangeParams
GetRangeParams returns RangeParams parameters describing whether ranges of values are allowed and what wildcards are allowed.
func (*IPv4AddressStringParamsBuilder) GetRangeParamsBuilder ¶
func (builder *IPv4AddressStringParamsBuilder) GetRangeParamsBuilder() *RangeParamsBuilder
GetRangeParamsBuilder returns a builder that builds the range parameters for these IPv4 address string parameters.
func (*IPv4AddressStringParamsBuilder) Set ¶
func (builder *IPv4AddressStringParamsBuilder) Set(params IPv4AddressStringParams) *IPv4AddressStringParamsBuilder
Set populates this builder with the values from the given IPv4AddressStringParams.
func (*IPv4AddressStringParamsBuilder) SetRangeParams ¶
func (builder *IPv4AddressStringParamsBuilder) SetRangeParams(rangeParams RangeParams) *IPv4AddressStringParamsBuilder
SetRangeParams populates this builder with the values from the given RangeParams.
func (*IPv4AddressStringParamsBuilder) ToParams ¶
func (builder *IPv4AddressStringParamsBuilder) ToParams() IPv4AddressStringParams
ToParams returns an immutable IPv4AddressStringParams instance built by this builder.
type IPv6AddressStringParams ¶
type IPv6AddressStringParams interface { IPAddressStringFormatParams // AllowsMixed allows mixed-in embedded IPv4 like "a:b:c:d:e:f:1.2.3.4". AllowsMixed() bool // AllowsZone allows zones like "a:b:c:d:e:f:a:b%zone". AllowsZone() bool // AllowsEmptyZone allows the zone character % with no following zone. AllowsEmptyZone() bool // AllowsBase85 allows IPv6 single-segment base 85 addresses. AllowsBase85() bool // GetMixedParams provides the IP parameters that for parsing the embedded IPv4 section of a mixed IPv6/v4 address, if AllowsMixed is true. GetMixedParams() IPAddressStringParams // GetEmbeddedIPv4AddressParams returns the IPv4 parameters for parsing the embedded IPv4 section of a mixed IPv6/v4 address. GetEmbeddedIPv4AddressParams() IPv4AddressStringParams }
IPv6AddressStringParams provides parameters specific to IPv6 addresses and subnets.
type IPv6AddressStringParamsBuilder ¶
type IPv6AddressStringParamsBuilder struct { IPAddressStringFormatParamsBuilder // contains filtered or unexported fields }
IPv6AddressStringParamsBuilder builds an immutable IPv6AddressStringParams for controlling parsing of IPv6 address strings'
func (*IPv6AddressStringParamsBuilder) AllowBase85 ¶
func (builder *IPv6AddressStringParamsBuilder) AllowBase85(allow bool) *IPv6AddressStringParamsBuilder
AllowBase85 dictates whether to allow IPv6 single-segment base 85 addresses.
func (*IPv6AddressStringParamsBuilder) AllowBinary ¶
func (builder *IPv6AddressStringParamsBuilder) AllowBinary(allow bool) *IPv6AddressStringParamsBuilder
AllowBinary dictates whether to allow binary addresses like "11111111.0.1.0" or "1111111111111111::".
func (*IPv6AddressStringParamsBuilder) AllowEmptyZone ¶
func (builder *IPv6AddressStringParamsBuilder) AllowEmptyZone(allow bool) *IPv6AddressStringParamsBuilder
AllowEmptyZone dictates whether to allow the zone character % with no following zone
func (*IPv6AddressStringParamsBuilder) AllowLeadingZeros ¶
func (builder *IPv6AddressStringParamsBuilder) AllowLeadingZeros(allow bool) *IPv6AddressStringParamsBuilder
AllowLeadingZeros dictates whether to allow addresses with segments that have leasing zeros like "001.2.3.004" or "1:000a::". For IPV4, this option overrides inetAton octal. Single segment addresses that must have the requisite length to be parsed are not affected by this flag.
func (*IPv6AddressStringParamsBuilder) AllowMixed ¶
func (builder *IPv6AddressStringParamsBuilder) AllowMixed(allow bool) *IPv6AddressStringParamsBuilder
AllowMixed dictates whether to allow mixed-in embedded IPv4 like "a:b:c:d:e:f:1.2.3.4".
func (*IPv6AddressStringParamsBuilder) AllowMixedInetAton ¶
func (builder *IPv6AddressStringParamsBuilder) AllowMixedInetAton(allow bool) *IPv6AddressStringParamsBuilder
AllowMixedInetAton dictates whether to allow inetAton style formats, whether hex, octal, or joined segments, in the embedded IPv4 section of a mixed IPv6/v4 address.
func (*IPv6AddressStringParamsBuilder) AllowPrefixLenLeadingZeros ¶
func (builder *IPv6AddressStringParamsBuilder) AllowPrefixLenLeadingZeros(allow bool) *IPv6AddressStringParamsBuilder
AllowPrefixLenLeadingZeros dictates whether to allow leading zeros in the prefix length like "1.2.3.4/016".
func (*IPv6AddressStringParamsBuilder) AllowPrefixesBeyondAddressSize ¶
func (builder *IPv6AddressStringParamsBuilder) AllowPrefixesBeyondAddressSize(allow bool) *IPv6AddressStringParamsBuilder
AllowPrefixesBeyondAddressSize dictates whether to allow prefix length values greater than 32 for IPv4 or greater than 128 for IPv6.
func (*IPv6AddressStringParamsBuilder) AllowUnlimitedLeadingZeros ¶
func (builder *IPv6AddressStringParamsBuilder) AllowUnlimitedLeadingZeros(allow bool) *IPv6AddressStringParamsBuilder
AllowUnlimitedLeadingZeros dictates whether to allow leading zeros that extend segments beyond the usual segment length, which is 3 for IPv4 dotted-decimal and 4 for IPv6. However, this only takes effect if leading zeros are allowed, which is when AllowsLeadingZeros is true or the address is IPv4 and AllowsInetAtonOctal is true. For example, this determines whether you allow 0001.0002.0003.0004
func (*IPv6AddressStringParamsBuilder) AllowWildcardedSeparator ¶
func (builder *IPv6AddressStringParamsBuilder) AllowWildcardedSeparator(allow bool) *IPv6AddressStringParamsBuilder
AllowWildcardedSeparator dictates whether the wildcard '*' or '%' can replace the segment separators '.' and ':'. If so, then you can write addresses like *.* or *:*
func (*IPv6AddressStringParamsBuilder) AllowZone ¶
func (builder *IPv6AddressStringParamsBuilder) AllowZone(allow bool) *IPv6AddressStringParamsBuilder
AllowZone dictates whether to allow zones like "a:b:c:d:e:f:a:b%zone".
func (*IPv6AddressStringParamsBuilder) AllowsBase85 ¶
func (builder *IPv6AddressStringParamsBuilder) AllowsBase85() bool
AllowsBase85 allows IPv6 single-segment base 85 addresses.
func (*IPv6AddressStringParamsBuilder) AllowsEmptyZone ¶
func (builder *IPv6AddressStringParamsBuilder) AllowsEmptyZone() bool
AllowsEmptyZone allows the zone character % with no following zone.
func (*IPv6AddressStringParamsBuilder) AllowsLeadingZeros ¶
func (params *IPv6AddressStringParamsBuilder) AllowsLeadingZeros() bool
AllowsLeadingZeros indicates whether to allow addresses with segments containing leading zeros, such as "001.2.3.004" or "1:000a::". For IPV4, this option overrides inet_aton octal. Single-segment addresses, which must have the required length for parsing, are not affected by this flag.
func (*IPv6AddressStringParamsBuilder) AllowsMixed ¶
func (builder *IPv6AddressStringParamsBuilder) AllowsMixed() bool
AllowsMixed allows mixed-in embedded IPv4 like "a:b:c:d:e:f:1.2.3.4".
func (*IPv6AddressStringParamsBuilder) AllowsUnlimitedLeadingZeros ¶
func (params *IPv6AddressStringParamsBuilder) AllowsUnlimitedLeadingZeros() bool
AllowsUnlimitedLeadingZeros determines whether to allow leading zeros that extend segments beyond the usual segment length of 3 for IPv4 dotted-decimal and 4 for IPv6. However, this parameter is valid only if leading zeros are allowed, that is, when AllowsLeadingZeros is true or the address is IPv4 and Allows_inet_aton_octal is true. For example, this determines whether to allow "0001.0002.0003.0004".
func (*IPv6AddressStringParamsBuilder) AllowsWildcardedSeparator ¶
func (params *IPv6AddressStringParamsBuilder) AllowsWildcardedSeparator() bool
AllowsWildcardedSeparator controls whether the wildcard '*' or '%' can replace the segment delimiters '.' and ':'. If so, addresses like *.* or *:* can be written.
func (*IPv6AddressStringParamsBuilder) AllowsZone ¶
func (builder *IPv6AddressStringParamsBuilder) AllowsZone() bool
AllowsZone allows zones like "a:b:c:d:e:f:a:b%zone".
func (*IPv6AddressStringParamsBuilder) GetEmbeddedIPv4AddressParamsBuilder ¶
func (builder *IPv6AddressStringParamsBuilder) GetEmbeddedIPv4AddressParamsBuilder() (result *IPv4AddressStringParamsBuilder)
GetEmbeddedIPv4AddressParamsBuilder returns a builder to build the IPv4 parameters that controls parsing of the embedded IPv4 section of a mixed IPv6/v4 address.
func (*IPv6AddressStringParamsBuilder) GetRangeParams ¶
func (params *IPv6AddressStringParamsBuilder) GetRangeParams() RangeParams
GetRangeParams returns RangeParams parameters describing whether ranges of values are allowed and what wildcards are allowed.
func (*IPv6AddressStringParamsBuilder) GetRangeParamsBuilder ¶
func (builder *IPv6AddressStringParamsBuilder) GetRangeParamsBuilder() *RangeParamsBuilder
GetRangeParamsBuilder returns a builder that builds the range parameters for these IPv6 address string parameters.
func (*IPv6AddressStringParamsBuilder) Set ¶
func (builder *IPv6AddressStringParamsBuilder) Set(params IPv6AddressStringParams) *IPv6AddressStringParamsBuilder
Set populates this builder with the values from the given IPv6AddressStringParams.
func (*IPv6AddressStringParamsBuilder) SetRangeParams ¶
func (builder *IPv6AddressStringParamsBuilder) SetRangeParams(rangeParams RangeParams) *IPv6AddressStringParamsBuilder
SetRangeParams populates this builder with the values from the given RangeParams.
func (*IPv6AddressStringParamsBuilder) ToParams ¶
func (builder *IPv6AddressStringParamsBuilder) ToParams() IPv6AddressStringParams
ToParams returns an immutable IPv6AddressStringParams instance built by this builder'
type MACAddressLen ¶
type MACAddressLen string
MACAddressLen is an option indicating a MAC address length.
const ( MAC48Len MACAddressLen = "MAC48" // indicates 48-bit MAC addresses EUI64Len MACAddressLen = "EUI64" // indicates 64-bit MAC addresses UnspecifiedMACLen MACAddressLen = "" // indicates unspecified bit-length MAC addresses )
type MACAddressStringFormatParams ¶
type MACAddressStringFormatParams interface { AddressStringFormatParams // AllowsShortSegments allows segments that are just a single hex digit and not two. AllowsShortSegments() bool }
MACAddressStringFormatParams provides format parameters for MAC addresses, indicating what formatting is allowed.
type MACAddressStringFormatParamsBuilder ¶
type MACAddressStringFormatParamsBuilder struct { AddressStringFormatParamsBuilder // contains filtered or unexported fields }
MACAddressStringFormatParamsBuilder builds an immutable MACAddressStringFormatParams for controlling parsing of MAC address strings.
func (*MACAddressStringFormatParamsBuilder) AllowLeadingZeros ¶
func (builder *MACAddressStringFormatParamsBuilder) AllowLeadingZeros(allow bool) *MACAddressStringFormatParamsBuilder
AllowLeadingZeros dictates whether to allow addresses with segments that have leasing zeros like "01:02:03:04:05:06". Single segment addresses that must have the requisite length to be parsed are not affected by this flag.
func (*MACAddressStringFormatParamsBuilder) AllowShortSegments ¶
func (builder *MACAddressStringFormatParamsBuilder) AllowShortSegments(allow bool) *MACAddressStringFormatParamsBuilder
AllowShortSegments dictates whether to allow segments that are just a single hex digit and not two.
func (*MACAddressStringFormatParamsBuilder) AllowUnlimitedLeadingZeros ¶
func (builder *MACAddressStringFormatParamsBuilder) AllowUnlimitedLeadingZeros(allow bool) *MACAddressStringFormatParamsBuilder
AllowUnlimitedLeadingZeros dictates whether to allow leading zeros that extend segments beyond the usual segment length of 2 hex digits. However, this only takes effect if leading zeros are allowed, which is when AllowsLeadingZeros is true.
func (*MACAddressStringFormatParamsBuilder) AllowWildcardedSeparator ¶
func (builder *MACAddressStringFormatParamsBuilder) AllowWildcardedSeparator(allow bool) *MACAddressStringFormatParamsBuilder
AllowWildcardedSeparator dictates whether the wildcard '*' or '%' can replace the segment separators '.', '-' and ':'. If so, then you can write addresses like "*.*" or "*:*".
func (*MACAddressStringFormatParamsBuilder) AllowsLeadingZeros ¶
func (params *MACAddressStringFormatParamsBuilder) AllowsLeadingZeros() bool
AllowsLeadingZeros indicates whether to allow addresses with segments containing leading zeros, such as "001.2.3.004" or "1:000a::". For IPV4, this option overrides inet_aton octal. Single-segment addresses, which must have the required length for parsing, are not affected by this flag.
func (*MACAddressStringFormatParamsBuilder) AllowsUnlimitedLeadingZeros ¶
func (params *MACAddressStringFormatParamsBuilder) AllowsUnlimitedLeadingZeros() bool
AllowsUnlimitedLeadingZeros determines whether to allow leading zeros that extend segments beyond the usual segment length of 3 for IPv4 dotted-decimal and 4 for IPv6. However, this parameter is valid only if leading zeros are allowed, that is, when AllowsLeadingZeros is true or the address is IPv4 and Allows_inet_aton_octal is true. For example, this determines whether to allow "0001.0002.0003.0004".
func (*MACAddressStringFormatParamsBuilder) AllowsWildcardedSeparator ¶
func (params *MACAddressStringFormatParamsBuilder) AllowsWildcardedSeparator() bool
AllowsWildcardedSeparator controls whether the wildcard '*' or '%' can replace the segment delimiters '.' and ':'. If so, addresses like *.* or *:* can be written.
func (*MACAddressStringFormatParamsBuilder) GetParentBuilder ¶
func (builder *MACAddressStringFormatParamsBuilder) GetParentBuilder() *MACAddressStringParamsBuilder
GetParentBuilder returns the original MACAddressStringParamsBuilder builder that this was obtained from, if this builder was obtained from a MACAddressStringParamsBuilder.
func (*MACAddressStringFormatParamsBuilder) GetRangeParams ¶
func (params *MACAddressStringFormatParamsBuilder) GetRangeParams() RangeParams
GetRangeParams returns RangeParams parameters describing whether ranges of values are allowed and what wildcards are allowed.
func (*MACAddressStringFormatParamsBuilder) GetRangeParamsBuilder ¶
func (builder *MACAddressStringFormatParamsBuilder) GetRangeParamsBuilder() *RangeParamsBuilder
GetRangeParamsBuilder returns a builder that builds the range parameters for these MAC address string format parameters.
func (*MACAddressStringFormatParamsBuilder) Set ¶
func (builder *MACAddressStringFormatParamsBuilder) Set(parms MACAddressStringFormatParams) *MACAddressStringFormatParamsBuilder
Set populates this builder with the values from the given MACAddressStringFormatParams.
func (*MACAddressStringFormatParamsBuilder) SetRangeParams ¶
func (builder *MACAddressStringFormatParamsBuilder) SetRangeParams(rangeParams RangeParams) *MACAddressStringFormatParamsBuilder
SetRangeParams populates this builder with the values from the given RangeParams.
func (*MACAddressStringFormatParamsBuilder) ToParams ¶
func (builder *MACAddressStringFormatParamsBuilder) ToParams() MACAddressStringFormatParams
ToParams returns an immutable MACAddressStringFormatParams instance built by this builder.
type MACAddressStringParams ¶
type MACAddressStringParams interface { AddressStringParams // GetPreferredLen indicates whether an ambiguous address like * is considered to be MAC 6 bytes, EUI-64 8 bytes, or either one. GetPreferredLen() MACAddressLen // AllowsDashed allows addresses like "aa-bb-cc-dd-ee-ff". AllowsDashed() bool // AllowsSingleDashed allows addresses like "aabbcc-ddeeff". AllowsSingleDashed() bool // AllowsColonDelimited allows addresses like "aa:bb:cc:dd:ee:ff". AllowsColonDelimited() bool // AllowsDotted allows addresses like "aaa.bbb.ccc.ddd". AllowsDotted() bool // AllowsSpaceDelimited allows addresses like "aa bb cc dd ee ff". AllowsSpaceDelimited() bool // GetFormatParams returns the parameters that apply to formatting of the address segments. GetFormatParams() MACAddressStringFormatParams }
MACAddressStringParams provides parameters for parsing MAC address strings. This allows you to control the validation performed by MACAddressString. MACAddressString uses the default MACAddressStringParams resolving instance if one is not specified. If you want to use parameters other than the default, use this interface. Immutable instances can be constructed using the MACAddressStringParamsBuilder.
func CopyMACAddressStringParams ¶
func CopyMACAddressStringParams(orig MACAddressStringParams) MACAddressStringParams
CopyMACAddressStringParams produces an immutable copy of the original MACAddressStringParams. Copying a MACAddressStringParams created by a MACAddressStringParamsBuilder is unnecessary since it is already immutable.
type MACAddressStringParamsBuilder ¶
type MACAddressStringParamsBuilder struct { AddressStringParamsBuilder // contains filtered or unexported fields }
MACAddressStringParamsBuilder builds an immutable MACAddressStringParameters for controlling parsing of MAC address strings.
func (*MACAddressStringParamsBuilder) AllowAll ¶
func (builder *MACAddressStringParamsBuilder) AllowAll(allow bool) *MACAddressStringParamsBuilder
AllowAll dictates whether to allow the string of just the wildcard "*" to denote all MAC addresses.
func (*MACAddressStringParamsBuilder) AllowColonDelimited ¶
func (builder *MACAddressStringParamsBuilder) AllowColonDelimited(allow bool) *MACAddressStringParamsBuilder
AllowColonDelimited dictates whether to allow addresses like "aa:bb:cc:dd:ee:ff".
func (*MACAddressStringParamsBuilder) AllowDashed ¶
func (builder *MACAddressStringParamsBuilder) AllowDashed(allow bool) *MACAddressStringParamsBuilder
AllowDashed dictates whether to allow addresses like "aa-bb-cc-dd-ee-ff".
func (*MACAddressStringParamsBuilder) AllowDotted ¶
func (builder *MACAddressStringParamsBuilder) AllowDotted(allow bool) *MACAddressStringParamsBuilder
AllowDotted dictates whether to allow addresses like "aaa.bbb.ccc.ddd".
func (*MACAddressStringParamsBuilder) AllowEmpty ¶
func (builder *MACAddressStringParamsBuilder) AllowEmpty(allow bool) *MACAddressStringParamsBuilder
AllowEmpty dictates whether to allow empty zero-length address strings.
func (*MACAddressStringParamsBuilder) AllowSingleDashed ¶
func (builder *MACAddressStringParamsBuilder) AllowSingleDashed(allow bool) *MACAddressStringParamsBuilder
AllowSingleDashed dictates whether to allow addresses like "aabbcc-ddeeff".
func (*MACAddressStringParamsBuilder) AllowSingleSegment ¶
func (builder *MACAddressStringParamsBuilder) AllowSingleSegment(allow bool) *MACAddressStringParamsBuilder
AllowSingleSegment dictates whether to allow an address to be specified as a single value, eg "ffffffff", without the standard use of segments like "1.2.3.4" or "1:2:4:3:5:6:7:8".
func (*MACAddressStringParamsBuilder) AllowSpaceDelimited ¶
func (builder *MACAddressStringParamsBuilder) AllowSpaceDelimited(allow bool) *MACAddressStringParamsBuilder
AllowSpaceDelimited dictates whether to allow addresses like "aa bb cc dd ee ff".
func (*MACAddressStringParamsBuilder) AllowWildcardedSeparator ¶
func (builder *MACAddressStringParamsBuilder) AllowWildcardedSeparator(allow bool) *MACAddressStringParamsBuilder
AllowWildcardedSeparator dictates whether the wildcard '*' or '%' can replace the segment separators '.', '-' and ':'. If so, then you can write addresses like "*.*" or "*:*".
func (*MACAddressStringParamsBuilder) AllowsAll ¶
func (params *MACAddressStringParamsBuilder) AllowsAll() bool
AllowsAll indicates if we allow the string of just the wildcard "*" to denote all addresses of all version. If false, then for IP addresses we check the preferred version with GetPreferredVersion(), and then check AllowsWildcardedSeparator(), to determine if the string represents all addresses of that version.
func (*MACAddressStringParamsBuilder) AllowsEmpty ¶
func (params *MACAddressStringParamsBuilder) AllowsEmpty() bool
AllowsEmpty indicates whether it allows zero-length address strings: "".
func (*MACAddressStringParamsBuilder) AllowsSingleSegment ¶
func (params *MACAddressStringParamsBuilder) AllowsSingleSegment() bool
AllowsSingleSegment allows an address to be specified as a single value, eg ffffffff, without the standard use of segments like "1.2.3.4" or "1:2:4:3:5:6:7:8".
func (*MACAddressStringParamsBuilder) GetFormatParamsBuilder ¶
func (builder *MACAddressStringParamsBuilder) GetFormatParamsBuilder() (result *MACAddressStringFormatParamsBuilder)
GetFormatParamsBuilder returns a builder that builds the MACAddressStringFormatParams for the MACAddressStringParams being built by this builder.
func (*MACAddressStringParamsBuilder) Set ¶
func (builder *MACAddressStringParamsBuilder) Set(params MACAddressStringParams) *MACAddressStringParamsBuilder
Set populates this builder with the values from the given MACAddressStringParams.
func (*MACAddressStringParamsBuilder) SetPreferredLen ¶
func (builder *MACAddressStringParamsBuilder) SetPreferredLen(size MACAddressLen) *MACAddressStringParamsBuilder
SetPreferredLen indicates the length for an ambiguous address like *, whether it is considered to be MAC 6 bytes, EUI-64 8 bytes, or either one.
func (*MACAddressStringParamsBuilder) SetRangeParams ¶
func (builder *MACAddressStringParamsBuilder) SetRangeParams(rangeParams RangeParams) *MACAddressStringParamsBuilder
SetRangeParams populates this builder with the values from the given RangeParams.
func (*MACAddressStringParamsBuilder) ToParams ¶
func (builder *MACAddressStringParamsBuilder) ToParams() MACAddressStringParams
ToParams returns an immutable MACAddressStringParams instance built by this builder.
type RangeParams ¶
type RangeParams interface { // AllowsWildcard indicates whether '*' is allowed to denote segments covering all possible segment values AllowsWildcard() bool // AllowsRangeSeparator indicates whether '-' (or the expected range separator for the address) is allowed to denote a range from lower to higher, like 1-10 AllowsRangeSeparator() bool // AllowsSingleWildcard indicates whether to allow a segment terminating with '_' characters, which represent any digit AllowsSingleWildcard() bool // AllowsReverseRange indicates whether '-' (or the expected range separator for the address) is allowed to denote a range from higher to lower, like 10-1 AllowsReverseRange() bool // AllowsInferredBoundary indicates whether a missing range value before or after a '-' is allowed to denote the mininum or maximum potential value AllowsInferredBoundary() bool }
RangeParams indicates what wildcards and ranges are allowed in the string.
var ( WildcardAndRange RangeParams = &rangeParameters{} // use this to support addresses supported by the default wildcard options and also addresses like "1.2-3.3.4" or "1:0-ff::". NoRange RangeParams = &rangeParameters{ noWildcard: true, noValueRange: true, noReverseRange: true, noSingleWildcard: true, noInferredBoundary: true, } WildcardOnly RangeParams = &rangeParameters{ noValueRange: true, noReverseRange: true, } )
type RangeParamsBuilder ¶
type RangeParamsBuilder struct {
// contains filtered or unexported fields
}
RangeParamsBuilder is used to build an immutable RangeParams for parsing address strings.
func (*RangeParamsBuilder) AllowInferredBoundary ¶
func (builder *RangeParamsBuilder) AllowInferredBoundary(allow bool) *RangeParamsBuilder
AllowInferredBoundary determines whether it is allowed to designate a missing range value before or after the '-' sign to indicate a minimum or maximum potential value.
func (*RangeParamsBuilder) AllowRangeSeparator ¶
func (builder *RangeParamsBuilder) AllowRangeSeparator(allow bool) *RangeParamsBuilder
AllowRangeSeparator specifies whether '-' (or the expected range separator for an address) is allowed to indicate a range from smaller to larger, such as 1-10.
func (*RangeParamsBuilder) AllowReverseRange ¶
func (builder *RangeParamsBuilder) AllowReverseRange(allow bool) *RangeParamsBuilder
AllowReverseRange specifies whether '-' (or the expected range separator for an address) is allowed to be used to indicate a range from larger to smaller, such as 10-1.
func (*RangeParamsBuilder) AllowSingleWildcard ¶
func (builder *RangeParamsBuilder) AllowSingleWildcard(allow bool) *RangeParamsBuilder
AllowSingleWildcard determines whether to allow a segment ending with '_' characters that represent any digit.
func (*RangeParamsBuilder) AllowWildcard ¶
func (builder *RangeParamsBuilder) AllowWildcard(allow bool) *RangeParamsBuilder
AllowWildcard dictates whether '*' is allowed to denote segments covering all possible segment values.
func (*RangeParamsBuilder) AllowsInferredBoundary ¶
func (builder *RangeParamsBuilder) AllowsInferredBoundary() bool
AllowsInferredBoundary indicates whether a missing range value before or after a '-' is allowed to denote the mininum or maximum potential value.
func (*RangeParamsBuilder) AllowsRangeSeparator ¶
func (builder *RangeParamsBuilder) AllowsRangeSeparator() bool
AllowsRangeSeparator indicates whether '-' (or the expected range separator for the address) is allowed to denote a range from lower to higher, like 1-10.
func (*RangeParamsBuilder) AllowsReverseRange ¶
func (builder *RangeParamsBuilder) AllowsReverseRange() bool
AllowsReverseRange indicates whether '-' (or the expected range separator for the address) is allowed to denote a range from higher to lower, like 10-1.
func (*RangeParamsBuilder) AllowsSingleWildcard ¶
func (builder *RangeParamsBuilder) AllowsSingleWildcard() bool
AllowsSingleWildcard indicates whether to allow a segment terminating with '_' characters, which represent any digit.
func (*RangeParamsBuilder) AllowsWildcard ¶
func (builder *RangeParamsBuilder) AllowsWildcard() bool
AllowsWildcard indicates whether '*' is allowed to denote segments covering all possible segment values.
func (*RangeParamsBuilder) GetIPv4ParentBuilder ¶
func (builder *RangeParamsBuilder) GetIPv4ParentBuilder() *IPv4AddressStringParamsBuilder
GetIPv4ParentBuilder returns the IPv4AddressStringParamsBuilder if this builder was obtained by a call to IPv4AddressStringParamsBuilder.GetRangeParamsBuilder.
func (*RangeParamsBuilder) GetIPv6ParentBuilder ¶
func (builder *RangeParamsBuilder) GetIPv6ParentBuilder() *IPv6AddressStringParamsBuilder
GetIPv6ParentBuilder returns the IPv6AddressStringParamsBuilder if this builder was obtained by a call to IPv6AddressStringParamsBuilder.GetRangeParamsBuilder.
func (*RangeParamsBuilder) GetMACParentBuilder ¶
func (builder *RangeParamsBuilder) GetMACParentBuilder() *MACAddressStringFormatParamsBuilder
GetMACParentBuilder returns the IPv6AddressStringParamsBuilder if this builder was obtained by a call to IPv6AddressStringParamsBuilder.GetRangeParamsBuilder.
func (*RangeParamsBuilder) Set ¶
func (builder *RangeParamsBuilder) Set(rangeParams RangeParams) *RangeParamsBuilder
Set initializes builder with the values from the given RangeParams.
func (*RangeParamsBuilder) ToParams ¶
func (builder *RangeParamsBuilder) ToParams() RangeParams
ToParams returns an immutable RangeParams instance built by this builder.