Skip to content

Commit

Permalink
doc: add English readme
Browse files Browse the repository at this point in the history
  • Loading branch information
0990 committed Sep 6, 2023
1 parent bae319f commit 11dcfdb
Show file tree
Hide file tree
Showing 6 changed files with 134 additions and 43 deletions.
41 changes: 25 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,37 @@
# socks5
轻量的socks代理服务器,支持socks4,socks4a,socks5,代码简单易读,就像sock原始协议一样
[中文文档](doc/README_zh.md)<br>
A lightweight SOCKS proxy server that supports socks4, socks4a, and socks5 protocols. The code is simple and easy to read, just like the original SOCKS protocol.

## Feature
* 支持 [socks4](doc/SOCKS4.protocol.txt),[socks4a](doc/socks4A.protocol.txt),[socks5(TCP&UDP)](doc/rfc1928.txt)
* 支持 [socks5用户名密码鉴权](doc/rfc1929.txt)
* support [socks4](doc/SOCKS4.protocol.txt),[socks4a](doc/socks4A.protocol.txt),[socks5(TCP&UDP)](doc/rfc1928.txt)
* Supports [socks5 username/password authentication](doc/rfc1929.txt)

## 使用
* [下载地址](https://github.com/0990/socks5/releases) 解压后直接执行二进制文件即可(linux平台需要加执行权限)<br>
* [Docker安装](doc/docker.md)
## Usage
Download the latest program for your operating system and architecture from the [Release](https://github.com/0990/socks5/releases) page.
Extracting,then execute the binary file directly (Linux platform requires execution permission)<br>
```bash
./ss5
```
or
```bash
./ss5 -c ./ss5.json
```
[Docker installation](doc/docker.md)

### 配置
解压后目录下的ss5.json是配置文件<br>
最简配置说明:
### Configuration
The ss5.json file in the extracted directory is the configuration file<br>
Simple configuration instructions:
```
ListenPort tcp和udp代理的监听端口,默认是1080
UserName,Password 需要用户名密码鉴权时填写,默认为空
LogLevel 日志等级(debug,info,warn,error)
ListenPort The listening port for TCP and UDP proxies, default is 1080
UserName,Password Fill in if username/password authentication is required, default is empty
LogLevel Log level (debug, info, warn, error)
```
[高级配置](doc/config.md)
## 示例
[Advanced configuration](doc/config.md)
## Package Usage
```
go get github.com/0990/socks5
```
以下为一个简单示用
Here is a simple example:
```
s := socks5.NewServer(socks5.ServerCfg{
ListenPort: 1080,
Expand All @@ -38,7 +47,7 @@ if err != nil {
}
```
## TODO
* 支持 BIND 命令
* Support BIND command

## Thanks
[txthinking/socks5](https://github.com/txthinking/socks5)
Expand Down
4 changes: 2 additions & 2 deletions cmd/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func main() {

}

//从环境变量中取配置,优先使用环境变量中的值
// 从环境变量中取配置,优先使用环境变量中的值
func parseOSEnvCfg() *socks5.ServerCfg {
cfg := socks5.DefaultServerConfig

Expand All @@ -65,7 +65,7 @@ func parseOSEnvCfg() *socks5.ServerCfg {
udpTimeout := os.Getenv("PROXY_UDP_TIMEOUT")
tcpTimeout := os.Getenv("PROXY_TCP_TIMEOUT")
port := os.Getenv("PROXY_PORT")
udpAdvIP := os.Getenv("PROXY_UDP_IP")
udpAdvIP := os.Getenv("PROXY_ADVERTISED_UDP_IP")

if udpAdvIP != "" {
cfg.UDPAdvertisedIP = udpAdvIP
Expand Down
52 changes: 52 additions & 0 deletions doc/README_zh.md
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)

35 changes: 17 additions & 18 deletions doc/config.md
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.
31 changes: 31 additions & 0 deletions doc/config_zh.md
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,
```
这个一般情况下不用更改
14 changes: 7 additions & 7 deletions doc/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ docker run -d --name socks5 -p 1080:1080/tcp -p 1080:1080/udp -e PROXY_UDP_IP="x
```
x.x.x.x为docker的访问ip

## 环境变量
## environment
```
PROXY_USER 用户名(鉴权用)
PROXY_PASSWORD 密码(鉴权用)
PROXY_UDP_TIMEOUT tcp超时时间(默认60s)
PROXY_TCP_TIMEOUT udp超时时间(默认60s)
PROXY_PORT tcp及udp代理端口(默认1080)
PROXY_UDP_IP udp下发地址
PROXY_USER username
PROXY_PASSWORD password
PROXY_UDP_TIMEOUT tcp timeout seconds(default 60s)
PROXY_TCP_TIMEOUT udp timeout seconds(default 60s)
PROXY_PORT tcp and udp listen port(default 1080)
PROXY_ADVERTISED_UDP_IP udp advertised ip
```


Expand Down

0 comments on commit 11dcfdb

Please sign in to comment.