-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
134 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# socks5 | ||
轻量的socks代理服务器,支持socks4,socks4a,socks5,代码简单易读,就像sock原始协议一样 | ||
|
||
## Feature | ||
* 支持 [socks4](doc/SOCKS4.protocol.txt),[socks4a](doc/socks4A.protocol.txt),[socks5(TCP&UDP)](doc/rfc1928.txt) | ||
* 支持 [socks5用户名密码鉴权](doc/rfc1929.txt) | ||
|
||
## 使用 | ||
* [下载地址](https://github.com/0990/socks5/releases) 解压后直接执行二进制文件即可(linux平台需要加执行权限)<br> | ||
```bash | ||
./ss5 | ||
``` | ||
或 | ||
```bash | ||
./ss5 -c ./ss5.json | ||
``` | ||
[Docker安装](doc/docker.md) | ||
|
||
### 配置 | ||
解压后目录下的ss5.json是配置文件<br> | ||
最简配置说明: | ||
``` | ||
ListenPort tcp和udp代理的监听端口,默认是1080 | ||
UserName,Password 需要用户名密码鉴权时填写,默认为空 | ||
LogLevel 日志等级(debug,info,warn,error) | ||
``` | ||
[高级配置](doc/config_zh.md) | ||
## 示例 | ||
``` | ||
go get github.com/0990/socks5 | ||
``` | ||
以下为一个简单示用 | ||
``` | ||
s := socks5.NewServer(socks5.ServerCfg{ | ||
ListenPort: 1080, | ||
UserName: "", | ||
Password: "", | ||
UDPTimout: 60, | ||
TCPTimeout: 60, | ||
LogLevel:"error" | ||
}) | ||
err := s.Run() | ||
if err != nil { | ||
log.Fatalln(err) | ||
} | ||
``` | ||
## TODO | ||
* 支持 BIND 命令 | ||
|
||
## Thanks | ||
[txthinking/socks5](https://github.com/txthinking/socks5) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,30 @@ | ||
## 高级配置 | ||
### UDP下发地址(UDPAdvertisedIP) | ||
socks5的UDP代理原理是: | ||
1. 先建立tcp代理连接 | ||
2. 通过tcp连接下发UDP的代理地址<br> | ||
3. 客户端再连接这个代理地址 | ||
## Advanced Configuration | ||
### UDPAdvertisedIP | ||
The UDP proxy process for socks5 is as follows: | ||
1. Establish a TCP proxy connection | ||
2. Send the UDP proxy address through the TCP connection | ||
3. The client then connects to this proxy address | ||
``` | ||
"ListenPort": 1080, | ||
"UDPAdvertisedIP": "192.168.0.100" | ||
``` | ||
上面配置的情况下<br> | ||
UDP代理地址为: 0.0.0.0:1080<br> | ||
下发的UDP代理地址为: 192.168.0.100:1080<br> | ||
请确保这个通过下发的UDP代理地址能连上这个UDP代理<br> | ||
<mark>UDPAdvertisedIP为空时,则使用本地地址,一般情况下没有问题,但在docker等环境获取不到本地地址时,需要配置此项</mark> | ||
### 自定义UDP,TCP监听地址 | ||
In the above configuration<br> | ||
The UDP proxy listen addr is: 0.0.0.0:1080<br> | ||
The advertised UDP proxy address is: 192.168.0.100:1080<br> | ||
Please ensure that the UDP proxy can be connected using the advertised UDP proxy address.<br> | ||
<mark>If UDPAdvertisedIP is empty, the local address will be used. In general, this is not a problem, but it needs to be configured when the local address cannot be obtained in environments like Docker.</mark> | ||
### Custom UDP and TCP listening addresses | ||
``` | ||
"TCPListen": "127.0.0.1:1081", | ||
"UDPListen": "127.0.0.1:1082", | ||
``` | ||
<mark>当TCPListen或UDPListen有值时,ListenPort则会被忽略</mark><br> | ||
上面的情况下,ListenPort的值1080无效 | ||
<mark>When TCPListen or UDPListen has a value, ListenPort will be ignored.</mark><br> | ||
In the above scenario, the value of ListenPort, which is 1080, is invalid.<br> | ||
<mark>Note: Improper configuration of UDPListen and UDPAdvertisedIP can cause UDP proxy failure.</mark> | ||
|
||
<mark>注意:UDPListen、UDPAdvertisedIP配置不当,会导致UDP代理不了</mark> | ||
|
||
### TCP,UDP超时时间 | ||
### TCP and UDP Timeout | ||
``` | ||
"UDPTimout": 60, | ||
"TCPTimeout": 60, | ||
``` | ||
这个一般情况下不用更改 | ||
In general, there is no need to change these values. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
## 高级配置 | ||
### UDP下发地址(UDPAdvertisedIP) | ||
socks5的UDP代理原理是: | ||
1. 先建立tcp代理连接 | ||
2. 通过tcp连接下发UDP的代理地址<br> | ||
3. 客户端再连接这个代理地址 | ||
``` | ||
"ListenPort": 1080, | ||
"UDPAdvertisedIP": "192.168.0.100" | ||
``` | ||
上面配置的情况下<br> | ||
UDP代理地址为: 0.0.0.0:1080<br> | ||
下发的UDP代理地址为: 192.168.0.100:1080<br> | ||
请确保这个通过下发的UDP代理地址能连上这个UDP代理<br> | ||
<mark>UDPAdvertisedIP为空时,则使用本地地址,一般情况下没有问题,但在docker等环境获取不到本地地址时,需要配置此项</mark> | ||
### 自定义UDP,TCP监听地址 | ||
``` | ||
"TCPListen": "127.0.0.1:1081", | ||
"UDPListen": "127.0.0.1:1082", | ||
``` | ||
<mark>当TCPListen或UDPListen有值时,ListenPort则会被忽略</mark><br> | ||
上面的情况下,ListenPort的值1080无效 | ||
|
||
<mark>注意:UDPListen、UDPAdvertisedIP配置不当,会导致UDP代理不了</mark> | ||
|
||
### TCP,UDP超时时间 | ||
``` | ||
"UDPTimout": 60, | ||
"TCPTimeout": 60, | ||
``` | ||
这个一般情况下不用更改 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters