diff --git a/README.md b/README.md index 39444cc..9d168f0 100644 --- a/README.md +++ b/README.md @@ -11,8 +11,8 @@ NetShears adds a Request interceptor mechanisms to be able to modify the HTTP/HT - [x] Intercept HTTP/HTTPS request header - [x] Intercept HTTP/HTTPS request endpoint +- [x] View traffic logs - [ ] Intercept HTTP/HTTPS response body -- [ ] View traffic logs - [ ] Block HTTP requets ## How it works @@ -32,6 +32,9 @@ func application(_ application: UIApplication, didFinishLaunchingWithOptions lau } ``` + +## Interceptor + Header Modification: ```swift @@ -48,6 +51,51 @@ let endpointModifier = RequestEvaluatorModifierEndpoint(redirectedRequest: endpo NetShears.shared.modify(modifier: endpointModifier) ``` +# Traffic Monitoring + +In order to show network traffics in your app simply call presentNetworkMonitor method and then a view will presented containing traffic logs. + +

+Icon +

+ +## gRPC + +You can view gRPC calls by constructing the Request and Response from GRPC models: + +```swift +public func addGRPC(url: String, + host: String, + requestObject: Data?, + responseObject: Data?, + success: Bool, + statusCode: Int, + statusMessage: String?, + duration: Double?, + HPACKHeadersRequest: [String: String]?, + HPACKHeadersResponse: [String: String]?) +``` +Example + +```swift +// Your GRPC services that is generated from SwiftGRPC +private let client = NoteServiceServiceClient.init(address: "127.0.0.1:12345", secure: false) + + +func insertNote(note: Note, completion: @escaping(Note?, CallResult?) -> Void) { + _ = try? client.insert(note, completion: { (createdNote, result) in + + // Add to atlantis and show it on Proxyman app + NetShears.shared.addGRPC(url: "https://test.com/grpc", + requestObject: try? note.jsonUTF8Data(), + responseObject: try? createdNote.jsonUTF8Data(), + success: result.success, + statusCode: result.statusCode.rawValue, + statusMessage: result.statusMessage) + }) +} +``` + ## Installation ### [Swift Package Manager](https://github.com/apple/swift-package-manager) diff --git a/traffic_screen.png b/traffic_screen.png new file mode 100644 index 0000000..d79e5b9 Binary files /dev/null and b/traffic_screen.png differ