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

Future: Specific network traffic feature #154

Closed
pyamsoft opened this issue Mar 24, 2023 · 4 comments
Closed

Future: Specific network traffic feature #154

pyamsoft opened this issue Mar 24, 2023 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@pyamsoft
Copy link
Owner

Continuing #115

Revisiting this to say, one day, far in the future, it may be possible if we talk with Androids connectivity framework and force traffic to proxy over only a given network type

https://developer.android.com/reference/android/net/Network

This link shows you can bind a socket to an arbitrary network type

Wed have to do something like

Grab current network
Check if network type is whatever we want
Bind the socket we open to the network
Then exchange over the socket

@pyamsoft pyamsoft added the enhancement New feature or request label Mar 24, 2023
@pyamsoft pyamsoft self-assigned this Mar 24, 2023
@pyamsoft pyamsoft changed the title Specific network traffic feature Future: Specific network traffic feature Jul 13, 2023
@pyamsoft
Copy link
Owner Author

Socket from KTOR should be a socketImpl which implements Selectable which has a Channel which should be an nio socket channel, which has a Java Socket which let's us use bindNetwork(Socket) from Android

Maybe

@pyamsoft
Copy link
Owner Author

KTOR doesn't expose Socket until after connect is called, which won't work.

Issue opened with KTOR, we will see. Otherwise, reflection?

@pyamsoft
Copy link
Owner Author

https://github.com/pyamsoft/ktor

Using a custom build of KTOR to expose the socket before the connect call happens (see branch pyamsoft-changes-2.3.12) we are able to implement this feature.

Should come with the next release 48, or 49.

@pyamsoft
Copy link
Owner Author

KTOR 3 has been released and my fork has been updated to accommodate it.

Still to come in the next release, 48 once a few other issues are polished off.

pyamsoft added a commit that referenced this issue Nov 2, 2024
Fixes #154
Fixes #331

Relies on a custom build of KTOR that adds a single "onBeforeConnect"
hook that we use to bind the Socket to the Android network
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant