address_string
packageThis package is not in the latest version of its module.
Details
Valid go.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Overview¶
The address_string package provides interfaces to define howto create certain strings from addresses and address sections,as well as the builder types for creating instances of these interfaces.
For example, StringOptionsBuilder creates instances that implement StringOptions to specify generic strings.
For more specific versions and address types,there are more specific builders and corresponding interface types.
Each instance created by the builder is immutable.
Index¶
- Constants
- type CompressOptions
- type CompressOptionsBuilder
- func (opts *CompressOptionsBuilder) CompressSingle() bool
- func (opts *CompressOptionsBuilder) GetCompressionChoiceOptions() CompressionChoiceOptions
- func (opts *CompressOptionsBuilder) GetMixedCompressionOptions() MixedCompressionOptions
- func (builder *CompressOptionsBuilder) SetCompressSingle(compressSingle bool) *CompressOptionsBuilder
- func (builder *CompressOptionsBuilder) SetCompressionChoiceOptions(rangeSelection CompressionChoiceOptions) *CompressOptionsBuilder
- func (builder *CompressOptionsBuilder) SetMixedCompressionOptions(compressMixedOptions MixedCompressionOptions) *CompressOptionsBuilder
- func (builder *CompressOptionsBuilder) ToOptions() CompressOptions
- type CompressionChoiceOptions
- type IPStringOptions
- type IPStringOptionsBuilder
- func (opts *IPStringOptionsBuilder) GetAddressLabel() string
- func (opts *IPStringOptionsBuilder) GetRadix() int
- func (opts *IPStringOptionsBuilder) GetSegmentStrPrefix() string
- func (opts *IPStringOptionsBuilder) GetSeparator() byte
- func (opts *IPStringOptionsBuilder) GetWildcards() Wildcards
- func (opts *IPStringOptionsBuilder) HasSeparator() bool
- func (opts *IPStringOptionsBuilder) IsExpandedSegments() bool
- func (opts *IPStringOptionsBuilder) IsReverse() bool
- func (opts *IPStringOptionsBuilder) IsUppercase() bool
- func (builder *IPStringOptionsBuilder) SetAddressLabel(label string) *IPStringOptionsBuilder
- func (builder *IPStringOptionsBuilder) SetAddressSuffix(suffix string) *IPStringOptionsBuilder
- func (builder *IPStringOptionsBuilder) SetExpandedSegments(expandSegments bool) *IPStringOptionsBuilder
- func (builder *IPStringOptionsBuilder) SetHasSeparator(has bool) *IPStringOptionsBuilder
- func (builder *IPStringOptionsBuilder) SetRadix(base int) *IPStringOptionsBuilder
- func (builder *IPStringOptionsBuilder) SetReverse(reverse bool) *IPStringOptionsBuilder
- func (builder *IPStringOptionsBuilder) SetSegmentStrPrefix(prefix string) *IPStringOptionsBuilder
- func (builder *IPStringOptionsBuilder) SetSeparator(separator byte) *IPStringOptionsBuilder
- func (builder *IPStringOptionsBuilder) SetUppercase(uppercase bool) *IPStringOptionsBuilder
- func (builder *IPStringOptionsBuilder) SetWildcardOption(wildcardOption WildcardOption) *IPStringOptionsBuilder
- func (builder *IPStringOptionsBuilder) SetWildcardOptions(wildcardOptions WildcardOptions) *IPStringOptionsBuilder
- func (builder *IPStringOptionsBuilder) SetWildcards(wildcards Wildcards) *IPStringOptionsBuilder
- func (builder *IPStringOptionsBuilder) SetZoneSeparator(separator string) *IPStringOptionsBuilder
- func (builder *IPStringOptionsBuilder) ToOptions() IPStringOptions
- type IPv4StringOptionsBuilder
- func (opts *IPv4StringOptionsBuilder) GetAddressLabel() string
- func (opts *IPv4StringOptionsBuilder) GetRadix() int
- func (opts *IPv4StringOptionsBuilder) GetSegmentStrPrefix() string
- func (opts *IPv4StringOptionsBuilder) GetSeparator() byte
- func (opts *IPv4StringOptionsBuilder) GetWildcards() Wildcards
- func (opts *IPv4StringOptionsBuilder) HasSeparator() bool
- func (opts *IPv4StringOptionsBuilder) IsExpandedSegments() bool
- func (opts *IPv4StringOptionsBuilder) IsReverse() bool
- func (opts *IPv4StringOptionsBuilder) IsUppercase() bool
- func (builder *IPv4StringOptionsBuilder) SetAddressLabel(label string) *IPv4StringOptionsBuilder
- func (builder *IPv4StringOptionsBuilder) SetAddressSuffix(suffix string) *IPv4StringOptionsBuilder
- func (builder *IPv4StringOptionsBuilder) SetExpandedSegments(expandSegments bool) *IPv4StringOptionsBuilder
- func (builder *IPv4StringOptionsBuilder) SetHasSeparator(has bool) *IPv4StringOptionsBuilder
- func (builder *IPv4StringOptionsBuilder) SetRadix(base int) *IPv4StringOptionsBuilder
- func (builder *IPv4StringOptionsBuilder) SetReverse(reverse bool) *IPv4StringOptionsBuilder
- func (builder *IPv4StringOptionsBuilder) SetSegmentStrPrefix(prefix string) *IPv4StringOptionsBuilder
- func (builder *IPv4StringOptionsBuilder) SetSeparator(separator byte) *IPv4StringOptionsBuilder
- func (builder *IPv4StringOptionsBuilder) SetUppercase(uppercase bool) *IPv4StringOptionsBuilder
- func (builder *IPv4StringOptionsBuilder) SetWildcardOption(wildcardOption WildcardOption) *IPv4StringOptionsBuilder
- func (builder *IPv4StringOptionsBuilder) SetWildcardOptions(wildcardOptions WildcardOptions) *IPv4StringOptionsBuilder
- func (builder *IPv4StringOptionsBuilder) SetWildcards(wildcards Wildcards) *IPv4StringOptionsBuilder
- func (builder *IPv4StringOptionsBuilder) ToOptions() IPStringOptions
- type IPv6StringOptions
- type IPv6StringOptionsBuilder
- func (opts *IPv6StringOptionsBuilder) GetAddressLabel() string
- func (builder *IPv6StringOptionsBuilder) GetCompressOptions() CompressOptions
- func (builder *IPv6StringOptionsBuilder) GetIPv4Opts() IPStringOptions
- func (opts *IPv6StringOptionsBuilder) GetRadix() int
- func (opts *IPv6StringOptionsBuilder) GetSegmentStrPrefix() string
- func (opts *IPv6StringOptionsBuilder) GetSeparator() byte
- func (opts *IPv6StringOptionsBuilder) GetWildcards() Wildcards
- func (opts *IPv6StringOptionsBuilder) HasSeparator() bool
- func (opts *IPv6StringOptionsBuilder) IsExpandedSegments() bool
- func (builder *IPv6StringOptionsBuilder) IsMixed() bool
- func (opts *IPv6StringOptionsBuilder) IsReverse() bool
- func (opts *IPv6StringOptionsBuilder) IsUppercase() bool
- func (builder *IPv6StringOptionsBuilder) SetAddressSuffix(suffix string) *IPv6StringOptionsBuilder
- func (builder *IPv6StringOptionsBuilder) SetCompressOptions(compressOptions CompressOptions) *IPv6StringOptionsBuilder
- func (builder *IPv6StringOptionsBuilder) SetExpandedSegments(expandSegments bool) *IPv6StringOptionsBuilder
- func (builder *IPv6StringOptionsBuilder) SetHasSeparator(has bool) *IPv6StringOptionsBuilder
- func (builder *IPv6StringOptionsBuilder) SetMixed(makeMixed bool) *IPv6StringOptionsBuilder
- func (builder *IPv6StringOptionsBuilder) SetMixedOptions(ipv4Options IPStringOptions) *IPv6StringOptionsBuilder
- func (builder *IPv6StringOptionsBuilder) SetRadix(base int) *IPv6StringOptionsBuilder
- func (builder *IPv6StringOptionsBuilder) SetReverse(reverse bool) *IPv6StringOptionsBuilder
- func (builder *IPv6StringOptionsBuilder) SetSegmentStrPrefix(prefix string) *IPv6StringOptionsBuilder
- func (builder *IPv6StringOptionsBuilder) SetSeparator(separator byte) *IPv6StringOptionsBuilder
- func (builder *IPv6StringOptionsBuilder) SetSplitDigits(splitDigits bool) *IPv6StringOptionsBuilder
- func (builder *IPv6StringOptionsBuilder) SetUppercase(upper bool) *IPv6StringOptionsBuilder
- func (builder *IPv6StringOptionsBuilder) SetWildcardOption(wildcardOption WildcardOption) *IPv6StringOptionsBuilder
- func (builder *IPv6StringOptionsBuilder) SetWildcardOptions(wildcardOptions WildcardOptions) *IPv6StringOptionsBuilder
- func (builder *IPv6StringOptionsBuilder) SetWildcards(wildcards Wildcards) *IPv6StringOptionsBuilder
- func (builder *IPv6StringOptionsBuilder) SetZoneSeparator(separator string) *IPv6StringOptionsBuilder
- func (builder *IPv6StringOptionsBuilder) ToOptions() IPv6StringOptions
- type MACStringOptionsBuilder
- func (opts *MACStringOptionsBuilder) GetAddressLabel() string
- func (opts *MACStringOptionsBuilder) GetRadix() int
- func (opts *MACStringOptionsBuilder) GetSegmentStrPrefix() string
- func (opts *MACStringOptionsBuilder) GetSeparator() byte
- func (opts *MACStringOptionsBuilder) GetWildcards() Wildcards
- func (opts *MACStringOptionsBuilder) HasSeparator() bool
- func (opts *MACStringOptionsBuilder) IsExpandedSegments() bool
- func (opts *MACStringOptionsBuilder) IsReverse() bool
- func (opts *MACStringOptionsBuilder) IsUppercase() bool
- func (builder *MACStringOptionsBuilder) SetAddressLabel(label string) *MACStringOptionsBuilder
- func (builder *MACStringOptionsBuilder) SetExpandedSegments(expandSegments bool) *MACStringOptionsBuilder
- func (builder *MACStringOptionsBuilder) SetHasSeparator(has bool) *MACStringOptionsBuilder
- func (builder *MACStringOptionsBuilder) SetRadix(base int) *MACStringOptionsBuilder
- func (builder *MACStringOptionsBuilder) SetReverse(reverse bool) *MACStringOptionsBuilder
- func (builder *MACStringOptionsBuilder) SetSegmentStrPrefix(prefix string) *MACStringOptionsBuilder
- func (builder *MACStringOptionsBuilder) SetSeparator(separator byte) *MACStringOptionsBuilder
- func (builder *MACStringOptionsBuilder) SetUppercase(uppercase bool) *MACStringOptionsBuilder
- func (builder *MACStringOptionsBuilder) SetWildcards(wildcards Wildcards) *MACStringOptionsBuilder
- func (builder *MACStringOptionsBuilder) ToOptions() StringOptions
- type MixedCompressionOptions
- type StringOptions
- type StringOptionsBuilder
- func (opts *StringOptionsBuilder) GetAddressLabel() string
- func (opts *StringOptionsBuilder) GetRadix() int
- func (opts *StringOptionsBuilder) GetSegmentStrPrefix() string
- func (opts *StringOptionsBuilder) GetSeparator() byte
- func (opts *StringOptionsBuilder) GetWildcards() Wildcards
- func (opts *StringOptionsBuilder) HasSeparator() bool
- func (opts *StringOptionsBuilder) IsExpandedSegments() bool
- func (opts *StringOptionsBuilder) IsReverse() bool
- func (opts *StringOptionsBuilder) IsUppercase() bool
- func (builder *StringOptionsBuilder) SetAddressLabel(label string) *StringOptionsBuilder
- func (builder *StringOptionsBuilder) SetExpandedSegments(expandSegments bool) *StringOptionsBuilder
- func (builder *StringOptionsBuilder) SetHasSeparator(has bool) *StringOptionsBuilder
- func (builder *StringOptionsBuilder) SetRadix(base int) *StringOptionsBuilder
- func (builder *StringOptionsBuilder) SetReverse(reverse bool) *StringOptionsBuilder
- func (builder *StringOptionsBuilder) SetSegmentStrPrefix(prefix string) *StringOptionsBuilder
- func (builder *StringOptionsBuilder) SetSeparator(separator byte) *StringOptionsBuilder
- func (builder *StringOptionsBuilder) SetUppercase(uppercase bool) *StringOptionsBuilder
- func (builder *StringOptionsBuilder) SetWildcards(wildcards Wildcards) *StringOptionsBuilder
- func (builder *StringOptionsBuilder) ToOptions() StringOptions
- type WildcardOption
- type WildcardOptions
- type WildcardOptionsBuilder
- func (opts *WildcardOptionsBuilder) GetWildcardOption() WildcardOption
- func (opts *WildcardOptionsBuilder) GetWildcards() Wildcards
- func (builder *WildcardOptionsBuilder) SetWildcardOptions(wildcardOption WildcardOption) *WildcardOptionsBuilder
- func (builder *WildcardOptionsBuilder) SetWildcards(wildcards Wildcards) *WildcardOptionsBuilder
- func (builder *WildcardOptionsBuilder) ToOptions() WildcardOptions
- type Wildcards
- type WildcardsBuilder
- func (wildcards *WildcardsBuilder) GetRangeSeparator() string
- func (wildcards *WildcardsBuilder) GetSingleWildcard() string
- func (wildcards *WildcardsBuilder) GetWildcard() string
- func (wildcards *WildcardsBuilder) SetRangeSeparator(str string) *WildcardsBuilder
- func (wildcards *WildcardsBuilder) SetSingleWildcard(str string) *WildcardsBuilder
- func (wildcards *WildcardsBuilder) SetWildcard(str string) *WildcardsBuilder
- func (wildcards *WildcardsBuilder) ToWildcards() Wildcards
Constants¶
const (// WildcardsNetworkOnly prints wildcards that are part of the network// (only possible when using subnet address notation, otherwise this option is ignored).WildcardsNetworkOnlyWildcardOption = ""// WildcardsAll prints wildcards for any visible (uncompressed) segments.WildcardsAllWildcardOption = "allType"// ZerosCompression - compress the largest range of zero-segments.ZerosCompressionCompressionChoiceOptions = "zeros"// HostPreferred - if there is a host section, compress the host along with any adjoining zero-segments, otherwise compress a range of zero-segments.HostPreferredCompressionChoiceOptions = "host preferred"// MixedPreferred - if there is a mixed section that is compressible according to the MixedCompressionOptions, compress the mixed section along with any adjoining zero-segments, otherwise compress a range of zero-segments.MixedPreferredCompressionChoiceOptions = "mixed preferred"// ZerosOrHost - compress the largest range of zero or host segments.ZerosOrHostCompressionChoiceOptions = ""// NoMixedCompression - do not allow compression of an IPv4 section.NoMixedCompressionMixedCompressionOptions = "no mixed compression"// MixedCompressionNoHost - allow compression of the IPv4 section when there is no host of the prefixed address.MixedCompressionNoHostMixedCompressionOptions = "no host"// MixedCompressionCoveredByHost - compress the IPv4 section if it is part of the host of the prefixed address.MixedCompressionCoveredByHostMixedCompressionOptions = "covered by host"// AllowMixedCompression - allow compression of a the IPv4 section.AllowMixedCompressionMixedCompressionOptions = "")
Variables¶
This section is empty.
Functions¶
This section is empty.
Types¶
typeCompressOptions¶
type CompressOptions interface {// GetCompressionChoiceOptions provides CompressionChoiceOptions that determine which null segments should be compressed.GetCompressionChoiceOptions()CompressionChoiceOptions// GetMixedCompressionOptions provides MixedCompressionOptions options that specify which null segments should be compressed in mixed IPv6/v4 strings.GetMixedCompressionOptions()MixedCompressionOptions// CompressSingle specifies whether one zero segment should compress itself if there are no other segments to compress.CompressSingle()bool}
CompressOptions specifies how to compress zero-segments in the address or subnet string.
typeCompressOptionsBuilder¶
type CompressOptionsBuilder struct {// contains filtered or unexported fields}
The CompressOptionsBuilder is used to create an immutable CompressOptions instance for IPv6 address strings.
func (*CompressOptionsBuilder)CompressSingle¶
func (opts *CompressOptionsBuilder) CompressSingle()bool
CompressSingle specifies whether one zero segment should compress itself if there are no other segments to compress.
func (*CompressOptionsBuilder)GetCompressionChoiceOptions¶
func (opts *CompressOptionsBuilder) GetCompressionChoiceOptions()CompressionChoiceOptions
GetCompressionChoiceOptions provides CompressionChoiceOptions that determine which null segments should be compressed.
func (*CompressOptionsBuilder)GetMixedCompressionOptions¶
func (opts *CompressOptionsBuilder) GetMixedCompressionOptions()MixedCompressionOptions
GetMixedCompressionOptions provides MixedCompressionOptions options that specify which null segments should be compressed in mixed IPv6/v4 strings.
func (*CompressOptionsBuilder)SetCompressSingle¶
func (builder *CompressOptionsBuilder) SetCompressSingle(compressSinglebool) *CompressOptionsBuilder
SetCompressSingle determines whether one zero segment should compress itself if there are no other segments to compress.
func (*CompressOptionsBuilder)SetCompressionChoiceOptions¶
func (builder *CompressOptionsBuilder) SetCompressionChoiceOptions(rangeSelectionCompressionChoiceOptions) *CompressOptionsBuilder
SetCompressionChoiceOptions sets the CompressionChoiceOptions that determine which null segments should be compressed.
func (*CompressOptionsBuilder)SetMixedCompressionOptions¶
func (builder *CompressOptionsBuilder) SetMixedCompressionOptions(compressMixedOptionsMixedCompressionOptions) *CompressOptionsBuilder
SetMixedCompressionOptions sets the MixedCompressionOptions parameters that determinewhich null segments should be compressed in mixed IPv6/v4 strings.
func (*CompressOptionsBuilder)ToOptions¶
func (builder *CompressOptionsBuilder) ToOptions()CompressOptions
ToOptions returns an immutable instance of CompressOptions.
typeCompressionChoiceOptions¶
type CompressionChoiceOptionsstring
CompressionChoiceOptions specify which null segments are to be compressed.
func (CompressionChoiceOptions)CompressHost¶
func (choiceCompressionChoiceOptions) CompressHost()bool
CompressHost specifies whether to compress the host with the prefix address.
typeIPStringOptions¶
type IPStringOptions interface {StringOptions// GetAddressSuffix returns a suffix to be appended to the string.// .in-addr.arpa, .ip6.arpa, .ipv6-literal.net are examples of suffixes tacked onto the end of address strings.GetAddressSuffix()string// GetWildcardOption returns the WildcardOption to use.GetWildcardOption()WildcardOption// GetZoneSeparator specifies the separator that separates the zone from the address, the default is '%'.GetZoneSeparator()string}
IPStringOptions is an illustrative way to create a specific type of IP address or subnet string.
typeIPStringOptionsBuilder¶
type IPStringOptionsBuilder struct {StringOptionsBuilder// contains filtered or unexported fields}
IPStringOptionsBuilder is used to create an immutable IPStringOptions instance for IP address strings.
func (*IPStringOptionsBuilder)GetAddressLabel¶
func (opts *IPStringOptionsBuilder) GetAddressLabel()string
GetAddressLabel returns a string to add to the entire address string, such as an octal, hexadecimal or binary prefix.
func (*IPStringOptionsBuilder)GetRadix¶
func (opts *IPStringOptionsBuilder) GetRadix()int
GetRadix returns the radix used.The default is hexadecimal, unless the IPv4 option builder is used, in which case decimal is the default.
func (*IPStringOptionsBuilder)GetSegmentStrPrefix¶
func (opts *IPStringOptionsBuilder) GetSegmentStrPrefix()string
GetSegmentStrPrefix returns a string prefix (if any) to add to each segment value, such as an octal, hexadecimal, or binary prefix.
func (*IPStringOptionsBuilder)GetSeparator¶
func (opts *IPStringOptionsBuilder) GetSeparator()byte
GetSeparator returns a separator that separates address sections, usually ':' or '.'. HasSeparator specifies whether to call this method.By default, there is no separator unless the MAC, IPv6, or IPv4 option builder is used, in which case the separator is ':' for MAC and IPv6 and '.' for IPv4.
func (*IPStringOptionsBuilder)GetWildcards¶
func (opts *IPStringOptionsBuilder) GetWildcards()Wildcards
GetWildcards returns wildcards specified for use in the string.
func (*IPStringOptionsBuilder)HasSeparator¶
func (opts *IPStringOptionsBuilder) HasSeparator()bool
HasSeparator indicates whether there is a separator.The default is false, with no separator, unless using the MAC, IPv6 or IPv4 option builder, in which case there is a separator by default.
func (*IPStringOptionsBuilder)IsExpandedSegments¶
func (opts *IPStringOptionsBuilder) IsExpandedSegments()bool
IsExpandedSegments returns whether segments should be expanded to their maximum width, usually with leading zeros.
func (*IPStringOptionsBuilder)IsReverse¶
func (opts *IPStringOptionsBuilder) IsReverse()bool
IsReverse indicates whether the string segments should be printed in reverse from the usual order,the usual order being most to least significant.
func (*IPStringOptionsBuilder)IsUppercase¶
func (opts *IPStringOptionsBuilder) IsUppercase()bool
IsUppercase specifies whether to use uppercase for hexadecimal or other radians with alphabetic characters.
func (*IPStringOptionsBuilder)SetAddressLabel¶
func (builder *IPStringOptionsBuilder) SetAddressLabel(labelstring) *IPStringOptionsBuilder
SetAddressLabel dictates a string to add to the entire address string,such as an octal, hexadecimal or binary prefix.
func (*IPStringOptionsBuilder)SetAddressSuffix¶
func (builder *IPStringOptionsBuilder) SetAddressSuffix(suffixstring) *IPStringOptionsBuilder
SetAddressSuffix dictates a suffix to be appended to the string..in-addr.arpa, .ip6.arpa, .ipv6-literal.net are examples of suffixes tacked onto the end of address strings.
func (*IPStringOptionsBuilder)SetExpandedSegments¶
func (builder *IPStringOptionsBuilder) SetExpandedSegments(expandSegmentsbool) *IPStringOptionsBuilder
SetExpandedSegments dictates whether segments should be expanded to maximal width, typically by using leading zeros.
func (*IPStringOptionsBuilder)SetHasSeparator¶
func (builder *IPStringOptionsBuilder) SetHasSeparator(hasbool) *IPStringOptionsBuilder
SetHasSeparator determines whether there is a separator.By default the IPStringOptionsBuilder is set to false.
func (*IPStringOptionsBuilder)SetRadix¶
func (builder *IPStringOptionsBuilder) SetRadix(baseint) *IPStringOptionsBuilder
SetRadix sets the radix to be used.
func (*IPStringOptionsBuilder)SetReverse¶
func (builder *IPStringOptionsBuilder) SetReverse(reversebool) *IPStringOptionsBuilder
SetReverse determines whether to print the line segments in reverse order from the normal order,with the normal order being the order from largest to smallest value.
func (*IPStringOptionsBuilder)SetSegmentStrPrefix¶
func (builder *IPStringOptionsBuilder) SetSegmentStrPrefix(prefixstring) *IPStringOptionsBuilder
SetSegmentStrPrefix dictates a string prefix to add to each segment value,such as an octal, hexadecimal, or binary prefix.
func (*IPStringOptionsBuilder)SetSeparator¶
func (builder *IPStringOptionsBuilder) SetSeparator(separatorbyte) *IPStringOptionsBuilder
SetSeparator specifies the separator to separate address partitions.HasSeparator specifies whether this separator should be used or not.
func (*IPStringOptionsBuilder)SetUppercase¶
func (builder *IPStringOptionsBuilder) SetUppercase(uppercasebool) *IPStringOptionsBuilder
SetUppercase determines whether to use uppercase for hexadecimal or other alphabetic radians.
func (*IPStringOptionsBuilder)SetWildcardOption¶
func (builder *IPStringOptionsBuilder) SetWildcardOption(wildcardOptionWildcardOption) *IPStringOptionsBuilder
SetWildcardOption sets the WildcardOption parameter for use in the string.
func (*IPStringOptionsBuilder)SetWildcardOptions¶
func (builder *IPStringOptionsBuilder) SetWildcardOptions(wildcardOptionsWildcardOptions) *IPStringOptionsBuilder
SetWildcardOptions is a convenient method for simultaneously setting both WildcardOption and Wildcards.It overrides previous calls to SetWildcardOption and SetWildcards,and is overridden by subsequent calls to these methods.
func (*IPStringOptionsBuilder)SetWildcards¶
func (builder *IPStringOptionsBuilder) SetWildcards(wildcardsWildcards) *IPStringOptionsBuilder
SetWildcards defines wildcards to be used in the string.
func (*IPStringOptionsBuilder)SetZoneSeparator¶
func (builder *IPStringOptionsBuilder) SetZoneSeparator(separatorstring) *IPStringOptionsBuilder
SetZoneSeparator determines the separator to separate the zone from the address, the default is '%'.Zones only apply to IPv6 addresses, not IPv4 addresses.
func (*IPStringOptionsBuilder)ToOptions¶
func (builder *IPStringOptionsBuilder) ToOptions()IPStringOptions
ToOptions returns an immutable instance of IPStringOptions constructed by this constructor.
typeIPv4StringOptionsBuilder¶
type IPv4StringOptionsBuilder struct {IPStringOptionsBuilder}
The IPv4StringOptionsBuilder is used to create an immutable IPStringOptions instance for IPv4 address strings.
func (*IPv4StringOptionsBuilder)GetAddressLabel¶
func (opts *IPv4StringOptionsBuilder) GetAddressLabel()string
GetAddressLabel returns a string to add to the entire address string, such as an octal, hexadecimal or binary prefix.
func (*IPv4StringOptionsBuilder)GetRadix¶
func (opts *IPv4StringOptionsBuilder) GetRadix()int
GetRadix returns the radix used.The default is hexadecimal, unless the IPv4 option builder is used, in which case decimal is the default.
func (*IPv4StringOptionsBuilder)GetSegmentStrPrefix¶
func (opts *IPv4StringOptionsBuilder) GetSegmentStrPrefix()string
GetSegmentStrPrefix returns a string prefix (if any) to add to each segment value, such as an octal, hexadecimal, or binary prefix.
func (*IPv4StringOptionsBuilder)GetSeparator¶
func (opts *IPv4StringOptionsBuilder) GetSeparator()byte
GetSeparator returns a separator that separates address sections, usually ':' or '.'. HasSeparator specifies whether to call this method.By default, there is no separator unless the MAC, IPv6, or IPv4 option builder is used, in which case the separator is ':' for MAC and IPv6 and '.' for IPv4.
func (*IPv4StringOptionsBuilder)GetWildcards¶
func (opts *IPv4StringOptionsBuilder) GetWildcards()Wildcards
GetWildcards returns wildcards specified for use in the string.
func (*IPv4StringOptionsBuilder)HasSeparator¶
func (opts *IPv4StringOptionsBuilder) HasSeparator()bool
HasSeparator indicates whether there is a separator.The default is false, with no separator, unless using the MAC, IPv6 or IPv4 option builder, in which case there is a separator by default.
func (*IPv4StringOptionsBuilder)IsExpandedSegments¶
func (opts *IPv4StringOptionsBuilder) IsExpandedSegments()bool
IsExpandedSegments returns whether segments should be expanded to their maximum width, usually with leading zeros.
func (*IPv4StringOptionsBuilder)IsReverse¶
func (opts *IPv4StringOptionsBuilder) IsReverse()bool
IsReverse indicates whether the string segments should be printed in reverse from the usual order,the usual order being most to least significant.
func (*IPv4StringOptionsBuilder)IsUppercase¶
func (opts *IPv4StringOptionsBuilder) IsUppercase()bool
IsUppercase specifies whether to use uppercase for hexadecimal or other radians with alphabetic characters.
func (*IPv4StringOptionsBuilder)SetAddressLabel¶
func (builder *IPv4StringOptionsBuilder) SetAddressLabel(labelstring) *IPv4StringOptionsBuilder
SetAddressLabel dictates a string to add to the entire address string,such as an octal, hexadecimal or binary prefix.
func (*IPv4StringOptionsBuilder)SetAddressSuffix¶
func (builder *IPv4StringOptionsBuilder) SetAddressSuffix(suffixstring) *IPv4StringOptionsBuilder
SetAddressSuffix dictates a suffix to be appended to the string..in-addr.arpa, .ip6.arpa, .ipv6-literal.net are examples of suffixes tacked onto the end of address strings.
func (*IPv4StringOptionsBuilder)SetExpandedSegments¶
func (builder *IPv4StringOptionsBuilder) SetExpandedSegments(expandSegmentsbool) *IPv4StringOptionsBuilder
SetExpandedSegments determines whether segments should be expanded to their maximum width,usually with leading zeros.
func (*IPv4StringOptionsBuilder)SetHasSeparator¶
func (builder *IPv4StringOptionsBuilder) SetHasSeparator(hasbool) *IPv4StringOptionsBuilder
SetHasSeparator dictates whether there is a separator.The default for IPv4 is true.
func (*IPv4StringOptionsBuilder)SetRadix¶
func (builder *IPv4StringOptionsBuilder) SetRadix(baseint) *IPv4StringOptionsBuilder
SetRadix sets the radix to be used.
func (*IPv4StringOptionsBuilder)SetReverse¶
func (builder *IPv4StringOptionsBuilder) SetReverse(reversebool) *IPv4StringOptionsBuilder
SetReverse determines whether to print the line segments in reverse order from the normal order,with the normal order being the order from largest to smallest value.
func (*IPv4StringOptionsBuilder)SetSegmentStrPrefix¶
func (builder *IPv4StringOptionsBuilder) SetSegmentStrPrefix(prefixstring) *IPv4StringOptionsBuilder
SetSegmentStrPrefix dictates a string prefix to add to each segment value,such as an octal, hexadecimal, or binary prefix.
func (*IPv4StringOptionsBuilder)SetSeparator¶
func (builder *IPv4StringOptionsBuilder) SetSeparator(separatorbyte) *IPv4StringOptionsBuilder
SetSeparator defines a separator to separate parts of the address, for IPv4 the default is '.'.HasSeparator specifies whether to use this separator or not.
func (*IPv4StringOptionsBuilder)SetUppercase¶
func (builder *IPv4StringOptionsBuilder) SetUppercase(uppercasebool) *IPv4StringOptionsBuilder
SetUppercase determines whether to use uppercase for hexadecimal or other alphabetic radians.
func (*IPv4StringOptionsBuilder)SetWildcardOption¶
func (builder *IPv4StringOptionsBuilder) SetWildcardOption(wildcardOptionWildcardOption) *IPv4StringOptionsBuilder
SetWildcardOption sets the WildcardOption parameter for use in the string.
func (*IPv4StringOptionsBuilder)SetWildcardOptions¶
func (builder *IPv4StringOptionsBuilder) SetWildcardOptions(wildcardOptionsWildcardOptions) *IPv4StringOptionsBuilder
SetWildcardOptions is a convenient method for simultaneously setting both WildcardOption and Wildcards.It overrides previous calls to SetWildcardOption and SetWildcards,and is overridden by subsequent calls to these methods.
func (*IPv4StringOptionsBuilder)SetWildcards¶
func (builder *IPv4StringOptionsBuilder) SetWildcards(wildcardsWildcards) *IPv4StringOptionsBuilder
SetWildcards defines wildcards to be used in the string.
func (*IPv4StringOptionsBuilder)ToOptions¶
func (builder *IPv4StringOptionsBuilder) ToOptions()IPStringOptions
ToOptions returns an immutable IPStringOptions instance built by this builder.
typeIPv6StringOptions¶
type IPv6StringOptions interface {IPStringOptions// GetIPv4Opts returns the parameters used to create an embedded IPv4 address string in a mixed IPv6 address,// which is taken from the last 32 bits of the IPv6 address.// For example: "a:b:c:d:e:f:1.2.3.4".GetIPv4Opts()IPStringOptions// GetCompressOptions returns CompressOptions parameters that specify how to compress null segments in an IPv6 address string or subnet.GetCompressOptions()CompressOptions// IsSplitDigits specifies whether each digit is separated from each other by separators.// If separated, this parameter is ignored.// Can produce address_error.IncompatibleAddressError for ranged series.IsSplitDigits()bool// IsMixed specifies that the last two segments of the IPv6 address should be printed as IPv4 address, resulting in a mixed IPv6/v4 string.// Can produce address_error.IncompatibleAddressError for ranges in the IPv4 part of the series.IsMixed()bool}
IPv6StringOptions provides a clear way to create a specific type of IPv6 address string.
typeIPv6StringOptionsBuilder¶
type IPv6StringOptionsBuilder struct {IPStringOptionsBuilder// contains filtered or unexported fields}
IPv6StringOptionsBuilder is used to create an immutable IPv6StringOptions instance for IPv6 address strings.
func (*IPv6StringOptionsBuilder)GetAddressLabel¶
func (opts *IPv6StringOptionsBuilder) GetAddressLabel()string
GetAddressLabel returns a string to add to the entire address string, such as an octal, hexadecimal or binary prefix.
func (*IPv6StringOptionsBuilder)GetCompressOptions¶
func (builder *IPv6StringOptionsBuilder) GetCompressOptions()CompressOptions
GetCompressOptions returns CompressOptions parameters that specify how to compress null segments in an IPv6 address string or subnet.
func (*IPv6StringOptionsBuilder)GetIPv4Opts¶
func (builder *IPv6StringOptionsBuilder) GetIPv4Opts()IPStringOptions
GetIPv4Opts returns the IPv4 string options to be used in the IPv4 address section of a mixed IPv6/v4 string.
func (*IPv6StringOptionsBuilder)GetRadix¶
func (opts *IPv6StringOptionsBuilder) GetRadix()int
GetRadix returns the radix used.The default is hexadecimal, unless the IPv4 option builder is used, in which case decimal is the default.
func (*IPv6StringOptionsBuilder)GetSegmentStrPrefix¶
func (opts *IPv6StringOptionsBuilder) GetSegmentStrPrefix()string
GetSegmentStrPrefix returns a string prefix (if any) to add to each segment value, such as an octal, hexadecimal, or binary prefix.
func (*IPv6StringOptionsBuilder)GetSeparator¶
func (opts *IPv6StringOptionsBuilder) GetSeparator()byte
GetSeparator returns a separator that separates address sections, usually ':' or '.'. HasSeparator specifies whether to call this method.By default, there is no separator unless the MAC, IPv6, or IPv4 option builder is used, in which case the separator is ':' for MAC and IPv6 and '.' for IPv4.
func (*IPv6StringOptionsBuilder)GetWildcards¶
func (opts *IPv6StringOptionsBuilder) GetWildcards()Wildcards
GetWildcards returns wildcards specified for use in the string.
func (*IPv6StringOptionsBuilder)HasSeparator¶
func (opts *IPv6StringOptionsBuilder) HasSeparator()bool
HasSeparator indicates whether there is a separator.The default is false, with no separator, unless using the MAC, IPv6 or IPv4 option builder, in which case there is a separator by default.
func (*IPv6StringOptionsBuilder)IsExpandedSegments¶
func (opts *IPv6StringOptionsBuilder) IsExpandedSegments()bool
IsExpandedSegments returns whether segments should be expanded to their maximum width, usually with leading zeros.
func (*IPv6StringOptionsBuilder)IsMixed¶
func (builder *IPv6StringOptionsBuilder) IsMixed()bool
IsMixed specifies whether the last two segments of the IPv6 address should be printed as IPv4 address, resulting in a mixed IPv6/v4 string.
func (*IPv6StringOptionsBuilder)IsReverse¶
func (opts *IPv6StringOptionsBuilder) IsReverse()bool
IsReverse indicates whether the string segments should be printed in reverse from the usual order,the usual order being most to least significant.
func (*IPv6StringOptionsBuilder)IsUppercase¶
func (opts *IPv6StringOptionsBuilder) IsUppercase()bool
IsUppercase specifies whether to use uppercase for hexadecimal or other radians with alphabetic characters.
func (*IPv6StringOptionsBuilder)SetAddressSuffix¶
func (builder *IPv6StringOptionsBuilder) SetAddressSuffix(suffixstring) *IPv6StringOptionsBuilder
SetAddressSuffix determines the suffix to be added to the string..in-addr.arpa, .ip6.arpa, .ipv6-literal.net are examples ofsuffixes added to the end of address strings.
func (*IPv6StringOptionsBuilder)SetCompressOptions¶
func (builder *IPv6StringOptionsBuilder) SetCompressOptions(compressOptionsCompressOptions) *IPv6StringOptionsBuilder
SetCompressOptions sets the CompressOptions parameters, which determine how to compress null segments in the IPv6 address string or subnet.
func (*IPv6StringOptionsBuilder)SetExpandedSegments¶
func (builder *IPv6StringOptionsBuilder) SetExpandedSegments(expandSegmentsbool) *IPv6StringOptionsBuilder
SetExpandedSegments determines whether segments should be expanded to their maximum width, usually with leading zeros.
func (*IPv6StringOptionsBuilder)SetHasSeparator¶
func (builder *IPv6StringOptionsBuilder) SetHasSeparator(hasbool) *IPv6StringOptionsBuilder
SetHasSeparator determines whether there is a separator.The default for IPv6 is true.
func (*IPv6StringOptionsBuilder)SetMixed¶
func (builder *IPv6StringOptionsBuilder) SetMixed(makeMixedbool) *IPv6StringOptionsBuilder
SetMixed determines whether the string should be a mixed IPv6/v4 string in which the last two segments of the IPv6 address should be printed as an IPv4 address.
func (*IPv6StringOptionsBuilder)SetMixedOptions¶
func (builder *IPv6StringOptionsBuilder) SetMixedOptions(ipv4OptionsIPStringOptions) *IPv6StringOptionsBuilder
SetMixedOptions provides the IPv4 options to be used in the IPv4 mixed string section.Calling this method sets the string as an IPv6/v4 mixed string.
func (*IPv6StringOptionsBuilder)SetRadix¶
func (builder *IPv6StringOptionsBuilder) SetRadix(baseint) *IPv6StringOptionsBuilder
SetRadix sets the radix to be used.
func (*IPv6StringOptionsBuilder)SetReverse¶
func (builder *IPv6StringOptionsBuilder) SetReverse(reversebool) *IPv6StringOptionsBuilder
SetReverse determines whether to print the line segments in reverse order from the normal order,with the normal order being the order from largest to smallest value.
func (*IPv6StringOptionsBuilder)SetSegmentStrPrefix¶
func (builder *IPv6StringOptionsBuilder) SetSegmentStrPrefix(prefixstring) *IPv6StringOptionsBuilder
SetSegmentStrPrefix dictates a string prefix to add to each segment value, such as an octal, hexadecimal, or binary prefix.
func (*IPv6StringOptionsBuilder)SetSeparator¶
func (builder *IPv6StringOptionsBuilder) SetSeparator(separatorbyte) *IPv6StringOptionsBuilder
SetSeparator defines a separator to separate parts of the address, for IPv6 the default is ':'.HasSeparator specifies whether to use this separator or not.
func (*IPv6StringOptionsBuilder)SetSplitDigits¶
func (builder *IPv6StringOptionsBuilder) SetSplitDigits(splitDigitsbool) *IPv6StringOptionsBuilder
SetSplitDigits determines whether to separate each digit from each other with separators.When mixed, this parameter is ignored.
func (*IPv6StringOptionsBuilder)SetUppercase¶
func (builder *IPv6StringOptionsBuilder) SetUppercase(upperbool) *IPv6StringOptionsBuilder
SetUppercase determines whether to use uppercase for hexadecimal or other alphabetic radians.
func (*IPv6StringOptionsBuilder)SetWildcardOption¶
func (builder *IPv6StringOptionsBuilder) SetWildcardOption(wildcardOptionWildcardOption) *IPv6StringOptionsBuilder
SetWildcardOption sets the WildcardOption parameter for use in the string.
func (*IPv6StringOptionsBuilder)SetWildcardOptions¶
func (builder *IPv6StringOptionsBuilder) SetWildcardOptions(wildcardOptionsWildcardOptions) *IPv6StringOptionsBuilder
SetWildcardOptions is a convenient method for simultaneously setting WildcardOption and Wildcards.It overrides previous calls to SetWildcardOption and SetWildcards and is overridden by subsequent calls to these methods.
func (*IPv6StringOptionsBuilder)SetWildcards¶
func (builder *IPv6StringOptionsBuilder) SetWildcards(wildcardsWildcards) *IPv6StringOptionsBuilder
SetWildcards defines wildcards to be used in the string.
func (*IPv6StringOptionsBuilder)SetZoneSeparator¶
func (builder *IPv6StringOptionsBuilder) SetZoneSeparator(separatorstring) *IPv6StringOptionsBuilder
SetZoneSeparator determines the separator to separate the zone from the address, the default is '%'.
func (*IPv6StringOptionsBuilder)ToOptions¶
func (builder *IPv6StringOptionsBuilder) ToOptions()IPv6StringOptions
ToOptions returns an immutable instance of IPv6StringOptions constructed by this constructor.
typeMACStringOptionsBuilder¶
type MACStringOptionsBuilder struct {StringOptionsBuilder}
MACStringOptionsBuilder creates an immutable StringOptions instance for MAC address strings.
func (*MACStringOptionsBuilder)GetAddressLabel¶
func (opts *MACStringOptionsBuilder) GetAddressLabel()string
GetAddressLabel returns a string to add to the entire address string, such as an octal, hexadecimal or binary prefix.
func (*MACStringOptionsBuilder)GetRadix¶
func (opts *MACStringOptionsBuilder) GetRadix()int
GetRadix returns the radix used.The default is hexadecimal, unless the IPv4 option builder is used, in which case decimal is the default.
func (*MACStringOptionsBuilder)GetSegmentStrPrefix¶
func (opts *MACStringOptionsBuilder) GetSegmentStrPrefix()string
GetSegmentStrPrefix returns a string prefix (if any) to add to each segment value, such as an octal, hexadecimal, or binary prefix.
func (*MACStringOptionsBuilder)GetSeparator¶
func (opts *MACStringOptionsBuilder) GetSeparator()byte
GetSeparator returns a separator that separates address sections, usually ':' or '.'. HasSeparator specifies whether to call this method.By default, there is no separator unless the MAC, IPv6, or IPv4 option builder is used, in which case the separator is ':' for MAC and IPv6 and '.' for IPv4.
func (*MACStringOptionsBuilder)GetWildcards¶
func (opts *MACStringOptionsBuilder) GetWildcards()Wildcards
GetWildcards returns wildcards specified for use in the string.
func (*MACStringOptionsBuilder)HasSeparator¶
func (opts *MACStringOptionsBuilder) HasSeparator()bool
HasSeparator indicates whether there is a separator.The default is false, with no separator, unless using the MAC, IPv6 or IPv4 option builder, in which case there is a separator by default.
func (*MACStringOptionsBuilder)IsExpandedSegments¶
func (opts *MACStringOptionsBuilder) IsExpandedSegments()bool
IsExpandedSegments returns whether segments should be expanded to their maximum width, usually with leading zeros.
func (*MACStringOptionsBuilder)IsReverse¶
func (opts *MACStringOptionsBuilder) IsReverse()bool
IsReverse indicates whether the string segments should be printed in reverse from the usual order,the usual order being most to least significant.
func (*MACStringOptionsBuilder)IsUppercase¶
func (opts *MACStringOptionsBuilder) IsUppercase()bool
IsUppercase specifies whether to use uppercase for hexadecimal or other radians with alphabetic characters.
func (*MACStringOptionsBuilder)SetAddressLabel¶
func (builder *MACStringOptionsBuilder) SetAddressLabel(labelstring) *MACStringOptionsBuilder
SetAddressLabel dictates a string to add to the entire address string, such as an octal, hexadecimal or binary prefix.
func (*MACStringOptionsBuilder)SetExpandedSegments¶
func (builder *MACStringOptionsBuilder) SetExpandedSegments(expandSegmentsbool) *MACStringOptionsBuilder
SetExpandedSegments determines whether segments should be expanded to their maximum width, usually with leading zeros.
func (*MACStringOptionsBuilder)SetHasSeparator¶
func (builder *MACStringOptionsBuilder) SetHasSeparator(hasbool) *MACStringOptionsBuilder
SetHasSeparator determines whether there is a separator.The default for MAC is true.
func (*MACStringOptionsBuilder)SetRadix¶
func (builder *MACStringOptionsBuilder) SetRadix(baseint) *MACStringOptionsBuilder
SetRadix sets the radix in use.
func (*MACStringOptionsBuilder)SetReverse¶
func (builder *MACStringOptionsBuilder) SetReverse(reversebool) *MACStringOptionsBuilder
SetReverse determines whether to print line segments in reverse order from the normal order, with the normal order being from largest to smallest value.
func (*MACStringOptionsBuilder)SetSegmentStrPrefix¶
func (builder *MACStringOptionsBuilder) SetSegmentStrPrefix(prefixstring) *MACStringOptionsBuilder
SetSegmentStrPrefix dictates a string prefix to add to each segment value, such as an octal, hexadecimal, or binary prefix.
func (*MACStringOptionsBuilder)SetSeparator¶
func (builder *MACStringOptionsBuilder) SetSeparator(separatorbyte) *MACStringOptionsBuilder
SetSeparator specifies the separator for address partitions, for MAC the default is ':'.HasSeparator specifies whether to use this separator or not.
func (*MACStringOptionsBuilder)SetUppercase¶
func (builder *MACStringOptionsBuilder) SetUppercase(uppercasebool) *MACStringOptionsBuilder
SetUppercase determines whether to use uppercase for hexadecimal or other alphabetic radians.
func (*MACStringOptionsBuilder)SetWildcards¶
func (builder *MACStringOptionsBuilder) SetWildcards(wildcardsWildcards) *MACStringOptionsBuilder
SetWildcards defines wildcards to be used in the string.
func (*MACStringOptionsBuilder)ToOptions¶
func (builder *MACStringOptionsBuilder) ToOptions()StringOptions
ToOptions returns an immutable StringOptions instance built by this constructor.
typeMixedCompressionOptions¶
type MixedCompressionOptionsstring
MixedCompressionOptions specify which null segments should be compressed in mixed IPv6/v4 strings.
typeStringOptions¶
type StringOptions interface {// GetWildcards returns wildcards specified for use in the stringGetWildcards()Wildcards// IsReverse indicates whether the string segments should be printed in reverse from the usual order,// the usual order being most to least significantIsReverse()bool// IsUppercase specifies whether to use uppercase for hexadecimal or other radians with alphabetic charactersIsUppercase()bool// IsExpandedSegments returns whether segments should be expanded to their maximum width, usually with leading zerosIsExpandedSegments()bool// GetRadix returns the radix used.// The default is hexadecimal, unless the IPv4 option builder is used, in which case decimal is the defaultGetRadix()int// GetSeparator returns a separator that separates address sections, usually ':' or '.'. HasSeparator specifies whether to call this method.// By default, there is no separator unless the MAC, IPv6, or IPv4 option builder is used, in which case the separator is ':' for MAC and IPv6 and '.' for IPv4GetSeparator()byte// HasSeparator indicates whether there is a separator.// The default is false, with no separator, unless using the MAC, IPv6 or IPv4 option builder, in which case there is a separator by defaultHasSeparator()bool// GetAddressLabel returns a string to add to the entire address string, such as an octal, hexadecimal or binary prefixGetAddressLabel()string// GetSegmentStrPrefix returns a string prefix (if any) to add to each segment value, such as an octal, hexadecimal, or binary prefixGetSegmentStrPrefix()string}
StringOptions represents a clear way to create a specific type of string.
typeStringOptionsBuilder¶
type StringOptionsBuilder struct {// contains filtered or unexported fields}
StringOptionsBuilder is used to create an immutable StringOptions instance.
func (*StringOptionsBuilder)GetAddressLabel¶
func (opts *StringOptionsBuilder) GetAddressLabel()string
GetAddressLabel returns a string to add to the entire address string, such as an octal, hexadecimal or binary prefix.
func (*StringOptionsBuilder)GetRadix¶
func (opts *StringOptionsBuilder) GetRadix()int
GetRadix returns the radix used.The default is hexadecimal, unless the IPv4 option builder is used, in which case decimal is the default.
func (*StringOptionsBuilder)GetSegmentStrPrefix¶
func (opts *StringOptionsBuilder) GetSegmentStrPrefix()string
GetSegmentStrPrefix returns a string prefix (if any) to add to each segment value, such as an octal, hexadecimal, or binary prefix.
func (*StringOptionsBuilder)GetSeparator¶
func (opts *StringOptionsBuilder) GetSeparator()byte
GetSeparator returns a separator that separates address sections, usually ':' or '.'. HasSeparator specifies whether to call this method.By default, there is no separator unless the MAC, IPv6, or IPv4 option builder is used, in which case the separator is ':' for MAC and IPv6 and '.' for IPv4.
func (*StringOptionsBuilder)GetWildcards¶
func (opts *StringOptionsBuilder) GetWildcards()Wildcards
GetWildcards returns wildcards specified for use in the string.
func (*StringOptionsBuilder)HasSeparator¶
func (opts *StringOptionsBuilder) HasSeparator()bool
HasSeparator indicates whether there is a separator.The default is false, with no separator, unless using the MAC, IPv6 or IPv4 option builder, in which case there is a separator by default.
func (*StringOptionsBuilder)IsExpandedSegments¶
func (opts *StringOptionsBuilder) IsExpandedSegments()bool
IsExpandedSegments returns whether segments should be expanded to their maximum width, usually with leading zeros.
func (*StringOptionsBuilder)IsReverse¶
func (opts *StringOptionsBuilder) IsReverse()bool
IsReverse indicates whether the string segments should be printed in reverse from the usual order,the usual order being most to least significant.
func (*StringOptionsBuilder)IsUppercase¶
func (opts *StringOptionsBuilder) IsUppercase()bool
IsUppercase specifies whether to use uppercase for hexadecimal or other radians with alphabetic characters.
func (*StringOptionsBuilder)SetAddressLabel¶
func (builder *StringOptionsBuilder) SetAddressLabel(labelstring) *StringOptionsBuilder
SetAddressLabel dictates a string to add to the entire address string, such as an octal, hexadecimal or binary prefix.
func (*StringOptionsBuilder)SetExpandedSegments¶
func (builder *StringOptionsBuilder) SetExpandedSegments(expandSegmentsbool) *StringOptionsBuilder
SetExpandedSegments determines whether segments should be expanded to their maximum width, usually with leading zeros.
func (*StringOptionsBuilder)SetHasSeparator¶
func (builder *StringOptionsBuilder) SetHasSeparator(hasbool) *StringOptionsBuilder
SetHasSeparator determines whether the separator is present.The default is false, with no separator, unless the MAC, IPv6 or IPv4 option builder is used, in which case the separator is present by default.
func (*StringOptionsBuilder)SetRadix¶
func (builder *StringOptionsBuilder) SetRadix(baseint) *StringOptionsBuilder
SetRadix sets the radix in use.
func (*StringOptionsBuilder)SetReverse¶
func (builder *StringOptionsBuilder) SetReverse(reversebool) *StringOptionsBuilder
SetReverse determines whether to print the line segments in reverse order from the normal order, with the normal order being the order from largest to smallest value.
func (*StringOptionsBuilder)SetSegmentStrPrefix¶
func (builder *StringOptionsBuilder) SetSegmentStrPrefix(prefixstring) *StringOptionsBuilder
SetSegmentStrPrefix dictates a string prefix to add to each segment value, such as an octal, hexadecimal, or binary prefix.
func (*StringOptionsBuilder)SetSeparator¶
func (builder *StringOptionsBuilder) SetSeparator(separatorbyte) *StringOptionsBuilder
SetSeparator defines a separator to separate address partitions, usually ':' or '.'.HasSeparator specifies whether this separator should be used or not.
func (*StringOptionsBuilder)SetUppercase¶
func (builder *StringOptionsBuilder) SetUppercase(uppercasebool) *StringOptionsBuilder
SetUppercase determines whether to use uppercase for hexadecimal or other alphabetic radians.
func (*StringOptionsBuilder)SetWildcards¶
func (builder *StringOptionsBuilder) SetWildcards(wildcardsWildcards) *StringOptionsBuilder
SetWildcards defines wildcards to be used in the string.
func (*StringOptionsBuilder)ToOptions¶
func (builder *StringOptionsBuilder) ToOptions()StringOptions
ToOptions returns an immutable StringOptions instance built by this constructor.
typeWildcardOption¶
type WildcardOptionstring
WildcardOption specifies parameters that specify when and where to use wildcards.
typeWildcardOptions¶
type WildcardOptions interface {GetWildcardOption()WildcardOption// returns the used WildcardOption parameterGetWildcards()Wildcards// returns the wildcard characters to be used.}
WildcardOptions specifies parameters that specify when and where to use wildcards, and which wildcards to use.
typeWildcardOptionsBuilder¶
type WildcardOptionsBuilder struct {// contains filtered or unexported fields}
WildcardOptionsBuilder is used to create an immutable WildcardOptions instance for address strings.
func (*WildcardOptionsBuilder)GetWildcardOption¶
func (opts *WildcardOptionsBuilder) GetWildcardOption()WildcardOption
GetWildcardOption returns the WildcardOption parameter used.
func (*WildcardOptionsBuilder)GetWildcards¶
func (opts *WildcardOptionsBuilder) GetWildcards()Wildcards
GetWildcards returns the wildcards to be used.
func (*WildcardOptionsBuilder)SetWildcardOptions¶
func (builder *WildcardOptionsBuilder) SetWildcardOptions(wildcardOptionWildcardOption) *WildcardOptionsBuilder
SetWildcardOptions defines the WildcardOption to use.
func (*WildcardOptionsBuilder)SetWildcards¶
func (builder *WildcardOptionsBuilder) SetWildcards(wildcardsWildcards) *WildcardOptionsBuilder
SetWildcards dictates the wildcards to use.
func (*WildcardOptionsBuilder)ToOptions¶
func (builder *WildcardOptionsBuilder) ToOptions()WildcardOptions
ToOptions returns an immutable instance of WildcardOptions constructed by this constructor.
typeWildcards¶
type Wildcards interface {// GetRangeSeparator returns the wildcard used to separate the lower and upper bound (inclusive) of a range of values.// If it is not specified, it defaults to RangeSeparatorStr, which is a hyphen '-'.GetRangeSeparator()string// GetWildcard returns the wildcard used to represent any legitimate value, which by default is an asterisk '*'.GetWildcard()string// GetSingleWildcard returns the wildcard used to represent any single digit, which by default is the underscore character '_'.GetSingleWildcard()string}
Wildcards determines the wildcards to use when constructing an address string.WildcardsBuilder can be used to create a Wildcards instance.
var (// DefaultWildcards is the default Wildcards instance, using '-' and '*' as range separator and wildcard.DefaultWildcardsWildcards = &wildcards{rangeSeparator: rangeSeparatorStr, wildcard: segmentWildcardStr})
typeWildcardsBuilder¶
type WildcardsBuilder struct {// contains filtered or unexported fields}
WildcardsBuilder builds an instance of Wildcards.
func (*WildcardsBuilder)GetRangeSeparator¶
func (wildcards *WildcardsBuilder) GetRangeSeparator()string
GetRangeSeparator returns the wildcard used to separate the lower and upper bound (inclusive) of a range of values.If it is not specified, it defaults to RangeSeparatorStr, which is a hyphen '-'.
func (*WildcardsBuilder)GetSingleWildcard¶
func (wildcards *WildcardsBuilder) GetSingleWildcard()string
GetSingleWildcard returns the wildcard used to represent any single digit, which by default is the underscore character '_'.
func (*WildcardsBuilder)GetWildcard¶
func (wildcards *WildcardsBuilder) GetWildcard()string
GetWildcard returns the wildcard used to represent any legitimate value, which by default is an asterisk '*'.
func (*WildcardsBuilder)SetRangeSeparator¶
func (wildcards *WildcardsBuilder) SetRangeSeparator(strstring) *WildcardsBuilder
SetRangeSeparator sets the wildcard used to separate the lower and upper bound (inclusive) of a range of values.If not set, it defaults to RangeSeparatorStr, which is a hyphen '-'.
func (*WildcardsBuilder)SetSingleWildcard¶
func (wildcards *WildcardsBuilder) SetSingleWildcard(strstring) *WildcardsBuilder
SetSingleWildcard sets the wildcard used to represent any single digit, which by default is the underscore character '_'.
func (*WildcardsBuilder)SetWildcard¶
func (wildcards *WildcardsBuilder) SetWildcard(strstring) *WildcardsBuilder
SetWildcard sets the wildcard used to represent any legitimate value, the default is an asterisk '*'.
func (*WildcardsBuilder)ToWildcards¶
func (wildcards *WildcardsBuilder) ToWildcards()Wildcards
ToWildcards returns an immutable Wildcards instance built by this builder.