Tunnel implementation, allow using ssh on connection screen

This commit is contained in:
Dan Sosedoff
2016-01-14 19:50:01 -06:00
parent fb66acebc3
commit f0f447857f
11 changed files with 229 additions and 93 deletions

View File

@@ -8,10 +8,12 @@ import (
"time"
"github.com/gin-gonic/gin"
"github.com/sosedoff/pgweb/pkg/bookmarks"
"github.com/sosedoff/pgweb/pkg/client"
"github.com/sosedoff/pgweb/pkg/command"
"github.com/sosedoff/pgweb/pkg/connection"
"github.com/sosedoff/pgweb/pkg/shared"
)
var (
@@ -67,6 +69,7 @@ func GetSessions(c *gin.Context) {
}
func Connect(c *gin.Context) {
var sshInfo *shared.SSHInfo
url := c.Request.FormValue("url")
if url == "" {
@@ -82,7 +85,11 @@ func Connect(c *gin.Context) {
return
}
cl, err := client.NewFromUrl(url)
if c.Request.FormValue("ssh") != "" {
sshInfo = parseSshInfo(c)
}
cl, err := client.NewFromUrl(url, sshInfo)
if err != nil {
c.JSON(400, Error{err.Error()})
return