Skip to content

feat(go): implement TCP/TLS connection in Go SDK#2834

Merged
mmodzelewski merged 3 commits into
apache:masterfrom
saie-ch:feature/go_tcp_tls
Mar 5, 2026
Merged

feat(go): implement TCP/TLS connection in Go SDK#2834
mmodzelewski merged 3 commits into
apache:masterfrom
saie-ch:feature/go_tcp_tls

Conversation

@saie-ch
Copy link
Copy Markdown
Contributor

@saie-ch saie-ch commented Feb 27, 2026

Which issue does this PR close?

This unblocks issue #2807 so TCP/TLS integration tests and examples can now be written for the Go
SDK.

Rationale

The Go SDK had TLS configuration fields (tlsEnabled, tlsDomain, tlsCAFile, tlsValidateCertificate)
and TLS error types generated, but the handshake was stubbed out at line 329 with return
errors.New("TLS connection is not implemented yet"). This blocked writing integration tests and
examples for TCP/TLS connections.

What changed?

Before: Line 329 returned a stub error preventing any TLS connections.

After: Full TLS implementation with:

  • Added 4 TLS configuration option functions: WithTLS(), ### WithTLSDomain(), WithTLSCAFile(),
    WithTLSValidateCertificate()
  • Implemented createTLSConfig() helper method that:
    • Configures certificate validation (InsecureSkipVerify)
    • Extracts server name from address for SNI (if tlsDomain not provided)
    • Loads custom CA certificates from file
    • Returns appropriate TLS error types (ErrInvalidTlsDomain, ErrInvalidTlsCertificatePath,
      ErrInvalidTlsCertificate)
  • Replaced stub with actual TLS handshake using crypto/tls (lines 360-373):
    • Creates TLS config
    • Wraps TCP connection with tls.Client()
    • Performs TLS handshake with proper error handling

Implementation follows the same patterns as Rust (tcp_tls_connection_stream.rs), Java
(InternalTcpClient.java), C# (TcpMessageStream.cs), and Node.js (client.connection.ts) SDKs.

AI Usage

Claude Sonnet 4.5

  • Guided by existing Rust, Java, Node.js, and C# TLS implementations
  • Followed Go SDK patterns and used existing error types
  • All pre-merge checks passed locally

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 2, 2026

Codecov Report

❌ Patch coverage is 0% with 42 lines in your changes missing coverage. Please review.
✅ Project coverage is 67.55%. Comparing base (13ff0f5) to head (14c4cb8).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
foreign/go/client/tcp/tcp_core.go 0.00% 42 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #2834      +/-   ##
============================================
- Coverage     68.43%   67.55%   -0.88%     
  Complexity      739      739              
============================================
  Files          1052     1049       -3     
  Lines         84635    84117     -518     
  Branches      61214    60653     -561     
============================================
- Hits          57917    56825    -1092     
- Misses        24347    24942     +595     
+ Partials       2371     2350      -21     
Flag Coverage Δ
go 6.27% <0.00%> (-0.06%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
foreign/go/client/tcp/tcp_core.go 0.00% <0.00%> (ø)

... and 41 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor

@hubcio hubcio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where are tests?

@saie-ch
Copy link
Copy Markdown
Contributor Author

saie-ch commented Mar 4, 2026

Hi @hubcio This PR implements the TLS handshake functionality that was previously stubbed out (line 329). It does NOT include tests - those will be added in issue #2807.

@atharvalade
Copy link
Copy Markdown
Contributor

atharvalade commented Mar 4, 2026

Hi @hubcio This PR implements the TLS handshake functionality that was previously stubbed out (line 329). It does NOT include tests - those will be added in issue #2807.

I can confirm. @hubcio Test issue was created and assigned to me but implementation itself was pending so I went ahead and created implementation issue.

@saie-ch if it's easier, do you want to take up tests for this since you did implementation? I don't mind either. Once I get some time, I'll do a quick review as well. Currently I am assigned for #2807.

Copy link
Copy Markdown
Member

@mmodzelewski mmodzelewski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, @saie-ch. @saie-ch @atharvalade could you please coordinate on who will be proceeding with the tests/examples issue? Feel free to hop on Discord to discuss it if that’s easier.

@mmodzelewski mmodzelewski merged commit f6c4150 into apache:master Mar 5, 2026
47 checks passed
@saie-ch
Copy link
Copy Markdown
Contributor Author

saie-ch commented Mar 5, 2026

Hi @hubcio This PR implements the TLS handshake functionality that was previously stubbed out (line 329). It does NOT include tests - those will be added in issue #2807.

I can confirm. @hubcio Test issue was created and assigned to me but implementation itself was pending so I went ahead and created implementation issue.

@saie-ch if it's easier, do you want to take up tests for this since you did implementation? I don't mind either. Once I get some time, I'll do a quick review as well. Currently I am assigned for #2807.

Hi @atharvalade, happy to take on the test task; I'll work on #2807. thanks:)

kriti-sc pushed a commit to kriti-sc/iggy that referenced this pull request Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants