Skip to content

shangxinbo/cardinal

Repository files navigation

cardinal

npm Travis Codecov branch

A shadowsocks client by nodejs, include socks proxy and http proxy

why another

@clowwindy was asked to delete all the shadowsocks code,and shadowsocks-R's cribbing, and lantern start charging a fee. Because of that, I made it.

model

model pic

dependent

achieve

  • jet

  • use GeoIp to pac file not use gfwlist

  • encrypt type filter by shadowsocks and node surport

    method size and length
    aes-128-ctr [16, 16]
    aes-192-ctr [24, 16]
    aes-192-ctr [24, 16]
    aes-256-ctr [32, 16]
    aes-128-cfb [16, 16]
    aes-192-cfb [24, 16]
    aes-256-cfb [32, 16]
    bf-cfb [16, 8]
    camellia-128-cfb [16, 16]
    camellia-192-cfb [24, 16]
    camellia-256-cfb [32, 16]
    cast5-cfb [16, 8]
    des-cfb [8, 8]
    idea-cfb [16, 8]
    rc2-cfb [16, 8]
    salsa20 [32, 8]
    seed-cfb [16, 16]

install

npm install -g cardinalis

CLI

Use cardinal to start in CLI

options

  • upip
  • sc

examples

default start

$ cardinal

start with update GeoIp-CN(IPs in china)

$ cardinal ip

configs

normal

  • config/GeoIP-CN ------ IPs in china
  • config/local.json ------ host and port config
    • host
    • proxyPortCeil ---- socks port min
    • httpPort
    • pacPort
    • allowDelay ---- optimal timeout
  • config/pac.js ------ pac file functions
  • config/server.json ------ shadowsocks server and password,types

spider rules

In spider/source.js, all shadowsocks server nodes item list.You can add/edit/delete them.cardinal use this to make tunnel.if you have a shadowsocks server,you can use sc start option.

  • url spider webpage url.
  • deXml DOM analyse function, param is a buffer,return a array/null.

example like this:

{
    url: 'https://freessr.xyz/',
    deXml: function (body) {
        try {
            let $ = cheerio.load(body);
            let list = $('.col-md-6.text-center');
            let arr = [];
            for (let i = 0; i < list.length - 1; i++) {
                if (ciphers[$(list[i]).find('h4').eq('3').html().split(':')[1]]) {
                    arr.push({
                        "host": $(list[i]).find('h4').eq('0').html().split(':')[1],
                        "port": $(list[i]).find('h4').eq('1').html().split(':')[1],
                        "password": $(list[i]).find('h4').eq('2').html().split(':')[1],
                        "method": $(list[i]).find('h4').eq('3').html().split(':')[1],
                        "remarks": "frss",
                        "auth": false
                    });
                }
            }
            return arr;
        } catch (e) {
            return null;
        }
    }
}

license

other