summaryrefslogtreecommitdiff
path: root/client/main.go
diff options
context:
space:
mode:
authoratanarjuat <atanarjuat@example.com>2022-05-29 18:11:46 +0200
committeratanarjuat <atanarjuat@example.com>2022-05-29 18:25:26 +0200
commite5067a84ee12230dbfa02778df7d49c74dc39dea (patch)
treec6bea2b9489eadff06b0f985ec4c7960b2cb85eb /client/main.go
parentce4b0fb6fb69ffc61bc4fb21b508a6a23b811d55 (diff)
pass kcp dialer to socks5 proxy
Diffstat (limited to 'client/main.go')
-rw-r--r--client/main.go21
1 files changed, 10 insertions, 11 deletions
diff --git a/client/main.go b/client/main.go
index 80ebb35..5cdfa4f 100644
--- a/client/main.go
+++ b/client/main.go
@@ -9,7 +9,7 @@ import (
"os"
"0xacab.org/leap/obfsvpn"
- socks5 "github.com/armon/go-socks5"
+ "0xacab.org/leap/obfsvpn/socks5"
"github.com/xtaci/kcp-go"
)
@@ -52,25 +52,24 @@ func main() {
}
// TODO make this configurable via a Config struct
- // TODO make sure we're disabling the crypto options for KCP
+ // TODO make sure we're disabling all the crypto options for KCP
if os.Getenv("KCP") == "1" {
dialer.DialFunc = func(network, address string) (net.Conn, error) {
+ log.Printf("Dialing kcp://%s\n", address)
return kcp.Dial(address)
}
}
- socksConf := &socks5.Config{
- Dial: dialer.Dial,
- }
+ addr := net.JoinHostPort(socksHost, socksPort)
- server, err := socks5.New(socksConf)
- if err != nil {
- panic(err)
+ server := &socks5.Server{
+ Addr: addr,
+ BindIP: "127.0.0.1",
+ Dial: dialer.Dial,
}
- addr := net.JoinHostPort(socksHost, socksPort)
- fmt.Printf("[+] Started socks5 proxy at %s\n", addr)
- if err := server.ListenAndServe("tcp", addr); err != nil {
+ fmt.Printf("[+] Starting socks5 proxy at %s\n", addr)
+ if err := server.ListenAndServe(); err != nil {
panic(err)
}
}