Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kataras/tunnel
Public URLs for exposing your local web server
https://github.com/kataras/tunnel
go golang http iris ngrok tunneling
Last synced: 3 months ago
JSON representation
Public URLs for exposing your local web server
- Host: GitHub
- URL: https://github.com/kataras/tunnel
- Owner: kataras
- License: mit
- Created: 2020-07-10T06:58:24.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-12-24T06:22:47.000Z (about 2 years ago)
- Last Synced: 2024-10-14T11:23:55.242Z (3 months ago)
- Topics: go, golang, http, iris, ngrok, tunneling
- Language: Go
- Homepage:
- Size: 22.5 KB
- Stars: 26
- Watchers: 3
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# Tunnel
[![build status](https://img.shields.io/github/actions/workflow/status/kataras/tunnel/ci.yml?style=for-the-badge)](https://github.com/kataras/tunnel/actions) [![report card](https://img.shields.io/badge/report%20card-a%2B-ff3333.svg?style=for-the-badge)](https://goreportcard.com/report/github.com/kataras/tunnel) [![godocs](https://img.shields.io/badge/go-%20docs-488AC7.svg?style=for-the-badge)](https://godoc.org/github.com/kataras/tunnel)
Public URLs for exposing your local web server using [ngrok's API](https://ngrok.com/).
## Installation
The only requirement is the [Go Programming Language](https://golang.org/dl).
```sh
$ go get github.com/kataras/tunnel@latest
```## Getting Started
First of all, navigate to , create an [account](https://dashboard.ngrok.com/signup) and [download](https://dashboard.ngrok.com/get-started/setup) ngrok. Extract the downloaded zip file anywhere you like and _optionally_ add it to your _PATH_ or _NGROK_ system environment variable. Test if installation successfully completed by running the following command:
```sh
$ ngrok version
```Import the package:
```go
package mainimport "github.com/kataras/tunnel"
```Start a new local http Server and expose it to the internet using **just a single new line of code**:
```go
func main() {
// [...http.HandleFunc]srv := &http.Server{Addr: ":8080"}
// 1 LOC:
go fmt.Printf("• Public Address: %s\n", tunnel.MustStart(tunnel.WithServers(srv)))
//
srv.ListenAndServe()
}
```OR
```go
config := tunnel.Configuration{
// AuthToken: "",
// Bin: "C:/ngrok.exe",
// WebInterface: "http://127.0.0.1:4040",
// Region: "eu",
Tunnels: []tunnel.Tunnel{
{Name: "my-app", Addr: ":8080"},
},
}
publicAddrs := tunnel.MustStart(config)
fmt.Printf("• Public Address: %s\n", publicAddrs)
```Example output:
```sh
• Public Address: https://ef02b1377b65.ngrok.io
```> The [Web Interface](https://ngrok.com/docs#inspect) is also available.
Please navigate through [_examples](_examples) directory for more.
## License
This software is licensed under the [MIT License](LICENSE).