Skip to content

Commit

Permalink
Merge pull request #112 from SiaFoundation/nate/rhp4-upgrade-helper
Browse files Browse the repository at this point in the history
Add UpgradeConn helper
  • Loading branch information
n8maninger authored Oct 21, 2024
2 parents da3e94e + 5a9fa81 commit c00c7f7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions rhp/v4/siamux.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ func DialSiaMux(ctx context.Context, addr string, peerKey types.PublicKey) (Tran
return nil, fmt.Errorf("failed to connect to %q: %w", addr, err)
}

return UpgradeConn(ctx, conn, peerKey)
}

// UpgradeConn upgrades an existing connection to use the SiaMux multiplexer.
func UpgradeConn(ctx context.Context, conn net.Conn, peerKey types.PublicKey) (TransportClient, error) {
m, err := mux.Dial(conn, peerKey[:])
if err != nil {
return nil, fmt.Errorf("failed to establish siamux connection: %w", err)
Expand Down

0 comments on commit c00c7f7

Please sign in to comment.