https://github.com/romantomjak/go-socks
SOCKS (SOCKS4, SOCKS4a, SOCKS5) proxy server written in Go
https://github.com/romantomjak/go-socks
go socks socks-proxy socks4 socks4a socks5
Last synced: 4 months ago
JSON representation
SOCKS (SOCKS4, SOCKS4a, SOCKS5) proxy server written in Go
- Host: GitHub
- URL: https://github.com/romantomjak/go-socks
- Owner: romantomjak
- License: mit
- Created: 2017-08-14T19:26:25.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2022-11-09T08:11:01.000Z (almost 3 years ago)
- Last Synced: 2025-01-23T07:10:00.841Z (9 months ago)
- Topics: go, socks, socks-proxy, socks4, socks4a, socks5
- Language: Go
- Homepage:
- Size: 14.6 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-socks
[](https://travis-ci.org/r00m/go-socks)
[](https://coveralls.io/github/r00m/go-socks?branch=master)
[](https://goreportcard.com/report/github.com/r00m/go-socks)
[](https://github.com/r00m/go-socks/blob/master/LICENSE)SOCKS (SOCKS4, SOCKS4a, SOCKS5) proxy library for Go
---
## Requirements
- Go 1.8
## Client example
```go
package mainimport (
"fmt"
"io""github.com/romantomjak/go-socks"
)func main() {
// 1. connect to a SOCKS server
client, err := socks.NewV4Client("127.0.0.1:1234")
if err != nil {
panic(err)
}// 2. instruct the server to relay connections to golang.org
conn, err := client.Connect("142.250.187.241:80", "roman")
if err != nil {
panic(err)
}
defer conn.Close()// 3. fetch index.html via the relayed connection
fmt.Fprintf(conn, "GET / HTTP/1.0\r\n\r\n")
body, err := io.ReadAll(conn)
if err != nil {
panic(err)
}
fmt.Printf("%s\n", body)
}
```## Testing
```
$ go test
```## License
MIT