[GH-ISSUE #52] Consider Separating API from Use Case #40

Open
opened 2026-03-03 19:11:12 +03:00 by kerem · 8 comments
Owner

Originally created by @Sherlouk on GitHub (Jan 19, 2021).
Original GitHub issue: https://github.com/ProxymanApp/atlantis/issues/52

Originally assigned to: @NghiaTranUIT on GitHub.

Hey @NghiaTranUIT 👋

First off just wanted to say I love Proxyman - I use it personally and it's a breath of fresh air from what feels like an ancient Charles Proxy! 🙌

I just wondered how you felt about the idea of separating Atlantis down into two distinct 'targets' (to use SPM terminology) or 'subspecs' (CocoaPods).

In essence, I have a use case where I want to monitor network traffic as part of a debug monitoring package.

In its simplest form I'd want to register an observer/listener which receives a call with the request/response every time a request is completed. It should work automatically (method swizzling) or through the manual API as per your implementation documentation.

The reason I mention specifically breaking it down into two distinct frameworks is that it'd be nice to not have to include the transporter or bonjour/local network components which would generally improve the amount of use cases?

Thanks 😄

Originally created by @Sherlouk on GitHub (Jan 19, 2021). Original GitHub issue: https://github.com/ProxymanApp/atlantis/issues/52 Originally assigned to: @NghiaTranUIT on GitHub. Hey @NghiaTranUIT 👋 First off just wanted to say I love Proxyman - I use it personally and it's a breath of fresh air from what feels like an ancient Charles Proxy! 🙌 I just wondered how you felt about the idea of separating Atlantis down into two distinct 'targets' (to use SPM terminology) or 'subspecs' (CocoaPods). In essence, I have a use case where I want to monitor network traffic as part of a debug monitoring package. In its simplest form I'd want to register an observer/listener which receives a call with the request/response every time a request is completed. It should work automatically (method swizzling) or through the manual API as per your implementation documentation. The reason I mention specifically breaking it down into two distinct frameworks is that it'd be nice to not have to include the transporter or bonjour/local network components which would generally improve the amount of use cases? Thanks 😄
Author
Owner

@NghiaTranUIT commented on GitHub (Jan 20, 2021):

Hi, Glad to know that you love Proxyman 😄

It's possible to support two targets (SMP):

  • One for only Method Swizzling to automatically capture all traffic and notify the observer
  • One that is a Transport layer (Use Bonjour)

But it's quite complicated to implement it at the moment (since I have a plan to support WS/WSS too).


However, I can quick support:

  • Add a Flag to disable the Bonjour Service
  • Add simple Observer class to Atlantis that you can register.

It doesn't change the structure of the project and it can be implemented easily.

What do you think? Is it fit your case? 🤔

<!-- gh-comment-id:763278998 --> @NghiaTranUIT commented on GitHub (Jan 20, 2021): Hi, Glad to know that you love Proxyman 😄 It's possible to support two targets (SMP): - One for only Method Swizzling to automatically capture all traffic and notify the observer - One that is a Transport layer (Use Bonjour) But it's quite complicated to implement it at the moment (since I have a plan to support WS/WSS too). ------------------------- However, I can quick support: - Add a Flag to disable the Bonjour Service - Add simple Observer class to Atlantis that you can register. It doesn't change the structure of the project and it can be implemented easily. What do you think? Is it fit your case? 🤔
Author
Owner

@Sherlouk commented on GitHub (Jan 20, 2021):

Thanks for the quick response! That'd certainly help support my use case 🙌

We can of course still keep an issue around for a longer-term improvement to break the project down, but it won't be as time critical if we can still carry out our pieces

<!-- gh-comment-id:763465286 --> @Sherlouk commented on GitHub (Jan 20, 2021): Thanks for the quick response! That'd certainly help support my use case 🙌 We can of course still keep an issue around for a longer-term improvement to break the project down, but it won't be as time critical if we can still carry out our pieces
Author
Owner

@NghiaTranUIT commented on GitHub (Jan 21, 2021):

@Sherlouk If you don't mind, please check out this branch (https://github.com/ProxymanApp/atlantis/pull/53)

pod 'atlantis-proxyman', :git => 'https://github.com/ProxymanApp/atlantis.git', :branch => 'feat/better-interface'

From now, you can disable the Bonjour and observe the traffic from its delegate:

// Set from didFinishLaunchingWithOptions
Atlantis.setDelegate(self)
Atlantis.setEnableTransportLayer(false)
Atlantis.start()

extension AppDelegate: AtlantisDelegate {

    func atlantisDidHaveNewPackage(_ package: TrafficPackage) {
        print("New package id=\(package.id)")
        print("Request URL = \(package.request.url), bodyCount=\(package.request.body?.count ?? 0)")
        print("Response code=\(package.response?.statusCode)")
    }
}

Please let me know if it works for you 👍

<!-- gh-comment-id:764204350 --> @NghiaTranUIT commented on GitHub (Jan 21, 2021): @Sherlouk If you don't mind, please check out this branch (https://github.com/ProxymanApp/atlantis/pull/53) ``` pod 'atlantis-proxyman', :git => 'https://github.com/ProxymanApp/atlantis.git', :branch => 'feat/better-interface' ``` From now, you can disable the Bonjour and observe the traffic from its delegate: ```swift // Set from didFinishLaunchingWithOptions Atlantis.setDelegate(self) Atlantis.setEnableTransportLayer(false) Atlantis.start() extension AppDelegate: AtlantisDelegate { func atlantisDidHaveNewPackage(_ package: TrafficPackage) { print("New package id=\(package.id)") print("Request URL = \(package.request.url), bodyCount=\(package.request.body?.count ?? 0)") print("Response code=\(package.response?.statusCode)") } } ``` Please let me know if it works for you 👍
Author
Owner

@Sherlouk commented on GitHub (Jan 21, 2021):

Hey @NghiaTranUIT 👋

Thanks for the quick work! The PR looks perfect for what we need.

Analyzing dependencies
Pre-downloading: `atlantis-proxyman` from `https://github.com/ProxymanApp/atlantis.git`, branch `feat/better-interface`
[!] Failed to load 'atlantis-proxyman' podspec: 
[!] Invalid `atlantis-proxyman.podspec` file: undefined method `swift_versions=' for #<Pod::Specification name="atlantis-proxyman">
Did you mean?  swift_version=
               swift_version.

 #  from /var/folders/3q/2m5qbcmn66lc55t3st59p5_4fw_hpx/T/d20210121-45534-borzj0/atlantis-proxyman.podspec:27
 #  -------------------------------------------
 #    spec.source_files  = 'Sources/*.swift'
 >    spec.swift_versions = ['5.0', '5.1', '5.2', '5.3']
 #  end
 #  -------------------------------------------

Unfortunately I'm getting an unrelated issue when installing the CocoaPod - and we've not yet upgraded to Xcode 12 for the SPM version (in the main project).

I'll download it into a sample project this evening to triple check behaviour and confirm 👍 Sorry for the delay

<!-- gh-comment-id:764649789 --> @Sherlouk commented on GitHub (Jan 21, 2021): Hey @NghiaTranUIT 👋 Thanks for the quick work! The PR looks perfect for what we need. ``` Analyzing dependencies Pre-downloading: `atlantis-proxyman` from `https://github.com/ProxymanApp/atlantis.git`, branch `feat/better-interface` [!] Failed to load 'atlantis-proxyman' podspec: [!] Invalid `atlantis-proxyman.podspec` file: undefined method `swift_versions=' for #<Pod::Specification name="atlantis-proxyman"> Did you mean? swift_version= swift_version. # from /var/folders/3q/2m5qbcmn66lc55t3st59p5_4fw_hpx/T/d20210121-45534-borzj0/atlantis-proxyman.podspec:27 # ------------------------------------------- # spec.source_files = 'Sources/*.swift' > spec.swift_versions = ['5.0', '5.1', '5.2', '5.3'] # end # ------------------------------------------- ``` Unfortunately I'm getting an unrelated issue when installing the CocoaPod - and we've not yet upgraded to Xcode 12 for the SPM version (in the main project). I'll download it into a sample project this evening to triple check behaviour and confirm 👍 Sorry for the delay
Author
Owner

@NghiaTranUIT commented on GitHub (Jan 21, 2021):

Thanks for letting me know. I will upload a better sample project for the Atlantis project in this week. It's easier for other users who would try the Atlantis 👍

<!-- gh-comment-id:764740571 --> @NghiaTranUIT commented on GitHub (Jan 21, 2021): Thanks for letting me know. I will upload a better sample project for the Atlantis project in this week. It's easier for other users who would try the Atlantis 👍
Author
Owner

@Sherlouk commented on GitHub (Jan 21, 2021):

I have also just got it working on an experimental Xcode 12 branch using the SPM integration and it's working beautifully. Huge appreciation for getting that done

<!-- gh-comment-id:764762414 --> @Sherlouk commented on GitHub (Jan 21, 2021): I have also just got it working on an experimental Xcode 12 branch using the SPM integration and it's working **beautifully**. Huge appreciation for getting that done
Author
Owner

@NghiaTranUIT commented on GitHub (Jan 22, 2021):

Glad to know it works for you. I will finalize the PR and bump a version today 😄

<!-- gh-comment-id:765092166 --> @NghiaTranUIT commented on GitHub (Jan 22, 2021): Glad to know it works for you. I will finalize the PR and bump a version today 😄
Author
Owner

@NghiaTranUIT commented on GitHub (Jan 22, 2021):

Just let you know that the PR, which includes a new Example Code as I promise is closed due to a few limitations of SMP #54

<!-- gh-comment-id:765104919 --> @NghiaTranUIT commented on GitHub (Jan 22, 2021): Just let you know that the PR, which includes a new Example Code as I promise is closed due to a few limitations of SMP #54
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/atlantis#40
No description provided.