Skip to content

feat: Add LAN bypass option to exclude local network traffic from proxying#116

Merged
wiresock merged 3 commits intomainfrom
feature/lan-bypass
Jan 1, 2026
Merged

feat: Add LAN bypass option to exclude local network traffic from proxying#116
wiresock merged 3 commits intomainfrom
feature/lan-bypass

Conversation

@wiresock
Copy link
Copy Markdown
Owner

@wiresock wiresock commented Jan 1, 2026

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.

…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.
Copilot AI review requested due to automatic review settings January 1, 2026 12:31
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @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 bypassLan option, traffic destined for common private IPv4 subnets will no longer be routed through the SOCKS5 proxy. This change is designed to enhance performance when accessing local resources and mitigate potential routing conflicts with services operating within the local network environment.

Highlights

  • LAN Bypass Option: Introduced a new configurable option, "bypassLan", to exclude local network traffic from being routed through the SOCKS5 proxy.
  • Private IPv4 Subnet Filtering: Implemented add_lan_passover_filters_v4() in socks_local_router to establish pass-through filters for standard private IPv4 ranges (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).
  • API Integration: Added set_bypass_lan() methods across socks_local_router, socksify_unmanaged, and the Socksifier C++/CLI wrapper to propagate the LAN bypass functionality.
  • Configuration and Application: Integrated the bypassLan setting into the app-config.json schema and ProxiFyreSettings, with logic in Program.cs to apply the setting at startup.
  • Mutex Refactoring: Updated mutex usage from std::lock_guard to std::scoped_lock in socks_local_router.h for improved exception safety and modern C++ practices.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 bypassLan boolean 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
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@wiresock wiresock merged commit b5c6a4d into main Jan 1, 2026
@wiresock wiresock deleted the feature/lan-bypass branch January 1, 2026 14:17
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