mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 16:59:12 +00:00
feat: download clients skip tls verify option (#181)
This commit is contained in:
parent
8bf43dc1e0
commit
bb9e51f9d3
10 changed files with 166 additions and 150 deletions
|
@ -2,6 +2,7 @@ package qbittorrent
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"crypto/tls"
|
||||
"fmt"
|
||||
"io"
|
||||
"mime/multipart"
|
||||
|
@ -32,12 +33,13 @@ type Client struct {
|
|||
}
|
||||
|
||||
type Settings struct {
|
||||
Hostname string
|
||||
Port uint
|
||||
Username string
|
||||
Password string
|
||||
SSL bool
|
||||
protocol string
|
||||
Hostname string
|
||||
Port uint
|
||||
Username string
|
||||
Password string
|
||||
TLS bool
|
||||
TLSSkipVerify bool
|
||||
protocol string
|
||||
}
|
||||
|
||||
func NewClient(s Settings) *Client {
|
||||
|
@ -58,10 +60,19 @@ func NewClient(s Settings) *Client {
|
|||
}
|
||||
|
||||
c.settings.protocol = "http"
|
||||
if c.settings.SSL {
|
||||
if c.settings.TLS {
|
||||
c.settings.protocol = "https"
|
||||
}
|
||||
|
||||
if c.settings.TLSSkipVerify {
|
||||
//skip TLS verification
|
||||
tr := &http.Transport{
|
||||
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
|
||||
}
|
||||
|
||||
c.http.Transport = tr
|
||||
}
|
||||
|
||||
return c
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue