From a54d6e2ab1934e57f34e4b7140480ee243e740a1 Mon Sep 17 00:00:00 2001 From: eyedeekay Date: Fri, 3 Oct 2025 12:18:24 -0400 Subject: [PATCH] Add UDP port configuration to NewDatagramSession and NewRawSession methods --- compatibility_test.go | 2 +- datagram_test.go | 6 +++--- example_test.go | 2 +- primary_datagram_test.go | 2 +- sessions_test.go | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/compatibility_test.go b/compatibility_test.go index 7b6e691e5..8257dd4f2 100644 --- a/compatibility_test.go +++ b/compatibility_test.go @@ -398,7 +398,7 @@ func TestSAM3CompatibilityIntegration(t *testing.T) { { name: "DatagramSessionPattern", test: func(t *testing.T) { - session, err := sam.NewDatagramSession("compat-datagram-"+RandString(), keys, Options_Small) + session, err := sam.NewDatagramSession("compat-datagram-"+RandString(), keys, Options_Small, 0) if err != nil { t.Errorf("Datagram session creation failed: %v", err) return diff --git a/datagram_test.go b/datagram_test.go index 1c06187db..dc342eb1d 100644 --- a/datagram_test.go +++ b/datagram_test.go @@ -26,7 +26,7 @@ func Test_DatagramServerClient(t *testing.T) { // fmt.Println("\tServer: My address: " + keys.Addr().Base32()) fmt.Println("\tServer: Creating tunnel") // ds, err := sam.NewDatagramSession("DGserverTun", keys, []string{"inbound.length=0", "outbound.length=0", "inbound.lengthVariance=0", "outbound.lengthVariance=0", "inbound.quantity=1", "outbound.quantity=1"}, 0) - ds, err := sam.NewDatagramSession("DGserverTun", keys, []string{"inbound.length=0", "outbound.length=0", "inbound.lengthVariance=0", "outbound.lengthVariance=0", "inbound.quantity=1", "outbound.quantity=1"}) + ds, err := sam.NewDatagramSession("DGserverTun", keys, []string{"inbound.length=0", "outbound.length=0", "inbound.lengthVariance=0", "outbound.lengthVariance=0", "inbound.quantity=1", "outbound.quantity=1"}, 0) if err != nil { fmt.Println("Server: Failed to create tunnel: " + err.Error()) t.Fail() @@ -47,7 +47,7 @@ func Test_DatagramServerClient(t *testing.T) { } fmt.Println("\tClient: Creating tunnel") // ds2, err := sam2.NewDatagramSession("DGclientTun", keys, []string{"inbound.length=0", "outbound.length=0", "inbound.lengthVariance=0", "outbound.lengthVariance=0", "inbound.quantity=1", "outbound.quantity=1"}, 0) - ds2, err := sam2.NewDatagramSession("DGclientTun", keys, []string{"inbound.length=0", "outbound.length=0", "inbound.lengthVariance=0", "outbound.lengthVariance=0", "inbound.quantity=1", "outbound.quantity=1"}) + ds2, err := sam2.NewDatagramSession("DGclientTun", keys, []string{"inbound.length=0", "outbound.length=0", "inbound.lengthVariance=0", "outbound.lengthVariance=0", "inbound.quantity=1", "outbound.quantity=1"}, 0) if err != nil { c <- false return @@ -105,7 +105,7 @@ func ExampleDatagramSession() { // See the example Option_* variables. // dg, err := sam.NewDatagramSession("DGTUN", keys, Options_Small, 0) - dg, err := sam.NewDatagramSession("DGTUN", keys, Options_Small) + dg, err := sam.NewDatagramSession("DGTUN", keys, Options_Small, 0) if err != nil { fmt.Println(err.Error()) return diff --git a/example_test.go b/example_test.go index 5bc95ecb8..f4b27ec67 100644 --- a/example_test.go +++ b/example_test.go @@ -119,7 +119,7 @@ func ExampleSAM_NewDatagramSession() { } // Create a datagram session for authenticated messaging - session, err := sam.NewDatagramSession("udp-app", keys, sam3.Options_Small) + session, err := sam.NewDatagramSession("udp-app", keys, sam3.Options_Small, 0) if err != nil { log.Printf("Failed to create datagram session: %v", err) return diff --git a/primary_datagram_test.go b/primary_datagram_test.go index 33384f83b..67ee14a75 100644 --- a/primary_datagram_test.go +++ b/primary_datagram_test.go @@ -55,7 +55,7 @@ func Test_PrimaryDatagramServerClient(t *testing.T) { } fmt.Println("\tClient: Creating tunnel") // ds2, err := sam2.NewDatagramSession("PRIMARYClientTunnel", keys, []string{"inbound.length=0", "outbound.length=0", "inbound.lengthVariance=0", "outbound.lengthVariance=0", "inbound.quantity=1", "outbound.quantity=1"}, 0) - ds2, err := sam2.NewDatagramSession("PRIMARYClientTunnel", keys, []string{"inbound.length=0", "outbound.length=0", "inbound.lengthVariance=0", "outbound.lengthVariance=0", "inbound.quantity=1", "outbound.quantity=1"}) + ds2, err := sam2.NewDatagramSession("PRIMARYClientTunnel", keys, []string{"inbound.length=0", "outbound.length=0", "inbound.lengthVariance=0", "outbound.lengthVariance=0", "inbound.quantity=1", "outbound.quantity=1"}, 0) if err != nil { c <- false return diff --git a/sessions_test.go b/sessions_test.go index 1e2901179..960307390 100644 --- a/sessions_test.go +++ b/sessions_test.go @@ -198,7 +198,7 @@ func TestSAMSessionMethods(t *testing.T) { t.Fatalf("Failed to generate I2P keys: %v", err) } - session, err := sam.NewDatagramSession("test-datagram-"+RandString(), keys, Options_Default) + session, err := sam.NewDatagramSession("test-datagram-"+RandString(), keys, Options_Default, 0) if err != nil { t.Errorf("NewDatagramSession failed: %v", err) return @@ -573,7 +573,7 @@ func TestSessionMethodSignatures(t *testing.T) { t.Fatalf("Failed to generate keys: %v", err) } - session, err := sam.NewDatagramSession("sig-test-datagram-"+RandString(), keys, Options_Small) + session, err := sam.NewDatagramSession("sig-test-datagram-"+RandString(), keys, Options_Small, 0) if err != nil { t.Errorf("NewDatagramSession signature test failed: %v", err) } else {