{"_id":"bestroutetb","_rev":"26-1cfaac51d5281ffe27794be79fee95b5","name":"bestroutetb","description":"Generating the most optimized route table for VPN users.","dist-tags":{"latest":"0.3.0"},"versions":{"0.1.3":{"name":"bestroutetb","author":{"name":"Xiaoyi Shi","email":"ashi009@gmail.com"},"version":"0.1.3","description":"Generating the most optimized route table for VPN users.","main":"index.js","dependencies":{"apollojs":"^1.3.0","async":"^0.9.0","chalk":"^0.5.1","ftp":"^0.3.7","progress":"^1.1.8","yargs":"git+https://github.com/ashi009/yargs"},"engines":{"node":">=0.8"},"repository":{"type":"git","url":"https://github.com/ashi009/bestroutetb.git"},"bin":{"bestroutetb":"./cli.js"},"keywords":["route table","optimize"],"license":"MIT","gitHead":"28de0f1ad7501f73697d073e92af7dd243979789","bugs":{"url":"https://github.com/ashi009/bestroutetb/issues"},"homepage":"https://github.com/ashi009/bestroutetb","_id":"bestroutetb@0.1.3","scripts":{},"_shasum":"5b95852af1aefa67de943ad2c67d6e12c2c1a492","_from":".","_npmVersion":"2.1.8","_nodeVersion":"0.10.32","_npmUser":{"name":"ashi009","email":"ashi009@gmail.com"},"maintainers":[{"name":"ashi009","email":"ashi009@gmail.com"}],"dist":{"shasum":"5b95852af1aefa67de943ad2c67d6e12c2c1a492","tarball":"https://registry.npmjs.org/bestroutetb/-/bestroutetb-0.1.3.tgz","integrity":"sha512-jTifaP7bLmGU+ao1daztH5Gn48wB0upHhvlPMjAcKnnjc4PSsfd9Xrji73buBe+dA9/7sd1yYUWzfcEDL3wIPg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIC99IT0DMhy/aLczeNvwzSv3cbnXBxp2i3BlqfIHzvY8AiEAq77RcI122L+Knz9plJkwRLczc+gCqCjyyEYJ87q6XkY="}]}},"0.1.4":{"name":"bestroutetb","author":{"name":"Xiaoyi Shi","email":"ashi009@gmail.com"},"version":"0.1.4","description":"Generating the most optimized route table for VPN users.","main":"index.js","dependencies":{"apollojs":"^1.3.0","async":"^0.9.0","chalk":"^0.5.1","ftp":"^0.3.7","progress":"^1.1.8","yargs":"git+https://github.com/ashi009/yargs"},"engines":{"node":">=0.8"},"repository":{"type":"git","url":"https://github.com/ashi009/bestroutetb.git"},"bin":{"bestroutetb":"./cli.js"},"keywords":["route table","optimize"],"license":"MIT","gitHead":"86f9499e70f97c8fc7a248de98519b9a35431beb","bugs":{"url":"https://github.com/ashi009/bestroutetb/issues"},"homepage":"https://github.com/ashi009/bestroutetb","_id":"bestroutetb@0.1.4","scripts":{},"_shasum":"1d2f5e086704114238d1ff4a54bbc08fcf854e85","_from":".","_npmVersion":"2.1.8","_nodeVersion":"0.10.32","_npmUser":{"name":"ashi009","email":"ashi009@gmail.com"},"maintainers":[{"name":"ashi009","email":"ashi009@gmail.com"}],"dist":{"shasum":"1d2f5e086704114238d1ff4a54bbc08fcf854e85","tarball":"https://registry.npmjs.org/bestroutetb/-/bestroutetb-0.1.4.tgz","integrity":"sha512-zmqKyhwXHCSJSP32fTa6lFJr5pUOk/87to/1zD2yqu3vMzA5kdBbs7168YR8fzBRAEC6qEr0z9ulV4zGP6GPCg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHsGWycAOR9ZDb/pVnOFc5OhY03W/GB97P03epP119VZAiEA/cvgoBRouKh03pWVViN81/lMhUXK6EwnsNeeLRihlUc="}]}},"0.1.5":{"name":"bestroutetb","author":{"name":"Xiaoyi Shi","email":"ashi009@gmail.com"},"version":"0.1.5","description":"Generating the most optimized route table for VPN users.","main":"index.js","dependencies":{"apollojs":"^1.3.0","async":"^0.9.0","chalk":"^0.5.1","ftp":"^0.3.7","progress":"^1.1.8","yargs":"git+https://github.com/ashi009/yargs"},"engines":{"node":">=0.8"},"repository":{"type":"git","url":"https://github.com/ashi009/bestroutetb.git"},"bin":{"bestroutetb":"./cli.js"},"keywords":["route table","optimize"],"license":"MIT","gitHead":"9bd4c8638bcb5cc0c1907e1636634365a9ee272e","bugs":{"url":"https://github.com/ashi009/bestroutetb/issues"},"homepage":"https://github.com/ashi009/bestroutetb","_id":"bestroutetb@0.1.5","scripts":{},"_shasum":"ea4675e2b9adae7586e6c68efde90b512c397f93","_from":".","_npmVersion":"2.1.9","_nodeVersion":"0.10.33","_npmUser":{"name":"ashi009","email":"ashi009@gmail.com"},"maintainers":[{"name":"ashi009","email":"ashi009@gmail.com"}],"dist":{"shasum":"ea4675e2b9adae7586e6c68efde90b512c397f93","tarball":"https://registry.npmjs.org/bestroutetb/-/bestroutetb-0.1.5.tgz","integrity":"sha512-UiD/yGQ8YoPK6u+VjFw1pZ9aic/t2hqX9igGLINn0KW75BqcatdIo5q1EwiJMDDT8BCDehB43ODb/1HY5lvzUQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCxYZqXayQdUnxJ65pDQ5eqz4TiTcpMxF7hL4t4eFe00AIgIV7vrChSJJ859AEbXsNPIlnXli1JFOzmS3U0HirvAjw="}]}},"0.1.6":{"name":"bestroutetb","author":{"name":"Xiaoyi Shi","email":"ashi009@gmail.com"},"version":"0.1.6","description":"Generating the most optimized route table for VPN users.","main":"index.js","dependencies":{"apollojs":"^1.3.0","async":"^0.9.0","chalk":"^0.5.1","ftp":"^0.3.7","progress":"^1.1.8","yargs":"git+https://github.com/ashi009/yargs"},"engines":{"node":">=0.8"},"repository":{"type":"git","url":"https://github.com/ashi009/bestroutetb.git"},"bin":{"bestroutetb":"./cli.js"},"keywords":["route table","optimize"],"license":"MIT","gitHead":"36993e1e27cb1149adbd9e3b888f3b06ab11db13","bugs":{"url":"https://github.com/ashi009/bestroutetb/issues"},"homepage":"https://github.com/ashi009/bestroutetb","_id":"bestroutetb@0.1.6","scripts":{},"_shasum":"b6a0df9c5b2bcbd158b2c83d63ca8f291485918a","_from":".","_npmVersion":"2.1.9","_nodeVersion":"0.10.33","_npmUser":{"name":"ashi009","email":"ashi009@gmail.com"},"maintainers":[{"name":"ashi009","email":"ashi009@gmail.com"}],"dist":{"shasum":"b6a0df9c5b2bcbd158b2c83d63ca8f291485918a","tarball":"https://registry.npmjs.org/bestroutetb/-/bestroutetb-0.1.6.tgz","integrity":"sha512-geUzBtfKyq8FsOLwFY5wLtNdvNeBYN+mvztNOsDzgjYg6PlnaRjrOqE3K8tjS9y4LjFFnauMxM7tdYB2xzj8/w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDUBp/gw1Ma6wjzvxm2nKFRo8sxoNYGHpgmNcUrjf14EgIhAOp3ZyquWedkUVdHnGfTRCLwpXsz79knB4gXBuhEM7ir"}]}},"0.2.0":{"name":"bestroutetb","author":{"name":"Xiaoyi Shi","email":"ashi009@gmail.com"},"version":"0.2.0","description":"Generating the most optimized route table for VPN users.","main":"index.js","dependencies":{"apollojs":"^1.3.0","async":"^0.9.0","chalk":"^0.5.1","ftp":"^0.3.7","progress":"^1.1.8","yargs":"git+https://github.com/ashi009/yargs"},"engines":{"node":">=0.8"},"repository":{"type":"git","url":"https://github.com/ashi009/bestroutetb.git"},"bin":{"bestroutetb":"./cli.js"},"keywords":["route table","optimize"],"license":"MIT","gitHead":"ef443d85454f5f288a2682b370dea01e83598503","bugs":{"url":"https://github.com/ashi009/bestroutetb/issues"},"homepage":"https://github.com/ashi009/bestroutetb","_id":"bestroutetb@0.2.0","scripts":{},"_shasum":"11c6691160f28c08ab5d738e786f18f9119b50fb","_from":".","_npmVersion":"2.1.9","_nodeVersion":"0.10.33","_npmUser":{"name":"ashi009","email":"ashi009@gmail.com"},"maintainers":[{"name":"ashi009","email":"ashi009@gmail.com"}],"dist":{"shasum":"11c6691160f28c08ab5d738e786f18f9119b50fb","tarball":"https://registry.npmjs.org/bestroutetb/-/bestroutetb-0.2.0.tgz","integrity":"sha512-ZR6ETKb4RcO9IYzj6iqYIc4JTaY06YKlZjgBGSyHSOyRJq+2AI7iF6iEDw5w9zgDQPF3WkIWj9rCkRynNAchcg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHef4lG4d4gEe7cf5xjYWJn6CnBRf81Q/yo0T7kDdL2DAiEAm7OsIrCIWGhkRp6qO+hsqWR7KzMnkDNHxjwwa+bdqSk="}]}},"0.2.1":{"name":"bestroutetb","author":{"name":"Xiaoyi Shi","email":"ashi009@gmail.com"},"version":"0.2.1","description":"Generating the most optimized route table for VPN users.","main":"index.js","dependencies":{"apollojs":"^1.3.0","async":"^0.9.0","chalk":"^1.0.0","ftp":"^0.3.7","progress":"^1.1.8","yargs":"git+https://github.com/ashi009/yargs"},"engines":{"node":">=0.8"},"repository":{"type":"git","url":"https://github.com/ashi009/bestroutetb.git"},"bin":{"bestroutetb":"./cli.js"},"keywords":["route table","optimize"],"license":"MIT","gitHead":"7af52667b33979296760eeb488e8fecee378e98a","bugs":{"url":"https://github.com/ashi009/bestroutetb/issues"},"homepage":"https://github.com/ashi009/bestroutetb","_id":"bestroutetb@0.2.1","scripts":{},"_shasum":"73f08e196bbca3107b709807cf6efb4324504012","_from":".","_npmVersion":"2.7.5","_nodeVersion":"0.12.2","_npmUser":{"name":"ashi009","email":"ashi009@gmail.com"},"maintainers":[{"name":"ashi009","email":"ashi009@gmail.com"}],"dist":{"shasum":"73f08e196bbca3107b709807cf6efb4324504012","tarball":"https://registry.npmjs.org/bestroutetb/-/bestroutetb-0.2.1.tgz","integrity":"sha512-zeapf4WR3lNEp2d2T/OudiAZUvdd1ot9WajIib733dDeQdfqTRDA6EQdt7QAOTbGwfCCWjEk0fTmwR2eudwWSw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDmW0txzK03f/8woVtJ6tvOxrJpViiT5bW8sedbxwwkiwIhAI/QVYmlBaLh3UILxyANjcu+MQ7AY87TyQae1w8a4q0U"}]}},"0.3.0":{"name":"bestroutetb","author":{"name":"Xiaoyi Shi","email":"ashi009@gmail.com"},"version":"0.3.0","description":"Generating the most optimized route table for VPN users.","main":"index.js","dependencies":{"apollojs":"^1.3.0","async":"^1.3.0","chalk":"^1.0.0","ftp":"^0.3.7","progress":"^1.1.8","yargs":"^3.29.0"},"engines":{"node":">=0.8"},"repository":{"type":"git","url":"git+https://github.com/ashi009/bestroutetb.git"},"bin":{"bestroutetb":"./cli.js"},"keywords":["route table","optimize"],"license":"MIT","gitHead":"3e3e05dad6a120b75de6afe70ff46831f020f10d","bugs":{"url":"https://github.com/ashi009/bestroutetb/issues"},"homepage":"https://github.com/ashi009/bestroutetb#readme","_id":"bestroutetb@0.3.0","scripts":{},"_shasum":"17ae63aa72489bbb3525863c15be45b4c7bf2c38","_from":".","_npmVersion":"2.14.7","_nodeVersion":"4.2.1","_npmUser":{"name":"ashi009","email":"ashi009@gmail.com"},"maintainers":[{"name":"ashi009","email":"ashi009@gmail.com"}],"dist":{"shasum":"17ae63aa72489bbb3525863c15be45b4c7bf2c38","tarball":"https://registry.npmjs.org/bestroutetb/-/bestroutetb-0.3.0.tgz","integrity":"sha512-czyLCIW6aNXVg2ovIwq8hqq2JZfKYEJJXYuZ335hhoNQ1OnQKkkosOqJrvtBmq+DRn/sbUIY/jzg/xIXCHoaiA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGVIOZL3p1H0cpMKk3WWdM0s+mUQQLRceQ3yOQr2fDiIAiBp03ugr/sKrHg6ByJKkjsTaTHQMncnirTbVEkSP3brdQ=="}]}}},"readme":"# Best Route Table [![NPM version](https://badge.fury.io/js/bestroutetb.svg)](http://badge.fury.io/js/bestroutetb) [![Dependency](https://david-dm.org/ashi009/bestroutetb.svg)](https://david-dm.org/ashi009/bestroutetb)\n\nInspired by [chnroutes][chnroutes].\n\nThis project aimed to generate the smallest route table,\nwhile preserves the minimalist requirements that IPs of\nspecified countries or subnets will be routed to a\nspecified gateway (default or VPN).\n\nGenerally speaking, the generated route table is at least\n70% smaller than chnroutes's.\n\n\n## Objective\n\nI started this project as a result of the huge route table\ngenerated by *chnroutes* didn't fit into my router.\n\nThe route table took almost 4 minutes to load up, and it cannot be\nput into OpenVPN's configuration file, due to my service\nprovider pushed `ping-reset 60` to the client, reseted\nOpenVPN before route table being loaded up.\n\nTherefore I decided to minimize the route table.\n\n\n## How efficient it is?\n\nFor an example, a route table that route all IPs in China to\ndefault gateway, and US, GB, Japan, Hong kong administered\nIPs to VPN gateway, only need 1546 routing directives,\nwhile *chnroutes* needs 4953 routing directives (based on 11/21/2014 data).\n\nWhich is almost **70% smaller**. And if route US address to VPN only,\nthe route table has only **105 directives**, which is about only\n2% of original size.\n\nOn Linux system, which usese [TRASH][trash] structure to store\nroute table, a route lookup operation expected to access\nmemory O(loglog _n_) times. Using *bestroutetb* instead of *chnroutes*,\nwill reduce route table look up at least 0.01 times expectedly.\nHowever, this solution does reduce the route table size for 70% by\nassuming TRASH structure is implemented with a small overhead\nhash implementation.  It is therefore that a perfect approach for those\nrouters with low free memory.\n\n\n## How it works\n\nUnlike *chnroutes* which will generate a route table that\nroute all subnets of China to ISP gateway, while other route to VPN gateway.\nThis project divides IPs in three groups. First group is guaranteed\nto be routed to default gateway, Second group is guaranteed to be\nrouted to VPN gateway. And the last group will be dynamically assigned\nto one of the gateways, in a manner that will generate\nthe smallest route table.\n\nTo achieve this goal, this project using dynamic programming\nalgorithm to find the most optimized route table.\n\nWe can prove that, the generated route table is the smallest\none based on the given restrictions.\n\n[For further detail][blog].\n\n\n## How to use\n\n### Install\n\nThis project requires [node.js][nodejs] to run.\n\nIf you are using OS X, install node.js with homebrew:\n\n    $ brew install nodejs\n\nFrom NPM for use as a command line app:\n\n    $ npm install -g bestroutetb\n\nFrom NPM for programmatic use:\n\n    $ npm install bestroutetb\n\nFrom Git:\n\n    $ git clone https://github.com/ashi009/bestroutetb.git\n    $ cd bestroutetb\n    $ npm link .\n\n### Usage\n\n    $ bestroutetb [options]\n\n### Options\n\n#### Route\n\n    --route.net=<spec>\n    --route.vpn=<spec>\n\nSubnets that should be routed to ISP or VPN gateway.\n\n**spec** should be a list of two-letter country initials (eg. US), subnet (eg.\n`8.0.0.0/8`), and host (eg. `123.123.123.123`), concatenated with comma (`,`).\n\n_NOTE:_ You could also use multiple `--route.*` arguments to construct the list.\n\n#### Output Profile\n\n    -p <profile>, --profile=<profile>\n\nBuilt-in profiles are `custom`, `iproute`, `json` and `openvpn`.\n\n#### Output\n\n    -o <path>, --output=<path>\n\nOutput file path.\n\n_NOTE:_ Some profiles may generate multiple files. In which case you need to\nspecify path to a directory (eg. `-o output/`), and you may also specify the\nprefix and the desired extension for the output file (eg. `-o output/ip-.sh`).\n\n    -f, --force\n\nForce to overwrite existing files.\n\n#### Report\n\n    -r <path>, --report=<path>\n\nGenerate a report in CSV format and save to given path. Here's an example:\n\nCountry | net | vpn\n--- | ---:| ---:\nAD | 0 | 33792\nAE | 512 | 3738752\nAF | 125952 | 3072\n\n#### Output format\n\n_NOTE:_ These formats applies when `--profile=custom`, or in case you want\nto override default settings in profile.\nAll strings will be outputted without adding new line (`\\n`).\nThus, it would be favorable for you to add them in the string.  For zsh, bash\nand some other shells, you could use `$'line\\n'` to include a escaped character.\n\n    --header=<string>\n    --footer=<string>\n\nHeader and Footer of the output file.\n\n    --rule-format=<string>\n\nString used to format a rule.\n\nYou may use `%prefix`, `%mask`, `%length` and `%gateway` or `%gw` in the string.\n\n- `%prefix` is the prefix of the subnet (eg. `14.0.0.0`).\n- `%mask` is the mask of the subnet (eg. `255.0.0.0`).\n- `%length` is the length of the mask (eg. `8`).\n- `%gateway` is the routing destination of the subnet (eg. `net` and `vpn`).\n- `%gw` is the customized destination (eg. `pppoe` and `tun0`), which is set with\n  `--gateway.net` and `--gateway.vpn`.\n\n<!-- -->\n\n    --gateway.net=<string>\n    --gateway.vpn=<string>\n\nDefine substitutes for `%gw` in rule format.\n\n    --[no-]default-gateway\n\nWhether to output directive for default route (`0.0.0.0/0`), which would be\noutputted by default.\n\n    --[no-]group-gateway\n\nWhether to group rules by gateway.\n\n    --group-header=<string>\n    --group-footer=<string>\n\nHeader and Footer of each group.\n\nYou may include `%name` in the string.\n\n- `%name` is the customized group name (eg. `wan` and `vpn`), which is set with\n  `--group-name.net` and `--group-name.vpn`.\n\n<!-- -->\n\n    --group-name.net=<string>\n    --group-name.vpn=<string>\n\nDefine substitutes for `%name` in group header and group footer.\n\n#### Update\n\n    --[no-]update\n\nForce update delegation data, or force to use stale data.\n\n#### Config\n\n    -c <path>, --config=<path>\n\nConfiguration file path.\n\n#### Logging\n\n    -v, --verbose\n\nVerbose output level. Use `-vvvv` for debug.\n\n    -s, --silent\n\nSilent mode, which will suppress any output.\n\n#### Help\n\n    -h, --help\n\nShow help.\n\n#### Version\n\n    -V, --version\n\nShow version number.\n\n### Examples\n\n    $ bestroutetb --route.vpn=us -p json -o routes.json\n\n[chnroutes]: https://github.com/fivesheep/chnroutes\n[wiki]: https://github.com/ashi009/bestroutetb/wiki/%E4%BD%BF%E7%94%A8%E8%AF%B4%E6%98%8E\n[trash]: http://www.nada.kth.se/~snilsson/publications/TRASH/trash.pdf\n[blog]: http://ashi009.tumblr.com/post/36581070478/vpn\n[nodejs]: http://nodejs.org\n[wget]: http://www.gnu.org/software/wget/\n","maintainers":[{"name":"ashi009","email":"ashi009@gmail.com"}],"time":{"modified":"2022-06-13T04:32:51.397Z","created":"2014-11-21T03:28:44.428Z","0.1.0":"2014-11-21T03:28:44.428Z","0.1.1":"2014-11-21T06:50:48.366Z","0.1.2":"2014-11-23T05:09:31.067Z","0.1.3":"2014-11-23T05:37:09.637Z","0.1.4":"2014-11-23T16:13:41.326Z","0.1.5":"2014-11-29T17:02:02.619Z","0.1.6":"2014-11-30T01:58:19.407Z","0.2.0":"2014-12-02T17:31:36.651Z","0.2.1":"2015-05-26T14:09:45.786Z","0.3.0":"2015-11-02T14:13:50.591Z"},"homepage":"https://github.com/ashi009/bestroutetb#readme","keywords":["route table","optimize"],"repository":{"type":"git","url":"git+https://github.com/ashi009/bestroutetb.git"},"author":{"name":"Xiaoyi Shi","email":"ashi009@gmail.com"},"bugs":{"url":"https://github.com/ashi009/bestroutetb/issues"},"license":"MIT","readmeFilename":"README.md"}