CHEGVA

轻量级网络代理转发神器 socat 使用详解 (opens in new tab)

socat(SOcket CAT)是一个基于命令行的实用程序,其核心原理是在任意两个独立的数据通道之间建立双向传输的桥梁。它本身不解读或处理应用层协议(如HTTP),只是忠实地在指定的源和目的地之间转发原始字节流。这种"数据搬运工"的特性,使其成为构建轻量级网络代理的理想工具。有点类似于netcat (即nc命令),nc是单纯面向网络的,而socat连接的更多。socat安装# CentOS/RHEL yum install socat # Debian/Ubuntu sudo apt-get install socat # macOS (Homebrew) brew install socatsocat进阶配置在实际使用时,为了让代理更稳定、安全,你还可以关注以下选项和要点:基础命令格式:socat [options] 。常用选项:-u 或 -U:设定数据流为单向(从源到目标或反之)。range= :限制允许连接代理的客户端IP范围,例如range=192.168.1.0/24。su= :让socat进程以指定低权限用户(如n...

Read the original article
Sign in to keep reading the full article.

Keyboard Shortcuts

Navigation

Next / previous post
j/k
Open post
oorEnter
Preview post
v

Post Actions

Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Save / unsave
s

Recommendations

Add interest / feed
Enter
Not interested
x

Go to

Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Discover
gb
Search
/

General

Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help