Git Product home page Git Product logo

s-ws's Introduction

Shadowsocks over WebSocket

Build Status License GitHub last commit

shadowsocks-ws 是基于 WebSocket 的 Shadowsocks,可以部署在 Heroku 等平台。

        socks5            tcp               websocket                tcp
client <------> ss-local <---> ss-ws-local <-- gfw --> ss-ws-remote <---> target
                encrypt                                decrypt

shadowsocks-ws 客户端只负责转发经过加密的流量,须配合 Shadowsocks for Windows 等现有 Shadowsocks 客户端使用。shadowsocks-ws 客户端和服务器端之间使用 WebSocket 协议进行通信。shadowsocks-ws 服务器对外表现为一个 Web 服务器,可以用浏览器访问。

环境要求

部署

Heroku

Deploy

Railway

Deploy on Railway

本地配置

克隆代码到本地,安装依赖:

$ git clone https://github.com/totravel/shadowsocks-ws.git
$ cd shadowsocks-ws
$ npm i

将配置文件 config.json.example 重命名为 config.json 并修改 remote_addresspasswordmethod 三个字段。

{
  "dns": "https://doh.pub/dns-query",
  "remote_address": "https://*.example.com/",
  "remote_port": 80,
  "local_address": "127.0.0.1",
  "local_port": 8787,
  "timeout": 5000,
  "password": "secret",
  "method": "aes-256-gcm"
}

dns 字段一般无须修改。下列取值供参考:

  • DNSPod https://doh.pub/dns-query
  • AliDNS https://dns.alidns.com/resolve
  • 360DNS https://doh.360.cn/query
  • Cloudflare https://cloudflare-dns.com/dns-query

执行脚本 start.sh 启动 shadowsocks-ws 客户端:

$ ./start.sh
ss://...
resolving ...
trying ...
server running on host ...
listening on port 8787

下文根据需要选择性阅读。

Shadowsocks for Windows

打开 Shadowsocks for Windows

  1. 系统托盘 > 上下文菜单
    1. 服务器 > 扫描屏幕上的二维码
    2. 系统代理 > PAC 模式

Clash for Windows

将配置文件 clash.yaml.example 重命名为 clash.yaml 并修改 cipherpassword 两个字段。

proxies:
  - name: "ss1"
    type: ss
    server: 127.0.0.1
    port: 8787
    cipher: aes-256-gcm
    password: "secret"

proxy-groups:
  - name: PROXY
    type: select
    proxies:
      - ss1

rules:
  - GEOIP,LAN,DIRECT
  - GEOIP,CN,DIRECT
  - MATCH,PROXY

打开 Clash for Windows

  1. 配置 > 导入上述配置文件
  2. 主页 > 打开「系统代理」开关
  3. 代理 > 规则

获取和使用规则集

执行脚本 ruleset.sh 下载 Clash 规则集

$ ./ruleset.sh
downloading reject.yaml...
downloading icloud.yaml...
downloading apple.yaml...
downloading google.yaml...
downloading proxy.yaml...
downloading direct.yaml...
downloading private.yaml...
downloading gfw.yaml...
downloading greatfire.yaml...
downloading tld-not-cn.yaml...
downloading telegramcidr.yaml...
downloading cncidr.yaml...
downloading lancidr.yaml...
downloading applications.yaml...

使用规则集的配置文件的模板为 blacklist.yaml.examplewhitelist.yaml.example

SagerNet for Android

将手机和电脑连接至同一网络,打开 SagerNet for Android

  1. 右上角 > 添加服务器配置 > 扫描二维码
  2. 修改服务器配置 > 将「服务器」字段由 127.0.0.1 修改为电脑的 IP 地址
  3. 右下角 > 连接

鸣谢

许可协议

MIT

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.