-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
194 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
# Ngrokit | ||
|
||
Swift API for Ngrok's Local API. | ||
|
||
[![SwiftPM](https://img.shields.io/badge/SPM-Linux%20%7C%20iOS%20%7C%20macOS%20%7C%20watchOS%20%7C%20tvOS-success?logo=swift)](https://swift.org) | ||
[![Twitter](https://img.shields.io/badge/[email protected]?style=flat)](http://twitter.com/brightdigit) | ||
![GitHub](https://img.shields.io/github/license/brightdigit/Ngrokit) | ||
![GitHub issues](https://img.shields.io/github/issues/brightdigit/Ngrokit) | ||
![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/brightdigit/Ngrokit/Ngrokit.yml?label=actions&logo=github&?branch=main) | ||
|
||
[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fbrightdigit%2FNgrokit%2Fbadge%3Ftype%3Dswift-versions)](https://swiftpackageindex.com/brightdigit/Ngrokit) | ||
[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fbrightdigit%2FNgrokit%2Fbadge%3Ftype%3Dplatforms)](https://swiftpackageindex.com/brightdigit/Ngrokit) | ||
|
||
|
||
<!-- | ||
[![Codecov](https://img.shields.io/codecov/c/github/brightdigit/Ngrokit)](https://codecov.io/gh/brightdigit/Ngrokit) | ||
--> | ||
[![CodeFactor Grade](https://img.shields.io/codefactor/grade/github/brightdigit/Ngrokit)](https://www.codefactor.io/repository/github/brightdigit/Ngrokit) | ||
[![codebeat badge](https://codebeat.co/badges/91d512f0-ab30-42f9-9791-02add3278171)](https://codebeat.co/projects/github-com-brightdigit-Ngrokit-main) | ||
[![Code Climate maintainability](https://img.shields.io/codeclimate/maintainability/brightdigit/Ngrokit)](https://codeclimate.com/github/brightdigit/Ngrokit) | ||
[![Code Climate technical debt](https://img.shields.io/codeclimate/tech-debt/brightdigit/Ngrokit?label=debt)](https://codeclimate.com/github/brightdigit/Ngrokit) | ||
[![Code Climate issues](https://img.shields.io/codeclimate/issues/brightdigit/Ngrokit)](https://codeclimate.com/github/brightdigit/Ngrokit) | ||
[![Reviewed by Hound](https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg)](https://houndci.com) | ||
|
||
# Table of Contents | ||
|
||
* [Introduction](#introduction) | ||
* [Requirements](#requirements) | ||
* [Installation](#installation) | ||
* [Server Installation](#server-installation) | ||
* [Client Installation](#client-installation) | ||
* [Bonjour vs Ngrok](#bonjour-vs-ngrok) | ||
* [Using Bonjour](#using-bonjour) | ||
* [Using Ngrok](#using-ngrok) | ||
* [License](#license) | ||
|
||
# Requirements | ||
|
||
**Apple Platforms** | ||
|
||
- Xcode 16.0 or later | ||
- Swift 6.0 or later | ||
- iOS 17 / watchOS 10.0 / tvOS 17 / macOS 14 or later deployment targets | ||
|
||
**Linux** | ||
|
||
- Ubuntu 20.04 or later | ||
- Swift 6.0 or later | ||
|
||
# Installation | ||
|
||
Sublimation has two components: Server and Client. You can check out the SublimationDemoApp Xcode project for an example. | ||
|
||
To integrate **Sublimation** into your app using SPM, specify it in your Package.swift file: | ||
|
||
```swift | ||
let package = Package( | ||
... | ||
dependencies: [ | ||
.package(url: "https://github.com/brightdigit/Ngrokit.git", from: "1.0.0") | ||
], | ||
targets: [ | ||
.target( | ||
name: "YourServerApp", | ||
dependencies: [ | ||
.product(name: "Ngrokit", package: "Ngrokit"), ... | ||
]), | ||
... | ||
] | ||
) | ||
``` | ||
|
||
# Usage | ||
|
||
Ngrokit is an easy to use Swift library for call the local Ngrok API as well as running the `ngrok` command. | ||
|
||
### Connecting to the Local REST API | ||
|
||
Using the ``NgrokClient`` to connect to your local development server: | ||
|
||
```swift | ||
let client = NgrokClient(transport: URLSession.shared) | ||
``` | ||
|
||
For using different transports see the client list at the [Swift OpenAPI Generator](https://github.com/apple/swift-openapi-generator?tab=readme-ov-file#package-ecosystem). | ||
|
||
### Starting the CLI Process. | ||
|
||
Start the CLI process by using ``NgrokProcessCLIAPI``: | ||
|
||
```swift | ||
let cliAPI = NgrokProcessCLIAPI(ngrokPath: "/usr/local/bin/ngrok") | ||
let process = api.process(forHTTPPort: 100) | ||
process.run { let error in | ||
print(error) | ||
} | ||
``` | ||
# License | ||
|
||
This code is distributed under the MIT license. See the [LICENSE](https://github.com/brightdigit/Ngrokit/LICENSE) file for more info. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# ``Ngrokit`` | ||
|
||
Swift API for Ngrok's Local API. | ||
|
||
## Overview | ||
|
||
Ngrokit is an easy to use Swift library for call the local Ngrok API as well as running the `ngrok` command. | ||
|
||
### Connecting to the Local REST API | ||
|
||
Using the ``NgrokClient`` to connect to your local development server: | ||
|
||
```swift | ||
let client = NgrokClient(transport: URLSession.shared) | ||
``` | ||
|
||
For using different transports see the client list at the [Swift OpenAPI Generator](https://github.com/apple/swift-openapi-generator?tab=readme-ov-file#package-ecosystem). | ||
|
||
### Starting the CLI Process. | ||
|
||
Start the CLI process by using ``NgrokProcessCLIAPI``: | ||
|
||
```swift | ||
let cliAPI = NgrokProcessCLIAPI(ngrokPath: "/usr/local/bin/ngrok") | ||
let process = api.process(forHTTPPort: 100) | ||
process.run { let error in | ||
print(error) | ||
} | ||
``` | ||
|
||
## Topics | ||
|
||
### Consuming Ngrok API | ||
|
||
- ``NgrokClient`` | ||
- ``NgrokProcessCLIAPI`` | ||
|
||
### Data Structures | ||
|
||
- ``NgrokTunnel`` | ||
- ``TunnelRequest`` | ||
- ``NgrokTunnelConfiguration`` | ||
|
||
### Errors | ||
|
||
- ``RuntimeError`` | ||
- ``NgrokError`` | ||
- ``TerminationReason`` | ||
|
||
### Process Components | ||
|
||
- ``NgrokProcess`` | ||
- ``NgrokCLIAPI`` | ||
- ``Processable`` | ||
- ``ProcessableProcess`` | ||
- ``Pipable`` | ||
- ``DataHandle`` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters