-
Notifications
You must be signed in to change notification settings - Fork 8
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
0 parents
commit 5e149e9
Showing
4 changed files
with
125 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
server | ||
|
||
### Linux ### | ||
*~ | ||
|
||
# temporary files which can be created if a process still has a handle open of a deleted file | ||
.fuse_hidden* | ||
|
||
# KDE directory preferences | ||
.directory | ||
|
||
# Linux trash folder which might appear on any partition or disk | ||
.Trash-* | ||
|
||
# .nfs files are created when an open file is removed but is still being accessed | ||
.nfs* | ||
|
||
### macOS ### | ||
*.DS_Store | ||
.AppleDouble | ||
.LSOverride | ||
|
||
# Icon must end with two \r | ||
Icon | ||
|
||
# Thumbnails | ||
._* | ||
|
||
# Files that might appear in the root of a volume | ||
.DocumentRevisions-V100 | ||
.fseventsd | ||
.Spotlight-V100 | ||
.TemporaryItems | ||
.Trashes | ||
.VolumeIcon.icns | ||
.com.apple.timemachine.donotpresent | ||
|
||
# Directories potentially created on remote AFP share | ||
.AppleDB | ||
.AppleDesktop | ||
Network Trash Folder | ||
Temporary Items | ||
.apdisk | ||
|
||
### Windows ### | ||
# Windows thumbnail cache files | ||
Thumbs.db | ||
ehthumbs.db | ||
ehthumbs_vista.db | ||
|
||
# Folder config file | ||
Desktop.ini | ||
|
||
# Recycle Bin used on file shares | ||
$RECYCLE.BIN/ | ||
|
||
# Windows Installer files | ||
*.cab | ||
*.msi | ||
*.msm | ||
*.msp | ||
|
||
# Windows shortcuts | ||
*.lnk | ||
|
||
|
||
# End of https://www.gitignore.io/api/macos,linux,windows |
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,3 @@ | ||
FROM scratch | ||
ADD server . | ||
CMD ["./server"] |
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,24 @@ | ||
# Build | ||
The following command will perform a build of a static binary for Linux. | ||
The result of this build can be used by a scratch Docker image. This reduces container size drastically. | ||
|
||
```bash | ||
CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o server . | ||
``` | ||
|
||
# Docker image usage | ||
|
||
You can start Docker container with the following command (make sure to replace `<USER>` and `<PASSWORD>` placeholders with your own credentials). | ||
|
||
```bash | ||
docker run -d --name socks5-proxy -p 1080:1080 -e USER=<USER> -e PASSWORD=<PASSWORD> ocassio/go-socks5-proxy | ||
``` | ||
|
||
# Special thanks | ||
|
||
- The original idea. Actually this project is just a very lightweight variation of the serj's one: | ||
https://github.com/serjs/socks5-server | ||
- SOCKS 5 server implementation for Go: | ||
https://github.com/armon/go-socks5 | ||
- Article about building minimal Go containers with Docker by Nick Gauthier: | ||
https://blog.codeship.com/building-minimal-docker-containers-for-go-applications/ |
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 @@ | ||
package main | ||
|
||
import ( | ||
"log" | ||
"os" | ||
|
||
"github.com/armon/go-socks5" | ||
) | ||
|
||
func main() { | ||
|
||
creadentials := socks5.StaticCredentials{ | ||
os.Getenv("USER"): os.Getenv("PASSWORD"), | ||
} | ||
authenticator := socks5.UserPassAuthenticator{Credentials: creadentials} | ||
|
||
// Create a SOCKS5 server | ||
config := &socks5.Config{ | ||
AuthMethods: []socks5.Authenticator{authenticator}, | ||
Logger: log.New(os.Stdout, "", log.LstdFlags), | ||
} | ||
server, err := socks5.New(config) | ||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
// Create SOCKS5 proxy on localhost port 8000 | ||
if err := server.ListenAndServe("tcp", "0.0.0.0:1080"); err != nil { | ||
panic(err) | ||
} | ||
} |