From ed82e1b6482203542dd49aa674d5c51db29739c1 Mon Sep 17 00:00:00 2001 From: Allan Nava Date: Tue, 31 Jan 2023 12:40:50 +0100 Subject: [PATCH] added insecure tls --- haivision/builder.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/haivision/builder.go b/haivision/builder.go index 0b511fc..31ffd94 100644 --- a/haivision/builder.go +++ b/haivision/builder.go @@ -1,6 +1,7 @@ package haivision import ( + "crypto/tls" "log" "net/http" @@ -8,7 +9,7 @@ import ( ) // 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, @@ -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