Skip to content

Commit

Permalink
Fix "missing port in address" gQUIC dial failure
Browse files Browse the repository at this point in the history
  • Loading branch information
rod-hynes committed Mar 11, 2024
1 parent e9ac80a commit 3375e13
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
7 changes: 7 additions & 0 deletions psiphon/common/quic/gquic.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,13 @@ func gQUICDialContext(
quicSNIAddress string,
versionNumber uint32) (quicConnection, error) {

// The legacy gquic-go fork expects a port number in the SNI field
// (which is then stripped). Add a stub port value if none is present.
_, _, err := net.SplitHostPort(quicSNIAddress)
if err != nil {
quicSNIAddress = net.JoinHostPort(quicSNIAddress, "0")
}

quicConfig := &gquic.Config{
HandshakeTimeout: time.Duration(1<<63 - 1),
IdleTimeout: CLIENT_IDLE_TIMEOUT,
Expand Down
7 changes: 6 additions & 1 deletion psiphon/common/quic/quic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,16 @@ func runQUIC(
}
}

quicSNIAddress, _, err := net.SplitHostPort(serverAddress)
if err != nil {
return errors.Trace(err)
}

conn, err := Dial(
ctx,
packetConn,
remoteAddr,
serverAddress,
quicSNIAddress,
quicVersion,
clientHelloSeed,
clientObfuscationKey,
Expand Down

0 comments on commit 3375e13

Please sign in to comment.