Skip to content

Feat: add per-connection proxy configuration and improve network interface handling - #32

Merged
anmolkapil merged 5 commits into
anmolkapil:mainfrom
Shreyansh-kushw:feat/per-connection-proxy
Oct 29, 2026
Merged

anmolkapil merged 5 commits into
anmolkapil:mainfrom
Shreyansh-kushw:feat/per-connection-proxy

Conversation

@Shreyansh-kushw

Copy link
Copy Markdown
Contributor

Summary

This PR adds per-network proxy configuration and improves Linux network interface detection.

Proxy Support

  • Added a zero-dependency proxy tunnel engine supporting:
    • HTTP CONNECT
    • HTTPS
    • SOCKS5 with RFC 1929 authentication
    • SOCKS4/4a
  • Added interface-bound proxy connections using SO_BINDTODEVICE.
  • Added persistent per-network proxy configuration in app-settings.json.
  • Propagated proxy settings through:
    • ChunkDownloader
    • DownloadManager
    • Latency pinging
  • Added proxy configuration UI to NetworkEditPopover with protocol selection and credentials.
  • Added PROXY badges and tunnel endpoint information to NetworkCard and NetworkRow.
  • Added user-friendly translations for proxy-specific error codes.

Linux Network Handling

  • Added sysfs/udev-based hardware interface detection.
  • Filtered out virtual/container interfaces such as:
    • docker0
    • br-*
    • veth*
  • Updated package.json to allow koffi build scripts required for Linux FFI socket binding.

Motivation

This allows users to configure proxies independently for each network connection while ensuring proxy traffic is bound to the corresponding network interface.

It also prevents virtual container interfaces from appearing as selectable network connections on Linux.

Testing

  • Tested proxy configuration and connection handling across the supported proxy protocols.
  • Verified Linux network interface filtering.
  • Verified koffi build configuration on Linux.

… scripts on Linux

- Query sysfs and udev on Linux to detect hardware interfaces and filter out virtual container bridges (docker0, br-*, veth*, etc.)
- Update package.json allowScripts to include koffi for Linux FFI socket binding
…CKS4)

- Add zero-dependency proxy tunnel engine in proxyTunnel.ts supporting HTTP CONNECT, HTTPS, SOCKS5 (with RFC 1929 auth), and SOCKS4/4a
- Connect proxy tunnels directly over interface-bound sockets (SO_BINDTODEVICE)
- Persist per-network proxy configurations in app-settings.json
- Pipe interface proxy settings through ChunkDownloader, DownloadManager, and latency pinging
- Add proxy configuration section in NetworkEditPopover with protocol switcher and credentials
- Show PROXY badges and tunnel endpoints in NetworkCard and NetworkRow
- Add friendly translations for proxy-specific error codes in format.ts
@anmolkapil

Copy link
Copy Markdown
Owner

@Shreyansh-kushw Thanks for contributing...

Could you please take a look at merge conflicts.
And please also share screenshots of final UI

# Conflicts:
#	package.json
#	src/main/download/chunkDownloader.ts
#	src/main/download/downloadManager.ts
#	src/main/ipc/handlers.ts
#	src/main/network/deviceBinding.ts
#	src/main/network/interfaces.ts
#	src/main/network/latency.ts
#	src/main/settings.ts
#	src/renderer/src/components/NetworkCard.tsx
#	src/renderer/src/components/NetworkRow.tsx
#	src/renderer/src/utils/format.ts
#	src/shared/types.ts
@Shreyansh-kushw

Copy link
Copy Markdown
Contributor Author

Fixed all the merge conflicts.
Here is the updated UI-

image image image

@anmolkapil

Copy link
Copy Markdown
Owner

Hi, this looks great!

Sorry for delayed response.

Here are some UI/UX suggestions from my side. Rest of the things look fine!

Lets not show "proxy" text next to edit icon. We can have some icon to indicate only when proxy is applied.

@anmolkapil

Copy link
Copy Markdown
Owner

@Shreyansh-kushw merging this for now. Will my small UI/UX changes myself

@anmolkapil
anmolkapil merged commit d49abcd into anmolkapil:main Oct 29, 2026
2 of 3 checks passed
@Shreyansh-kushw

Copy link
Copy Markdown
Contributor Author

Hi,
Sorry for not responding on time, I was very busy with my college work these days.
About the UI/UX update, should I work on the modification or are you satisfied with the results?

ysai258 added a commit to ysai258/plexo that referenced this pull request Oct 29, 2026
…ne's USB serial id on top

anmolkapil#32 now hides Docker bridges and veths in getLinuxAdapters, so this branch's
own filtering is dropped. What's left: a USB adapter's id is usb:<serial>,
so a tethered phone keeps its saved name and color across replugs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
ysai258 added a commit to ysai258/plexo that referenced this pull request Oct 29, 2026
anmolkapil#32 named the button after the network ("Edit Office fibre") instead of
"Edit network", so the settings test couldn't find it and failed on main.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
alisinaee referenced this pull request in alisinaee/Lightning Oct 30, 2026
…rface handling (#32)

* fix(network): exclude virtual container bridges and allow koffi build scripts on Linux

- Query sysfs and udev on Linux to detect hardware interfaces and filter out virtual container bridges (docker0, br-*, veth*, etc.)
- Update package.json allowScripts to include koffi for Linux FFI socket binding

* feat: add per-connection proxy configuration (HTTP, HTTPS, SOCKS5, SOCKS4)

- Add zero-dependency proxy tunnel engine in proxyTunnel.ts supporting HTTP CONNECT, HTTPS, SOCKS5 (with RFC 1929 auth), and SOCKS4/4a
- Connect proxy tunnels directly over interface-bound sockets (SO_BINDTODEVICE)
- Persist per-network proxy configurations in app-settings.json
- Pipe interface proxy settings through ChunkDownloader, DownloadManager, and latency pinging
- Add proxy configuration section in NetworkEditPopover with protocol switcher and credentials
- Show PROXY badges and tunnel endpoints in NetworkCard and NetworkRow
- Add friendly translations for proxy-specific error codes in format.ts

* fix(proxy): enforce per-interface proxy tunnels and prevent direct connection fallback

* Fixing errors

(cherry picked from commit d49abcde758be40a1249820263e60c6914efa790)
Arpit-Khandelwal added a commit to Arpit-Khandelwal/plexo that referenced this pull request Nov 4, 2026
Conflicts were in downloadManager.ts, httpTransfer.ts and transfer.ts: the transfer host gets both getProxyForInterface (anmolkapil#32) and refreshLink, an attempt keeps its own url alongside the split's startOffset and end (anmolkapil#154), and a completed attempt still records the link it was served from before the block is squared up the split way.
dxmoc added a commit to dxmoc/plexo that referenced this pull request Nov 4, 2026
A proxy set on a network (anmolkapil#32) now applies to news server connections too,
as it does to HTTP downloads.
Arpit-Khandelwal pushed a commit that referenced this pull request Nov 4, 2026
* feat: NZB downloads from a Usenet news server

Adds Usenet as a third download source next to web links and torrents.
An NZB (indexer link, .nzb file, or one dropped on the window) becomes a
normal Plexo download: its articles are fetched over connections to the
user's news server, shared evenly over the networks in use, decoded
(yEnc, CRC-32 checked) and written straight into their files.

- NNTP client (greeting, AUTHINFO, BODY by message ID) on routed sockets,
  TLS on by default
- yEnc decoder in TypeScript, no native modules
- articles the server lacks (430) or keeps sending damaged are marked
  missing and left as gaps; a download with none available fails
- news server settings with a connection test; the password is sealed
  with safeStorage, kept in memory only where there is no keychain
- pause, resume and relaunch keep finished articles
- e2e tests against a local mock news server

Download only: par2 repair and unpacking are left to the user's tools.

* feat: open an NZB download's server settings from its page

A wrong password or address can be put right where the download shows it:
the download's page and its failure page name the server and open its
settings. Adds an e2e test for fixing a rejected sign-in and starting the
download again.

* feat: show an indexer's refusal instead of downloading it

Indexer APIs answer in XML either way: an NZB they don't label as one, or
an error (a wrong API key, the daily limit reached) where the NZB would
be. An XML answer is now read far enough to tell: an NZB is taken as
one, an error is shown as the indexer gave it.

* fix: treat a news server that refuses connections as unreachable

Errors opening the socket (refused, timed out, failed TLS handshake) weren't
connection errors, so each counted as a strike: connections were retired and
replaced without end, the network never showed as unreachable, and the
download sat at 0 B/s without saying why.

* fix: keep what a server sends first after a proxy handshake

The proxy handshake read the socket with a 'data' listener, which left it
flowing once the listener was removed: bytes that came with or right after
the proxy's answer were emitted with no one listening and lost. HTTP never
noticed, since the client speaks first; an NNTP server's greeting did.
Read in paused mode instead, so the rest stays buffered for the caller.

* feat: route NNTP connections through the network's proxy

A proxy set on a network (#32) now applies to news server connections too,
as it does to HTTP downloads.

* feat: note that the password is sent unencrypted without SSL

* fix: use the network's proxy for NZB downloads

The TransferHost built for NZB runtimes had no getProxyForInterface,
so NNTP connections always went direct. Adds an e2e test with a SOCKS5
proxy on the network.

* fix: count NZB downloads in the taskbar progress

Leave missing articles out of the wanted bytes, like skipped torrent
pieces, so the bar can reach 100%.

---------

Co-authored-by: Anmol Kapil <[email protected]>
@Shreyansh-kushw
Shreyansh-kushw deleted the feat/per-connection-proxy branch November 11, 2026 11:28
Arpit-Khandelwal pushed a commit that referenced this pull request Nov 15, 2026
* Linux: hide Docker bridges, and know a USB-tethered phone across replugs

Docker's bridges (br-<id>, docker0) and libvirt's virbr0 have addresses, so
they were listed as networks that never carry anything. A bridge is now
skipped when it is virtual and nothing but veths/taps are plugged into it.

Android USB tethering picks a random MAC each time the phone is plugged in,
so systemd names it enx<mac> afresh and its saved name and color were lost.
A USB network device now takes its id from the USB serial (usb:<serial>)
and its label from the device's product name ("SAMSUNG Android"). A serial
two devices share falls back to the device name, so ids stay unique.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* e2e: find a network's edit button by its new name

#32 named the button after the network ("Edit Office fibre") instead of
"Edit network", so the settings test couldn't find it and failed on main.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* e2e: format the edit-button lookup as Prettier lays it out

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Carry a USB adapter's saved settings over to its usb:<serial> id

Names, colors, limits and proxies are keyed by network id, so giving a USB
adapter with a serial the id usb:<serial> would have lost them on upgrade,
and a network with a proxy would have quietly gone direct. What's saved under
the device name now moves to the new id when none is saved there. Main does
it before the network is used, so it also happens with no window open; the
window does the same to its copy, which it saves whole.

getLinuxAdapters takes the sys root and moves out of interfaces.ts, which
loads Electron, so it can be tested over a fake /sys tree.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants