Преглед на файлове

Fork http2 to reduce request body buffer size

Rod Hynes преди 7 години
родител
ревизия
a826ecc290
променени са 35 файла, в които са добавени 65 реда и са изтрити 11 реда
  1. 1 1
      psiphon/meekConn.go
  2. 27 0
      vendor/github.com/Psiphon-Labs/net/LICENSE
  3. 22 0
      vendor/github.com/Psiphon-Labs/net/PATENTS
  4. 0 0
      vendor/github.com/Psiphon-Labs/net/http2/Dockerfile
  5. 0 0
      vendor/github.com/Psiphon-Labs/net/http2/Makefile
  6. 0 0
      vendor/github.com/Psiphon-Labs/net/http2/README
  7. 0 0
      vendor/github.com/Psiphon-Labs/net/http2/ciphers.go
  8. 0 0
      vendor/github.com/Psiphon-Labs/net/http2/client_conn_pool.go
  9. 0 0
      vendor/github.com/Psiphon-Labs/net/http2/configure_transport.go
  10. 0 0
      vendor/github.com/Psiphon-Labs/net/http2/databuffer.go
  11. 0 0
      vendor/github.com/Psiphon-Labs/net/http2/errors.go
  12. 0 0
      vendor/github.com/Psiphon-Labs/net/http2/flow.go
  13. 0 0
      vendor/github.com/Psiphon-Labs/net/http2/frame.go
  14. 0 0
      vendor/github.com/Psiphon-Labs/net/http2/go111.go
  15. 0 0
      vendor/github.com/Psiphon-Labs/net/http2/go16.go
  16. 0 0
      vendor/github.com/Psiphon-Labs/net/http2/go17.go
  17. 0 0
      vendor/github.com/Psiphon-Labs/net/http2/go17_not18.go
  18. 0 0
      vendor/github.com/Psiphon-Labs/net/http2/go18.go
  19. 0 0
      vendor/github.com/Psiphon-Labs/net/http2/go19.go
  20. 0 0
      vendor/github.com/Psiphon-Labs/net/http2/gotrack.go
  21. 0 0
      vendor/github.com/Psiphon-Labs/net/http2/headermap.go
  22. 1 1
      vendor/github.com/Psiphon-Labs/net/http2/http2.go
  23. 0 0
      vendor/github.com/Psiphon-Labs/net/http2/not_go111.go
  24. 0 0
      vendor/github.com/Psiphon-Labs/net/http2/not_go16.go
  25. 0 0
      vendor/github.com/Psiphon-Labs/net/http2/not_go17.go
  26. 0 0
      vendor/github.com/Psiphon-Labs/net/http2/not_go18.go
  27. 0 0
      vendor/github.com/Psiphon-Labs/net/http2/not_go19.go
  28. 0 0
      vendor/github.com/Psiphon-Labs/net/http2/pipe.go
  29. 0 0
      vendor/github.com/Psiphon-Labs/net/http2/server.go
  30. 8 2
      vendor/github.com/Psiphon-Labs/net/http2/transport.go
  31. 0 0
      vendor/github.com/Psiphon-Labs/net/http2/write.go
  32. 0 0
      vendor/github.com/Psiphon-Labs/net/http2/writesched.go
  33. 0 0
      vendor/github.com/Psiphon-Labs/net/http2/writesched_priority.go
  34. 0 0
      vendor/github.com/Psiphon-Labs/net/http2/writesched_random.go
  35. 6 7
      vendor/vendor.json

+ 1 - 1
psiphon/meekConn.go

@@ -39,13 +39,13 @@ import (
 	"time"
 	"time"
 
 
 	"github.com/Psiphon-Labs/goarista/monotime"
 	"github.com/Psiphon-Labs/goarista/monotime"
+	"github.com/Psiphon-Labs/net/http2"
 	"github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common"
 	"github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common"
 	"github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common/crypto/nacl/box"
 	"github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common/crypto/nacl/box"
 	"github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common/obfuscator"
 	"github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common/obfuscator"
 	"github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common/parameters"
 	"github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common/parameters"
 	"github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common/protocol"
 	"github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common/protocol"
 	"github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/upstreamproxy"
 	"github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/upstreamproxy"
-	"golang.org/x/net/http2"
 )
 )
 
 
 // MeekConn is based on meek-client.go from Tor and Psiphon:
 // MeekConn is based on meek-client.go from Tor and Psiphon:

+ 27 - 0
vendor/github.com/Psiphon-Labs/net/LICENSE

@@ -0,0 +1,27 @@
+Copyright (c) 2009 The Go Authors. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+   * Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+   * Redistributions in binary form must reproduce the above
+copyright notice, this list of conditions and the following disclaimer
+in the documentation and/or other materials provided with the
+distribution.
+   * Neither the name of Google Inc. nor the names of its
+contributors may be used to endorse or promote products derived from
+this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

+ 22 - 0
vendor/github.com/Psiphon-Labs/net/PATENTS

@@ -0,0 +1,22 @@
+Additional IP Rights Grant (Patents)
+
+"This implementation" means the copyrightable works distributed by
+Google as part of the Go project.
+
+Google hereby grants to You a perpetual, worldwide, non-exclusive,
+no-charge, royalty-free, irrevocable (except as stated in this section)
+patent license to make, have made, use, offer to sell, sell, import,
+transfer and otherwise run, modify and propagate the contents of this
+implementation of Go, where such license applies only to those patent
+claims, both currently owned or controlled by Google and acquired in
+the future, licensable by Google that are necessarily infringed by this
+implementation of Go.  This grant does not include claims that would be
+infringed only as a consequence of further modification of this
+implementation.  If you or your agent or exclusive licensee institute or
+order or agree to the institution of patent litigation against any
+entity (including a cross-claim or counterclaim in a lawsuit) alleging
+that this implementation of Go or any code incorporated within this
+implementation of Go constitutes direct or contributory patent
+infringement, or inducement of patent infringement, then any patent
+rights granted to you under this License for this implementation of Go
+shall terminate as of the date such litigation is filed.

+ 0 - 0
vendor/golang.org/x/net/http2/Dockerfile → vendor/github.com/Psiphon-Labs/net/http2/Dockerfile


+ 0 - 0
vendor/golang.org/x/net/http2/Makefile → vendor/github.com/Psiphon-Labs/net/http2/Makefile


+ 0 - 0
vendor/golang.org/x/net/http2/README → vendor/github.com/Psiphon-Labs/net/http2/README


+ 0 - 0
vendor/golang.org/x/net/http2/ciphers.go → vendor/github.com/Psiphon-Labs/net/http2/ciphers.go


+ 0 - 0
vendor/golang.org/x/net/http2/client_conn_pool.go → vendor/github.com/Psiphon-Labs/net/http2/client_conn_pool.go


+ 0 - 0
vendor/golang.org/x/net/http2/configure_transport.go → vendor/github.com/Psiphon-Labs/net/http2/configure_transport.go


+ 0 - 0
vendor/golang.org/x/net/http2/databuffer.go → vendor/github.com/Psiphon-Labs/net/http2/databuffer.go


+ 0 - 0
vendor/golang.org/x/net/http2/errors.go → vendor/github.com/Psiphon-Labs/net/http2/errors.go


+ 0 - 0
vendor/golang.org/x/net/http2/flow.go → vendor/github.com/Psiphon-Labs/net/http2/flow.go


+ 0 - 0
vendor/golang.org/x/net/http2/frame.go → vendor/github.com/Psiphon-Labs/net/http2/frame.go


+ 0 - 0
vendor/golang.org/x/net/http2/go111.go → vendor/github.com/Psiphon-Labs/net/http2/go111.go


+ 0 - 0
vendor/golang.org/x/net/http2/go16.go → vendor/github.com/Psiphon-Labs/net/http2/go16.go


+ 0 - 0
vendor/golang.org/x/net/http2/go17.go → vendor/github.com/Psiphon-Labs/net/http2/go17.go


+ 0 - 0
vendor/golang.org/x/net/http2/go17_not18.go → vendor/github.com/Psiphon-Labs/net/http2/go17_not18.go


+ 0 - 0
vendor/golang.org/x/net/http2/go18.go → vendor/github.com/Psiphon-Labs/net/http2/go18.go


+ 0 - 0
vendor/golang.org/x/net/http2/go19.go → vendor/github.com/Psiphon-Labs/net/http2/go19.go


+ 0 - 0
vendor/golang.org/x/net/http2/gotrack.go → vendor/github.com/Psiphon-Labs/net/http2/gotrack.go


+ 0 - 0
vendor/golang.org/x/net/http2/headermap.go → vendor/github.com/Psiphon-Labs/net/http2/headermap.go


+ 1 - 1
vendor/golang.org/x/net/http2/http2.go → vendor/github.com/Psiphon-Labs/net/http2/http2.go

@@ -14,7 +14,7 @@
 //
 //
 // See https://http2.golang.org/ for a test server running this code.
 // See https://http2.golang.org/ for a test server running this code.
 //
 //
-package http2 // import "golang.org/x/net/http2"
+package http2 // import "github.com/Psiphon-Labs/net/http2"
 
 
 import (
 import (
 	"bufio"
 	"bufio"

+ 0 - 0
vendor/golang.org/x/net/http2/not_go111.go → vendor/github.com/Psiphon-Labs/net/http2/not_go111.go


+ 0 - 0
vendor/golang.org/x/net/http2/not_go16.go → vendor/github.com/Psiphon-Labs/net/http2/not_go16.go


+ 0 - 0
vendor/golang.org/x/net/http2/not_go17.go → vendor/github.com/Psiphon-Labs/net/http2/not_go17.go


+ 0 - 0
vendor/golang.org/x/net/http2/not_go18.go → vendor/github.com/Psiphon-Labs/net/http2/not_go18.go


+ 0 - 0
vendor/golang.org/x/net/http2/not_go19.go → vendor/github.com/Psiphon-Labs/net/http2/not_go19.go


+ 0 - 0
vendor/golang.org/x/net/http2/pipe.go → vendor/github.com/Psiphon-Labs/net/http2/pipe.go


+ 0 - 0
vendor/golang.org/x/net/http2/server.go → vendor/github.com/Psiphon-Labs/net/http2/server.go


+ 8 - 2
vendor/golang.org/x/net/http2/transport.go → vendor/github.com/Psiphon-Labs/net/http2/transport.go

@@ -335,7 +335,9 @@ func (noCachedConnError) Error() string             { return "http2: no cached c
 // or its equivalent renamed type in net/http2's h2_bundle.go. Both types
 // or its equivalent renamed type in net/http2's h2_bundle.go. Both types
 // may coexist in the same running program.
 // may coexist in the same running program.
 func isNoCachedConnError(err error) bool {
 func isNoCachedConnError(err error) bool {
-	_, ok := err.(interface{ IsHTTP2NoCachedConnError() })
+	_, ok := err.(interface {
+		IsHTTP2NoCachedConnError()
+	})
 	return ok
 	return ok
 }
 }
 
 
@@ -790,7 +792,11 @@ func (cc *ClientConn) Close() error {
 	return cc.tconn.Close()
 	return cc.tconn.Close()
 }
 }
 
 
-const maxAllocFrameSize = 512 << 10
+// [Psiphon]
+// Request body sizes are typically under 64K; allocating 512K is problematic
+// in low-memory environments.
+//const maxAllocFrameSize = 512 << 10
+const maxAllocFrameSize = 64 << 10
 
 
 // frameBuffer returns a scratch buffer suitable for writing DATA frames.
 // frameBuffer returns a scratch buffer suitable for writing DATA frames.
 // They're capped at the min of the peer's max frame size or 512KB
 // They're capped at the min of the peer's max frame size or 512KB

+ 0 - 0
vendor/golang.org/x/net/http2/write.go → vendor/github.com/Psiphon-Labs/net/http2/write.go


+ 0 - 0
vendor/golang.org/x/net/http2/writesched.go → vendor/github.com/Psiphon-Labs/net/http2/writesched.go


+ 0 - 0
vendor/golang.org/x/net/http2/writesched_priority.go → vendor/github.com/Psiphon-Labs/net/http2/writesched_priority.go


+ 0 - 0
vendor/golang.org/x/net/http2/writesched_random.go → vendor/github.com/Psiphon-Labs/net/http2/writesched_random.go


+ 6 - 7
vendor/vendor.json

@@ -56,6 +56,12 @@
 			"revision": "18963be5f9c52609b1dd6960d1370d34e63fc3fb",
 			"revision": "18963be5f9c52609b1dd6960d1370d34e63fc3fb",
 			"revisionTime": "2018-04-26T17:24:40Z"
 			"revisionTime": "2018-04-26T17:24:40Z"
 		},
 		},
+		{
+			"checksumSHA1": "cxmVWOV+0g1ZqB9BvGksJuD4lU0=",
+			"path": "github.com/Psiphon-Labs/net/http2",
+			"revision": "03e6572170e3643a5cf49ef0a0ce746e53b63cf3",
+			"revisionTime": "2018-09-12T16:47:43Z"
+		},
 		{
 		{
 			"checksumSHA1": "4D0uWGD7eh1gaAaB1zTlgBze3TA=",
 			"checksumSHA1": "4D0uWGD7eh1gaAaB1zTlgBze3TA=",
 			"path": "github.com/Psiphon-Labs/tls-tris",
 			"path": "github.com/Psiphon-Labs/tls-tris",
@@ -621,13 +627,6 @@
 			"revision": "8a410e7b638dca158bf9e766925842f6651ff828",
 			"revision": "8a410e7b638dca158bf9e766925842f6651ff828",
 			"revisionTime": "2018-08-25T16:15:26Z"
 			"revisionTime": "2018-08-25T16:15:26Z"
 		},
 		},
-		{
-			"checksumSHA1": "3p4xISa2iLZULxYfVsIUlHJ+PUk=",
-			"path": "golang.org/x/net/http2",
-			"revision": "8a410e7b638dca158bf9e766925842f6651ff828",
-			"revisionTime": "2018-08-25T16:15:26Z",
-			"versionExact": "release-branch.go1.9"
-		},
 		{
 		{
 			"checksumSHA1": "KZniwnfpWkaTPhUQDUTvgex/7y0=",
 			"checksumSHA1": "KZniwnfpWkaTPhUQDUTvgex/7y0=",
 			"path": "golang.org/x/net/http2/hpack",
 			"path": "golang.org/x/net/http2/hpack",