mirror of
https://github.com/asmogo/nws.git
synced 2025-01-18 10:01:33 +00:00
Merge branch 'main' into lintexit
This commit is contained in:
commit
4b50d48e78
@ -163,6 +163,9 @@ func (nc *NostrConnection) Write(b []byte) (int, error) {
|
||||
|
||||
// Go lang
|
||||
func (nc *NostrConnection) handleNostrWrite(buffer []byte) (int, error) {
|
||||
if nc.ctx.Err() != nil {
|
||||
return 0, fmt.Errorf("context canceled: %w", nc.ctx.Err())
|
||||
}
|
||||
publicKey, relays, err := nc.parseDestination()
|
||||
if err != nil {
|
||||
return 0, fmt.Errorf("could not parse destination: %w", err)
|
||||
|
@ -44,7 +44,7 @@ func DialSocks(options DialOptions, config *config.EntryConfig) func(ctx context
|
||||
} else {
|
||||
publicKey, relays, err = connection.parseDestination()
|
||||
if err != nil {
|
||||
slog.Error("error parsing host", err)
|
||||
slog.Error("error parsing host", "error", err)
|
||||
return nil, fmt.Errorf("error parsing host: %w", err)
|
||||
}
|
||||
}
|
||||
|
@ -3,13 +3,15 @@ package socks5
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/asmogo/nws/netstr"
|
||||
"github.com/asmogo/nws/protocol"
|
||||
"github.com/google/uuid"
|
||||
"io"
|
||||
"net"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/asmogo/nws/netstr"
|
||||
"github.com/asmogo/nws/protocol"
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -193,7 +195,7 @@ func (s *Server) handleConnect(ctx context.Context, conn net.Conn, req *Request,
|
||||
|
||||
dial = netstr.DialSocks(options, s.config.entryConfig)
|
||||
}
|
||||
|
||||
ctx, _ = context.WithTimeout(context.Background(), time.Second*10)
|
||||
target, err := dial(ctx, "tcp", req.realDestAddr.Address())
|
||||
if err != nil {
|
||||
msg := err.Error()
|
||||
|
Loading…
Reference in New Issue
Block a user