quic_disabled.go 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. // +build DISABLE_QUIC
  2. /*
  3. * Copyright (c) 2020, Psiphon Inc.
  4. * All rights reserved.
  5. *
  6. * This program is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. *
  19. */
  20. package quic
  21. import (
  22. "context"
  23. "net"
  24. "net/http"
  25. "github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common"
  26. "github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common/errors"
  27. "github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common/prng"
  28. )
  29. // Enabled indicates if QUIC functionality is enabled.
  30. func Enabled() bool {
  31. return false
  32. }
  33. func Listen(
  34. logger common.Logger,
  35. address string,
  36. obfuscationKey string) (net.Listener, error) {
  37. return nil, errors.TraceNew("operation is not enabled")
  38. }
  39. func Dial(
  40. ctx context.Context,
  41. packetConn net.PacketConn,
  42. remoteAddr *net.UDPAddr,
  43. quicSNIAddress string,
  44. negotiateQUICVersion string,
  45. obfuscationKey string,
  46. obfuscationPaddingSeed *prng.Seed) (net.Conn, error) {
  47. return nil, errors.TraceNew("operation is not enabled")
  48. }
  49. type QUICTransporter struct {
  50. }
  51. func (t *QUICTransporter) SetRequestContext(ctx context.Context) {
  52. }
  53. func (t *QUICTransporter) CloseIdleConnections() {
  54. }
  55. func (t *QUICTransporter) RoundTrip(req *http.Request) (resp *http.Response, err error) {
  56. return nil, errors.TraceNew("operation is not enabled")
  57. }
  58. func NewQUICTransporter(
  59. ctx context.Context,
  60. noticeEmitter func(string),
  61. udpDialer func(ctx context.Context) (net.PacketConn, *net.UDPAddr, error),
  62. quicSNIAddress string,
  63. negotiateQUICVersion string) (*QUICTransporter, error) {
  64. return nil, errors.TraceNew("operation is not enabled")
  65. }