Skip to content

brightdigit/Ngrokit

Repository files navigation

Ngrokit

Swift API for Ngrok Agent API.

SwiftPM Twitter GitHub GitHub issues GitHub Workflow Status

Codecov CodeFactor Grade codebeat badge Code Climate maintainability Code Climate technical debt Code Climate issues

Table of Contents

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

To integrate Ngrokit into your app using SPM, specify it in your Package.swift file:

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:

let client = NgrokClient(transport: URLSession.shared)

For using different transports see the client list at the Swift OpenAPI Generator.

Starting the CLI Process

Start the CLI process by using NgrokProcessCLIAPI:

let cliAPI = NgrokProcessCLIAPI(ngrokPath: "/usr/local/bin/ngrok")
let process = api.process(forHTTPPort: 100)
process.run { let error in
  print(error)
}

Documentation

To learn more, check out the full documentation.

License

This code is distributed under the MIT license. See the LICENSE file for more info.