commit
ed75eae386
|
@ -108,6 +108,7 @@ $ brew install https://raw.githubusercontent.com/moul/ssh2docker/master/contrib/
|
|||
* Add an error if the go version is lower than 1.5
|
||||
* Flexible parsing of the input URL
|
||||
* Add tests
|
||||
* Support of `--skip-tls-verify`
|
||||
|
||||
[full commits list](https://github.com/moul/gotty-client/compare/v1.3.0...master)
|
||||
|
||||
|
|
|
@ -28,6 +28,11 @@ func main() {
|
|||
Usage: "Enable debug mode",
|
||||
EnvVar: "GOTTY_CLIENT_DEBUG",
|
||||
},
|
||||
cli.BoolFlag{
|
||||
Name: "skip-tls-verify",
|
||||
Usage: "Skip TLS verify",
|
||||
EnvVar: "SKIP_TLS_VERIFY",
|
||||
},
|
||||
}
|
||||
|
||||
app.Action = Action
|
||||
|
@ -55,6 +60,10 @@ func Action(c *cli.Context) {
|
|||
logrus.Fatalf("Cannot create client: %v", err)
|
||||
}
|
||||
|
||||
if c.Bool("skip-tls-verify") {
|
||||
client.SkipTLSVerify = true
|
||||
}
|
||||
|
||||
// loop
|
||||
if err = client.Loop(); err != nil {
|
||||
logrus.Fatalf("Communication error: %v", err)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package gottyclient
|
||||
|
||||
import (
|
||||
"crypto/tls"
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
|
@ -80,6 +81,7 @@ type Client struct {
|
|||
Output io.Writer
|
||||
QuitChan chan struct{}
|
||||
QuitChanClosed bool
|
||||
SkipTLSVerify bool
|
||||
}
|
||||
|
||||
type querySingleType struct {
|
||||
|
@ -104,6 +106,11 @@ func (c *Client) GetAuthToken() (string, error) {
|
|||
req, err := http.NewRequest("GET", target.String(), nil)
|
||||
req.Header = *header
|
||||
client := http.Client{}
|
||||
if c.SkipTLSVerify {
|
||||
client.Transport = &http.Transport{
|
||||
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
|
||||
}
|
||||
}
|
||||
resp, err := client.Do(req)
|
||||
if err != nil {
|
||||
return "", err
|
||||
|
@ -146,6 +153,9 @@ func (c *Client) Connect() error {
|
|||
return err
|
||||
}
|
||||
logrus.Debugf("Connecting to websocket: %q", target.String())
|
||||
if c.SkipTLSVerify {
|
||||
c.Dialer.TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
|
||||
}
|
||||
conn, _, err := c.Dialer.Dial(target.String(), *header)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
Loading…
Reference in New Issue