首页 map[addtime:<nil> column:0 data:{"status":0,"msg":"","data":{"data":{"banner":[{"image":"/assets/upload/2024/10/09/8321b9b943cd4f57fe891334012bebb1.png","t1":"感恩有你,未来可期","t2":"","t3":"/p/2802"}],"name1":"新闻资讯"}}} data2:<nil> description:16年IT服务经验-全国服务电话:400-017-5181 featured: id:1 illustrate:新闻资讯 keywords:同创双子公司新闻, 同创双子,同创双子怎么样,同创双子公司,成都同创双子,北京同创双子,同创双子最新新闻 name:新闻资讯 orders:1 state:true tag:<nil> templateslist:{ "controls": [ { "name": "data.name1", "label": "简单标题", "type": "input-text" }, { "type": "combo", "name": "data.banner", "label": "轮播", "multiple": true, "draggable": true, "items": [ { "name": "t1", "label": "标题", "type": "input-text" }, { "name": "t2", "label": "时间", "type": "input-text" }, { "name": "t3", "label": "连接", "type": "input-text" }, { "type": "input-image", "name": "image", "label": "配图", "receiver": "./api/upload?rich=2" } ] } ] } templatespage:{ "controls": [ { "label": "推荐等级", "type": "select", "name": "featured", "options": [ { "label": "不推荐", "value": 0 }, { "label": "首页推荐", "value": 1001 } ] }, { "type": "group", "body": [ { "name": "data.listimg", "label": "列表图片", "receiver": "./api/upload?rich=2", "type": "input-image" }, { "name": "data.img", "label": "首页图片", "receiver": "./api/upload?rich=2", "type": "input-image" } ] }, { "type": "input-rich-text", "name": "data.body", "label": "文章内容1", "receiver": "post:./api/upload?rich=1" } ] } title:新闻资讯-同创双子(北京)信息技术股份有限公司 tmpllist:list tmplpage:page url:news] > 新闻资讯 map[addtime:<nil> column:1 data:{"status":0,"msg":"","data":{"data":{"banner":[{"image":"/assets/upload/2023/12/13/3e1643bd17c60956f27ddf735eb3048d.png","t1":"桌面运维是什么?外包好还是自招好","t3":"https://www.itgemini.net/p/2613"},{"image":"/assets/upload/2023/12/13/d52a5f367538356cbcbfbbf727a5e0a7.png","t1":"什么是系统集成?同创双子可以做哪些系统集成服务","t3":"https://www.itgemini.net/p/2611"}],"name1":"干货分享"}}} data2:<nil> description:16年IT服务经验-全国服务电话:400-017-5181 featured: id:3 illustrate:干货分享 keywords:同创双子公司新闻, 同创双,同创双子公司,成都同创双子,北京同创双子,同创双子最新新闻,电脑卡顿,电脑故障,网络故障 name:干货分享 orders:1 state:true tag:<nil> templateslist:{ "controls": [ { "name": "data.name1", "label": "简单标题", "type": "input-text" }, { "type": "combo", "name": "data.banner", "label": "轮播", "multiple": true, "draggable": true, "items": [ { "name": "t1", "label": "标题", "type": "input-text" }, { "name": "t2", "label": "时间", "type": "input-text" }, { "name": "t3", "label": "连接", "type": "input-text" }, { "type": "input-image", "name": "image", "label": "配图", "receiver": "./api/upload?rich=2" } ] } ] } templatespage:{ "controls": [ { "label": "推荐等级", "type": "select", "name": "featured", "options": [ { "label": "不推荐", "value": 0 }, { "label": "首页推荐", "value": 1001 } ] }, { "type": "group", "body": [ { "name": "data.listimg", "label": "列表图片", "receiver": "./api/upload?rich=2", "type": "input-image" }, { "name": "data.img", "label": "首页图片", "receiver": "./api/upload?rich=2", "type": "input-image" } ] }, { "type": "input-rich-text", "name": "data.body", "label": "文章内容", "receiver": "post:./api/upload?rich=1" } ] } title:干货分享-IT技巧-同创双子(北京)信息技术股份有限公司 tmpllist:list tmplpage:page url:share] > 干货分享
使用kcptun对ss服务器进行优化加速

发布日期:2019/01/16 08:00:00

  KCP 是一个快速可靠协议,能以比 TCP浪费10%-20%的带宽的代价,换取平均延迟降低 30%-40%,且最大延迟降低三倍的传输效果。纯算法实现,并不负责底层协议(如UDP)的收发,需要使用者自己定义下层数据包的发送方式,以 callback的方式提供给 KCP。连时钟都需要外部传递进来,内部不会有任何一次系统调用。

  1. 先下载Kcptun

  mkdir kcptun

  cd kcptun

  wget https://github.com/xtaci/kcptun/releases/download/v20160701/kcptun-linux-amd64-20160701.tar.gz

  tar -zxf kcptun-linux-amd64-20160701.tar.gz

  提醒:wget时根据本地系统下载。32位下载 kcptun-linux-386-*.tar.gz,64位下载 kcptun-linux-amd64-*.tar.gz

  2.创建 start.sh

  vi /root/kcptun/start.sh

  写入以下内容:

  ./server_linux_amd64 -l :29900 -t 127.0.0.1:8388 -key test -mtu 1400 -sndwnd 2048 -rcvwnd 2048 -mode fast2 > kcptun.log 2>&1 &

  server_linux_amd64 对应服务端文件名,请对应修改。

  -l 表示 Kcptun 的服务端监听端口,用于接收外部请求和发送数据,默认 29900; -t 表示要加速的地址,我这里设置的是我服务器的 Shadowsocks 端口;

  -key 是 Kcptun 的验证密钥,服务端和本地必须一致才能通过验证,请自行设置;

  -mode 为加速模式,默认 fast,这里使用 fast2。

  3.创建 stop.sh

  vi /root/kcptun/stop.sh

  写入以下内容:

  #!/bin/sh

  PID=`ps -ef | grep server_linux_amd64 | grep -v grep | awk '{print $2}'`

  if [[ "" != "$PID" ]]; then

  echo "killing $PID"

  kill -9 $PID

  fi

  4.创建 restart.sh

  #!/bin/sh

  cd /root/kcptun/

  echo "Stopping Kcptun..."

  sh stop.sh

  sh start.sh

  echo "Kcptun started."

  添加开机启动:

  echo "sh /root/kcptun/start.sh" >> /etc/rc.d/rc.local

  上面是服务器端配置,下面配置客户端

  1. 先下载客户端文件,以windows为例

  http://download.csdn.NET/detail/per_son/9583356 kcptun64位下载

  http://download.csdn.Net/detail/per_son/9583352 kcptun32位下载

  由于 Kcptun 是控制台程序,所以我选择使用 vbs 脚本,来达到后台运行的目的:新建 run.vbs

  Dim RunKcptun

  Set fso = CreateObject("Scripting.FileSystemObject")

  Set WshShell = WScript.CreateObject("WScript.Shell")

  '获取文件路径

  currentPath = fso.GetFile(Wscript.ScriptFullName).ParentFolder.Path & "\"

  '软件运行参数

  exeConfig = "client_windows_amd64.exe -l :12948 -r 10.10.10.10:29900 -key test -mtu 1400 -sndwnd 256 -rcvwnd 2048 -mode fast2 -dscp 46"

  '日志文件

  logFile = "kcptun.log"

  '拼接命令行

  cmdLine = "cmd /c " & currentPath & exeConfig & " > " & currentPath & logFile & " 2>&1"

  '启动软件

  WshShell.Run cmdLine, 0, False

  '等待1秒

  'WScript.Sleep 1000

  '打印运行命令

  'Wscript.echo cmdLine

  Set WshShell = Nothing

  Set fso = Nothing

  '退出脚本

  WScript.quit

  本地监听端口为 12948;服务器 IP 地址 10.10.10.10 端口 29900;验证密钥和服务端一致。其他参数说明见上面服务端配置的说明。

  v20160616 新增参数:-conn,使用多线程连接。可尝试添加 -conn 4 以使用4线程连接服务器。

  新建 stop.bat

  taskkill /f /im client_windows_amd64.exe

  把stop.bat 和 run.vbs 放到kcptun解压的那个文件里,双击 run.vbs 运行程序,使用 stop.bat 来停止程序,kcptun.log 为输出的日志信息。

  然后是Shadowsocks 客户端配置

  在客户端中新建服务器:

  服务器 IP 填写:127.0.0.1

  服务器端口填写:12948

  正确填写你的 Shadowsocks 密码,加密方式,协议和混淆方式。

  切换到该服务器上,测试是否正确运行。


同创双子为企业保驾护航

专注数字化方案建设,推动智慧企业生态圈的升级发展