Documentation ¶
Index ¶
- Constants
- func GetAPNName(apn *APN) (name string)
- func GetAPNUsageType(apn *APN) (usageType string)
- func GetAllCountryCode() (codeList []string, err error)
- func GetDefaultProvider(countryCode string) (defaultProvider string, err error)
- func GetProviderNames(countryCode string) (names []string, err error)
- func MarshalPlan(plan Plan) (jsonStr string)
- type APN
- type APNPlan
- type BalanceCheck
- type BalanceTopUp
- type CDMA
- type Country
- type GSM
- type MobileServiceProviderDatabase
- type MsisdnQuery
- type Name
- type NetworkID
- type Plan
- func GetDefaultCDMAPlanForCountry(countryCode string) (defaultCDMAPlan Plan, err error)
- func GetDefaultGSMPlanForCountry(countryCode string) (defaultGSMPlan Plan, err error)
- func GetDefaultPlan(countryCode, providerName string) (defaultPlan Plan, err error)
- func GetPlans(countryCode, providerName string) (plans []Plan, err error)
- func UnmarshalPlan(jsonStr string) (plan *Plan, err error)
- type Provider
- type ProviderPrimaryValue
- type SID
- type SMS
- type USSD
- type Usage
Constants ¶
const ( PlanTypeValuePrepaid = "prepaid" PlanTypeValuePostpaid = "postpaid" )
const ( UsageTypeInternet = "internet" UsageTypeMMS = "mms" UsageTypeWAP = "wap" )
Variables ¶
This section is empty.
Functions ¶
func GetAPNName ¶
GetAPNName return apn's default name, if not exist, return empty string.
func GetAPNUsageType ¶
GetAPNUsageType return apn's usage type, if not exist, return empty string.
func GetAllCountryCode ¶
GetAllCountryCode return all country code that provide mobile service.
func GetDefaultProvider ¶
GetDefaultProvider return the default provider in target country, usually is the first provider.
func GetProviderNames ¶
GetProviderNames return all provider names in target country.
func MarshalPlan ¶
Types ¶
type APN ¶
type APN struct { Value string `xml:"value,attr"` Plan []*APNPlan `xml:"plan"` Usage *Usage `xml:"usage"` Name []*Name `xml:"name"` Gateway string `xml:"gateway"` Username string `xml:"username"` Password string `xml:"password"` DNS []string `xml:"dns"` MMSC string `xml:"mmsc"` MMSproxy string `xml:"mmsproxy"` }
type BalanceCheck ¶
type BalanceTopUp ¶
type CDMA ¶
type GSM ¶
type GSM struct { NetworkID []*NetworkID `xml:"network-id"` MsisdnQuery []*MsisdnQuery `xml:"msisdn-query"` Voicemail []string `xml:"voicemail"` BalanceCheck []*BalanceCheck `xml:"balance-check"` BalanceTopUp []*BalanceTopUp `xml:"balance-top-up"` APN []*APN `xml:"apn"` }
func GetGSM ¶
GetGSM return the gsm information that matched the provided country code and provider name.
func GetGSMForNetworkID ¶
GetGSMForNetworkID return the gsm information that match the mcc and mnc.
type MobileServiceProviderDatabase ¶
type MobileServiceProviderDatabase struct { Format string `xml:"format,attr"` Countries []*Country `xml:"country"` }
func GetMobileProviderDatabase ¶
func GetMobileProviderDatabase() (*MobileServiceProviderDatabase, error)
GetMobileProviderDatabase return mobile service provider's database that marshaled from serviceproviders.xml.
type MsisdnQuery ¶
type Plan ¶
type Plan struct { IsGSM bool Name string // apn names for gsm or provider name for cdma ProviderName string APNValue string APNUsageType string }
Plan defines the unique information for each plan(gsm or cdma) in provider.
func GetDefaultCDMAPlanForCountry ¶
GetDefaultCDMAPlanForCountry return default gsm plan in target country.
func GetDefaultGSMPlanForCountry ¶
GetDefaultGSMPlanForCountry return default gsm plan in target country.
func GetDefaultPlan ¶
GetDefaultPlan return default plan for taget provider, usually is the first plan.
func GetPlans ¶
GetPlans return all plans(apn names for gsm and provider name for cdma) under target provider.
func UnmarshalPlan ¶
type Provider ¶
type Provider struct { Primary ProviderPrimaryValue `xml:"primary,attr"` Name *Name `xml:"name"` GSM *GSM `xml:"gsm"` CDMA *CDMA `xml:"cdma"` }
func GetProvider ¶
GetProvider return the provider information that matched the provided country code and provider name.
func GetProviders ¶
GetProviders return all providers in target country.
type ProviderPrimaryValue ¶
type ProviderPrimaryValue string
const ( ProviderPrimaryValueTrue ProviderPrimaryValue = "true" ProviderPrimaryValueFalse ProviderPrimaryValue = "false" )