Skip to content

[Feature] Add IPv4-only network option (#13332) - #13632

Open
JensvanDijk wants to merge 6 commits into
TeamNewPipe:devfrom
JensvanDijk:feature/ipv4-only
Open

[Feature] Add IPv4-only network option (#13332)#13632
JensvanDijk wants to merge 6 commits into
TeamNewPipe:devfrom
JensvanDijk:feature/ipv4-only

Conversation

@JensvanDijk

Copy link
Copy Markdown

What is it?

  • Bugfix (user facing)
  • Feature (user facing)
  • Codebase improvement (dev facing)
  • Meta improvement to the project (dev facing)

Description of the changes in your PR

Added a network settings toggle to allow users to disable IPv6 and use only IPv4 for network requests. This solves issues where:

  • YouTube forces CAPTCHA on IPv6 networks
  • Network switches (WiFi → cellular) cause crashes due to protocol mismatch
  • Some ISPs drop IPv6 packets

Implementation:

  • New "Network" settings category with "IPv4 only" toggle
  • Custom DNS resolver (IPv4Dns.java) that filters AAAA records when enabled
  • Immediate effect by clearing OkHttp connection pool on background thread
  • Fallback: Uses original addresses if no IPv4 found (prevents connection failure)

Before/After Screenshots/Screen Record

  • Before: No IPv6 control available
  • After: Settings > Network > IPv4 only (toggle switch visible)

Fixes the following issue(s)

Relies on the following changes

  • None

APK testing

The APK can be found by going to the "Checks" tab below the title. On the left pane, click on "CI", scroll down to "artifacts" and click "app" to download the zip file which contains the debug APK of this PR.

Due diligence

@github-actions github-actions Bot added the size/medium PRs with less than 250 changed lines label Jun 22, 2026
@ItsJustSomeDude

Copy link
Copy Markdown

Is this intentionally designed such that if the system DNS only returns IPv6 address(es), that they will be used even if IPv4 Only is enabled? Or is that an oversight?

@absurdlylongusername

Copy link
Copy Markdown
Member

Please note: the contribution guidelines currently say at the top that currently we are only focusing on bugfixes and refactors right now.

That being said, this feature steers closer to bugfix than feature as it strives to bypass YT anti-bot checks.

But for future reference: as per the guidelines, you must state your intent to open a PR for issues before opening a PR

If you want to help out with an existing bug report or feature request, leave a comment on that issue saying you want to try your hand at it.

For these reasons, please do not be surprised if this is not reviewed any time soon, and do not be surprised if it gets closed as we were not given opportunity to vet your implementation approach before you started working on it, so your solution may not be viable.

@JensvanDijk

Copy link
Copy Markdown
Author

Is this intentionally designed such that if the system DNS only returns IPv6 address(es), that they will be used even if IPv4 Only is enabled? Or is that an oversight?

You're right that was an oversight, not intentional. Fixed it in fb6dfe8 and 4a0906d, it now throws an UnknownHostException if no IPv4 address is found instead of falling back to IPv6.

@JensvanDijk

Copy link
Copy Markdown
Author

Please note: the contribution guidelines currently say at the top that currently we are only focusing on bugfixes and refactors right now.

That being said, this feature steers closer to bugfix than feature as it strives to bypass YT anti-bot checks.

But for future reference: as per the guidelines, you must state your intent to open a PR for issues before opening a PR

If you want to help out with an existing bug report or feature request, leave a comment on that issue saying you want to try your hand at it.

For these reasons, please do not be surprised if this is not reviewed any time soon, and do not be surprised if it gets closed as we were not given opportunity to vet your implementation approach before you started working on it, so your solution may not be viable.

About contributing, I should have mentioned this on the issue first before starting. I couldn't comment or assign myself without prior contributions to the repo, so should've reached out on Matrix or e-mail instead. Happy to keep working on it if there's interest, but I get it if it doesn't get reviewed right away or ends up closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/medium PRs with less than 250 changed lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: Network option to disable use of IPv6

3 participants