Skip to content

Commit

Permalink
take back socks5 client
Browse files Browse the repository at this point in the history
  • Loading branch information
zyxkad committed Oct 2, 2023
1 parent ba9963c commit 18ade74
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions client/desktop/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import (
"time"

"github.com/kmcsr/wpn"
"github.com/kmcsr/wpn/l2tp"
"github.com/kmcsr/wpn/socks5"
"github.com/kmcsr/wpn/wssocks"
)

func main(){
Expand All @@ -23,7 +24,7 @@ func main(){
{
ping, err := client.Ping()
if err != nil {
// loger.Fatalf("Cannot ping the server: %v", err)
loger.Fatalf("Cannot ping the server: %v", err)
}
loger.Infof("Connected to the server: ping=%v", ping)
}
Expand All @@ -42,16 +43,20 @@ func main(){
}
}
}()
server := &l2tp.Server{
// Addr: config.SocksAddr,
Logger: loger,
shandler := &wssocks.Handler{
Client: client,
}
server := &socks5.Server{
Addr: config.SocksAddr,
Handler: shandler,
DialTimeout: time.Second * 30,
}

go func(){
defer close(done)
loger.Infof("Starting L2TP server at %q", server.Addr)
loger.Infof("Starting Socks5 server at %q", server.Addr)
if err := server.ListenAndServe(); err != nil && !errors.Is(err, net.ErrClosed) {
loger.Fatalf("Error when running L2TP server: %v", err)
loger.Fatalf("Error when running Socks5 server: %v", err)
}
}()

Expand Down

0 comments on commit 18ade74

Please sign in to comment.