Versions in this module Expand all Collapse all v0 v0.2.0 Aug 11, 2026 Changes in this version + const AnyType type Phone + func GenerateForPrefix(region, prefix string, intn func(n int) int) (*Phone, bool) + func GenerateWith(region string, t PhoneType, intn func(n int) int) (*Phone, bool) v0.1.0 Aug 11, 2026 Changes in this version + const FixedLine + const FixedLineOrMobile + const Mobile + const Pager + const PersonalNumber + const PremiumRate + const SharedCost + const TollFree + const UAN + const Unknown + const VoIP + const Voicemail + var ErrInvalidCharacters = &ValidationError + var ErrInvalidCountry = &ValidationError + var ErrInvalidCountryCode = &ValidationError + var ErrInvalidExtension = &ValidationError + var ErrInvalidFormat = &ValidationError + var ErrInvalidLength = &ValidationError + var ErrInvalidPrefix = &ValidationError + var ErrInvalidType = &ValidationError + var ErrMissingCountry = &ValidationError + var ErrTooLong = &ValidationError + var ErrTooShort = &ValidationError + var MaskFirst3 = MaskOptions + var MaskFull = MaskOptions + var MaskLast4 = MaskOptions + var MaskMiddle = MaskOptions + func Equal(a, b string, opts ...ParseOption) bool + func Fingerprint(p *Phone, opts ...HashOption) string + func IsPossible(input string, opts ...ParseOption) bool + func IsValid(input string, opts ...ParseOption) bool + func Normalize(input string) string + func NormalizeBytes(input []byte) []byte + func Redact(p *Phone) string + func SortNumbers(numbers []string, opts ...ParseOption) []string + func SupportedRegions() []string + func ToE164(input string, opts ...ParseOption) (string, error) + func Unique(numbers []string, opts ...ParseOption) []string + type CountryCodeSource uint8 + const FromDefaultCountry + const FromNumberWithIDD + const FromNumberWithPlusSign + const FromNumberWithoutPlusSign + func (s CountryCodeSource) String() string + type ErrorCode int + const CodeInvalidCharacters + const CodeInvalidCountry + const CodeInvalidCountryCode + const CodeInvalidExtension + const CodeInvalidFormat + const CodeInvalidLength + const CodeInvalidPrefix + const CodeInvalidType + const CodeMissingCountry + const CodeTooLong + const CodeTooShort + type FormatType int + const FormatE164 + const FormatInternational + const FormatNational + const FormatRFC3966 + type Formatter struct + func NewFormatter(region string) *Formatter + func (f *Formatter) Clear() + func (f *Formatter) Digits() string + func (f *Formatter) Input(s string) string + func (f *Formatter) InputDigit(r rune) string + func (f *Formatter) RemoveLastDigit() string + func (f *Formatter) String() string + type HashAlgorithm int + const MD5 + const SHA1 + const SHA256 + const SHA512 + type HashOption func(*HashOptions) + func WithSecret(s string) HashOption + type HashOptions struct + Secret string + type MaskOptions struct + Mask string + Prefix int + Suffix int + type MatchType uint8 + const ExactMatch + const NSNMatch + const NoMatch + const ShortNSNMatch + func MatchNumbers(a, b string, opts ...ParseOption) MatchType + func (m MatchType) String() string + type Metadata = countries.Metadata + func Countries() []*Metadata + func Country(iso2 string) (*Metadata, bool) + func CountryByDialCode(code string) (*Metadata, bool) + func CountryByPhone(number string, opts ...ParseOption) (*Metadata, bool) + func NonGeoEntities() []*Metadata + func RegionsForDialCode(code string) []*Metadata + func SearchCountries(query string) []*Metadata + type ParseOption func(ParseOptions) ParseOptions + func WithAlphaCharacters() ParseOption + func WithDefaultCountry(region string) ParseOption + func WithoutRawInput() ParseOption + type ParseOptions struct + AllowAlpha bool + DefaultCountry string + KeepRawInput bool + func DefaultParseOptions() ParseOptions + type Phone struct + func ExampleNumber(region string) (*Phone, bool) + func ExampleNumberForType(region string, t PhoneType) (*Phone, bool) + func Generate(region string) (*Phone, bool) + func GenerateForType(region string, t PhoneType) (*Phone, bool) + func Parse(input string, opts ...ParseOption) (*Phone, error) + func ParseBytes(input []byte, opts ...ParseOption) (*Phone, error) + func ParseWith(input string, options ParseOptions) (*Phone, error) + func (p *Phone) AppendE164(dst []byte) []byte + func (p *Phone) CanBeInternationallyDialled() bool + func (p *Phone) CarrierCode() string + func (p *Phone) Clone() *Phone + func (p *Phone) Country() string + func (p *Phone) CountryCode() string + func (p *Phone) CountryName() string + func (p *Phone) DialCode() string + func (p *Phone) Digits() string + func (p *Phone) E164() string + func (p *Phone) Equal(other *Phone) bool + func (p *Phone) EqualExact(other *Phone) bool + func (p *Phone) Extension() string + func (p *Phone) Format(f FormatType) string + func (p *Phone) HasExtension() bool + func (p *Phone) Hash(algo ...HashAlgorithm) string + func (p *Phone) ISO2() string + func (p *Phone) ISO3() string + func (p *Phone) International() string + func (p *Phone) IsFixedLineOrMobile() bool + func (p *Phone) IsLandline() bool + func (p *Phone) IsMobile() bool + func (p *Phone) IsNonGeographical() bool + func (p *Phone) IsPager() bool + func (p *Phone) IsPersonalNumber() bool + func (p *Phone) IsPossible() bool + func (p *Phone) IsPremiumRate() bool + func (p *Phone) IsSharedCost() bool + func (p *Phone) IsTollFree() bool + func (p *Phone) IsUAN() bool + func (p *Phone) IsValid() bool + func (p *Phone) IsValidForRegion(region string) bool + func (p *Phone) IsVoIP() bool + func (p *Phone) IsVoicemail() bool + func (p *Phone) MarshalJSON() ([]byte, error) + func (p *Phone) MarshalText() ([]byte, error) + func (p *Phone) Mask(opts ...MaskOptions) string + func (p *Phone) Match(other *Phone) MatchType + func (p *Phone) Metadata() *Metadata + func (p *Phone) MobileNumberPortable() bool + func (p *Phone) NSN() string + func (p *Phone) National() string + func (p *Phone) NationalDigits() string + func (p *Phone) NationalWithCarrier(carrierCode string) string + func (p *Phone) OutOfCountry(fromRegion string) string + func (p *Phone) Parse(input string, opts ...ParseOption) error + func (p *Phone) ParseBytes(input []byte, opts ...ParseOption) error + func (p *Phone) ParseWith(input string, options ParseOptions) error + func (p *Phone) Possibility() Possibility + func (p *Phone) PossibilityForType(t PhoneType) Possibility + func (p *Phone) RFC3966() string + func (p *Phone) RawInput() string + func (p *Phone) Scan(value any) error + func (p *Phone) Source() CountryCodeSource + func (p *Phone) String() string + func (p *Phone) Timezones() []string + func (p *Phone) Type() PhoneType + func (p *Phone) UnmarshalJSON(data []byte) error + func (p *Phone) UnmarshalText(text []byte) error + func (p Phone) Value() (driver.Value, error) + type PhoneType = countries.PhoneType + type Possibility uint8 + const InvalidCountryCode + const InvalidLength + const IsPossibleLocalOnly + const IsPossibleNumber + const TooLong + const TooShort + func (p Possibility) String() string + type Result struct + Error error + Phone *Phone + func ParseMany(numbers []string, opts ...ParseOption) []Result + type ValidationError struct + Code ErrorCode + Message string + func (e *ValidationError) Error() string + func (e *ValidationError) Is(target error) bool