Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Close connection on broken tunnel, private key is not mandatory #159

Merged
merged 18 commits into from
Sep 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions .github/actions/check/Dockerfile

This file was deleted.

27 changes: 0 additions & 27 deletions .github/actions/check/README.md

This file was deleted.

54 changes: 0 additions & 54 deletions .github/actions/check/cov-diff.html.tpl

This file was deleted.

11 changes: 0 additions & 11 deletions .github/actions/check/cov-diff.txt.tpl

This file was deleted.

95 changes: 0 additions & 95 deletions .github/actions/check/entrypoint.sh

This file was deleted.

23 changes: 23 additions & 0 deletions .github/workflows/ci-master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: CI Master

on:
push:
branches: [ master ]

jobs:
check:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17

- name: Build
run: make build

- name: Test
run: make test
23 changes: 23 additions & 0 deletions .github/workflows/ci-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: CI PR

on:
pull_request:
branches: [ master ]

jobs:
check:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17

- name: Build
run: make build

- name: Test
run: make test
12 changes: 0 additions & 12 deletions .github/workflows/push.yml

This file was deleted.

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[![CI](https://github.com/davrodpin/mole/actions/workflows/ci-master.yml/badge.svg)](https://github.com/davrodpin/mole/actions/workflows/ci-master.yml)
[![Documentation](https://godoc.org/github.com/davrodpin/mole?status.svg)](http://godoc.org/github.com/davrodpin/mole)
# [Mole](https://davrodpin.github.io/mole/)

Expand Down
18 changes: 15 additions & 3 deletions cmd/misc_rpc.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package cmd

import (
"context"
"encoding/json"
"fmt"
"os"

"github.com/davrodpin/mole/mole"
"github.com/davrodpin/mole/rpc"

log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -32,15 +34,25 @@ var (
return nil
},
Run: func(cmd *cobra.Command, arg []string) {
resp, err := mole.Rpc(id, method, params)
resp, err := rpc.CallById(context.Background(), id, method, params)
if err != nil {
log.WithError(err).WithFields(log.Fields{
"id": id,
}).Error("error executing remote procedure.")

os.Exit(1)
}

json, err := json.MarshalIndent(resp, "", " ")
if err != nil {
log.WithError(err).WithFields(log.Fields{
"id": id,
}).Error("error executing remote procedure.")

os.Exit(1)
}

fmt.Printf(resp)
fmt.Printf("%s\n", string(json))
},
}
)
Expand Down
60 changes: 60 additions & 0 deletions cmd/show_instances.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package cmd

import (
"fmt"
"os"

"github.com/davrodpin/mole/mole"

log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)

var (
showInstancesCmd = &cobra.Command{
Use: "instances [name]",
Short: "Shows runtime information about application instances",
Long: `Shows runtime information about application instances.

Only instances with rpc enabled will be shown by this command.`,
Args: func(cmd *cobra.Command, args []string) error {
if len(args) > 0 {
id = args[0]
}

return nil
},
Run: func(cmd *cobra.Command, arg []string) {
var err error
var formatter mole.Formatter

if id == "" {
formatter, err = mole.ShowInstances()
} else {
formatter, err = mole.ShowInstance(id)
}

if err != nil {
log.WithError(err).WithFields(log.Fields{
"id": id,
}).Error("could not retrieve information about application instance(s)")
os.Exit(1)
}

out, err := formatter.Format("toml")
if err != nil {
log.WithError(err).WithFields(log.Fields{
"id": id,
}).Error("error converting output")
os.Exit(1)
}

fmt.Printf("%s\n", out)

},
}
)

func init() {
showCmd.AddCommand(showInstancesCmd)
}
1 change: 1 addition & 0 deletions cmd/start_local.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Destination endpoints are adrresess that can be reached from the jump server.

err := client.Start()
if err != nil {
log.WithError(err).Error("error starting mole")
os.Exit(1)
}
},
Expand Down
Loading