forked from ttacon/libphonenumber
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial commit, a bunch of stuff, a lot is garbage and needs cleaning…
… up, but it works, need to migrate tests next - and then the big clean up starts
- Loading branch information
0 parents
commit a3c394f
Showing
11 changed files
with
16,899 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package libphonenumber | ||
|
||
var AlternateCountyCodeSet = map[int]struct{}{ | ||
7: struct{}{}, | ||
27: struct{}{}, | ||
30: struct{}{}, | ||
31: struct{}{}, | ||
34: struct{}{}, | ||
36: struct{}{}, | ||
43: struct{}{}, | ||
44: struct{}{}, | ||
49: struct{}{}, | ||
55: struct{}{}, | ||
58: struct{}{}, | ||
61: struct{}{}, | ||
62: struct{}{}, | ||
63: struct{}{}, | ||
66: struct{}{}, | ||
81: struct{}{}, | ||
84: struct{}{}, | ||
90: struct{}{}, | ||
94: struct{}{}, | ||
95: struct{}{}, | ||
255: struct{}{}, | ||
350: struct{}{}, | ||
351: struct{}{}, | ||
352: struct{}{}, | ||
358: struct{}{}, | ||
359: struct{}{}, | ||
372: struct{}{}, | ||
373: struct{}{}, | ||
380: struct{}{}, | ||
381: struct{}{}, | ||
385: struct{}{}, | ||
505: struct{}{}, | ||
506: struct{}{}, | ||
595: struct{}{}, | ||
675: struct{}{}, | ||
679: struct{}{}, | ||
855: struct{}{}, | ||
971: struct{}{}, | ||
972: struct{}{}, | ||
995: struct{}{}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package libphonenumber | ||
|
||
// TODO(ttacon): ✔ (do it) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,225 @@ | ||
package libphonenumber | ||
|
||
// TODO(ttacon): do we need to worry about load factor? | ||
|
||
var CountryCodeToRegion = map[int][]string{ | ||
1: []string{ | ||
"US", "AG", "AI", "AS", "BB", "BM", "BS", "CA", "DM", "DO", | ||
"GD", "GU", "JM", "KN", "KY", "LC", "MP", "MS", "PR", "SX", | ||
"TC", "TT", "VC", "VG", "VI", | ||
}, | ||
7: []string{"RU", "KZ"}, | ||
20: []string{"EG"}, | ||
27: []string{"ZA"}, | ||
30: []string{"GR"}, | ||
31: []string{"NL"}, | ||
32: []string{"BE"}, | ||
33: []string{"FR"}, | ||
34: []string{"ES"}, | ||
36: []string{"HU"}, | ||
39: []string{"IT"}, | ||
40: []string{"RO"}, | ||
41: []string{"CH"}, | ||
43: []string{"AT"}, | ||
44: []string{"GB", "GG", "IM", "JE"}, | ||
45: []string{"DK"}, | ||
46: []string{"SE"}, | ||
47: []string{"NO", "SJ"}, | ||
48: []string{"PL"}, | ||
49: []string{"DE"}, | ||
51: []string{"PE"}, | ||
52: []string{"MX"}, | ||
53: []string{"CU"}, | ||
54: []string{"AR"}, | ||
55: []string{"BR"}, | ||
56: []string{"CL"}, | ||
57: []string{"CO"}, | ||
58: []string{"VE"}, | ||
60: []string{"MY"}, | ||
61: []string{"AU", "CC", "CX"}, | ||
62: []string{"ID"}, | ||
63: []string{"PH"}, | ||
64: []string{"NZ"}, | ||
65: []string{"SG"}, | ||
66: []string{"TH"}, | ||
81: []string{"JP"}, | ||
82: []string{"KR"}, | ||
84: []string{"VN"}, | ||
86: []string{"CN"}, | ||
90: []string{"TR"}, | ||
91: []string{"IN"}, | ||
92: []string{"PK"}, | ||
93: []string{"AF"}, | ||
94: []string{"LK"}, | ||
95: []string{"MM"}, | ||
98: []string{"IR"}, | ||
211: []string{"SS"}, | ||
212: []string{"MA", "EH"}, | ||
213: []string{"DZ"}, | ||
216: []string{"TN"}, | ||
218: []string{"LY"}, | ||
220: []string{"GM"}, | ||
221: []string{"SN"}, | ||
222: []string{"MR"}, | ||
223: []string{"ML"}, | ||
224: []string{"GN"}, | ||
225: []string{"CI"}, | ||
226: []string{"BF"}, | ||
227: []string{"NE"}, | ||
228: []string{"TG"}, | ||
229: []string{"BJ"}, | ||
230: []string{"MU"}, | ||
231: []string{"LR"}, | ||
232: []string{"SL"}, | ||
233: []string{"GH"}, | ||
234: []string{"NG"}, | ||
235: []string{"TD"}, | ||
236: []string{"CF"}, | ||
237: []string{"CM"}, | ||
238: []string{"CV"}, | ||
239: []string{"ST"}, | ||
240: []string{"GQ"}, | ||
241: []string{"GA"}, | ||
242: []string{"CG"}, | ||
243: []string{"CD"}, | ||
244: []string{"AO"}, | ||
245: []string{"GW"}, | ||
246: []string{"IO"}, | ||
247: []string{"AC"}, | ||
248: []string{"SC"}, | ||
249: []string{"SD"}, | ||
250: []string{"RW"}, | ||
251: []string{"ET"}, | ||
252: []string{"SO"}, | ||
253: []string{"DJ"}, | ||
254: []string{"KE"}, | ||
255: []string{"TZ"}, | ||
256: []string{"UG"}, | ||
257: []string{"BI"}, | ||
258: []string{"MZ"}, | ||
260: []string{"ZM"}, | ||
261: []string{"MG"}, | ||
262: []string{"RE", "YT"}, | ||
263: []string{"ZW"}, | ||
264: []string{"NA"}, | ||
265: []string{"MW"}, | ||
266: []string{"LS"}, | ||
267: []string{"BW"}, | ||
268: []string{"SZ"}, | ||
269: []string{"KM"}, | ||
290: []string{"SH", "TA"}, | ||
291: []string{"ER"}, | ||
297: []string{"AW"}, | ||
298: []string{"FO"}, | ||
299: []string{"GL"}, | ||
350: []string{"GI"}, | ||
351: []string{"PT"}, | ||
352: []string{"LU"}, | ||
353: []string{"IE"}, | ||
354: []string{"IS"}, | ||
355: []string{"AL"}, | ||
356: []string{"MT"}, | ||
357: []string{"CY"}, | ||
358: []string{"FI", "AX"}, | ||
359: []string{"BG"}, | ||
370: []string{"LT"}, | ||
371: []string{"LV"}, | ||
372: []string{"EE"}, | ||
373: []string{"MD"}, | ||
374: []string{"AM"}, | ||
375: []string{"BY"}, | ||
376: []string{"AD"}, | ||
377: []string{"MC"}, | ||
378: []string{"SM"}, | ||
379: []string{"VA"}, | ||
380: []string{"UA"}, | ||
381: []string{"RS"}, | ||
382: []string{"ME"}, | ||
385: []string{"HR"}, | ||
386: []string{"SI"}, | ||
387: []string{"BA"}, | ||
389: []string{"MK"}, | ||
420: []string{"CZ"}, | ||
421: []string{"SK"}, | ||
423: []string{"LI"}, | ||
500: []string{"FK"}, | ||
501: []string{"BZ"}, | ||
502: []string{"GT"}, | ||
503: []string{"SV"}, | ||
504: []string{"HN"}, | ||
505: []string{"NI"}, | ||
506: []string{"CR"}, | ||
507: []string{"PA"}, | ||
508: []string{"PM"}, | ||
509: []string{"HT"}, | ||
590: []string{"GP", "BL", "MF"}, | ||
591: []string{"BO"}, | ||
592: []string{"GY"}, | ||
593: []string{"EC"}, | ||
594: []string{"GF"}, | ||
595: []string{"PY"}, | ||
596: []string{"MQ"}, | ||
597: []string{"SR"}, | ||
598: []string{"UY"}, | ||
599: []string{"CW", "BQ"}, | ||
670: []string{"TL"}, | ||
672: []string{"NF"}, | ||
673: []string{"BN"}, | ||
674: []string{"NR"}, | ||
675: []string{"PG"}, | ||
676: []string{"TO"}, | ||
677: []string{"SB"}, | ||
678: []string{"VU"}, | ||
679: []string{"FJ"}, | ||
680: []string{"PW"}, | ||
681: []string{"WF"}, | ||
682: []string{"CK"}, | ||
683: []string{"NU"}, | ||
685: []string{"WS"}, | ||
686: []string{"KI"}, | ||
687: []string{"NC"}, | ||
688: []string{"TV"}, | ||
689: []string{"PF"}, | ||
690: []string{"TK"}, | ||
691: []string{"FM"}, | ||
692: []string{"MH"}, | ||
800: []string{"001"}, | ||
808: []string{"001"}, | ||
850: []string{"KP"}, | ||
852: []string{"HK"}, | ||
853: []string{"MO"}, | ||
855: []string{"KH"}, | ||
856: []string{"LA"}, | ||
870: []string{"001"}, | ||
878: []string{"001"}, | ||
880: []string{"BD"}, | ||
881: []string{"001"}, | ||
882: []string{"001"}, | ||
883: []string{"001"}, | ||
886: []string{"TW"}, | ||
888: []string{"001"}, | ||
960: []string{"MV"}, | ||
961: []string{"LB"}, | ||
962: []string{"JO"}, | ||
963: []string{"SY"}, | ||
964: []string{"IQ"}, | ||
965: []string{"KW"}, | ||
966: []string{"SA"}, | ||
967: []string{"YE"}, | ||
968: []string{"OM"}, | ||
970: []string{"PS"}, | ||
971: []string{"AE"}, | ||
972: []string{"IL"}, | ||
973: []string{"BH"}, | ||
974: []string{"QA"}, | ||
975: []string{"BT"}, | ||
976: []string{"MN"}, | ||
977: []string{"NP"}, | ||
979: []string{"001"}, | ||
992: []string{"TJ"}, | ||
993: []string{"TM"}, | ||
994: []string{"AZ"}, | ||
995: []string{"GE"}, | ||
996: []string{"KG"}, | ||
998: []string{"UZ"}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package libphonenumber | ||
|
||
import ( | ||
"io" | ||
"os" | ||
) | ||
|
||
type MetadataLoader interface { | ||
LoadMetadata(filename string) io.ReadCloser | ||
} | ||
|
||
type metaLoader struct{} | ||
|
||
func (m metaLoader) LoadMetadata(filename string) io.ReadCloser { | ||
f, err := os.Open(filename) | ||
if err != nil { | ||
return nil | ||
} | ||
return f | ||
} | ||
|
||
var DEFAULT_METADATA_LOADER = metaLoader{} |
Oops, something went wrong.