https://github.com/7c/go-ssclient
Shadowsocks client with error handling and signals
https://github.com/7c/go-ssclient
Last synced: 3 months ago
JSON representation
Shadowsocks client with error handling and signals
- Host: GitHub
- URL: https://github.com/7c/go-ssclient
- Owner: 7c
- Created: 2023-11-11T00:22:49.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-11-11T15:41:21.000Z (over 2 years ago)
- Last Synced: 2025-12-26T09:34:40.435Z (6 months ago)
- Language: Go
- Size: 178 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ssclient for go using go-shadowsocks2
This package is basic wrapper around a version of https://godoc.org/github.com/shadowsocks/go-shadowsocks2/. go-shadowsocks2 does not support acting as a package. This is why i had to take a stable version and build it in this package statically.. Also added kind of error handling for testing purphoses
Connection Error Handling, Timeout Handling has been added with context and go-channels.
# Install
`go get github.com/7c/go-ssclient`
# Usage
## tcp/udp SSClient with socks5 listener
```
ssc, err := shared.NewSSClient("ss://AEAD_CHACHA20_POLY1305:HwhYX94emfSVhMD@217.244.79.108:903", true, time.Second*15)
if err != nil {
log.Fatalln(err)
}
// launch tcp-only and listen on ':1080" socks5
ssc.LaunchWithSocks5(":1080", false)
for {
select {
case <-ssc.Ctx.Done():
color.Green("Disconnected")
os.Exit(1)
case err3 := <-ssc.Channels.ChanError:
color.Red("Errored", err3)
case <-ssc.Channels.ChanTCPReady:
color.Blue("TCP Listener is ready")
_, err3 := ssc.TestSocks5(":1080", "tcp")
if err3 != nil {
color.Yellow("TCP Test failed:%s", err3)
ssc.Disconnect()
}
color.Yellow("TCP Test succeeed")
case <-ssc.Channels.ChanUDPReady:
color.Yellow("UDP Listener is ready")
// ssc.TestSocks5(":1080", "udp")
}
}
```