feat: allow insecure connections on deployment to some self-hosted services

This commit is contained in:
Fu Diwei
2025-03-07 21:04:32 +08:00
parent 29dda4ec66
commit 1e2e88e299
33 changed files with 250 additions and 81 deletions

View File

@@ -35,7 +35,7 @@ func (c *Client) WithTimeout(timeout time.Duration) *Client {
return c
}
func (c *Client) WithTlsConfig(config *tls.Config) *Client {
func (c *Client) WithTLSConfig(config *tls.Config) *Client {
c.client.SetTLSClientConfig(config)
return c
}

View File

@@ -2,6 +2,7 @@ package btpanelsdk
import (
"crypto/md5"
"crypto/tls"
"encoding/hex"
"encoding/json"
"fmt"
@@ -34,6 +35,11 @@ func (c *Client) WithTimeout(timeout time.Duration) *Client {
return c
}
func (c *Client) WithTLSConfig(config *tls.Config) *Client {
c.client.SetTLSClientConfig(config)
return c
}
func (c *Client) generateSignature(timestamp string) string {
keyMd5 := md5.Sum([]byte(c.apiKey))
keyMd5Hex := strings.ToLower(hex.EncodeToString(keyMd5[:]))

View File

@@ -1,6 +1,7 @@
package safelinesdk
import (
"crypto/tls"
"encoding/json"
"fmt"
"strings"
@@ -31,6 +32,11 @@ func (c *Client) WithTimeout(timeout time.Duration) *Client {
return c
}
func (c *Client) WithTLSConfig(config *tls.Config) *Client {
c.client.SetTLSClientConfig(config)
return c
}
func (c *Client) sendRequest(path string, params interface{}) (*resty.Response, error) {
url := c.apiHost + path
req := c.client.R().