[GH-ISSUE #500] Rewrite ProxymanCore with Swift NIO #497

Open
opened 2026-03-03 19:19:18 +03:00 by kerem · 5 comments
Owner

Originally created by @NghiaTranUIT on GitHub (May 8, 2020).
Original GitHub issue: https://github.com/ProxymanApp/Proxyman/issues/500

Originally assigned to: @NghiaTranUIT on GitHub.

Description

ProxymanCore v1 is built on top of CocoaAsyncSocket, which has some major problems:

  • Don't Support HTTP/2, we have to manually implement it, which is error-prone
  • Not an HTTP Server, so we have to deal with all HTTP Message Parsers
  • CocoaAsyncSocket doesn't seem active anymore. We encountered random crashes from deep inside the socket with no reason. (Ex: Crash in SSL_Handshake, closeSocket, ...)
  • ProxymanCore v1 architecture is not good for extending for future features, such as SOCK Proxy, ReWrite, gRPC...
  • Poor performance in some cases since CocoaAsycnSocket doesn't tend for high-performance network tools with multiple incoming/outcoming requests, response

It's time to move to Swift NIO, which is a cross-platform asynchronous event-driven network application framework for rapid development of maintainable high-performance protocol servers & clients.
Other benefits would be:

Originally created by @NghiaTranUIT on GitHub (May 8, 2020). Original GitHub issue: https://github.com/ProxymanApp/Proxyman/issues/500 Originally assigned to: @NghiaTranUIT on GitHub. ### Description ProxymanCore v1 is built on top of CocoaAsyncSocket, which has some major problems: - Don't Support HTTP/2, we have to manually implement it, which is error-prone - Not an HTTP Server, so we have to deal with all HTTP Message Parsers - CocoaAsyncSocket doesn't seem active anymore. We encountered random crashes from deep inside the socket with no reason. (Ex: Crash in SSL_Handshake, closeSocket, ...) - ProxymanCore v1 architecture is not good for extending for future features, such as SOCK Proxy, ReWrite, gRPC... - Poor performance in some cases since CocoaAsycnSocket doesn't tend for high-performance network tools with multiple incoming/outcoming requests, response It's time to move to [Swift NIO](https://github.com/apple/swift-nio), which is a cross-platform asynchronous event-driven network application framework for rapid development of maintainable high-performance protocol servers & clients. Other benefits would be: - Built-in HTTP Server - Officially support HTTP/2 - Has gRPC 3rd-party - Use BoringSSL so we can get rid of spawn a `openssl` to generate certificates => Suitable for iOS app - Highly reusable on iOS and Linux (Window is possible in the near future) - Battle-testing and active development from Apple Team 🙌 ...... Examples: - HTTP/2: https://github.com/apple/swift-nio-http2 - SSL: https://github.com/apple/swift-nio-ssl - Proxy: https://github.com/apple/swift-nio-examples/tree/master/connect-proxy
Author
Owner

@NghiaTranUIT commented on GitHub (Jun 4, 2020):

Update 1:

Beta : https://proxyman.s3.us-east-2.amazonaws.com/beta/Proxyman_1.24.0_Core_v2_Steaming_Body.dmg

  • Support HTTP/HTTPS/Proxy with Swift NIO
  • Support Map Local
  • Support Mock Testing for Map Local (Able to generate a self-signed cert for fake HTTPS domains)
  • Support Map Remote
  • Support External Proxying
  • Refactor the Core with elegant Models
  • Support Breakpoint (on Request)
  • Support Connection: Keep-Alive / Close
  • Remove all openssl and use BoringSSL to generate programmatically
  • Fetch peer certificates with bundle openSSL-Universal lib
  • ....
<!-- gh-comment-id:638600027 --> @NghiaTranUIT commented on GitHub (Jun 4, 2020): ## Update 1: Beta : https://proxyman.s3.us-east-2.amazonaws.com/beta/Proxyman_1.24.0_Core_v2_Steaming_Body.dmg - Support HTTP/HTTPS/Proxy with Swift NIO - Support Map Local - Support Mock Testing for Map Local (Able to generate a self-signed cert for fake HTTPS domains) - Support Map Remote - Support External Proxying - Refactor the Core with elegant Models - Support Breakpoint (on Request) - Support Connection: Keep-Alive / Close - Remove all `openssl` and use BoringSSL to generate programmatically - Fetch peer certificates with bundle` openSSL-Universal` lib - ....
Author
Owner

@NghiaTranUIT commented on GitHub (Jun 7, 2020):

Update 2

BETA: https://proxyman.s3.us-east-2.amazonaws.com/beta/Proxyman_1.24.0_Proxyman_v2_Swift_NIO_Breakpoint.dmg

  • Support Breakpoint on Requests and Response
  • Refactor Compose window and fix some bugs
  • Finally, remove all AsyncCocoaSocket

Known-issues:

  • Websocket doesn't support yet
<!-- gh-comment-id:640187667 --> @NghiaTranUIT commented on GitHub (Jun 7, 2020): ## Update 2 BETA: https://proxyman.s3.us-east-2.amazonaws.com/beta/Proxyman_1.24.0_Proxyman_v2_Swift_NIO_Breakpoint.dmg - Support Breakpoint on Requests and Response - Refactor Compose window and fix some bugs - Finally, remove all AsyncCocoaSocket ## Known-issues: - Websocket doesn't support yet
Author
Owner

@NghiaTranUIT commented on GitHub (Jun 11, 2020):

Update 4

BETA: https://proxyman.s3.us-east-2.amazonaws.com/beta/Proxyman_1.24.0_Core_v2_Update_4_WebSocket.dmg

  • Support Websocket and Secure Websocket
  • Fix keep-alive connection
  • Improve RequestResponseAccumulator with CircularBuffer
<!-- gh-comment-id:642770135 --> @NghiaTranUIT commented on GitHub (Jun 11, 2020): ## Update 4 BETA: https://proxyman.s3.us-east-2.amazonaws.com/beta/Proxyman_1.24.0_Core_v2_Update_4_WebSocket.dmg - Support Websocket and Secure Websocket - Fix keep-alive connection - Improve RequestResponseAccumulator with CircularBuffer
Author
Owner

@NghiaTranUIT commented on GitHub (Jun 12, 2020):

Update 5 🎉

Beta: https://proxyman.s3.us-east-2.amazonaws.com/beta/Proxyman_1.24.0_Core_v2_Swift_NIO_Update_5.1.dmg

  • Final build for Proxyman V2 with Swift NIO
  • Replace all features from v1
  • Fix WS/WSS schema
<!-- gh-comment-id:643294010 --> @NghiaTranUIT commented on GitHub (Jun 12, 2020): ## Update 5 🎉 Beta: https://proxyman.s3.us-east-2.amazonaws.com/beta/Proxyman_1.24.0_Core_v2_Swift_NIO_Update_5.1.dmg - Final build for Proxyman V2 with Swift NIO - Replace all features from v1 - Fix WS/WSS schema
Author
Owner

@NghiaTranUIT commented on GitHub (Jun 15, 2020):

Final Update

Beta: https://proxyman.s3.us-east-2.amazonaws.com/beta/Proxyman_1.24.0_Swift_NIO_BETA.dmg

<!-- gh-comment-id:644175473 --> @NghiaTranUIT commented on GitHub (Jun 15, 2020): ## Final Update Beta: https://proxyman.s3.us-east-2.amazonaws.com/beta/Proxyman_1.24.0_Swift_NIO_BETA.dmg
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/Proxyman#497
No description provided.