Просмотр исходного кода

Workaround quic-go v44 API limitation

Rod Hynes 7 лет назад
Родитель
Сommit
9a26991032
1 измененных файлов с 14 добавлено и 6 удалено
  1. 14 6
      vendor/github.com/lucas-clemente/quic-go/client.go

+ 14 - 6
vendor/github.com/lucas-clemente/quic-go/client.go

@@ -127,14 +127,22 @@ func dialContext(
 	config *Config,
 	createdPacketConn bool,
 ) (Session, error) {
-	config = populateClientConfig(config, createdPacketConn)
-	if !createdPacketConn {
-		for _, v := range config.Versions {
-			if v == protocol.Version44 {
-				return nil, errors.New("Cannot multiplex connections using gQUIC 44, see https://groups.google.com/a/chromium.org/forum/#!topic/proto-quic/pE9NlLLjizE. Please disable gQUIC 44 in the quic.Config, or use DialAddr")
+
+	// [Psiphon]
+	// We call DialContext as we need to create a custom net.PacketConn.
+	// There is one custom net.PacketConn per QUIC connection, which
+	// satisfies the gQUIC 44 constraint.
+	config = populateClientConfig(config, true)
+	/*
+		config = populateClientConfig(config, createdPacketConn)
+		if !createdPacketConn {
+			for _, v := range config.Versions {
+				if v == protocol.Version44 {
+					return nil, errors.New("Cannot multiplex connections using gQUIC 44, see https://groups.google.com/a/chromium.org/forum/#!topic/proto-quic/pE9NlLLjizE. Please disable gQUIC 44 in the quic.Config, or use DialAddr")
+				}
 			}
 		}
-	}
+	*/
 	packetHandlers, err := getMultiplexer().AddConn(pconn, config.ConnectionIDLength)
 	if err != nil {
 		return nil, err