├── LICENSE ├── README.md └── main.go /LICENSE: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2016, Lee Christensen (@tifkin_) 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | * Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | * Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | * Neither the name of the copyright holder nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # GolangSocks5Server 2 | A standalone SOCKS5 server written in Go. Binaries can be downloaded from the [release page](https://github.com/leechristensen/GolangSocks5Server/releases). 3 | 4 | # Building 5 | 1) Install Go (https://golang.org/doc/install) and setup your GOPATH 6 | 7 | 2) Get it 8 | ``` 9 | go get github.com/leechristensen/GolangSocks5Server 10 | ``` 11 | 3) Build it 12 | ``` 13 | go install github.com/leechristensen/GolangSocks5Server 14 | ``` 15 | 4) Run it 16 | ``` 17 | GolangSocks5Server 2222 Starts the SOCKS server on localhost:2222 18 | 19 | or 20 | 21 | GolangSocks5Server 0.0.0.0 2222 Starts the SOCKS server on 0.0.0.0:2222 22 | ``` 23 | 24 | # Thanks 25 | All credit goes to the go-socks5 project(https://github.com/armon/go-socks5) 26 | -------------------------------------------------------------------------------- /main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | 7 | "github.com/armon/go-socks5" 8 | ) 9 | 10 | func main() { 11 | var IPAddress, Port string 12 | 13 | if len(os.Args) == 2 { 14 | IPAddress = "localhost" 15 | Port = os.Args[1] 16 | } else if len(os.Args) == 3 { 17 | IPAddress = os.Args[1] 18 | Port = os.Args[2] 19 | } else { 20 | fmt.Println("syntax: ") 21 | fmt.Println(" Binds to the specified IP and port") 22 | fmt.Println(" Binds to localhost and the specified port") 23 | return 24 | } 25 | 26 | conf := &socks5.Config{} 27 | server, err := socks5.New(conf) 28 | if err != nil { 29 | panic(err) 30 | } 31 | 32 | if err := server.ListenAndServe("tcp", IPAddress+":"+Port); err != nil { 33 | panic(err) 34 | } 35 | } 36 | --------------------------------------------------------------------------------