From 102c79f53575d1c7812fb3290ead9a44be82da5b Mon Sep 17 00:00:00 2001 From: eyedeekay Date: Sun, 1 Jun 2025 17:07:23 -0400 Subject: [PATCH] Fixes the DatagramSession implementation --- datagram/dial_test.go | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/datagram/dial_test.go b/datagram/dial_test.go index 02954ff..e28bc8a 100644 --- a/datagram/dial_test.go +++ b/datagram/dial_test.go @@ -101,7 +101,12 @@ func TestDatagramSession_DialContext(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) defer cancel() - conn, err := dialerSession.DialContext(ctx, listener.Addr().String()) + addr, err := dialerSession.sam.Lookup(listener.Addr().String()) + if err != nil { + t.Fatalf("Failed to lookup listener address: %v", err) + } + + conn, err := dialerSession.DialContext(ctx, addr.Base64()) if err != nil { t.Fatalf("Failed to dial with context: %v", err) } @@ -126,11 +131,16 @@ func TestDatagramSession_DialContext_Timeout(t *testing.T) { defer session.Close() // Use very short timeout to force timeout - ctx, cancel := context.WithTimeout(context.Background(), 1*time.Millisecond) + ctx, cancel := context.WithTimeout(context.Background(), 1*time.Microsecond) defer cancel() + addr, err := session.sam.Lookup("idk.i2p") + if err != nil { + t.Fatalf("Failed to lookup address: %v", err) + } + // Try to dial with short timeout - conn, err := session.DialContext(ctx, "idk.i2p") + conn, err := session.DialContext(ctx, addr.Base64()) // Should get context deadline exceeded error if err == nil {