Documentation ¶
Index ¶
- Constants
- func E164Atoi(s string) (int, error)
- func NumbersSetAreaCodesNANP(numSet *NumbersSet) (*histogram.Histogram, error)
- func NumbersSetNumbersE164(numSet *NumbersSet) (*histogram.Histogram, error)
- func NumbersSetToTable(numsSet *NumbersSet) table.Table
- func ParseAreaCodeString(numberToParse, defaultRegion string) (string, error)
- type Carrier
- type Components
- type Direction
- type LineType
- type NumberInfo
- type NumberLookup
- type NumbersSet
- type PhoneNumber
- func (num *PhoneNumber) GetAreaCode() int
- func (num *PhoneNumber) GetAreaCodeString() string
- func (num *PhoneNumber) GetCountryCode() int32
- func (num *PhoneNumber) GetNumberE164() string
- func (num *PhoneNumber) GetNumberE164Uint() uint
- func (num *PhoneNumber) GetRegionCode() string
- func (num *PhoneNumber) Meta() Components
- type Source
- type ToFromNumbersSet
- type ToFromNumbersSets
- type ToFromNumbersSetsStats
Constants ¶
View Source
const ( CarrierATT = "att.com" CarrierSprint = "sprint.com" CarrierTMobile = "t-mobile.com" CarrierVerizon = "verizon.com" )
Variables ¶
This section is empty.
Functions ¶
func NumbersSetAreaCodesNANP ¶
func NumbersSetAreaCodesNANP(numSet *NumbersSet) (*histogram.Histogram, error)
func NumbersSetNumbersE164 ¶
func NumbersSetNumbersE164(numSet *NumbersSet) (*histogram.Histogram, error)
func NumbersSetToTable ¶
func NumbersSetToTable(numsSet *NumbersSet) table.Table
func ParseAreaCodeString ¶
ParseAreaCode will attempt to extract an areacode from a phone number string.
Types ¶
type Carrier ¶
type Carrier struct { MobileCountryCode string `json:"mobileCountryCode,omitempty"` MobileNetworkCode string `json:"mobileNetworkCode,omitempty"` Name string `json:"name,omitempty"` LineType string `json:"lineType,omitempty"` ErrorCode string `json:"errorCode,omitempty"` }
func TwilioCarrierToCommon ¶
type Components ¶
type Components struct { E164 string E164Uint uint RegionCode string CountryCode uint NANPAreaCode uint // NPA - Numbering plan area code NANPExchangeCode uint // NXX - Central office (exchange) code NANPLineNumber uint // xxxx - Line number or subscriber number }
func ParseE164 ¶
func ParseE164(e164 string) Components
type NumberInfo ¶
type NumberInfo struct { NumberE164 string Components Components Carrier Carrier Lookups []NumberLookup CarrierNamesEach []string LineTypesEach []string }
func NewNumberInfo ¶
func NewNumberInfo() NumberInfo
func (*NumberInfo) Inflate ¶
func (ni *NumberInfo) Inflate() error
func (*NumberInfo) InflateComponents ¶
func (ni *NumberInfo) InflateComponents()
type NumberLookup ¶
type NumberLookup struct { NumberE164 string Components Components Carrier Carrier LookupSource Source LookupTime time.Time SourceNumverify *numverify.ResponseSuccess SourceTwilio *twilio.NumberInfo }
func NewNumberLookupNumverify ¶
func NewNumberLookupNumverify(src *numverify.Response) (NumberLookup, error)
func NewNumberLookupTwilio ¶
func NewNumberLookupTwilio(src *twilio.NumberInfo) (NumberLookup, error)
func SortLookupsDesc ¶
func SortLookupsDesc(lookups []NumberLookup) []NumberLookup
type NumbersSet ¶
type NumbersSet struct {
NumbersMap map[string]NumberInfo
}
func NewNumbersSet ¶
func NewNumbersSet() NumbersSet
func ReadLookupsNumverify ¶
func ReadLookupsNumverify(dir, rxPattern string, numsSet *NumbersSet) (*NumbersSet, error)
func ReadLookupsTwilio ¶
func ReadLookupsTwilio(dir, rxPattern string, numsSet *NumbersSet) (*NumbersSet, error)
func (*NumbersSet) AddLookup ¶
func (set *NumbersSet) AddLookup(lookup NumberLookup) error
func (*NumbersSet) AddNumber ¶
func (set *NumbersSet) AddNumber(num NumberInfo) error
func (*NumbersSet) Inflate ¶
func (set *NumbersSet) Inflate() error
type PhoneNumber ¶
type PhoneNumber struct {
Number *phonenumbers.PhoneNumber
}
func (*PhoneNumber) GetAreaCode ¶
func (num *PhoneNumber) GetAreaCode() int
func (*PhoneNumber) GetAreaCodeString ¶
func (num *PhoneNumber) GetAreaCodeString() string
func (*PhoneNumber) GetCountryCode ¶
func (num *PhoneNumber) GetCountryCode() int32
func (*PhoneNumber) GetNumberE164 ¶
func (num *PhoneNumber) GetNumberE164() string
func (*PhoneNumber) GetNumberE164Uint ¶
func (num *PhoneNumber) GetNumberE164Uint() uint
func (*PhoneNumber) GetRegionCode ¶
func (num *PhoneNumber) GetRegionCode() string
func (*PhoneNumber) Meta ¶
func (num *PhoneNumber) Meta() Components
type ToFromNumbersSet ¶
type ToFromNumbersSet struct { To NumbersSet From NumbersSet }
func NewToFromNumbersSet ¶
func NewToFromNumbersSet() ToFromNumbersSet
func (*ToFromNumbersSet) AddNumber ¶
func (tfns *ToFromNumbersSet) AddNumber(ni NumberInfo, direction Direction) error
type ToFromNumbersSets ¶
type ToFromNumbersSets struct { All ToFromNumbersSet AreaCodesMap map[string]ToFromNumbersSet }
func NewToFromNumbersSets ¶
func NewToFromNumbersSets() ToFromNumbersSets
func (*ToFromNumbersSets) AddNumber ¶
func (tfSets *ToFromNumbersSets) AddNumber(num NumberInfo, direction Direction, addAreaCode bool) error
func (*ToFromNumbersSets) Stats ¶
func (tfSets *ToFromNumbersSets) Stats() (ToFromNumbersSetsStats, error)
Click to show internal directories.
Click to hide internal directories.