cygwin64 源码编译socat_socks5

本文使用的 socat 是打过 socks5 支持补丁的版本

参考这篇文章:Nginx 如何与 Socat 配合使用 - 哔哩哔哩前言socat 是一个多功能的网络工具,其主要特点就是在两个数据流之间建立通道,它可以帮助 Nginx 访问需要中转的服务。本文着重介绍的就是如何让 Nginx 通过 socat 访问 proxy_pass 的目标。由于专栏代码块已损坏不可使用(会吞换行),因此下文涉及代码均会用截图,相关代码会在评论区放出 Gist 链接,请不用担心复制问题。本文所使用环境:HK GCP 服务器Ubuntu 20.04.1 LTS (64bit)所用中转为 socks5 协议,监听本地端口 1080(台湾出口)https://www.bilibili.com/read/cv8905997

使用下载工具( 迅雷 )下载源码:

GitHub - runsisi/socat: socat with socks5 support (official socat release does not support socks5 proxy)https://github.com/runsisi/socat.git

https://github.com/runsisi/socat.git

得到socat-master.zip,解压

我是解压到这里: C:\cygwin64\home\Administrator\socat-master

C:\cygwin64\home\Administrator\socat-master 

cygwin64需要这些依赖: make,gcc-core , gcc-g++ ,libgcc1, libgccpp1, pkg-config

参考:ygwin 编译redis源码生成 window版 x86_64 下使用的 redis 6.2.6_s5629068的博客-CSDN博客_cygwin 编译redis  https://blog.csdn.net/s5629068/article/details/124402317

http://www.cygwin.com/setup-x86_64.exe

http://www.cygwin.com/setup-x86_64.exe

autoconf
./configure --prefix=/usr/local/bin

#为了不报错需要如下两条命令 绕过 生成帮助手册:
ln /usr/bin/echo /usr/bin/yodl2man
ln /usr/bin/echo /usr/bin/yodl2html

make
make install

Administrator@lvB ~
$ /usr/local/bin/bin/socat  -hhh | grep -C2  socks
      socket-recvfrom:<domain>:<type>:<protocol>:<local-address>        groups=FD,SOCKET,CHILD,RANGE
      socket-sendto:<domain>:<type>:<protocol>:<remote-address> groups=FD,SOCKET
         socks is an alias name for socks4
      socks4:<socks-server>:<host>:<port>       groups=FD,SOCKET,CHILD,RETRY,IP4,IP6,TCP,SOCKS4
      socks4a:<socks-server>:<host>:<port>      groups=FD,SOCKET,CHILD,RETRY,IP4,IP6,TCP,SOCKS4
      socks5:<socks-server>:<host>:<port>       groups=FD,SOCKS5,SOCKET,CHILD,RETRY,IP4,IP6,TCP
         socks5-client is an alias name for socks5
      stderr    groups=FD,FIFO,BLK,REG,SOCKET,TERMIOS,UNIX,IP4,IP6,UDP,TCP,SCTP
      stdin     groups=FD,FIFO,BLK,REG,SOCKET,TERMIOS,UNIX,IP4,IP6,UDP,TCP,SCTP
--
      sockopt-int is an alias for setsockopt-int
      sockopt-string is an alias for setsockopt-string
      socks5pass        groups=SOCKS5   phase=SPECIFIC  type=STRING
      socks5port        groups=SOCKS5   phase=SPECIFIC  type=STRING
      socks5user        groups=SOCKS5   phase=SPECIFIC  type=STRING
      socksport groups=SOCKS4   phase=LATE      type=STRING
      socksuser groups=SOCKS4   phase=LATE      type=STRING
      socktype is an alias for so-type
      sourceport        groups=UDP,TCP,SCTP     phase=LATE      type=UNSIGNED-SHORT

Administrator@lvB ~
$

看到了  socks5port   ,说明成功了  

测试:

/usr/local/bin/bin/socat -v -d exec:'whoami',pty,stderr,setsid,sigint,sane  SOCKS5:127.0.0.1:ncip_xx.xx.xx.xx:ncport_xx,socks5port=1080
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值