mirror of
https://github.com/hoppscotch/hoppscotch.git
synced 2026-04-26 01:06:00 +03:00
[PR #5311] [MERGED] feat(desktop): explore random port for IPv6 compat #5153
Labels
No labels
CodeDay
a11y
browser limited
bug
bug fix
cli
core
critical
design
desktop
discussion
docker
documentation
duplicate
enterprise
feature
feature
fosshack
future
good first issue
hacktoberfest
help wanted
i18n
invalid
major
minor
need information
need testing
not applicable to hoppscotch
not reproducible
pull-request
question
refactor
resolved
sandbox
self-host
spam
stale
testmu
wip
wont fix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/hoppscotch#5153
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/hoppscotch/hoppscotch/pull/5311
Author: @CuriousCorrelation
Created: 8/6/2025
Status: ✅ Merged
Merged: 8/8/2025
Merged by: @jamesgeorge007
Base:
patch← Head:desktop-feat-explore-stable-port-selection📝 Commits (1)
fbaa3cffeat(desktop): explore random port for IPv6 compat📊 Changes
4 files changed (+34 additions, -15 deletions)
View changed files
📝
packages/hoppscotch-common/src/components.d.ts(+1 -2)📝
packages/hoppscotch-desktop/src-tauri/Cargo.lock(+25 -11)📝
packages/hoppscotch-desktop/src-tauri/Cargo.toml(+1 -1)📝
packages/hoppscotch-desktop/src-tauri/src/lib.rs(+7 -1)📄 Description
This attempts to resolve app startup failures on Linux systems
where IPv6 is disabled at the kernel level by replacing the dual-stack
port selection logic with network interface discovery.
Closes FE-912
Closes #4962
The current
portpicker-rslibrary uses AND logic requiring both IPv4and IPv6 socket binding to succeed, causing "Cannot find unused port"
errors when IPv6 is disabled via
ipv6.disable=1even though IPv4ports are available and the application only needs IPv4 connectivity
for the local HTTP server.
This affects users who disable IPv6 for VPN compatibility (Outline VPN)
or enterprise security policies where re-enabling IPv6 is not viable.
What's changed
Replaced
portpickerdependency withrandom-portlibrary that usesactual network interface discovery instead of assuming dual-stack
availability. The new implementation discovers available network
interfaces using the
network-interfacecrate, tests only protocolsavailable on the system, and provides fallback behavior when IPv6
is disabled.
From this:
To this:
Implementation
Updated
Cargo.tomlto replaceportpicker = "0.1.1"withrandom-port = "0.1.1"and modified port selection logic insetup_serverfunction insrc/lib.rs. The new implementationmaintains the same port range (15000-25000) and TCP protocol
requirements.
Backwards Compat
The change preserves all existing functionality including server
initialization, port availability checking, and HTTP server binding
with no changes to external API or user experience.
Testing
Testing should verify port selection works on dual-stack systems with
IPv6 enabled, IPv6-disabled systems with
ipv6.disable=1kernelparameter. The implementation should also maintain existing port
conflict detection, and should resolve IPv6 compat issues.
NOTE: The best way to test this works is by simply trying the login flow,
since login server uses random port to fetch the auth tokens.
Notes to reviewers
This is an exploratory fix based on user reports from GitHub issue
#4962. random-port library uses a different approach to port selection
that handles diverse network configs better.
NOTE: Due to the verity of environments, this will be an exploratory PR
rather than a confirmed fix at the moment.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.