Skip to content

Commit

Permalink
feat: add insecure field in node client
Browse files Browse the repository at this point in the history
  • Loading branch information
ironman0x7b2 committed Jan 30, 2025
1 parent e3dcc8d commit b5e7c17
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 9 additions & 2 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,9 @@ func (c *BaseClient) HTTP() (*http.HTTP, error) {
// NodeClient is a struct for interacting with nodes.
type NodeClient struct {
*BaseClient
addr sentinelhub.NodeAddress
timeout time.Duration
addr sentinelhub.NodeAddress
insecure bool
timeout time.Duration
}

// NewNodeClient creates a new instance of NodeClient.
Expand All @@ -191,6 +192,12 @@ func (c *NodeClient) WithAddr(addr sentinelhub.NodeAddress) *NodeClient {
return c
}

// WithInsecure sets the insecure flag of the NodeClient and returns the updated instance.
func (c *NodeClient) WithInsecure(insecure bool) *NodeClient {
c.insecure = insecure
return c
}

// WithTimeout sets the timeout of the NodeClient and returns the updated instance.
func (c *NodeClient) WithTimeout(timeout time.Duration) *NodeClient {
c.timeout = timeout
Expand Down
2 changes: 1 addition & 1 deletion client/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func (c *NodeClient) do(ctx context.Context, method, url string, reqBody, result
client := &http.Client{
Transport: &http.Transport{
TLSClientConfig: &tls.Config{
InsecureSkipVerify: true,
InsecureSkipVerify: c.insecure,
},
},
}
Expand Down

0 comments on commit b5e7c17

Please sign in to comment.