Giter Club home page Giter Club logo

sing-box-installer's Introduction

sing-box-installer

https://github.com/RayWangQvQ/sing-box-installer

基于sing-boxdocker容器化搭建vmessnaiveproxyhysteria2的保姆级教程。

1. 大概介绍下

1.1. 关于sing-box

开源地址:https://github.com/SagerNet/sing-box

sing-box是一个开源的通用代理部署平台,支持大部分协议,有了它,我可以使用同一套配置规则,部署多个不同的协议。

1.2. 关于naiveproxy

开源地址:

naiveproxy据说是当前最安全的协议之一,了解到它还是去年(2022年)10月份那次大规模封禁,据说除了naiveproxy幸免,其他协议均有死伤(包括trojanXrayV2Ray TLS+WebsocketVLESSgRPC),详细可查看issue:net4people/bbs#129

naiveproxy-bbs-survivor.png

它在服务端它使用自己优化过Caddyforwardproxy),利用反代,将没有认证的流量转到一个正常的站点(伪装站点)。也就是,你用你的proxy客户端去访问,认证(用户名+密码)能通过,它就给你做代理;你不用客户端用正常浏览器(或用户名密码错误),只要认证不通过,它就给你反代到正常站点,瞒天过海。

关于TLS指纹问题的讨论,可以看下这个issus:v2ray/v2ray-core#2098

在issue里顺便也了解到,naiveproxy的作者原来也是trojan最初的几个作者之一,后来trojan有些设计上的争议,包括一些优化的想法,由于主程没时间,无法得到实施,于是naiveproxy的作者就自己开了个项目来实现这些想法,这个项目就是现在的naiveproxy

1.3. 关于hysteria

开源地址:https://github.com/apernet/hysteria

hysteria的优势是快,同一台机器,我的测试结果是,比我之前的xray快了2到3倍(网上有人测出快了10倍)。

它是基于quic协议,走udp,跟它名字一样(歇斯底里),并发去请求扔包,所以快。

已知问题是qos,来自服务商的限制,当请求流量过大时,会被限速、断流。以前看有图比是嫌清晰度不够,用了hysteria可能要反过来主动去自己调低清晰度了。

关于安全性,目前墙对UDP的管控技术还没有TCP那么成熟,所以相对来说算比较安全。

1.4. 关于sing-box的配置

文档:https://sing-box.sagernet.org/zh/configuration/

部署sing-box的关键,就是编写它的配置文件。

sing-box抽象出一套配置规则,有DNS,有路由(router),有入站(inbound)和出站(outbound)。

如果之前使用过v2ray,对这些概念很熟悉,那么你可以很轻松切换到sing-box

当前sing-box的文档还处于待完善阶段(也可能是故意不想写的太详细),只有对各配置字段的解释,并不会告诉你它是什么以及为什么要这么配。

2. 部署服务端

2.1. 思路

我个人推荐使用docker容器化部署,容器化有很多好处,这里就不多说了。

下面会基于sing-box的官方docker镜像,使用docker-compose进行容器构建。

官方镜像地址:https://github.com/orgs/SagerNet/packages?repo_name=sing-box

如果你的机器没有装过docker,请先安装docker,安装指令:

curl -sSL https://get.docker.com/ | sh
systemctl start docker
systemctl enable docker

然后基于docker容器run sing-box的官方镜像,我们只需要配置好配置文件config.json即可。

下面有两种模式:一键脚本部署和手动部署,任选其一即可。

2.2. 一键脚本部署

# create a dir
mkdir -p ./sing-box && cd ./sing-box

# install
bash <(curl -sSL https://raw.githubusercontent.com/RayWangQvQ/sing-box-installer/main/install.sh)

运行后会让输入参数:

  • 域名:需要自己DNS解析好到自己的服务器ip
  • 邮箱:用来申请证书的(会自动申请并更新)
  • proxy uuid: 自己设置,可以随便搜个网站生成
  • proxy用户名:自己设置
  • proxy密码:自己设置

2.3. 手动部署

教程

3. 客户端

3.1. 安卓-SagerNet

vmess

3.1.1. hysteria

sing-box-client-sagernet-hysteria.jpg

其中:

  • 混淆密码是配置中的obfs
  • 认证荷载是配置中的auth_str

3.1.2. naive

sing-box-client-sagernet-naive.jpg

其中,密码是配置中的password

3.2. IOS-小火箭

vmess

3.2.1. hysteria

shadowrocket-hy

3.2.2. naiveproxy

shadowrocket-naive

3.3. Win-Nekoray

nekoray

vmess

nekoray-vmess

3.3.1. hysteria

nekoray-hy

3.3.2. naive

nekeray-naive

3.4. Win-V2RayN

如果你没有必要的理由,请优先选择使用Nekoray。

vmess

3.4.1. hysteria

hysteria-v2rayn-add.png

配置文件内容如下:

{
  "server": "sample.zai7lou.ml:10080",
  "server_name": "sample.zai7lou.ml",
  "obfs": "nicetofuckyou",
  "auth_str": "1234@qwer",
  "alpn": "h2",
  "up_mbps": 100,
  "down_mbps": 100,
  "socks5": {
    "listen": "127.0.0.1:10808"
  },
  "http": {
    "listen": "127.0.0.1:10809"
  }
}

3.4.2. naive

naive-v2rayn-add.png

配置文件内容如下:

{
  "listen": "socks://127.0.0.1:10808",
  "proxy": "https://Ray:1234@[email protected]:8090"
}

3.5. Mac-Nekoray

同上,跟windows下的Nekoray一样。

4. FAQ

4.1. hy的端口hop

sing-box暂不支持,目前只能多加几个hy节点,然后在客户端做负载均衡。

sing-box-installer's People

Contributors

raywangqvq avatar

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.