{"id":25301683,"url":"https://github.com/wenerme/telattr","last_synced_at":"2025-04-07T01:28:07.570Z","repository":{"id":57573999,"uuid":"104052988","full_name":"wenerme/telattr","owner":"wenerme","description":"Telephone Attribution - 电话归属地","archived":false,"fork":false,"pushed_at":"2020-11-14T14:52:55.000Z","size":1791,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-01T12:05:33.684Z","etag":null,"topics":["golang","protocol-buffer","protocol-buffers","telephone-attribution"],"latest_commit_sha":null,"homepage":"https://apis.wener.me/phone/attribution","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wenerme.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-09-19T09:11:18.000Z","updated_at":"2021-08-24T07:54:07.000Z","dependencies_parsed_at":"2022-09-26T19:01:39.633Z","dependency_job_id":null,"html_url":"https://github.com/wenerme/telattr","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wenerme%2Ftelattr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wenerme%2Ftelattr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wenerme%2Ftelattr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wenerme%2Ftelattr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wenerme","download_url":"https://codeload.github.com/wenerme/telattr/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247576748,"owners_count":20961023,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["golang","protocol-buffer","protocol-buffers","telephone-attribution"],"created_at":"2025-02-13T06:48:25.832Z","updated_at":"2025-04-07T01:28:07.549Z","avatar_url":"https://github.com/wenerme.png","language":"Go","readme":"\u003e Moved to https://github.com/wenerme/tools#teleattr\n\n[English](#telattr) | [中文](#电话归属地)\n--------|-----\n\n# telattr\nTelephone Attribution\n\n* Data source [xluohome/phonedata](https://github.com/xluohome/phonedata)\n* Converted to protobuf\n    * can use in web\n    * no need to parse\n* Use bind data, so, no need to keep the dat file\n    * Use optimized pb data.\n* Pre-generated protodata, csv\n    * [Releases](https://github.com/wenerme/telattr/releases)\n* Optimized index, remove continue prefix with same record index.\n    * Original phone.dat 3.2M\n    * PB phone.pb 3.8M\n    * PB optimized phone-opt.pb 1.9M\n* Useful command line tool\n\n# 电话归属地\n* 数据源 [xluohome/phonedata](https://github.com/xluohome/phonedata)\n* 转换为 protobuf 格式\n    * 可在网页中使用\n    * 不需要手动解析\n* 使用绑定数据, 不需要保留原始文件\n    * 使用优化有的 protobuf 数据\n* 预生成的 protobuf 数据和 csv\n    * [Releases](https://github.com/wenerme/telattr/releases)\n* 索引优化, 移除有相同记录索引的连续前缀\n    * 原始数据 phone.dat 3.2M\n    * Protobuf phone.pb 3.8M\n    * 优化后的 Protobuf phone-opt.pb 1.9M\n* 非常好用的命令行工具\n\n## CLI\n```bash\ngo get -u github.com/wenerme/telattr/cmd/telattr\n```\n\n```bash\n# Query\ntelattr a 1852159 15807212 15208231563\n```\n \n```\nnumber:1852159\nvendor:中国联通\nprovince:上海\ncity:上海\nzone:021\nzip:200000\nmin:1852100\nmax:1852199\n\nnumber:15807212\nvendor:中国移动\nprovince:湖北\ncity:荆州\nzone:0716\nzip:434000\nmin:1580721\nmax:1580721\n\nnumber:15208231563\nvendor:中国移动\nprovince:四川\ncity:成都\nzone:028\nzip:610000\nmin:1520810\nmax:1520849\n```\n\n```bash\n# Conversion\n# Convert raw data to pb with optimize\ntelattr conv -f data phone.dat -t pb test.pb -o\n# Conver pb to csv\n# Output csv idx-test.csv, rec-test.csv\ntelattr conv -f pb phone.pb -t pb test.csv -o\n```\n\n## Demo\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/wenerme/telattr\"\n\t_ \"github.com/wenerme/telattr/data_proto\"\n)\n\nfunc main() {\n\trec, err := telattr.Find(\"18957509123\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Printf(\"%#v\\n\", rec)\n}\n```\n\n```\n\u0026telattr.Record{Version:\"1707\", Province:\"浙江\", City:\"绍兴\", Zip:\"312000\", Zone:\"0575\", VendorName:\"中国电信\", MinPrefix:1895750, MaxPrefix:1895759}\n```\n\n\n## Performance\n\nA little bit faster than [xluohome/phonedata](https://github.com/xluohome/phonedata)\n\n```\ngoos: darwin\ngoarch: amd64\npkg: github.com/xluohome/phonedata\nBenchmarkFindPhone-8    10000000               181 ns/op\n\ngoos: darwin\ngoarch: amd64\npkg: github.com/wenerme/telattr\nBenchmarkFindPhone-8    10000000               136 ns/op\n```\n\n## Dev\n```bash\n# Generate proto data\ngo-bindata -pkg data_proto -o data_proto/bindata.go phone.pb\n# Generate pb\nprotoc --go_out=plugins=grpc,import_path=telattr:$HOME/go/src/ *.proto\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwenerme%2Ftelattr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwenerme%2Ftelattr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwenerme%2Ftelattr/lists"}