百科.dev
全部条目AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
K

killswitch

> 安全
开源

适用于 macOS 的 VPN 杀死开关

193 stars0 点赞2 次浏览
访问官网GitHub

工具介绍

适用于 macOS 的 VPN 杀死开关

killswitch

VPN kill switch for macOS. Blocks all outgoing traffic when the VPN connection drops, preventing your real IP from leaking.

How it works

When enabled, killswitch loads pf firewall rules that only allow traffic through the VPN tunnel. If the VPN disconnects, the tunnel interface disappears but the firewall rules remain — blocking all internet traffic until the VPN reconnects or the kill switch is disabled.

Rules are written to /tmp/killswitch.pf.conf and loaded with pfctl. The system default /etc/pf.conf is never modified.

Usage

Show network interfaces, public IP, and detected VPN peer:

$ killswitch

Enable the kill switch (requires root):

$ sudo killswitch -e

Disable and restore default firewall rules:

$ sudo killswitch -d

Print the firewall rules without applying them:

$ killswitch --print

Options

Flag Description
--leak Allow ICMP (ping) and DNS requests outside the VPN
--local Allow local network traffic
--ipv4 Manually specify the VPN peer IP (auto-detected if omitted)
-v, -vv Verbose / debug output

Examples

Enable with DNS leak and local network access:

$ sudo killswitch -e --leak --local

Specify the VPN peer IP manually:

$ sudo killswitch -e --ipv4 203.0.113.1

Preview rules in debug mode:

$ killswitch --print --leak -vv

VPN detection

The VPN gateway IP is auto-detected using multiple methods (in order):

  1. sysctl — reads the kernel routing table directly
  2. netstat — parses routes with UGSH/UGSc flags
  3. scutil — queries macOS Network Extension services (works with WireGuard, ProtonVPN, etc.)
  4. ifconfig — extracts peer addresses from tunnel interfaces

If auto-detection fails, use --ipv4 to specify the VPN peer IP manually.

Build from source

Requires Rust:

$ cargo build --release
$ sudo cp target/release/killswitch /usr/local/bin/

Development

$ just test       # format check + clippy + tests
$ just fmt        # check formatting
$ just clippy     # lint all targets

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Rustfirewallkillswitchleakmacos

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类安全
定价开源

> 相关工具

O
OWASP ZAP
开源 Web 应用安全扫描器
O
owasp-wstg-tracker
Simple web app to track OWASP WSTG security testing progress
H
homebridge-mi-gateway-security
XiaoMi Gateway Security plugin for HomeBridge.