feat: Add LAN bypass option to exclude local network traffic from proxying#116
feat: Add LAN bypass option to exclude local network traffic from proxying#116
Conversation
…xying
Add configurable option to bypass SOCKS5 proxy for local network traffic,
allowing users to exclude private network ranges from being proxied.
Changes:
- Add add_lan_passover_filters_v4() to socks_local_router for creating
pass-through filters for private IPv4 subnets (10.0.0.0/8, 172.16.0.0/12,
192.168.0.0/16, 224.0.0.0/24, 169.254.0.0/16)
- Add set_bypass_lan() public method to socks_local_router
- Propagate bypass LAN functionality through socksify_unmanaged and
Socksifier C++/CLI wrapper
- Add "bypassLan" configuration option to app-config.json schema
- Update ProxiFyreSettings to parse and apply the new setting
Usage in app-config.json:
{
"logLevel": "Info",
"bypassLan": true,
"proxies": [...]
}
When enabled, traffic to/from local networks passes through without
being redirected to the SOCKS5 proxy, improving performance for LAN
resources and avoiding routing issues with local services.
Summary of ChangesHello @wiresock, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a significant feature allowing users to configure the proxy to bypass local area network (LAN) traffic. By enabling the new Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a valuable feature to bypass LAN traffic from proxying. The implementation is well-structured, propagating the new bypassLan configuration from the C# application down to the native C++ networking library. The use of std::scoped_lock is a good modernization.
I have a few suggestions for improvement:
- The LAN bypass feature currently only supports IPv4. It would be beneficial to extend this to include IPv6 local traffic as well.
- The IPv4 loopback range (
127.0.0.0/8) should be included in the bypass list. - There is a redundant log message in the C# code that duplicates a log from the C++ library.
Details are in the specific comments.
There was a problem hiding this comment.
Pull request overview
This PR adds a configurable LAN bypass feature that allows local network traffic to skip SOCKS5 proxying, improving performance for LAN resources and avoiding routing issues with local services. The implementation propagates through all application layers from C++ core to C# configuration.
- Adds
add_lan_passover_filters_v4()to create pass-through filters for private IPv4 ranges (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, plus multicast and link-local ranges) - Exposes LAN bypass configuration through
set_bypass_lan()API across C++/CLI and C# layers - Introduces
bypassLanboolean configuration option in app-config.json
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| netlib/src/proxy/socks_local_router.h | Adds add_lan_passover_filters_v4() method to create IPv4 pass-through filters for local network ranges; changes std::lock_guard to std::scoped_lock throughout |
| socksify/socksify_unmanaged.h | Adds set_bypass_lan() method declaration; reorders private member variables; adds [[nodiscard]] attribute to exclude_process_name() |
| socksify/socksify_unmanaged.cpp | Implements set_bypass_lan() wrapper that delegates to proxy router |
| socksify/Socksifier.h | Adds managed SetBypassLan() method with XML documentation |
| socksify/Socksifier.cpp | Implements managed SetBypassLan() wrapper that delegates to unmanaged layer |
| ProxiFyre/Program.cs | Adds BypassLan property to ProxiFyreSettings class and applies the setting during service startup |
- Fix multicast range mask from 255.255.255.0 (/24) to 240.0.0.0 (/4) to properly cover all multicast addresses (224.0.0.0 - 239.255.255.255) - Update Socksifier.h XML documentation with accurate bypassed ranges - Update README.md with bypassLan feature documentation for v2.2.0: - Add feature announcement in introduction - Add bypassLan to configuration properties list - Add dedicated bypassLan section with correct CIDR notation - Update example configuration to include bypassLan option
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Add configurable option to bypass SOCKS5 proxy for local network traffic, allowing users to exclude private network ranges from being proxied.
Changes:
Usage in app-config.json:
{
"logLevel": "Info", "bypassLan": true, "proxies": [...] }
When enabled, traffic to/from local networks passes through without being redirected to the SOCKS5 proxy, improving performance for LAN resources and avoiding routing issues with local services.