This project implements a SOCKS5 server in Go.
- Go 1.18 or later
- Root access on Linux or Administrator privileges on Windows
- Clone the repository:
git clone https://gitlab.9prints.com/tuanha/go-sock5-server.git
cd go-sock5-server
- Run the build and deploy script:
-
On Linux:
sudo ./deploy.sh
-
On Windows:
Right-click on deploy.bat and select "Run as administrator"
The deploy.sh
script automates the process of building the go-sock5-server, installing it, and setting up a systemd service. Here's what it does:
- Checks for root privileges
- Verifies the Go version
- Builds the project
- Installs the binary to
/opt/go-sock5-server/bin/
- Copies the configuration file (if present) to
/opt/go-sock5-server/config/
- Sets up a systemd service
- Configures the firewall to allow the specified port
The deploy.bat
script performs similar actions for Windows:
- Checks for Administrator privileges
- Verifies the Go version
- Builds the project
- Installs the binary to
C:\Program Files\go-sock5-server\bin\
- Copies or creates the configuration file in
C:\Program Files\go-sock5-server\config\
- Sets up a Windows service
- Configures the Windows Firewall to allow the specified port
The server uses a configuration file named config.tom
. On both platforms, if the file doesn't exist, a default configuration will be created:
[proxy]
user = "admin"
ip = "0.0.0.0"
password = "25251325"
port = 1438
You can modify this file as needed before or after deployment.
After running the build_deploy script, the server will be set up as a systemd service named go-sock5-server
. You can manage it using standard systemd commands:
- Start the service:
sudo systemctl start go-sock5-server
- Stop the service:
sudo systemctl stop go-sock5-server
- Restart the service:
sudo systemctl restart go-sock5-server
- Check the status:
sudo systemctl status go-sock5-server
On Windows, the server is set up as a Windows service named "Go SOCKS5 Server". You can manage it using the Services application or command line:
Using Command Prompt:
- Start the service:
net start go-sock5-server
- Stop the service:
net stop go-sock5-server
- Check the status:
sc query go-sock5-server
Using PowerShell:
- Start the service:
Start-Service go-sock5-server
- Stop the service:
Stop-Service go-sock5-server
- Restart the service:
Restart-Service go-sock5-server
- Check the status:
Get-Service go-sock5-server
Logs are stored in /opt/go-sock5-server/logs/
:
- Standard output:
output.log
- Standard error:
error.log
Logs are stored in C:\Program Files\go-sock5-server\logs\
:
- Standard output:
output.log
- Standard error:
error.log
If you encounter any issues:
- Check the logs in the respective log directories
- Ensure the configuration file is correct
- Verify that the required ports are not in use by another application
- On Windows, check the Windows Event Viewer for additional error information
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests.
This project is licensed under the MIT License - see the LICENSE file for details.