github.com/psiphon-Labs/psiphon-tunnel-core@v2.0.28+incompatible/psiphon/common/quic/quic_disabled.go (about)

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