A simple SOCKS V5 proxy server.
Use make
to complete compilation and linking.
$ make
If followed by CFLAG=-DDEBUG
debugging mode is enabled:
$ make CFLAG=-DDEBUG
If started without any options, it will listen on port 1080 and no authentication is required.
$ ./server
NO AUTHENTICATION REQUIRED
Listening at 0.0.0.0:1080
With the -h
option, help information is displayed.
$ ./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.
Options -a
and -p
are used to specify the IP address and port number bound to the server respectively.
$ ./server -a 127.0.0.1 -p 8080
NO AUTHENTICATION REQUIRED
Listening at 127.0.0.1:8080
The option -u
is used to enable username and password authentication. The option must be followed by the path to a file. Each line of the file corresponds to a user, and the username and password are separated by commas ,
for example:
$ cat ./passwd
user1,123456
user2,666
user3,2333
$ ./server -u ./passwd
USERNAME/PASSWORD
3 users
Listening at 0.0.0.0:1080
If the -d
parameter is given, the server will leave the terminal and become a daemon process.
$ ./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
This project adopts the MIT open source license agreement.
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.