Documentation ¶
Overview ¶
Package addrstr provides interfaces for specifying how to create specific strings from addresses and address sections, as well as builder types to construct instances of those interfaces.
For example, StringOptionsBuilder produces instances implementing StringOptions for specifying generic strings. More specific builders and corresponding interface types exist for more specific address versions and types.
Each instance produced by a builders is immutable.
Index ¶
- 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 ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CompressOptions ¶
type CompressOptions interface { // GetCompressionChoiceOptions provides the CompressionChoiceOptions which specify which zero-segments should be compressed. GetCompressionChoiceOptions() CompressionChoiceOptions // GetMixedCompressionOptions provides the MixedCompressionOptions which specify which zero-segments should be compressed in mixed IPv6/v4 strings. GetMixedCompressionOptions() MixedCompressionOptions // CompressSingle indicates if a single zero-segment should be compressed on its own when there are no other segments to compress. CompressSingle() bool }
CompressOptions specifies how to compress the zero-segments in an address or subnet string.
type CompressOptionsBuilder ¶
type CompressOptionsBuilder struct {
// contains filtered or unexported fields
}
CompressOptionsBuilder is used to build an immutable CompressOptions instance for IPv6 address strings.
func (*CompressOptionsBuilder) CompressSingle ¶
func (opts *CompressOptionsBuilder) CompressSingle() bool
CompressSingle indicates if a single zero-segment should be compressed on its own when there are no other segments to compress.
func (*CompressOptionsBuilder) GetCompressionChoiceOptions ¶
func (opts *CompressOptionsBuilder) GetCompressionChoiceOptions() CompressionChoiceOptions
GetCompressionChoiceOptions provides the CompressionChoiceOptions which specify which zero-segments should be compressed.
func (*CompressOptionsBuilder) GetMixedCompressionOptions ¶
func (opts *CompressOptionsBuilder) GetMixedCompressionOptions() MixedCompressionOptions
GetMixedCompressionOptions provides the MixedCompressionOptions which specify which zero-segments should be compressed in mixed IPv6/v4 strings.
func (*CompressOptionsBuilder) SetCompressSingle ¶
func (builder *CompressOptionsBuilder) SetCompressSingle(compressSingle bool) *CompressOptionsBuilder
SetCompressSingle dictates whether a single zero-segment should be compressed on its own when there are no other segments to compress
func (*CompressOptionsBuilder) SetCompressionChoiceOptions ¶ added in v1.2.0
func (builder *CompressOptionsBuilder) SetCompressionChoiceOptions(rangeSelection CompressionChoiceOptions) *CompressOptionsBuilder
SetCompressionChoiceOptions sets the CompressionChoiceOptions which specify which zero-segments should be compressed
func (*CompressOptionsBuilder) SetMixedCompressionOptions ¶ added in v1.2.0
func (builder *CompressOptionsBuilder) SetMixedCompressionOptions(compressMixedOptions MixedCompressionOptions) *CompressOptionsBuilder
SetMixedCompressionOptions sets the MixedCompressionOptions which specify which zero-segments should be compressed in mixed IPv6/v4 strings
func (*CompressOptionsBuilder) ToOptions ¶
func (builder *CompressOptionsBuilder) ToOptions() CompressOptions
ToOptions returns an immutable CompressOptions instance built by this builder
type CompressionChoiceOptions ¶
type CompressionChoiceOptions string
CompressionChoiceOptions specify which zero-segments should be compressed.
const ( // HostPreferred - if there is a host section, compress the host along with any adjoining zero-segments, otherwise compress a range of zero-segments. HostPreferred CompressionChoiceOptions = "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. MixedPreferred CompressionChoiceOptions = "mixed preferred" // ZerosOrHost - compress the largest range of zero or host segments. ZerosOrHost CompressionChoiceOptions = "" // ZerosCompression - compress the largest range of zero-segments. ZerosCompression CompressionChoiceOptions = "zeros" )
func (CompressionChoiceOptions) CompressHost ¶
func (choice CompressionChoiceOptions) CompressHost() bool
CompressHost indicates if a host of a prefixed address should be compressed.
type IPStringOptions ¶
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 indicates the delimiter that separates the zone from the address, the default being '%'. GetZoneSeparator() string }
IPStringOptions represents a clear way to create a specific type of IP address or subnet string.
type IPStringOptionsBuilder ¶
type IPStringOptionsBuilder struct { StringOptionsBuilder // contains filtered or unexported fields }
IPStringOptionsBuilder is used to build an immutable IPStringOptions instance for IP address strings.
func (*IPStringOptionsBuilder) GetAddressLabel ¶
func (opts *IPStringOptionsBuilder) GetAddressLabel() string
GetAddressLabel returns a string to prepend to the entire address string, such as an octal, hex, or binary prefix.
func (*IPStringOptionsBuilder) GetRadix ¶
func (opts *IPStringOptionsBuilder) GetRadix() int
GetRadix returns the radix to be used. The default is hexadecimal unless built using an IPv4 options builder in which case the default is decimal.
func (*IPStringOptionsBuilder) GetSegmentStrPrefix ¶
func (opts *IPStringOptionsBuilder) GetSegmentStrPrefix() string
GetSegmentStrPrefix returns the string prefix (if any) to prepend to each segment's values, such as an octal, hex or binary prefix.
func (*IPStringOptionsBuilder) GetSeparator ¶
func (opts *IPStringOptionsBuilder) GetSeparator() byte
GetSeparator returns the separator that separates the divisions of the address, typically ':' or '.'. HasSeparator indicates if this method should be called. the default is to have no separator, unless built using a MAC, IPv6 or IPv4 options builder in which case the separator is ':' for MAC and IPv6 and '.' for IPv4.
func (*IPStringOptionsBuilder) GetWildcards ¶
func (opts *IPStringOptionsBuilder) GetWildcards() Wildcards
GetWildcards returns the 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, no separator, unless built using a MAC, IPv6 or IPv4 options builder in which case there is a default separator.
func (*IPStringOptionsBuilder) IsExpandedSegments ¶
func (opts *IPStringOptionsBuilder) IsExpandedSegments() bool
IsExpandedSegments returns whether segments should be expanded to maximal width, typically by using 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 indicates whether to use uppercase for hexadecimal or other radices with alphabetic characters.
func (*IPStringOptionsBuilder) SetAddressLabel ¶
func (builder *IPStringOptionsBuilder) SetAddressLabel(label string) *IPStringOptionsBuilder
SetAddressLabel dictates a string to prepend to the entire address string, such as an octal, hex, or binary prefix.
func (*IPStringOptionsBuilder) SetAddressSuffix ¶
func (builder *IPStringOptionsBuilder) SetAddressSuffix(suffix string) *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(expandSegments bool) *IPStringOptionsBuilder
SetExpandedSegments dictates whether segments should be expanded to maximal width, typically by using leading zeros.
func (*IPStringOptionsBuilder) SetHasSeparator ¶
func (builder *IPStringOptionsBuilder) SetHasSeparator(has bool) *IPStringOptionsBuilder
SetHasSeparator dictates whether there is a separator. The default for IPStringOptionsBuilder is false.
func (*IPStringOptionsBuilder) SetRadix ¶
func (builder *IPStringOptionsBuilder) SetRadix(base int) *IPStringOptionsBuilder
SetRadix sets the radix to be used.
func (*IPStringOptionsBuilder) SetReverse ¶
func (builder *IPStringOptionsBuilder) SetReverse(reverse bool) *IPStringOptionsBuilder
SetReverse dictates whether the string segments should be printed in reverse from the usual order, the usual order being most to least significant.
func (*IPStringOptionsBuilder) SetSegmentStrPrefix ¶
func (builder *IPStringOptionsBuilder) SetSegmentStrPrefix(prefix string) *IPStringOptionsBuilder
SetSegmentStrPrefix dictates a string prefix to prepend to each segment's values, such as an octal, hex or binary prefix.
func (*IPStringOptionsBuilder) SetSeparator ¶
func (builder *IPStringOptionsBuilder) SetSeparator(separator byte) *IPStringOptionsBuilder
SetSeparator dictates the separator to separate the divisions of the address. HasSeparator indicates if this separator should be used or not.
func (*IPStringOptionsBuilder) SetUppercase ¶
func (builder *IPStringOptionsBuilder) SetUppercase(uppercase bool) *IPStringOptionsBuilder
SetUppercase dictates whether to use uppercase for hexadecimal or other radices with alphabetic characters.
func (*IPStringOptionsBuilder) SetWildcardOption ¶
func (builder *IPStringOptionsBuilder) SetWildcardOption(wildcardOption WildcardOption) *IPStringOptionsBuilder
SetWildcardOption specifies the WildcardOption for use in the string.
func (*IPStringOptionsBuilder) SetWildcardOptions ¶
func (builder *IPStringOptionsBuilder) SetWildcardOptions(wildcardOptions WildcardOptions) *IPStringOptionsBuilder
SetWildcardOptions is a convenience method for setting both the WildcardOption and the Wildcards at the same time. It overrides previous calls to SetWildcardOption and SetWildcards, and is overridden by subsequent calls to those methods.
func (*IPStringOptionsBuilder) SetWildcards ¶
func (builder *IPStringOptionsBuilder) SetWildcards(wildcards Wildcards) *IPStringOptionsBuilder
SetWildcards specifies the wildcards for use in the string.
func (*IPStringOptionsBuilder) SetZoneSeparator ¶
func (builder *IPStringOptionsBuilder) SetZoneSeparator(separator string) *IPStringOptionsBuilder
SetZoneSeparator dictates the separator to separate the zone from the address, the default being '%' Zones apply to IPv6 addresses only, not IPv4.
func (*IPStringOptionsBuilder) ToOptions ¶
func (builder *IPStringOptionsBuilder) ToOptions() IPStringOptions
ToOptions returns an immutable IPStringOptions instance built by this builder.
type IPv4StringOptionsBuilder ¶
type IPv4StringOptionsBuilder struct {
IPStringOptionsBuilder
}
IPv4StringOptionsBuilder is used to build an immutable IPStringOptions instance for IPv4 address strings.
func (*IPv4StringOptionsBuilder) GetAddressLabel ¶
func (opts *IPv4StringOptionsBuilder) GetAddressLabel() string
GetAddressLabel returns a string to prepend to the entire address string, such as an octal, hex, or binary prefix.
func (*IPv4StringOptionsBuilder) GetRadix ¶
func (opts *IPv4StringOptionsBuilder) GetRadix() int
GetRadix returns the radix to be used. The default is hexadecimal unless built using an IPv4 options builder in which case the default is decimal.
func (*IPv4StringOptionsBuilder) GetSegmentStrPrefix ¶
func (opts *IPv4StringOptionsBuilder) GetSegmentStrPrefix() string
GetSegmentStrPrefix returns the string prefix (if any) to prepend to each segment's values, such as an octal, hex or binary prefix.
func (*IPv4StringOptionsBuilder) GetSeparator ¶
func (opts *IPv4StringOptionsBuilder) GetSeparator() byte
GetSeparator returns the separator that separates the divisions of the address, typically ':' or '.'. HasSeparator indicates if this method should be called. the default is to have no separator, unless built using a MAC, IPv6 or IPv4 options builder in which case the separator is ':' for MAC and IPv6 and '.' for IPv4.
func (*IPv4StringOptionsBuilder) GetWildcards ¶
func (opts *IPv4StringOptionsBuilder) GetWildcards() Wildcards
GetWildcards returns the 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, no separator, unless built using a MAC, IPv6 or IPv4 options builder in which case there is a default separator.
func (*IPv4StringOptionsBuilder) IsExpandedSegments ¶
func (opts *IPv4StringOptionsBuilder) IsExpandedSegments() bool
IsExpandedSegments returns whether segments should be expanded to maximal width, typically by using 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 indicates whether to use uppercase for hexadecimal or other radices with alphabetic characters.
func (*IPv4StringOptionsBuilder) SetAddressLabel ¶
func (builder *IPv4StringOptionsBuilder) SetAddressLabel(label string) *IPv4StringOptionsBuilder
SetAddressLabel dictates a string to prepend to the entire address string, such as an octal, hex, or binary prefix.
func (*IPv4StringOptionsBuilder) SetAddressSuffix ¶
func (builder *IPv4StringOptionsBuilder) SetAddressSuffix(suffix string) *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(expandSegments bool) *IPv4StringOptionsBuilder
SetExpandedSegments dictates whether segments should be expanded to maximal width, typically by using leading zeros.
func (*IPv4StringOptionsBuilder) SetHasSeparator ¶
func (builder *IPv4StringOptionsBuilder) SetHasSeparator(has bool) *IPv4StringOptionsBuilder
SetHasSeparator dictates whether there is a separator. The default for IPv4 is true.
func (*IPv4StringOptionsBuilder) SetRadix ¶
func (builder *IPv4StringOptionsBuilder) SetRadix(base int) *IPv4StringOptionsBuilder
SetRadix sets the radix to be used.
func (*IPv4StringOptionsBuilder) SetReverse ¶
func (builder *IPv4StringOptionsBuilder) SetReverse(reverse bool) *IPv4StringOptionsBuilder
SetReverse dictates whether the string segments should be printed in reverse from the usual order, the usual order being most to least significant.
func (*IPv4StringOptionsBuilder) SetSegmentStrPrefix ¶
func (builder *IPv4StringOptionsBuilder) SetSegmentStrPrefix(prefix string) *IPv4StringOptionsBuilder
SetSegmentStrPrefix dictates a string prefix to prepend to each segment's values, such as an octal, hex or binary prefix.
func (*IPv4StringOptionsBuilder) SetSeparator ¶
func (builder *IPv4StringOptionsBuilder) SetSeparator(separator byte) *IPv4StringOptionsBuilder
SetSeparator dictates the separator to separate the divisions of the address, for IPv4 the default is '.'. HasSeparator indicates if this separator should be used or not.
func (*IPv4StringOptionsBuilder) SetUppercase ¶
func (builder *IPv4StringOptionsBuilder) SetUppercase(uppercase bool) *IPv4StringOptionsBuilder
SetUppercase dictates whether to use uppercase for hexadecimal or other radices with alphabetic characters.
func (*IPv4StringOptionsBuilder) SetWildcardOption ¶
func (builder *IPv4StringOptionsBuilder) SetWildcardOption(wildcardOption WildcardOption) *IPv4StringOptionsBuilder
SetWildcardOption specifies the WildcardOption for use in the string.
func (*IPv4StringOptionsBuilder) SetWildcardOptions ¶
func (builder *IPv4StringOptionsBuilder) SetWildcardOptions(wildcardOptions WildcardOptions) *IPv4StringOptionsBuilder
SetWildcardOptions is a convenience method for setting both the WildcardOption and the Wildcards at the same time. It overrides previous calls to SetWildcardOption and SetWildcards, and is overridden by subsequent calls to those methods.
func (*IPv4StringOptionsBuilder) SetWildcards ¶
func (builder *IPv4StringOptionsBuilder) SetWildcards(wildcards Wildcards) *IPv4StringOptionsBuilder
SetWildcards specifies the wildcards for use in the string.
func (*IPv4StringOptionsBuilder) ToOptions ¶
func (builder *IPv4StringOptionsBuilder) ToOptions() IPStringOptions
ToOptions returns an immutable IPStringOptions instance built by this builder.
type IPv6StringOptions ¶
type IPv6StringOptions interface { IPStringOptions // GetIPv4Opts returns the options used for creating the embedded IPv4 address string in a mixed IPv6 address, // which comes 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 the CompressOptions which specify how to compress zero-segments in the IPv6 address or subnet string. GetCompressOptions() CompressOptions // IsSplitDigits indicates whether every digit is separated from every other by separators. If mixed, this option is ignored. IsSplitDigits() bool // can produce addrerr.IncompatibleAddressError for ranged series // IsMixed specifies that the last two segments of the IPv6 address should be printed as an IPv4 address, resulting in a mixed IPv6/v4 string. IsMixed() bool // can produce addrerr.IncompatibleAddressError for ranges in the IPv4 part of the series }
IPv6StringOptions provides a clear way to create a specific type of IPv6 address string.
type IPv6StringOptionsBuilder ¶
type IPv6StringOptionsBuilder struct { IPStringOptionsBuilder // contains filtered or unexported fields }
IPv6StringOptionsBuilder is used to build an immutable IPv6StringOptions instance for IPv6 address strings.
func (*IPv6StringOptionsBuilder) GetAddressLabel ¶
func (opts *IPv6StringOptionsBuilder) GetAddressLabel() string
GetAddressLabel returns a string to prepend to the entire address string, such as an octal, hex, or binary prefix.
func (*IPv6StringOptionsBuilder) GetCompressOptions ¶
func (builder *IPv6StringOptionsBuilder) GetCompressOptions() CompressOptions
GetCompressOptions returns the CompressOptions which specify how to compress zero-segments in the IPv6 address or subnet string.
func (*IPv6StringOptionsBuilder) GetIPv4Opts ¶
func (builder *IPv6StringOptionsBuilder) GetIPv4Opts() IPStringOptions
GetIPv4Opts returns the IPv4 string options to be used on the IPv4 address section in a mixed IPv6/v4 string.
func (*IPv6StringOptionsBuilder) GetRadix ¶
func (opts *IPv6StringOptionsBuilder) GetRadix() int
GetRadix returns the radix to be used. The default is hexadecimal unless built using an IPv4 options builder in which case the default is decimal.
func (*IPv6StringOptionsBuilder) GetSegmentStrPrefix ¶
func (opts *IPv6StringOptionsBuilder) GetSegmentStrPrefix() string
GetSegmentStrPrefix returns the string prefix (if any) to prepend to each segment's values, such as an octal, hex or binary prefix.
func (*IPv6StringOptionsBuilder) GetSeparator ¶
func (opts *IPv6StringOptionsBuilder) GetSeparator() byte
GetSeparator returns the separator that separates the divisions of the address, typically ':' or '.'. HasSeparator indicates if this method should be called. the default is to have no separator, unless built using a MAC, IPv6 or IPv4 options builder in which case the separator is ':' for MAC and IPv6 and '.' for IPv4.
func (*IPv6StringOptionsBuilder) GetWildcards ¶
func (opts *IPv6StringOptionsBuilder) GetWildcards() Wildcards
GetWildcards returns the 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, no separator, unless built using a MAC, IPv6 or IPv4 options builder in which case there is a default separator.
func (*IPv6StringOptionsBuilder) IsExpandedSegments ¶
func (opts *IPv6StringOptionsBuilder) IsExpandedSegments() bool
IsExpandedSegments returns whether segments should be expanded to maximal width, typically by using 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 an 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 indicates whether to use uppercase for hexadecimal or other radices with alphabetic characters.
func (*IPv6StringOptionsBuilder) SetAddressSuffix ¶
func (builder *IPv6StringOptionsBuilder) SetAddressSuffix(suffix string) *IPv6StringOptionsBuilder
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 (*IPv6StringOptionsBuilder) SetCompressOptions ¶
func (builder *IPv6StringOptionsBuilder) SetCompressOptions(compressOptions CompressOptions) *IPv6StringOptionsBuilder
SetCompressOptions sets the CompressOptions which specify how to compress zero-segments in the IPv6 address or subnet string.
func (*IPv6StringOptionsBuilder) SetExpandedSegments ¶
func (builder *IPv6StringOptionsBuilder) SetExpandedSegments(expandSegments bool) *IPv6StringOptionsBuilder
SetExpandedSegments dictates whether segments should be expanded to maximal width, typically by using leading zeros.
func (*IPv6StringOptionsBuilder) SetHasSeparator ¶
func (builder *IPv6StringOptionsBuilder) SetHasSeparator(has bool) *IPv6StringOptionsBuilder
SetHasSeparator dictates whether there is a separator. The default for IPv6 is true.
func (*IPv6StringOptionsBuilder) SetMixed ¶
func (builder *IPv6StringOptionsBuilder) SetMixed(makeMixed bool) *IPv6StringOptionsBuilder
SetMixed dictates 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(ipv4Options IPStringOptions) *IPv6StringOptionsBuilder
SetMixedOptions supplies the IPv4 options to be used on the IPv4 section of a mixed string. Calling this method sets the string to be a mixed IPv6/v4 string.
func (*IPv6StringOptionsBuilder) SetRadix ¶
func (builder *IPv6StringOptionsBuilder) SetRadix(base int) *IPv6StringOptionsBuilder
SetRadix sets the radix to be used.
func (*IPv6StringOptionsBuilder) SetReverse ¶
func (builder *IPv6StringOptionsBuilder) SetReverse(reverse bool) *IPv6StringOptionsBuilder
SetReverse dictates whether the string segments should be printed in reverse from the usual order, the usual order being most to least significant.
func (*IPv6StringOptionsBuilder) SetSegmentStrPrefix ¶
func (builder *IPv6StringOptionsBuilder) SetSegmentStrPrefix(prefix string) *IPv6StringOptionsBuilder
SetSegmentStrPrefix dictates a string prefix to prepend to each segment's values, such as an octal, hex or binary prefix.
func (*IPv6StringOptionsBuilder) SetSeparator ¶
func (builder *IPv6StringOptionsBuilder) SetSeparator(separator byte) *IPv6StringOptionsBuilder
SetSeparator dictates the separator to separate the divisions of the address, for IPv6 the default is ':'. HasSeparator indicates if this separator should be used or not.
func (*IPv6StringOptionsBuilder) SetSplitDigits ¶
func (builder *IPv6StringOptionsBuilder) SetSplitDigits(splitDigits bool) *IPv6StringOptionsBuilder
SetSplitDigits dictates whether every digit is separated from every other by separators. If mixed, this option is ignored.
func (*IPv6StringOptionsBuilder) SetUppercase ¶
func (builder *IPv6StringOptionsBuilder) SetUppercase(upper bool) *IPv6StringOptionsBuilder
SetUppercase dictates whether to use uppercase for hexadecimal or other radices with alphabetic characters.
func (*IPv6StringOptionsBuilder) SetWildcardOption ¶ added in v1.2.0
func (builder *IPv6StringOptionsBuilder) SetWildcardOption(wildcardOption WildcardOption) *IPv6StringOptionsBuilder
SetWildcardOption specifies the WildcardOption for use in the string.
func (*IPv6StringOptionsBuilder) SetWildcardOptions ¶
func (builder *IPv6StringOptionsBuilder) SetWildcardOptions(wildcardOptions WildcardOptions) *IPv6StringOptionsBuilder
SetWildcardOptions is a convenience method for setting both the WildcardOption and the Wildcards at the same time It overrides previous calls to SetWildcardOption and SetWildcards, and is overridden by subsequent calls to those methods.
func (*IPv6StringOptionsBuilder) SetWildcards ¶ added in v1.2.0
func (builder *IPv6StringOptionsBuilder) SetWildcards(wildcards Wildcards) *IPv6StringOptionsBuilder
SetWildcards specifies the wildcards for use in the string.
func (*IPv6StringOptionsBuilder) SetZoneSeparator ¶
func (builder *IPv6StringOptionsBuilder) SetZoneSeparator(separator string) *IPv6StringOptionsBuilder
SetZoneSeparator dictates the separator to separate the zone from the address, the default being '%'.
func (*IPv6StringOptionsBuilder) ToOptions ¶
func (builder *IPv6StringOptionsBuilder) ToOptions() IPv6StringOptions
ToOptions returns an immutable IPv6StringOptions instance built by this builder.
type MACStringOptionsBuilder ¶
type MACStringOptionsBuilder struct {
StringOptionsBuilder
}
MACStringOptionsBuilder is used to build an immutable StringOptions instance for MAC address strings.
func (*MACStringOptionsBuilder) GetAddressLabel ¶
func (opts *MACStringOptionsBuilder) GetAddressLabel() string
GetAddressLabel returns a string to prepend to the entire address string, such as an octal, hex, or binary prefix.
func (*MACStringOptionsBuilder) GetRadix ¶
func (opts *MACStringOptionsBuilder) GetRadix() int
GetRadix returns the radix to be used. The default is hexadecimal unless built using an IPv4 options builder in which case the default is decimal.
func (*MACStringOptionsBuilder) GetSegmentStrPrefix ¶
func (opts *MACStringOptionsBuilder) GetSegmentStrPrefix() string
GetSegmentStrPrefix returns the string prefix (if any) to prepend to each segment's values, such as an octal, hex or binary prefix.
func (*MACStringOptionsBuilder) GetSeparator ¶
func (opts *MACStringOptionsBuilder) GetSeparator() byte
GetSeparator returns the separator that separates the divisions of the address, typically ':' or '.'. HasSeparator indicates if this method should be called. the default is to have no separator, unless built using a MAC, IPv6 or IPv4 options builder in which case the separator is ':' for MAC and IPv6 and '.' for IPv4.
func (*MACStringOptionsBuilder) GetWildcards ¶
func (opts *MACStringOptionsBuilder) GetWildcards() Wildcards
GetWildcards returns the 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, no separator, unless built using a MAC, IPv6 or IPv4 options builder in which case there is a default separator.
func (*MACStringOptionsBuilder) IsExpandedSegments ¶
func (opts *MACStringOptionsBuilder) IsExpandedSegments() bool
IsExpandedSegments returns whether segments should be expanded to maximal width, typically by using 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 indicates whether to use uppercase for hexadecimal or other radices with alphabetic characters.
func (*MACStringOptionsBuilder) SetAddressLabel ¶
func (builder *MACStringOptionsBuilder) SetAddressLabel(label string) *MACStringOptionsBuilder
SetAddressLabel dictates a string to prepend to the entire address string, such as an octal, hex, or binary prefix.
func (*MACStringOptionsBuilder) SetExpandedSegments ¶
func (builder *MACStringOptionsBuilder) SetExpandedSegments(expandSegments bool) *MACStringOptionsBuilder
SetExpandedSegments dictates whether segments should be expanded to maximal width, typically by using leading zeros.
func (*MACStringOptionsBuilder) SetHasSeparator ¶
func (builder *MACStringOptionsBuilder) SetHasSeparator(has bool) *MACStringOptionsBuilder
SetHasSeparator dictates whether there is a separator. The default for MAC is true.
func (*MACStringOptionsBuilder) SetRadix ¶
func (builder *MACStringOptionsBuilder) SetRadix(base int) *MACStringOptionsBuilder
SetRadix sets the radix to be used.
func (*MACStringOptionsBuilder) SetReverse ¶
func (builder *MACStringOptionsBuilder) SetReverse(reverse bool) *MACStringOptionsBuilder
SetReverse dictates whether the string segments should be printed in reverse from the usual order, the usual order being most to least significant.
func (*MACStringOptionsBuilder) SetSegmentStrPrefix ¶
func (builder *MACStringOptionsBuilder) SetSegmentStrPrefix(prefix string) *MACStringOptionsBuilder
SetSegmentStrPrefix dictates a string prefix to prepend to each segment's values, such as an octal, hex or binary prefix.
func (*MACStringOptionsBuilder) SetSeparator ¶
func (builder *MACStringOptionsBuilder) SetSeparator(separator byte) *MACStringOptionsBuilder
SetSeparator dictates the separator to separate the divisions of the address, for MAC the default is ':'. HasSeparator indicates if this separator should be used or not.
func (*MACStringOptionsBuilder) SetUppercase ¶
func (builder *MACStringOptionsBuilder) SetUppercase(uppercase bool) *MACStringOptionsBuilder
SetUppercase dictates whether to use uppercase for hexadecimal or other radices with alphabetic characters.
func (*MACStringOptionsBuilder) SetWildcards ¶
func (builder *MACStringOptionsBuilder) SetWildcards(wildcards Wildcards) *MACStringOptionsBuilder
SetWildcards specifies the wildcards for use in the string.
func (*MACStringOptionsBuilder) ToOptions ¶
func (builder *MACStringOptionsBuilder) ToOptions() StringOptions
ToOptions returns an immutable StringOptions instance built by this builder.
type MixedCompressionOptions ¶
type MixedCompressionOptions string
MixedCompressionOptions specify which zero-segments should be compressed in mixed IPv6/v4 strings.
const ( // NoMixedCompression - do not allow compression of an IPv4 section. NoMixedCompression MixedCompressionOptions = "no mixed compression" // MixedCompressionNoHost - allow compression of the IPv4 section when there is no host of the prefixed address. MixedCompressionNoHost MixedCompressionOptions = "no host" // MixedCompressionCoveredByHost - compress the IPv4 section if it is part of the host of the prefixed address. MixedCompressionCoveredByHost MixedCompressionOptions = "covered by host" // AllowMixedCompression - allow compression of a the IPv4 section. AllowMixedCompression MixedCompressionOptions = "" )
type StringOptions ¶
type StringOptions interface { // GetWildcards returns the wildcards specified for use in the string. GetWildcards() Wildcards // IsReverse indicates whether the string segments should be printed in reverse from the usual order, the usual order being most to least significant. IsReverse() bool // IsUppercase indicates whether to use uppercase for hexadecimal or other radices with alphabetic characters. IsUppercase() bool // IsExpandedSegments returns whether segments should be expanded to maximal width, typically by using leading zeros. IsExpandedSegments() bool // GetRadix returns the radix to be used. The default is hexadecimal unless built using an IPv4 options builder in which case the default is decimal. GetRadix() int // GetSeparator returns the separator that separates the divisions of the address, typically ':' or '.'. HasSeparator indicates if this method should be called. // the default is to have no separator, unless built using a MAC, IPv6 or IPv4 options builder in which case the separator is ':' for MAC and IPv6 and '.' for IPv4. GetSeparator() byte // HasSeparator indicates whether there is a separator. // The default is false, no separator, unless built using a MAC, IPv6 or IPv4 options builder in which case there is a default separator. HasSeparator() bool // GetAddressLabel returns a string to prepend to the entire address string, such as an octal, hex, or binary prefix. GetAddressLabel() string // GetSegmentStrPrefix returns the string prefix (if any) to prepend to each segment's values, such as an octal, hex or binary prefix. GetSegmentStrPrefix() string }
StringOptions represents a clear way to create a specific type of string.
type StringOptionsBuilder ¶
type StringOptionsBuilder struct {
// contains filtered or unexported fields
}
StringOptionsBuilder is used to build an immutable StringOptions instance.
func (*StringOptionsBuilder) GetAddressLabel ¶
func (opts *StringOptionsBuilder) GetAddressLabel() string
GetAddressLabel returns a string to prepend to the entire address string, such as an octal, hex, or binary prefix.
func (*StringOptionsBuilder) GetRadix ¶
func (opts *StringOptionsBuilder) GetRadix() int
GetRadix returns the radix to be used. The default is hexadecimal unless built using an IPv4 options builder in which case the default is decimal.
func (*StringOptionsBuilder) GetSegmentStrPrefix ¶
func (opts *StringOptionsBuilder) GetSegmentStrPrefix() string
GetSegmentStrPrefix returns the string prefix (if any) to prepend to each segment's values, such as an octal, hex or binary prefix.
func (*StringOptionsBuilder) GetSeparator ¶
func (opts *StringOptionsBuilder) GetSeparator() byte
GetSeparator returns the separator that separates the divisions of the address, typically ':' or '.'. HasSeparator indicates if this method should be called. the default is to have no separator, unless built using a MAC, IPv6 or IPv4 options builder in which case the separator is ':' for MAC and IPv6 and '.' for IPv4.
func (*StringOptionsBuilder) GetWildcards ¶
func (opts *StringOptionsBuilder) GetWildcards() Wildcards
GetWildcards returns the 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, no separator, unless built using a MAC, IPv6 or IPv4 options builder in which case there is a default separator.
func (*StringOptionsBuilder) IsExpandedSegments ¶
func (opts *StringOptionsBuilder) IsExpandedSegments() bool
IsExpandedSegments returns whether segments should be expanded to maximal width, typically by using 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 indicates whether to use uppercase for hexadecimal or other radices with alphabetic characters.
func (*StringOptionsBuilder) SetAddressLabel ¶
func (builder *StringOptionsBuilder) SetAddressLabel(label string) *StringOptionsBuilder
SetAddressLabel dictates a string to prepend to the entire address string, such as an octal, hex, or binary prefix.
func (*StringOptionsBuilder) SetExpandedSegments ¶
func (builder *StringOptionsBuilder) SetExpandedSegments(expandSegments bool) *StringOptionsBuilder
SetExpandedSegments dictates whether segments should be expanded to maximal width, typically by using leading zeros.
func (*StringOptionsBuilder) SetHasSeparator ¶
func (builder *StringOptionsBuilder) SetHasSeparator(has bool) *StringOptionsBuilder
SetHasSeparator dictates whether there is a separator. The default is false, no separator, unless using a MAC, IPv6 or IPv4 options builder in which case there is a default separator.
func (*StringOptionsBuilder) SetRadix ¶
func (builder *StringOptionsBuilder) SetRadix(base int) *StringOptionsBuilder
SetRadix sets the radix to be used.
func (*StringOptionsBuilder) SetReverse ¶
func (builder *StringOptionsBuilder) SetReverse(reverse bool) *StringOptionsBuilder
SetReverse dictates whether the string segments should be printed in reverse from the usual order, the usual order being most to least significant.
func (*StringOptionsBuilder) SetSegmentStrPrefix ¶
func (builder *StringOptionsBuilder) SetSegmentStrPrefix(prefix string) *StringOptionsBuilder
SetSegmentStrPrefix dictates a string prefix to prepend to each segment's values, such as an octal, hex or binary prefix.
func (*StringOptionsBuilder) SetSeparator ¶
func (builder *StringOptionsBuilder) SetSeparator(separator byte) *StringOptionsBuilder
SetSeparator dictates the separator to separate the divisions of the address, typically ':' or '.'. HasSeparator indicates if this separator should be used or not.
func (*StringOptionsBuilder) SetUppercase ¶
func (builder *StringOptionsBuilder) SetUppercase(uppercase bool) *StringOptionsBuilder
SetUppercase dictates whether to use uppercase for hexadecimal or other radices with alphabetic characters.
func (*StringOptionsBuilder) SetWildcards ¶
func (builder *StringOptionsBuilder) SetWildcards(wildcards Wildcards) *StringOptionsBuilder
SetWildcards specifies the wildcards for use in the string.
func (*StringOptionsBuilder) ToOptions ¶
func (builder *StringOptionsBuilder) ToOptions() StringOptions
ToOptions returns an immutable StringOptions instance built by this builder.
type WildcardOption ¶
type WildcardOption string
WildcardOption indicates options indicating when and where to use wildcards.
const ( // WildcardsNetworkOnly prints wildcards that are part of the network portion (only possible with subnet address notation, otherwise this option is ignored). WildcardsNetworkOnly WildcardOption = "" // WildcardsAll prints wildcards for any visible (non-compressed) segments. WildcardsAll WildcardOption = "allType" )
type WildcardOptions ¶
type WildcardOptions interface { // GetWildcardOption returns the WildcardOption to use. GetWildcardOption() WildcardOption // GetWildcards returns the wildcards to use. GetWildcards() Wildcards }
WildcardOptions indicates options indicating when and where to use wildcards, and what wildcards to use.
type WildcardOptionsBuilder ¶
type WildcardOptionsBuilder struct {
// contains filtered or unexported fields
}
WildcardOptionsBuilder is used to build an immutable WildcardOptions instance for address strings.
func (*WildcardOptionsBuilder) GetWildcardOption ¶
func (opts *WildcardOptionsBuilder) GetWildcardOption() WildcardOption
GetWildcardOption returns the WildcardOption to use.
func (*WildcardOptionsBuilder) GetWildcards ¶
func (opts *WildcardOptionsBuilder) GetWildcards() Wildcards
GetWildcards returns the wildcards to use.
func (*WildcardOptionsBuilder) SetWildcardOptions ¶
func (builder *WildcardOptionsBuilder) SetWildcardOptions(wildcardOption WildcardOption) *WildcardOptionsBuilder
SetWildcardOptions dictates the WildcardOption to use.
func (*WildcardOptionsBuilder) SetWildcards ¶
func (builder *WildcardOptionsBuilder) SetWildcards(wildcards Wildcards) *WildcardOptionsBuilder
SetWildcards dictates the wildcards to use.
func (*WildcardOptionsBuilder) ToOptions ¶
func (builder *WildcardOptionsBuilder) ToOptions() WildcardOptions
ToOptions returns an immutable WildcardOptions instance built by this builder.
type Wildcards ¶
type Wildcards interface { // GetRangeSeparator returns the wildcard used to separate the lower and upper boundary (inclusive) of a range of values. // If not set, then the default separator RangeSeparatorStr is used, which is the hyphen '-'. GetRangeSeparator() string // GetWildcard returns the wildcard used for representing any legitimate value, which is the asterisk '*' by default. GetWildcard() string // GetSingleWildcard returns the wildcard used for representing any single digit, which is the underscore '_' by default. GetSingleWildcard() string }
Wildcards specifies the wildcards to use when constructing an address string. WildcardsBuilder can be used to build an instance of Wildcards.
var DefaultWildcards Wildcards = &wildcards{rangeSeparator: rangeSeparatorStr, wildcard: segmentWildcardStr}
DefaultWildcards is the default Wildcards instance, using '-' and '*' as range separator and wildcard.
type WildcardsBuilder ¶
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 boundary (inclusive) of a range of values. If not set, then the default separator RangeSeparatorStr is used, which is the hyphen '-'
func (*WildcardsBuilder) GetSingleWildcard ¶
func (wildcards *WildcardsBuilder) GetSingleWildcard() string
GetSingleWildcard returns the wildcard used for representing any single digit, which is the underscore '_' by default.
func (*WildcardsBuilder) GetWildcard ¶
func (wildcards *WildcardsBuilder) GetWildcard() string
GetWildcard returns the wildcard used for representing any legitimate value, which is the asterisk '*' by default.
func (*WildcardsBuilder) SetRangeSeparator ¶
func (wildcards *WildcardsBuilder) SetRangeSeparator(str string) *WildcardsBuilder
SetRangeSeparator sets the wildcard used to separate the lower and upper boundary (inclusive) of a range of values. If not set, then the default separator RangeSeparatorStr is used, which is the hyphen '-'
func (*WildcardsBuilder) SetSingleWildcard ¶
func (wildcards *WildcardsBuilder) SetSingleWildcard(str string) *WildcardsBuilder
SetSingleWildcard sets the wildcard used for representing any single digit, which is the underscore '_' by default.
func (*WildcardsBuilder) SetWildcard ¶
func (wildcards *WildcardsBuilder) SetWildcard(str string) *WildcardsBuilder
SetWildcard sets the wildcard used for representing any legitimate value, which is the asterisk '*' by default.
func (*WildcardsBuilder) ToWildcards ¶
func (wildcards *WildcardsBuilder) ToWildcards() Wildcards
ToWildcards returns an immutable Wildcards instance built by this builder.