Merge branch 'main' into lintexit

This commit is contained in:
asmogo 2024-09-01 21:30:57 +02:00 committed by GitHub
commit 4b50d48e78
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 10 additions and 5 deletions

View File

@ -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)

View File

@ -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)
}
}

View File

@ -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()