<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Amirhossein Hosseinpour</title>
    <description>The latest articles on Forem by Amirhossein Hosseinpour (@amirhp_com).</description>
    <link>https://forem.com/amirhp_com</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F267002%2F29e9771c-2c60-45ab-ae14-e6be7e966e0a.jpg</url>
      <title>Forem: Amirhossein Hosseinpour</title>
      <link>https://forem.com/amirhp_com</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/amirhp_com"/>
    <language>en</language>
    <item>
      <title>TunnelGuard: A Free macOS App to Exclude Domains from Your VPN (Split Tunneling)</title>
      <dc:creator>Amirhossein Hosseinpour</dc:creator>
      <pubDate>Fri, 06 Mar 2026 03:34:05 +0000</pubDate>
      <link>https://forem.com/amirhp_com/tunnelguard-a-free-macos-app-to-exclude-domains-from-your-vpn-split-tunneling-1i4c</link>
      <guid>https://forem.com/amirhp_com/tunnelguard-a-free-macos-app-to-exclude-domains-from-your-vpn-split-tunneling-1i4c</guid>
      <description>&lt;h2&gt;
  
  
  The Problem
&lt;/h2&gt;

&lt;p&gt;If you use a VPN for work, you've probably hit this wall: you're connected to your company VPN, and suddenly your local streaming service, your home NAS, or some dev server you run locally becomes unreachable — or painfully slow — because all traffic is being tunneled.&lt;/p&gt;

&lt;p&gt;Most VPN clients don't give you granular control over what goes through the tunnel. You either tunnel everything or nothing. &lt;strong&gt;Split tunneling&lt;/strong&gt; is the answer, but most apps either don't support it, lock it behind enterprise plans, or make it a nightmare to configure.&lt;/p&gt;

&lt;p&gt;So I built &lt;strong&gt;TunnelGuard&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  What Is TunnelGuard?
&lt;/h2&gt;

&lt;p&gt;TunnelGuard is a native &lt;strong&gt;macOS SwiftUI app&lt;/strong&gt; that lets you define a list of domains and automatically adds static routing rules so those domains bypass your VPN — at the OS level, using &lt;code&gt;route&lt;/code&gt; commands.&lt;/p&gt;

&lt;p&gt;It resolves the IPs for each domain via &lt;code&gt;dig&lt;/code&gt;, then calls:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;route &lt;span class="nt"&gt;-n&lt;/span&gt; add &amp;lt;ip&amp;gt; &amp;lt;gateway&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;No VPN client integration needed. No kernel extensions. No magic. Just pure macOS routing.&lt;/p&gt;




&lt;h2&gt;
  
  
  Features
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Domain-based rules&lt;/strong&gt; — Add any domain, TunnelGuard resolves its IPs and routes them around the VPN&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Auto IP resolution&lt;/strong&gt; via &lt;code&gt;dig&lt;/code&gt; with configurable DNS server&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Gateway auto-detection&lt;/strong&gt; — reads your default route from &lt;code&gt;netstat -nr&lt;/code&gt;, or you set it manually&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Toggle rules on/off&lt;/strong&gt; without deleting them&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Refresh IPs&lt;/strong&gt; on demand (useful for dynamic domains)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Activity log&lt;/strong&gt; — fully selectable, copyable, color-coded terminal-style output&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Launch at startup&lt;/strong&gt; via LaunchAgent&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Menu bar item + Dock icon&lt;/strong&gt; — configurable (Menu Bar Only / Dock Only / Both)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dark / Light / System theme&lt;/strong&gt; — liquid glass UI with proper macOS feel&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Quick access to macOS VPN Settings&lt;/strong&gt; — one click opens System Preferences VPN panel&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No account, no telemetry, no cloud&lt;/strong&gt; — everything stays local&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  How It Works
&lt;/h2&gt;

&lt;p&gt;The core is simple. When you add a domain:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;dig +short domain.com A&lt;/code&gt; resolves the IPs&lt;/li&gt;
&lt;li&gt;For each IP: &lt;code&gt;sudo route -n add &amp;lt;ip&amp;gt; &amp;lt;gateway&amp;gt;&lt;/code&gt; adds a static route that bypasses the VPN tunnel&lt;/li&gt;
&lt;li&gt;On rule toggle-off: &lt;code&gt;sudo route -n delete &amp;lt;ip&amp;gt;&lt;/code&gt; removes it&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The gateway is auto-detected from &lt;code&gt;netstat -nr&lt;/code&gt; or set manually. Routes are session-based by default (cleared on reboot), unless you enable "Apply on launch" which re-applies them every time the app starts.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Sudoers Setup
&lt;/h3&gt;

&lt;p&gt;Since &lt;code&gt;route&lt;/code&gt; requires &lt;code&gt;sudo&lt;/code&gt;, you either get a password prompt every time or set up passwordless sudo for &lt;code&gt;/sbin/route&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;visudo
&lt;span class="c"&gt;# Add:&lt;/span&gt;
%admin &lt;span class="nv"&gt;ALL&lt;/span&gt;&lt;span class="o"&gt;=(&lt;/span&gt;ALL&lt;span class="o"&gt;)&lt;/span&gt; NOPASSWD: /sbin/route
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Tech Stack
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;SwiftUI&lt;/strong&gt; — native macOS UI, macOS 13.0+&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AppKit&lt;/strong&gt; — &lt;code&gt;NSStatusItem&lt;/code&gt; for menu bar, &lt;code&gt;NSTextView&lt;/code&gt; for the log panel&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Swift Concurrency&lt;/strong&gt; — &lt;code&gt;async/await&lt;/code&gt; for IP resolution and rule management&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;UserDefaults&lt;/strong&gt; — persisting rules and settings&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;LaunchAgent plist&lt;/strong&gt; — startup integration&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Shell commands&lt;/strong&gt; — &lt;code&gt;dig&lt;/code&gt;, &lt;code&gt;route&lt;/code&gt;, &lt;code&gt;netstat&lt;/code&gt; via &lt;code&gt;Process()&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;No third-party dependencies. Zero.&lt;/p&gt;




&lt;h2&gt;
  
  
  Screenshot
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbsvjrdbingkn5507732g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbsvjrdbingkn5507732g.png" alt="Exclusion Rules view" width="800" height="603"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Exclusion Rules view&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The UI has a sidebar with Rules / Logs / Settings / About, plus a direct link to macOS VPN Settings that opens &lt;code&gt;x-apple.systempreferences:...?VPN&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The log panel is a native &lt;code&gt;NSTextView&lt;/code&gt; — fully selectable, copyable, color-coded (green = success, orange = warning, red = error).&lt;/p&gt;




&lt;h2&gt;
  
  
  Installation
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Clone&lt;/span&gt;
git clone https://github.com/amirhp-com/TunnelGuard
&lt;span class="nb"&gt;cd &lt;/span&gt;TunnelGuard

&lt;span class="c"&gt;# Build with Swift Package Manager&lt;/span&gt;
swift build &lt;span class="nt"&gt;-c&lt;/span&gt; release

&lt;span class="c"&gt;# Or open in Xcode&lt;/span&gt;
open TunnelGuard.xcodeproj
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then set up sudoers for passwordless route commands (see &lt;code&gt;SUDOERS_SETUP.md&lt;/code&gt; in the repo).&lt;/p&gt;




&lt;h2&gt;
  
  
  Caveats &amp;amp; Honest Limitations
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Routes are IP-based&lt;/strong&gt; — if a domain's IPs change (CDN, dynamic DNS), you need to refresh. The app makes this one click, but it's not automatic yet.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Session-based&lt;/strong&gt; — routes clear on reboot unless you enable "Apply on launch"&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No IPv6 support yet&lt;/strong&gt; — only &lt;code&gt;A&lt;/code&gt; records, not &lt;code&gt;AAAA&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;macOS only&lt;/strong&gt; — obviously&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Links
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Download&lt;/strong&gt;: &lt;a href="https://github.com/amirhp-com/tunnelguard/releases/latest" rel="noopener noreferrer"&gt;Latest Version&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GitHub&lt;/strong&gt;: &lt;a href="https://github.com/amirhp-com" rel="noopener noreferrer"&gt;github.com/amirhp-com&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Website&lt;/strong&gt;: &lt;a href="https://amirhp.com/landing" rel="noopener noreferrer"&gt;amirhp.com/landing&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;Built by &lt;a href="https://amirhp.com/landing" rel="noopener noreferrer"&gt;Amirhossein Hosseinpour&lt;/a&gt; — open to PRs, issues, and feedback.&lt;/p&gt;

&lt;p&gt;If this saves you from VPN headaches, give it a ⭐ on GitHub.&lt;/p&gt;

</description>
      <category>macos</category>
      <category>swift</category>
      <category>vpn</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
