chengxilo opened a new pull request, #2957:
URL: https://github.com/apache/iggy/pull/2957

   ## Which issue does this PR close?
   
   <!--
   We generally require a GitHub issue to be filed for all bug fixes and 
enhancements. You can link an issue to this PR using the GitHub syntax. For 
example `Closes #123` indicates that this PR will close issue #123.
   -->
   
   N/A
   
   ## Rationale
   
   <!--
   Why is this change needed? If the issue explains it well, a one-liner is 
fine.
   -->
   
   Currently, the TLS options requiring a user to call `WithTLS(true)` in 
addition to `WithTLSDomain` or `WithTLSCAFile`. This is redundant and 
error-prone. If a user provides a domain or a CA file, the intent to use TLS is 
already clear. 
   
   We can use nested option pattern for it, therefore we can create client like 
this:
   ```go
        cli, err := client.NewIggyClient(
                client.WithTcp(
                        tcp.WithServerAddress(connectAddr),
                        tcp.WithTLS(
                                tcp.WithTLSDomain("localhost"),
                                tcp.WithCAFile(caFile),
                        ),
                ),
        )
   ```
   
   ## What changed?
   1. Refactor WithTLS method.
   2. Extract TLS configuration struct, group all TLS-related parameters 
together
   
   
   ## Local Execution
   
   - Passed
   - Pre-commit hooks ran 
   
   
   ## AI Usage
   
   1. Claude Sonnet 4.6 
   3. code generation
   4. I reviewed the code and tested
   5. Sure
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to