Skip to content
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

Incoming parcels from a public endpoint are refused #44

Closed
gnarea opened this issue Mar 8, 2021 · 3 comments · Fixed by #45
Closed

Incoming parcels from a public endpoint are refused #44

gnarea opened this issue Mar 8, 2021 · 3 comments · Fixed by #45
Labels
bug Something isn't working released

Comments

@gnarea
Copy link
Member

gnarea commented Mar 8, 2021

https://github.com/relaycorp/relaynet-endpoint-android/blob/95a47a627f31fc4d5715b029ea7e342839b7e6d3/lib/src/main/java/tech/relaycorp/relaydroid/messaging/IncomingMessage.kt#L35-L42

    tech.relaycorp.relaydroid.endpoint.UnknownThirdPartyEndpointException: Unknown third party endpoint with address 093da70e1e872848d2a4d44b91d55950b8555207859d7e2cc7c45de3ed78ef5f4 for first party endpoint 054954c0bc152f793d531fbef18e9533a0c826101fd15302a48964946e747fc5b
        at tech.relaycorp.relaydroid.messaging.IncomingMessage$Companion.build$lib_release(IncomingMessage.kt:38)
        at tech.relaycorp.relaydroid.messaging.ReceiveMessages$collectParcels$$inlined$mapNotNull$1$2.emit(Collect.kt:147)
        at kotlinx.coroutines.flow.internal.SafeCollectorKt$emitFun$1.invoke(SafeCollector.kt:15)
        at kotlinx.coroutines.flow.internal.SafeCollectorKt$emitFun$1.invoke(Unknown Source:4)
        at kotlinx.coroutines.flow.internal.SafeCollector.emit(SafeCollector.kt:77)
        at kotlinx.coroutines.flow.internal.SafeCollector.emit(SafeCollector.kt:59)
        at tech.relaycorp.poweb.PoWebClient.collectAndAckParcels(PoWebClient.kt:224)
        at tech.relaycorp.poweb.PoWebClient$collectAndAckParcels$1.invokeSuspend(Unknown Source:12)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
        at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:571)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:678)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:665)

I'm getting that in relaycorp/awala-ping-android#14

@gnarea gnarea added the bug Something isn't working label Mar 8, 2021
@gnarea
Copy link
Member Author

gnarea commented Mar 8, 2021

This is the problem:

https://github.com/relaycorp/relaynet-endpoint-android/blob/95a47a627f31fc4d5715b029ea7e342839b7e6d3/lib/src/main/java/tech/relaycorp/relaydroid/endpoint/ThirdPartyEndpoint.kt#L20-L21

isPublicAddress(thirdPartyAddress) is always going to return false because we're always passing a private address -- Which is the only address we have. We won't have access to the sender's public address (if any) from the parcel.

So I think we'll have to use a single lookup key: The private address. And then return a PublicThirdPartyEndpoint or PrivateThirdPartyEndpoint, depending on whether the endpoint has a public address.

@gnarea
Copy link
Member Author

gnarea commented Mar 8, 2021

Hmm, actually, we do need the ability to look up the endpoint by public address, if we know that address.

What we lack is the ability to look it up if we only have the private address.

@github-actions
Copy link

github-actions bot commented Mar 8, 2021

🎉 This issue has been resolved in version 1.1.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released
Projects
None yet
1 participant