From 16a306080d5b0b816cae8a35e123593e5a338c73 Mon Sep 17 00:00:00 2001 From: Sergey Bogatyrets Date: Tue, 20 Dec 2016 13:09:34 +0300 Subject: [PATCH] repository one --- .gitignore | 39 +++++++++++++++++++++++++++++++++++++++ .idea/.name | 1 + .idea/compiler.xml | 22 ++++++++++++++++++++++ .idea/encodings.xml | 6 ++++++ .idea/misc.xml | 23 +++++++++++++++++++++++ .idea/modules.xml | 8 ++++++++ Dockerfile | 1 + go-socks-server.iml | 9 +++++++++ server.go | 28 ++++++++++++++++++++++++++++ 9 files changed, 137 insertions(+) create mode 100644 .gitignore create mode 100644 .idea/.name create mode 100644 .idea/compiler.xml create mode 100644 .idea/encodings.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 Dockerfile create mode 100644 go-socks-server.iml create mode 100644 server.go diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..159a183 --- /dev/null +++ b/.gitignore @@ -0,0 +1,39 @@ +# User-specific stuff: +.idea/workspace.xml +.idea/tasks.xml + +# Sensitive or high-churn files: +.idea/dataSources/ +.idea/dataSources.ids +.idea/dataSources.xml +.idea/dataSources.local.xml +.idea/sqlDataSources.xml +.idea/dynamic.xml +.idea/uiDesigner.xml + +# Gradle: +.idea/gradle.xml +.idea/libraries + +# Mongo Explorer plugin: +.idea/mongoSettings.xml + +## File-based project format: +*.iws + +## Plugin-specific files: + +# IntelliJ +/out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 0000000..6a112f9 --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +go-socks-server \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..96cc43e --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..97626ba --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..a8cacf4 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..a98cc18 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..fa74c25 --- /dev/null +++ b/Dockerfile @@ -0,0 +1 @@ +FROM golang:1.7.4-onbuild diff --git a/go-socks-server.iml b/go-socks-server.iml new file mode 100644 index 0000000..4fb9d12 --- /dev/null +++ b/go-socks-server.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/server.go b/server.go new file mode 100644 index 0000000..87c9f9a --- /dev/null +++ b/server.go @@ -0,0 +1,28 @@ +package main + +import ( + "github.com/armon/go-socks5" + "os" + "log" +) + +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), + } + server, err := socks5.New(conf) + 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) + } +} \ No newline at end of file