Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
a4734c7
fix: create JMESPATH flattenIfPossible functions for Lists (#1169)
0marperez Dec 16, 2024
7911a94
chore: release 1.3.30
aws-sdk-kotlin-ci Dec 16, 2024
7085c8a
chore: bump snapshot version to 1.3.31-SNAPSHOT
aws-sdk-kotlin-ci Dec 16, 2024
4575023
misc: enhance support for replayable instances of `InputStream` (#1197)
lauzadis Dec 18, 2024
b0a4bac
chore: release 1.3.31
aws-sdk-kotlin-ci Dec 18, 2024
80f4538
chore: bump snapshot version to 1.3.32-SNAPSHOT
aws-sdk-kotlin-ci Dec 18, 2024
e9d16a9
fix: CBOR protocol test assertions / blob serialization (#1198)
lauzadis Dec 18, 2024
48849a1
fix: correctly serialize subset of shape's members when configured (#…
lauzadis Jan 6, 2025
ded3a4b
chore: release 1.3.32
aws-sdk-kotlin-ci Jan 6, 2025
d97e8ba
chore: bump snapshot version to 1.3.33-SNAPSHOT
aws-sdk-kotlin-ci Jan 6, 2025
78f17f3
chore: add *-main to branch workflows (#1209)
ianbotsf Jan 8, 2025
d06ee0a
chore: add .kotlin/ to .gitignore (#1208)
ianbotsf Jan 8, 2025
d2e7c91
chore: smithy version bump (#1213)
0marperez Jan 10, 2025
5a2df8f
chore: release 1.3.33
aws-sdk-kotlin-ci Jan 10, 2025
003633b
chore: bump snapshot version to 1.3.34-SNAPSHOT
aws-sdk-kotlin-ci Jan 10, 2025
5f5ec8f
feat: add `AuthTokenGenerator` (#1212)
lauzadis Jan 10, 2025
3fe1b5e
chore: release 1.3.34
aws-sdk-kotlin-ci Jan 10, 2025
0bba308
chore: bump snapshot version to 1.3.35-SNAPSHOT
aws-sdk-kotlin-ci Jan 10, 2025
52e4439
misc: merge v1.4 into main (#1218)
0marperez Jan 15, 2025
e0c25d6
feat: support default checksums (#1191)
0marperez Jan 15, 2025
14e0958
chore: release 1.4.0
aws-sdk-kotlin-ci Jan 15, 2025
ed95d7b
chore: bump snapshot version to 1.4.1-SNAPSHOT
aws-sdk-kotlin-ci Jan 15, 2025
a4ace35
fix: add 0.9.x aws-crt-kotlin transform (#1220)
lauzadis Jan 16, 2025
15e5f0c
fix: Ensure `Host` header is included when signing auth tokens (#1222)
lauzadis Jan 16, 2025
447ac10
chore: release 1.4.1
aws-sdk-kotlin-ci Jan 16, 2025
0f8db44
chore: bump snapshot version to 1.4.2-SNAPSHOT
aws-sdk-kotlin-ci Jan 16, 2025
8b33693
fix: address various failing protocol tests (#1223)
lauzadis Jan 23, 2025
03badf9
misc: re-enable `kotlinWarningsAsErrors=true` (#1224)
lauzadis Jan 23, 2025
9f44cdb
fix: ignore hop-by-hop headers when signing requests (#1227)
ianbotsf Jan 28, 2025
97ac447
chore: release 1.4.2
aws-sdk-kotlin-ci Jan 28, 2025
b7e50e3
chore: bump snapshot version to 1.4.3-SNAPSHOT
aws-sdk-kotlin-ci Jan 28, 2025
df89e93
Implement HostResolver using getaddrinfo
lauzadis Jan 30, 2025
746881d
ktlint
lauzadis Jan 30, 2025
be248ae
Upgrade to upload-artifact@v4
lauzadis Jan 30, 2025
5ab633d
Apply iOS simulator fixes from aws-crt-kotlin
lauzadis Jan 30, 2025
e6357f9
misc: add telemetry configuration to DefaultAwsSigner (#1226)
xinsong-cui Jan 30, 2025
94e5878
Ignore code 405 on shutdown
lauzadis Jan 31, 2025
2363e26
Address PR feedback. Use shared configureIosSimulatorTasks
lauzadis Jan 31, 2025
a47da0a
ktlint
lauzadis Jan 31, 2025
57c52c5
Upgrade Gradle version
lauzadis Jan 31, 2025
272b6a0
Revert "Upgrade Gradle version"
lauzadis Jan 31, 2025
3de8e8c
Revert "Revert "Upgrade Gradle version""
lauzadis Jan 31, 2025
0a5beac
CI
lauzadis Jan 31, 2025
2ba120e
Merge branch 'main' of github.com:smithy-lang/smithy-kotlin into kn-h…
lauzadis Jan 31, 2025
aa069f7
CI
lauzadis Feb 1, 2025
334b41c
IgnoreNative
lauzadis Feb 3, 2025
5eb2d76
Revert
lauzadis Feb 3, 2025
d0e6c3d
Upgrade to latest build plugin
lauzadis Feb 3, 2025
115a818
Temporarily move iOS simulator config to smithy-kotlin to aid debuggi…
lauzadis Feb 3, 2025
c7487fe
ktlint
lauzadis Feb 3, 2025
aa2a657
Merge branch 'kn-main' of github.com:smithy-lang/smithy-kotlin into k…
lauzadis Feb 3, 2025
a175933
Only run boot and shutdown tasks once
lauzadis Feb 3, 2025
c234561
ktlint
lauzadis Feb 3, 2025
c325a4c
Upgrade to latest build plugin
lauzadis Feb 4, 2025
044b74c
ktlint
lauzadis Feb 4, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ jobs:
shell: bash
run: |
# FIXME K2. Re-enable warnings as errors after this warning is removed: https://youtrack.jetbrains.com/issue/KT-68532
# echo "kotlinWarningsAsErrors=true" >> $GITHUB_WORKSPACE/local.properties
# echo "kotlinWarningsAsErrors=true" >> $GITHUB_WORKSPACE/local.properties
./gradlew -Paws.kotlin.native=false apiCheck
./gradlew -Paws.kotlin.native=false test jvmTest

Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
kotlin-version = "2.1.0"
dokka-version = "1.9.10"

aws-kotlin-repo-tools-version = "0.4.22-kn"
aws-kotlin-repo-tools-version = "0.4.24-kn"

# libs
coroutines-version = "1.9.0"
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
3 changes: 3 additions & 0 deletions runtime/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import aws.sdk.kotlin.gradle.dsl.configurePublishing
import aws.sdk.kotlin.gradle.kmp.*
import aws.sdk.kotlin.gradle.util.typedProp
import org.gradle.kotlin.dsl.withType
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

plugins {
Expand Down Expand Up @@ -112,3 +113,5 @@ subprojects {
}
}
}

configureIosSimulatorTasks()
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
package aws.smithy.kotlin.runtime.net

import kotlinx.coroutines.test.runTest
import kotlin.test.*

class HostResolverTest {
@Test
fun testResolveLocalhost() = runTest {
val addresses = HostResolver.Default.resolve("localhost")
assertTrue(addresses.isNotEmpty())

addresses.forEach { addr ->
assertEquals("localhost", addr.hostname)

val localHostAddr = when (addr.address) {
is IpV4Addr -> IpV4Addr.LOCALHOST
is IpV6Addr -> IpV6Addr.LOCALHOST
}
assertEquals(addr.address, localHostAddr)
}
}

@Test
fun testResolveIpv4Address() = runTest {
val addresses = HostResolver.Default.resolve("127.0.0.1")
assertTrue(addresses.isNotEmpty())

addresses.forEach { addr ->
assertTrue(addr.address is IpV4Addr)
assertContentEquals(byteArrayOf(127, 0, 0, 1), addr.address.octets)
}
}

@Test
fun testResolveIpv6Address() = runTest {
val addresses = HostResolver.Default.resolve("::1")
assertTrue(addresses.isNotEmpty())

addresses.forEach { addr ->
assertTrue(addr.address is IpV6Addr)
val expectedBytes = ByteArray(16) { 0 }
expectedBytes[15] = 1
assertContentEquals(expectedBytes, addr.address.octets)
}
}

@Test
fun testResolveExampleDomain() = runTest {
val addresses = HostResolver.Default.resolve("example.com")
assertNotNull(addresses)
assertTrue(addresses.isNotEmpty())

addresses.forEach { addr ->
assertEquals("example.com", addr.hostname)
when (val ip = addr.address) {
is IpV4Addr -> assertEquals(4, ip.octets.size)
is IpV6Addr -> assertEquals(16, ip.octets.size)
}
}
}

@Test
fun testResolveInvalidDomain() = runTest {
assertFails {
HostResolver.Default.resolve("this-domain-definitely-does-not-exist-12345.local")
}
}

@Test
fun testNoopMethods() {
// Test no-op methods don't throw
val dummyAddr = HostAddress("test.com", IpV4Addr(ByteArray(4)))
val resolver = HostResolver.Default
resolver.reportFailure(dummyAddr)
resolver.purgeCache(null)
resolver.purgeCache(dummyAddr)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,59 @@
*/
package aws.smithy.kotlin.runtime.net

import aws.smithy.kotlin.runtime.InternalApi
import kotlinx.cinterop.*
import platform.posix.*

internal actual object DefaultHostResolver : HostResolver {
actual override suspend fun resolve(hostname: String): List<HostAddress> {
TODO("Not yet implemented")
actual override suspend fun resolve(hostname: String): List<HostAddress> = memScoped {
val hints = alloc<addrinfo>().apply {
ai_family = AF_UNSPEC // Allow both IPv4 and IPv6
ai_socktype = SOCK_STREAM // TCP stream sockets
ai_flags = AI_PASSIVE // For wildcard IP address
}

val result = allocPointerTo<addrinfo>()

try {
// Perform the DNS lookup
val status = getaddrinfo(hostname, null, hints.ptr, result.ptr)
check(status == 0) { "Failed to resolve host $hostname: ${gai_strerror(status)?.toKString()}" }

return generateSequence(result.value) { it.pointed.ai_next }
.map { it.pointed.ai_addr!!.pointed.toIpAddr() }
.map { HostAddress(hostname, it) }
.toList()
} finally {
freeaddrinfo(result.value)
}
}

@OptIn(UnsafeNumber::class)
private fun sockaddr.toIpAddr(): IpAddr {
val (size, addrPtr, constructor) = when (sa_family.toInt()) {
AF_INET -> Triple(
4,
reinterpret<sockaddr_in>().sin_addr.ptr,
{ bytes: ByteArray -> IpV4Addr(bytes) },
)
AF_INET6 -> Triple(
16,
reinterpret<sockaddr_in6>().sin6_addr.ptr,
{ bytes: ByteArray -> IpV6Addr(bytes) },
)
else -> throw IllegalArgumentException("Unsupported sockaddr family $sa_family")
}
Comment on lines +36 to +48
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment: Nice! I wish non-Pair tuples were a bit easier to use in Kotlin but this is a great abstraction.


val ipBytes = ByteArray(size)
memcpy(ipBytes.refTo(0), addrPtr, size.toULong())
return constructor(ipBytes)
}

actual override fun reportFailure(addr: HostAddress) {
TODO("Not yet implemented")
// No-op, same as JVM implementation
}

@InternalApi
actual override fun purgeCache(addr: HostAddress?) {
TODO("Not yet implemented")
// No-op, same as JVM implementation
}
}
Loading