-
-
Notifications
You must be signed in to change notification settings - Fork 181
Commit
Optional auth, vendoring and minimal docker image(880kb compressed)
- Loading branch information
There are no files selected for viewing
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,9 @@ | ||
FROM golang:1.7.4-onbuild | ||
FROM golang:latest as builder | ||
WORKDIR /go/src/github.com/olebedev/socks5 | ||
COPY . . | ||
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags '-s' -o ./socks5 | ||
|
||
FROM scratch | ||
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ | ||
COPY --from=builder /go/src/github.com/olebedev/socks5/socks5 / | ||
ENTRYPOINT ["/socks5"] |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
|
||
# Gopkg.toml example | ||
# | ||
# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md | ||
# for detailed Gopkg.toml documentation. | ||
# | ||
# required = ["github.com/user/thing/cmd/thing"] | ||
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"] | ||
# | ||
# [[constraint]] | ||
# name = "github.com/user/project" | ||
# version = "1.0.0" | ||
# | ||
# [[constraint]] | ||
# name = "github.com/user/project2" | ||
# branch = "dev" | ||
# source = "github.com/myfork/project2" | ||
# | ||
# [[override]] | ||
# name = "github.com/x/y" | ||
# version = "2.4.0" | ||
|
||
|
||
[[constraint]] | ||
branch = "master" | ||
name = "github.com/armon/go-socks5" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,11 @@ | ||
# go-socks5-proxy | ||
[![CircleCI](https://circleci.com/gh/serjs/socks5-server.svg?style=shield)](https://circleci.com/gh/serjs/socks5-server) | ||
|
||
Simple socks5 server using go-socks5 with auth | ||
Simple socks5 server using go-socks5 with or without auth. | ||
|
||
# Start container with proxy | ||
```docker run -d --name socks5-proxy -p 1080:1080 -e PROXY_USER=<PROXY_USER> -e PROXY_PASSWORD=<PROXY_PASSWORD> serjs/go-socks5-proxy``` | ||
```docker run -d --name socks5 -p 1080:1080 -e PROXY_USER=<PROXY_USER> -e PROXY_PASSWORD=<PROXY_PASSWORD> olebedev/socks5``` | ||
|
||
where | ||
|
||
```<PROXY_USER>``` - username to authenticate | ||
|
||
```<PROXY_PASSWORD>``` - password to authenticate | ||
For auth-less mode just do not pass `PROXY_USER` and `PROXY_PASSWORD`. | ||
|
||
# Test running service | ||
```curl --socks5 <docker machine ip>:1080 -U <PROXY_USER>:<PROXY_PASSWORD> https://ifcfg.me``` - result must show docker host ip (for bridged network) | ||
```curl --socks5 <docker machine ip>:1080 https://ya.ru``` - result must show docker host ip (for bridged network) |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,34 @@ | ||
package main | ||
|
||
import ( | ||
"github.com/armon/go-socks5" | ||
"os" | ||
"fmt" | ||
"log" | ||
"os" | ||
|
||
"github.com/armon/go-socks5" | ||
) | ||
|
||
func main() { | ||
creds := socks5.StaticCredentials{ | ||
os.Getenv("PROXY_USER"):os.Getenv("PROXY_PASSWORD"), | ||
} | ||
cator := socks5.UserPassAuthenticator{Credentials: creds} | ||
// Create a SOCKS5 server | ||
|
||
conf := &socks5.Config{ | ||
AuthMethods: []socks5.Authenticator{cator}, | ||
Logger: log.New(os.Stdout, "", log.LstdFlags), | ||
Logger: log.New(os.Stdout, "", log.LstdFlags), | ||
} | ||
|
||
if os.Getenv("PROXY_USER")+os.Getenv("PROXY_PASSWORD") != "" { | ||
creds := socks5.StaticCredentials{ | ||
os.Getenv("PROXY_USER"): os.Getenv("PROXY_PASSWORD"), | ||
} | ||
cator := socks5.UserPassAuthenticator{Credentials: creds} | ||
conf.AuthMethods = []socks5.Authenticator{cator} | ||
} | ||
|
||
server, err := socks5.New(conf) | ||
if err != nil { | ||
panic(err) | ||
log.Fatal(err) | ||
} | ||
|
||
// Create SOCKS5 proxy on localhost port 8000 | ||
if err := server.ListenAndServe("tcp", "0.0.0.0:1080"); err != nil { | ||
panic(err) | ||
fmt.Println("Start listening ...") | ||
if err := server.ListenAndServe("tcp", ":1080"); err != nil { | ||
log.Fatal(err) | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.