GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - dgershman/socketzero-ios: iOS proxy demo for SocketZero mobile client - Proof of concept for local HTTP/HTTPS proxy

BranchesTags
Open more actions menu

Latest commit

 

History

2 Commits
2 Commits

Folders and files

NameName
Last commit message
Last commit date
.gitignore
.gitignore
 
 
ContentView.swift
ContentView.swift
 
 
LICENSE
LICENSE
 
 
QUICKSTART.md
QUICKSTART.md
 
 
README.md
README.md
 
 
SocketZeroProxy.swift
SocketZeroProxy.swift
 
 
SocketZeroProxyApp.swift
SocketZeroProxyApp.swift
 
 
create-xcode-project.sh
create-xcode-project.sh
 
 

Repository files navigation

SocketZero iOS Proxy Demo

A minimal iOS app demonstrating a local HTTP/HTTPS proxy for SocketZero.

Parent Project: SocketZero - Zero trust connection utility

Status: 🚧 Proof of Concept - Not production ready

What It Does

  • Runs a local HTTP proxy on localhost:8080
  • Handles CONNECT tunneling for HTTPS (no MITM, just byte forwarding)
  • Shows connection logs in real-time
  • Demonstrates the core concept for SocketZero mobile

How to Test

1. Build & Run in Xcode

  1. Create a new Xcode project:

    • File → New → Project
    • iOS → App
    • Product Name: SocketZeroProxy
    • Interface: SwiftUI
    • Language: Swift
  2. Replace the generated files with these:

    • SocketZeroProxyApp.swift
    • ContentView.swift
    • SocketZeroProxy.swift
  3. Run on iPhone or Simulator (Cmd+R)

2. Configure iOS Proxy

On your iPhone:

  1. Go to Settings
  2. Tap Wi-Fi
  3. Tap (i) next to your connected network
  4. Scroll down to Configure Proxy
  5. Select Manual
  6. Enter:
    • Server: 127.0.0.1
    • Port: 8080
  7. Tap Save

3. Test It

Plain HTTP:

  • Open Safari
  • Go to http://example.com
  • You'll see the demo response from the proxy

HTTPS:

  • Go to https://example.com
  • The proxy will log the CONNECT request
  • (In this demo, it returns 200 OK but doesn't forward - see notes below)

Check Logs:

  • Return to the SocketZero Proxy app
  • See real-time connection logs at the bottom

What's Missing (For Production)

This is a proof of concept. To make it production-ready for SocketZero:

1. WebSocket to Receiver

Add WebSocket connection to your SocketZero receiver:

private func connectToReceiver() {
    var request = URLRequest(url: URL(string: receiverURL)!)
    request.addValue("Bearer \(authToken)", forHTTPHeaderField: "Authorization")
    
    let session = URLSession(configuration: .default)
    webSocket = session.webSocketTask(with: request)
    webSocket?.resume()
    
    receiveMessages()
}

2. Forward Requests

In handleCONNECT and handleHTTP, instead of sending demo responses:

// Send request to receiver
let message = [
    "type": "tunnel_request",
    "target": target,
    "data": data.base64EncodedString()
]
sendWebSocketMessage(message)

3. Pipe Bytes for CONNECT

After 200 Connection Established, pipe encrypted bytes:

connection.receive(...) { data, _, _, _ in
    // Send bytes to receiver via WebSocket
    self.forwardToReceiver(data)
}

// When bytes come back from receiver:
connection.send(content: receiverData, ...)

4. Background Persistence

For production, you'd need:

  • Network Extension (VPN capability) for background operation
  • Or accept foreground-only operation

5. OAuth Flow

Add authentication via Universal Links:

// Handle deep link callback
func handleAuthCallback(url: URL) {
    // Extract token from socketzero://auth/callback?token=...
    let token = extractToken(from: url)
    saveToKeychain(token)
    connectToReceiver()
}

Architecture

iOS Safari
    ↓ (HTTP/CONNECT requests)
Local Proxy (localhost:8080)
    ↓ (WebSocket - TODO)
SocketZero Receiver
    ↓
Target Services

Limitations

  • Foreground only - proxy stops when app backgrounds
  • Manual proxy config - user must configure in Settings
  • No receiver integration - demo responses only
  • HTTPS works but doesn't forward - needs WebSocket implementation

Next Steps

  1. Add WebSocket to receiver (reuse Go protocol)
  2. Implement byte forwarding for CONNECT tunnels
  3. Add OAuth flow via Universal Links
  4. Test with real SocketZero receiver
  5. Consider Network Extension for background operation

Files

  • SocketZeroProxyApp.swift - App entry point
  • ContentView.swift - SwiftUI interface
  • SocketZeroProxy.swift - Proxy server implementation

License

Same as SocketZero parent project.


Built by Rocky 🦝 for Danny @ Radius Method

About

iOS proxy demo for SocketZero mobile client - Proof of concept for local HTTP/HTTPS proxy

Resources

Readme
MIT license
Activity

Stars

1 star

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.