diff --git a/Networking/Sources/MsQuicSwift/NetAddr.swift b/Networking/Sources/MsQuicSwift/NetAddr.swift index 4476976a..50b3caf5 100644 --- a/Networking/Sources/MsQuicSwift/NetAddr.swift +++ b/Networking/Sources/MsQuicSwift/NetAddr.swift @@ -113,6 +113,7 @@ private func parseIpv6Addr(_ address: String) -> (String, UInt16)? { } private func parseIpv4Addr(_ address: String) -> (String, UInt16)? { + print(address) let parts = address.split(separator: ":") guard parts.count == 2 else { return nil diff --git a/Networking/Tests/MsQuicSwiftTests/QuicListenerTests.swift b/Networking/Tests/MsQuicSwiftTests/QuicListenerTests.swift index 6414ab7b..394c246a 100644 --- a/Networking/Tests/MsQuicSwiftTests/QuicListenerTests.swift +++ b/Networking/Tests/MsQuicSwiftTests/QuicListenerTests.swift @@ -42,13 +42,14 @@ struct QuicListenerTests { handler: serverHandler, registration: registration, configuration: serverConfiguration, - listenAddress: NetAddr(ipAddress: "127.0.0.1", port: 0), + listenAddress: NetAddr(ipAddress: "127.0.0.1", port: 0)!, alpns: [Data("testalpn".utf8)] ) let listenAddress = try listener.listenAddress() - #expect(listenAddress.ipAddress == "127.0.0.1") - #expect(listenAddress.port != 0) + let (ipAddress, port) = listenAddress.getAddressAndPort() + #expect(ipAddress == "127.0.0.1") + #expect(port != 0) // create connection to listener @@ -82,10 +83,12 @@ struct QuicListenerTests { } }.first! + let (ipAddress2, _) = info.remoteAddress.getAddressAndPort() + #expect(info.negotiatedAlpn == Data("testalpn".utf8)) #expect(info.serverName == "127.0.0.1") #expect(info.localAddress == listenAddress) - #expect(info.remoteAddress.ipAddress == "127.0.0.1") + #expect(ipAddress2 == "127.0.0.1") let stream2 = try serverConnection.createStream() try stream2.send(data: Data("other test data 2".utf8)) diff --git a/Networking/Tests/NetworkingTests/PKCS12Tests.swift b/Networking/Tests/NetworkingTests/PKCS12Tests.swift index 6b2a01a3..a884b6de 100644 --- a/Networking/Tests/NetworkingTests/PKCS12Tests.swift +++ b/Networking/Tests/NetworkingTests/PKCS12Tests.swift @@ -45,7 +45,7 @@ struct PKCS12Tests { handler: serverHandler, registration: registration, configuration: serverConfiguration, - listenAddress: NetAddr(ipAddress: "127.0.0.1", port: 0), + listenAddress: NetAddr(ipAddress: "127.0.0.1", port: 0)!, alpns: [Data("testalpn".utf8)] )