Skip to content

Commit

Permalink
Merge pull request #2 from olebedev/master
Browse files Browse the repository at this point in the history
Optional auth, vendoring and minimal docker image(880kb compressed)
  • Loading branch information
serjs authored Apr 24, 2018
2 parents 8bb8cf2 + d8e1d96 commit e321695
Show file tree
Hide file tree
Showing 652 changed files with 163,736 additions and 164 deletions.
32 changes: 0 additions & 32 deletions .circleci/config.yml

This file was deleted.

39 changes: 0 additions & 39 deletions .gitignore

This file was deleted.

1 change: 0 additions & 1 deletion .idea/.name

This file was deleted.

22 changes: 0 additions & 22 deletions .idea/compiler.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/encodings.xml

This file was deleted.

23 changes: 0 additions & 23 deletions .idea/misc.xml

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/modules.xml

This file was deleted.

10 changes: 9 additions & 1 deletion Dockerfile
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"]
21 changes: 21 additions & 0 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions Gopkg.toml
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"
13 changes: 4 additions & 9 deletions README.md
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)
9 changes: 0 additions & 9 deletions go-socks-server.iml

This file was deleted.

34 changes: 20 additions & 14 deletions server.go
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)
}
}
}
22 changes: 22 additions & 0 deletions vendor/github.com/armon/go-socks5/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions vendor/github.com/armon/go-socks5/.travis.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions vendor/github.com/armon/go-socks5/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 45 additions & 0 deletions vendor/github.com/armon/go-socks5/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit e321695

Please sign in to comment.