generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 31
kn: HostResolver #1229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
kn: HostResolver #1229
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 7911a94
chore: release 1.3.30
aws-sdk-kotlin-ci 7085c8a
chore: bump snapshot version to 1.3.31-SNAPSHOT
aws-sdk-kotlin-ci 4575023
misc: enhance support for replayable instances of `InputStream` (#1197)
lauzadis b0a4bac
chore: release 1.3.31
aws-sdk-kotlin-ci 80f4538
chore: bump snapshot version to 1.3.32-SNAPSHOT
aws-sdk-kotlin-ci e9d16a9
fix: CBOR protocol test assertions / blob serialization (#1198)
lauzadis 48849a1
fix: correctly serialize subset of shape's members when configured (#…
lauzadis ded3a4b
chore: release 1.3.32
aws-sdk-kotlin-ci d97e8ba
chore: bump snapshot version to 1.3.33-SNAPSHOT
aws-sdk-kotlin-ci 78f17f3
chore: add *-main to branch workflows (#1209)
ianbotsf d06ee0a
chore: add .kotlin/ to .gitignore (#1208)
ianbotsf d2e7c91
chore: smithy version bump (#1213)
0marperez 5a2df8f
chore: release 1.3.33
aws-sdk-kotlin-ci 003633b
chore: bump snapshot version to 1.3.34-SNAPSHOT
aws-sdk-kotlin-ci 5f5ec8f
feat: add `AuthTokenGenerator` (#1212)
lauzadis 3fe1b5e
chore: release 1.3.34
aws-sdk-kotlin-ci 0bba308
chore: bump snapshot version to 1.3.35-SNAPSHOT
aws-sdk-kotlin-ci 52e4439
misc: merge v1.4 into main (#1218)
0marperez e0c25d6
feat: support default checksums (#1191)
0marperez 14e0958
chore: release 1.4.0
aws-sdk-kotlin-ci ed95d7b
chore: bump snapshot version to 1.4.1-SNAPSHOT
aws-sdk-kotlin-ci a4ace35
fix: add 0.9.x aws-crt-kotlin transform (#1220)
lauzadis 15e5f0c
fix: Ensure `Host` header is included when signing auth tokens (#1222)
lauzadis 447ac10
chore: release 1.4.1
aws-sdk-kotlin-ci 0f8db44
chore: bump snapshot version to 1.4.2-SNAPSHOT
aws-sdk-kotlin-ci 8b33693
fix: address various failing protocol tests (#1223)
lauzadis 03badf9
misc: re-enable `kotlinWarningsAsErrors=true` (#1224)
lauzadis 9f44cdb
fix: ignore hop-by-hop headers when signing requests (#1227)
ianbotsf 97ac447
chore: release 1.4.2
aws-sdk-kotlin-ci b7e50e3
chore: bump snapshot version to 1.4.3-SNAPSHOT
aws-sdk-kotlin-ci df89e93
Implement HostResolver using getaddrinfo
lauzadis 746881d
ktlint
lauzadis be248ae
Upgrade to upload-artifact@v4
lauzadis 5ab633d
Apply iOS simulator fixes from aws-crt-kotlin
lauzadis e6357f9
misc: add telemetry configuration to DefaultAwsSigner (#1226)
xinsong-cui 94e5878
Ignore code 405 on shutdown
lauzadis 2363e26
Address PR feedback. Use shared configureIosSimulatorTasks
lauzadis a47da0a
ktlint
lauzadis 57c52c5
Upgrade Gradle version
lauzadis 272b6a0
Revert "Upgrade Gradle version"
lauzadis 3de8e8c
Revert "Revert "Upgrade Gradle version""
lauzadis 0a5beac
CI
lauzadis 2ba120e
Merge branch 'main' of github.com:smithy-lang/smithy-kotlin into kn-h…
lauzadis aa069f7
CI
lauzadis 334b41c
IgnoreNative
lauzadis 5eb2d76
Revert
lauzadis d0e6c3d
Upgrade to latest build plugin
lauzadis 115a818
Temporarily move iOS simulator config to smithy-kotlin to aid debuggi…
lauzadis c7487fe
ktlint
lauzadis aa2a657
Merge branch 'kn-main' of github.com:smithy-lang/smithy-kotlin into k…
lauzadis a175933
Only run boot and shutdown tasks once
lauzadis c234561
ktlint
lauzadis c325a4c
Upgrade to latest build plugin
lauzadis 044b74c
ktlint
lauzadis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
runtime/runtime-core/common/test/aws/smithy/kotlin/runtime/net/HostResolverTest.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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-
Pairtuples were a bit easier to use in Kotlin but this is a great abstraction.