Skip to content

Commit

Permalink
initial import
Browse files Browse the repository at this point in the history
  • Loading branch information
jsiebens committed Nov 4, 2021
0 parents commit 76a9839
Showing 17 changed files with 1,132 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/ci-only.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: ci-only

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v2
with:
go-version: ^1.17

- uses: actions/checkout@v2.3.4
with:
fetch-depth: 1

- uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- run: make dist
25 changes: 25 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: release

on:
release:
types: [ created ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v2
with:
go-version: ^1.17

- uses: actions/checkout@v2.3.4
with:
fetch-depth: 1

- run: make dist hash

- uses: skx/github-action-publish-binaries@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: "./dist/*"
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.idea
.vagrant
*.log
dist

inlets-on-fly
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 Johan Siebens

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
23 changes: 23 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
SHELL := bash
Version := $(shell git describe --tags --dirty)
# Version := "dev"
GitCommit := $(shell git rev-parse HEAD)
LDFLAGS := "-s -w -X github.com/jsiebens/inlets-on-fly/pkg/cmd.Version=$(Version) -X github.com/jsiebens/inlets-on-fly/pkg/cmd.GitCommit=$(GitCommit)"
.PHONY: all

.PHONY: build
build:
go build -ldflags $(LDFLAGS)

.PHONY: dist
dist:
mkdir -p dist
GOOS=linux go build -ldflags $(LDFLAGS) -o dist/inlets-on-fly
GOOS=darwin go build -ldflags $(LDFLAGS) -o dist/inlets-on-fly-darwin
GOOS=linux GOARCH=arm GOARM=6 go build -ldflags $(LDFLAGS) -o dist/inlets-on-fly-armhf
GOOS=linux GOARCH=arm64 go build -ldflags $(LDFLAGS) -o dist/inlets-on-fly-arm64
GOOS=windows go build -ldflags $(LDFLAGS) -o dist/inlets-on-fly.exe

.PHONY: hash
hash:
for f in dist/inlets-on-fly*; do shasum -a 256 $$f > $$f.sha256; done
90 changes: 90 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# inlets-on-fly

inlets-on-fly automates the task of creating an [inlets-pro](https://inlets.dev) exit-server (tunnel server) on the [fly.io](https://fly.io) platform.

## prerequisites

inlets-on-fly is actually a little wrapper around flyctl, so make sure you have that CLI installed and that you are authenticated.
- [Installing flyctl](https://fly.io/docs/getting-started/installing-flyctl/)
- [Login To Fly](https://fly.io/docs/getting-started/login-to-fly/)

## example

``` bash
$ inlets-on-fly create --region ams --ports 8080:80,8080:443,5432:10032
Temp dir name: /tmp/inletsfly-885552054

Selected App Name: vast-goblin-6527


New app created: vast-goblin-6527
Region Pool:
ams
Backup Region:
fra
lhr
Secrets are staged for the first deployment
Deploying vast-goblin-6527
==> Validating app configuration
--> Validating app configuration done
Services
TCP 10023 ⇢ 8123
TCP 10032 ⇢ 5432
TCP 80/443 ⇢ 8080
Waiting for remote builder fly-builder-crimson-dust-9853...
==> Creating build context
--> Creating build context done
==> Building image with Docker
--> docker host: 20.10.8 linux x86_64
Sending build context to Docker daemon 422B
Step 1/2 : FROM ghcr.io/inlets/inlets-pro:0.9.1
---> 68840e710735
Step 2/2 : CMD ["tcp", "server", "--auto-tls-san=vast-goblin-6527.fly.dev", "--token-env=TOKEN"]
---> Running in c148498ae9b3
---> 39a98585fc9b
Successfully built 39a98585fc9b
Successfully tagged registry.fly.io/vast-goblin-6527:deployment-1636030837
--> Building image done
==> Pushing image to fly
The push refers to repository [registry.fly.io/vast-goblin-6527]
8345a2e5488b: Preparing
c0d270ab7e0d: Preparing
8345a2e5488b: Mounted from amused-stag-5259
c0d270ab7e0d: Mounted from amused-stag-5259
deployment-1636030837: digest: sha256:5f0d03afb7044731670ba0cd1e20fa5793b4f4d286997b6aea51cb6d5879545c size: 738
--> Pushing image done
Image: registry.fly.io/vast-goblin-6527:deployment-1636030837
Image size: 19 MB
==> Creating release
Release v2 created

You can detach the terminal anytime without stopping the deployment
Monitoring Deployment

v0 is being deployed
ad3148e3: ams running healthy [health checks: 1 total, 1 passing]
--> v0 deployed successfully
==================================================================
inlets PRO TCP (vast-goblin-6527) server summary:

URL: wss://vast-goblin-6527.fly.dev:10023/connect
Auth-token: XuGk0bSsLuf9q3Q2gDcydohXUyOwuwyl1WzU3ep4KkpLA9cjWh0MLpNEtdWEP9ra

Command:

# Obtain a license at https://inlets.dev
# Store it at $HOME/.inlets/LICENSE or use --help for more options

export PORTS="5432,8080,"
export UPSTREAM="localhost"

inlets-pro tcp client \
--url wss://vast-goblin-6527.fly.dev:10023/connect \
--token XuGk0bSsLuf9q3Q2gDcydohXUyOwuwyl1WzU3ep4KkpLA9cjWh0MLpNEtdWEP9ra \
--upstream $UPSTREAM \
--ports $PORTS

To delete:
flyctl destroy vast-goblin-6527

```
15 changes: 15 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module github.com/jsiebens/inlets-on-fly

go 1.17

require (
github.com/alexellis/go-execute v0.5.0
github.com/dustinkirkland/golang-petname v0.0.0-20191129215211-8e5a1ed0cff0
github.com/sethvargo/go-password v0.2.0
github.com/spf13/cobra v1.2.1
)

require (
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
)
Loading

0 comments on commit 76a9839

Please sign in to comment.