Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Port Forwarder for macOS

🔄 A modern, native macOS port forwarding tool with glass-effect UI. Drop-in replacement for socat on macOS.

macOS Swift License


✨ Features

Feature Description
🖥️ Native macOS App Built with SwiftUI, optimized for macOS 14+ with glass-effect design
📡 TCP & UDP Forward both TCP and UDP traffic simultaneously or independently
🧩 Multi-Rule Manage multiple port forwarding rules with persistent storage
📊 Real-time Stats Live connection count, data transfer monitoring
📝 Log Viewer Built-in log filtering by severity (Info, Success, Warning, Error)
🔔 Menu Bar System status bar integration for quick access
Auto-start Rules can auto-start when the app launches
💾 Persistent All rules saved automatically via UserDefaults

🚀 Quick Start

Download & Install

  1. Download PortForwarder.dmg from the Releases page
  2. Open the DMG and drag PortForwarder.app to your Applications folder
  3. Launch from Launchpad or Spotlight

Create Your First Rule

Equivalent to the socat command:

socat TCP4-LISTEN:2283,fork TCP4:192.168.97.5:2283

In Port Forwarder:

  1. Click + to add a new rule
  2. Fill in:
    • Local IP: 0.0.0.0 (or 127.0.0.1)
    • Local Port: 2283
    • Target IP: 192.168.97.5
    • Target Port: 2283
    • Protocol: ✅ TCP
  3. Click 创建规则 (Create Rule)
  4. Click 启动 (Start)

Done! The port is now being forwarded.


🖼️ Screenshots

The app features a modern macOS glass-effect UI with translucent backgrounds, native sidebar navigation, and clean card-based layouts.

(Screenshots coming in v1.0.1)


🛠️ Build from Source

Requirements

  • macOS 14+ (Sonoma or newer)
  • Xcode 15+ / Swift 6.3+

Build

git clone https://github.com/YOUR_USERNAME/PortForwarder.git
cd PortForwarder
swift build -c release

Package App

# Build the app bundle
mkdir -p build/PortForwarder.app/Contents/MacOS
mkdir -p build/PortForwarder.app/Contents/Resources
cp .build/release/PortForwarder build/PortForwarder.app/Contents/MacOS/
cp Resources/Info.plist build/PortForwarder.app/Contents/

# Create DMG
hdiutil create -volname "Port Forwarder" \
  -srcfolder build/PortForwarder.app \
  -ov -format UDBZ \
  PortForwarder.dmg

📁 Project Structure

PortForwarder/
├── Package.swift              # Swift Package Manager manifest
├── Sources/
│   ├── PortForwarderApp.swift    # App entry point
│   ├── AppDelegate.swift         # NSApplicationDelegate & status bar
│   ├── PortForwarderEngine.swift # TCP/UDP forwarding engine (BSD sockets)
│   ├── ForwardRule.swift         # Data model & persistent storage
│   ├── LogManager.swift          # Log entry management
│   ├── ContentView.swift         # Main window (NavigationSplitView)
│   ├── RuleDetailView.swift      # Rule detail & stats panel
│   ├── RuleEditorSheet.swift     # New rule modal sheet
│   ├── LogView.swift             # Filtered log viewer
│   └── VisualEffectView.swift    # macOS glass effect helpers
├── Resources/
│   └── Info.plist                # App bundle metadata
└── README.md

🔄 Comparison with socat

Capability socat Port Forwarder
TCP forwarding
UDP forwarding
Multiple rules Manual scripts ✅ GUI managed
Persistent config None ✅ Auto-save
Visual monitoring None ✅ Real-time stats
macOS native CLI only ✅ Native app
Menu bar access None ✅ Status bar icon

📝 License

MIT License — see LICENSE for details.


🙏 Credits

Inspired by the original Port-Forwarder project by Lance-He, reimagined as a modern native macOS application.

About

Modern macOS port forwarding tool with glass-effect UI - drop-in replacement for socat

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages