科学上网工具 xSocks 的安装与使用

最近在 FinalSpeed(简称 FS)的网站看到,FS 已经有了所谓高级版(从而从免费走向了收费),其名字已改为 XSocks。由于想到 FS 已经开源,所以有点好奇这个 XSocks 是不是开源的。于是就去 GitHub 上搜xsocks,结果果然没有找到此处的 XSocks。不过,名字相同或相似的却有好几个,其中一个叫做 xSocksx为小写)的引起了我的注意,因为它的一个页面提到了 GFW,说明这个 xSocks 很可能也是中国人写的。于是,我就尝试在自己的 VPS(系统为 Debian Jessie)上安装它。当然,在安装的过程中遇到一些麻烦,主要是缺少一些依赖,但都逐一解决。由于至今没人写过这个工具的使用,于是我就写一写吧。

归纳起来,使用 xSocks 的主要步骤如下。

(A)服务端的安装

(1)安装最新版的 libtool(xSocks-0.4.4 要求 libtool 的版本为 1.4.2 或其以上)。到 GNU libtool 的官网首页查看其最新版的版本号及其下载链地址,最新版为 2.4.6,于是安装它:

wget http://ftpmirror.gnu.org/libtool/libtool-2.4.6.tar.gz
tar zxvf libtool-2.4.6.tar.gz
cd libtool-2.4.6
./configure && make && make install 

装完后,用 libtool –version 查看版本,确认已是最新的 2.4.6。

注意:不要用 apt-get install libtool 来安装,因为这样装上的版本太低。

(2)安装 autoconf 和 pkg-config:

apt-get install autoconf pkg-config

(3)下载 xSocks 源码包并安装:

git clone https://github.com/lparam/xSocks.git
cd xSocks
make    //这一步有点漫长。
make install    //GitHub 上的项目主页中写上了 make install,但是执行之后什么貌似什么也没发生。

至此,xSocks 就安装完成了。

在服务端运行,使用 xSocksd 命令,直接执行 xSocksd 或 xSocksd –help(注意大小写),就能输出该命令的使用方法:

root@hostname:~# xSocksd
xSocksd Version: xSocksd/0.4.4 Maintained by lparam
Usage: xSocksd [-l bind] <-k password> [-p pidfile] [-c concurrency] [-t timeout] [-s signal] [-nhvV]

Options:
-k <password> : password of server
[-l <bind address>] : bind address:port (default: 0.0.0.0:1073)  // 注意:默认的服务器端口为1073。
[-d <dns>] : name servers for internal DNS resolver
[-t <timeout>] : connection timeout in senconds
[-u] : enable udp relay
[-c <concurrency>] : worker threads
[-p <pidfile>] : pid file path (default: /var/run/xSocks/xSocksd.pid)
[--signal <signal>] : send signal to xSocksd: quit, stop
[-n] : non daemon mode
[-h, --help] : this help
[-v, --version] : show version
[-V] : verbose mode

于是运行:

xSocksd -k passpass    //假设使用密码 “passpass” 

但是出错,提示没有 xSocksd.pid 文件:

root@hostname:~/xSocks# xSocksd -k passpass
root@hostname:~/xSocks# 2016/04/27 06:16:41 [ERR]: open "/var/run/xSocks/xSocksd.pid" failed (2: No such file or directory)

于是只好尝试手动创建一个 xSocksd.pid(可以放在你想要的任何路径)。这里假设放在/root目录中。于是就这样运行:

xSocksd -k passpass -p /root/xSocksd.pid 

没有任何输出,但是运行是成功的。通过 cat /root/xSocksd.pid,可以看到 xSocksd.pid 中的进程号 xxx。如果想终止 xSocks 的运行,直接 kill xxx 即可。 

(B)客户端

(1)Windows 客户端。作者已经提供了编译好的 Windows 客户端。如下图:

xSocks

诶,这个界面是不是和我们所熟悉的某个工具极其相似呢?没错,这很可能就是经过修改的 SS 吧。使用方法和 SS 的客户端几乎一样,就不多说了。

(2)Linux 客户端 

Linux 客户端的安装与服务端一样,不同的是,通过 xSocks 命令来运行。类似地,可以执行 xSocks 或 xSocks –help 来查看使用说明。可能也需要手动创建 pid 文件。由于本人还未在 Linux 客户端用过,就不在此啰嗦了。感兴趣的可以试试。

补充:

Windows 客户端的下载地址为 https://github.com/lparam/xSocks-windows/releases 

Android 客户端的下载地址为 https://github.com/lparam/xSocks-android/releases 

 

欢迎分享或转载,转载请注明出处。

本文固定连接:https://www.oixxu.com/anti-gfw-xsocks-install-use 

《科学上网工具 xSocks 的安装与使用》上有17条评论

  1. 博主好!没有找到作者的windows客户端下载链接呢,请问哪里可以下载到呢?这个xsocks有没有加速效果?谢谢!

    1. 在这里下载:https://github.com/lparam/xSocks-windows/releases
      这不是加速工具,所以无所谓加速效果。
      加速的话,不知道FinalSpeed可以不可以加速xSocks。我没试过。

  2. 您好,我这里提示这个,怎么解决?
    ./autogen.sh: line 28: automake: command not found
    ./autogen.sh: line 33: test: : integer expression expected
    ./autogen.sh: line 34: test: : integer expression expected
    + libtoolize
    ./autogen.sh: line 43: libtoolize: command not found
    make: *** [/root/xSocks/3rd/libuv/Makefile] Error 127

    1. 你按我写的步骤来操作了吗?你安装最新版本的libtool和autoconf了吗?

  3. hi.
    我在一台vps上编译成功,在另一台上编译失败,如何解决?

    autoreconf: Entering directory `.’
    autoreconf: configure.ac: not using Gettext
    autoreconf: running: aclocal –force -I m4
    autoreconf: configure.ac: tracing
    autoreconf: configure.ac: creating directory build-aux
    autoreconf: configure.ac: not using Libtool
    autoreconf: running: /usr/bin/autoconf –force
    configure.ac:549: error: possibly undefined macro: AC_LIBTOOL_WIN32_DLL
    If this token and others are legitimate, please use m4_pattern_allow.
    See the Autoconf documentation.
    autoreconf: /usr/bin/autoconf failed with exit status: 1
    make: *** [/root/xSocks/3rd/libsodium/Makefile] 错误 1
    root@AR:~/xSocks#

    在google.com搜索了“configure.ac:549: error: possibly undefined macro: AC_LIBTOOL_WIN32_DLL
    If this token and others are legitimate, please use m4_pattern_allow.”
    未找到解决办法。

    非常感谢.

    1. 这个,我就不知道了。你再搜搜吧。或者去HitHub上提个Issue看看。。。

  4. XSOCKS能不能共享给局域网内其他终端使用?以前FS是可以通过SS共享的,XS找不到相应的教程,博主能不能指点一下?

    1. 之前我的回答有误。是可以共享给局域网内其他终端使用的。其实操作方法和SS一样啊,只是换成英文了。在任务栏右键点击xSocks的图标,选中Allow Clients from LAN之后,即可在局域网内的其他终端设置该代理。

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注