socks5 server c
1.0.0
一個簡易的SOCKS V5 代理伺服器。
使用make
完成編譯和連結。
$ make
若跟上CFLAG=-DDEBUG
則開啟調試模式:
$ make CFLAG=-DDEBUG
不含任何選項啟動,則監聽1080 端口,無需認證。
$ ./server
NO AUTHENTICATION REQUIRED
Listening at 0.0.0.0:1080
帶上-h
選項則顯示幫助資訊。
$ ./server -h
usage: ./server [options]
options:
-a < address > Local Address to bind (default: 0.0.0.0).
-p < port > Port number to bind (default: 1080).
-u < path/to/passwd > The path to passwd.
-d Run as a daemon.
-h Show this help message.
選項-a
和-p
分別用來指定伺服器綁定的IP 位址和連接埠號碼。
$ ./server -a 127.0.0.1 -p 8080
NO AUTHENTICATION REQUIRED
Listening at 127.0.0.1:8080
選項-u
用於開啟使用者名稱密碼認證方式,選項後面必須跟上一個檔案的路徑。該檔案的每一行對應一個用戶,用戶名和密碼之間用逗號,
隔開,例如:
$ cat ./passwd
user1,123456
user2,666
user3,2333
$ ./server -u ./passwd
USERNAME/PASSWORD
3 users
Listening at 0.0.0.0:1080
若帶上-d
參數,伺服器將脫離終端,成為守護程式。
$ ./server -d
NO AUTHENTICATION REQUIRED
Listening at 0.0.0.0:1080
PID is [xxxxx]
$ netstat -ntlp | grep xxxxx
tcp 0 0 0.0.0.0:1080 0.0.0.0: * LISTEN xxxxx/./server
本專案採用MIT 開源授權協議。
MIT License
Copyright (c) 2019-2021 totravel
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.