Skip to content

Commit

Permalink
added insecure tls
Browse files Browse the repository at this point in the history
  • Loading branch information
Allan-Nava authored Jan 31, 2023
1 parent 48ab16a commit ed82e1b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion haivision/builder.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
package haivision

import (
"crypto/tls"
"log"
"net/http"

"github.com/go-resty/resty/v2"
)

// Builder is used to build a new haivision client
func BuildHaivision(url string, debug bool, username string, password string, header *HeaderConfigurator) (*Haivision, error) {
func BuildHaivision(url string, debug bool, username string, password string, header *HeaderConfigurator, insecure *bool) (*Haivision, error) {
// init haivision
haivisionClient := &Haivision{
Url: url,
Expand All @@ -18,6 +19,10 @@ func BuildHaivision(url string, debug bool, username string, password string, he
//--------------------------------------------------------------------------------
// Host URL for all request. So you can use relative URL in the request
haivisionClient.restClient.SetBaseURL(url)
if insecure != nil {
haivisionClient.restClient.SetTLSClientConfig(&tls.Config{InsecureSkipVerify: true})
log.Println("Insecure mode is enabled for the haivision client ")
}
respSessionId, err := haivisionClient.InitSession(username, password)
if err != nil {
return nil, err
Expand Down

0 comments on commit ed82e1b

Please sign in to comment.