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

     1  /*
     2   * Copyright (c) 2021, Psiphon Inc.
     3   * All rights reserved.
     4   *
     5   * This program is free software: you can redistribute it and/or modify
     6   * it under the terms of the GNU General Public License as published by
     7   * the Free Software Foundation, either version 3 of the License, or
     8   * (at your option) any later version.
     9   *
    10   * This program is distributed in the hope that it will be useful,
    11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
    12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    13   * GNU General Public License for more details.
    14   *
    15   * You should have received a copy of the GNU General Public License
    16   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
    17   *
    18   */
    19  
    20  package refraction
    21  
    22  import (
    23  	"net/http"
    24  	"time"
    25  
    26  	"github.com/Psiphon-Labs/psiphon-tunnel-core/psiphon/common"
    27  )
    28  
    29  // ConjureConfig specifies the additional configuration for a Conjure dial.
    30  type ConjureConfig struct {
    31  
    32  	// RegistrationCacheTTL specifies how long to retain a successful Conjure
    33  	// registration for reuse in a subsequent dial. This value should be
    34  	// synchronized with the Conjure station configuration. When
    35  	// RegistrationCacheTTL is 0, registrations are not cached.
    36  	RegistrationCacheTTL time.Duration
    37  
    38  	// RegistrationCacheKey defines a scope or affinity for cached Conjure
    39  	// registrations. For example, the key can reflect the target Psiphon server
    40  	// as well as the current network ID. This ensures that any replay will
    41  	// always use the same cached registration, including its phantom IP(s). And
    42  	// ensures that the cache scope is restricted to the current network: when
    43  	// the network changes, the client's public IP changes, and previous
    44  	// registrations will become invalid. When the client returns to the original
    45  	// network, the previous registrations may be valid once again (assuming
    46  	// the client reverts back to its original public IP).
    47  	RegistrationCacheKey string
    48  
    49  	// APIRegistrarBidirectionalURL specifies the bidirectional API
    50  	// registration endpoint. Setting APIRegistrarBidirectionalURL enables
    51  	// API registration. The domain fronting configuration provided by
    52  	// APIRegistrarHTTPClient may ignore the host portion of this URL,
    53  	// implicitly providing another value; the path portion is always used in
    54  	// the request. Only one of API registration or decoy registration can be
    55  	// enabled for a single dial.
    56  	APIRegistrarBidirectionalURL string
    57  
    58  	// APIRegistrarHTTPClient specifies a custom HTTP client (and underlying
    59  	// dialers) to be used for Conjure API registration. The
    60  	// APIRegistrarHTTPClient enables domain fronting of API registration web
    61  	// requests. This parameter is required when API registration is enabled.
    62  	APIRegistrarHTTPClient *http.Client
    63  
    64  	// APIRegistrarDelay specifies how long to wait after a successful API
    65  	// registration before initiating the phantom dial(s), as required by the
    66  	// Conjure protocol. This value depends on Conjure station operations and
    67  	// should be synchronized with the Conjure station configuration.
    68  	APIRegistrarDelay time.Duration
    69  
    70  	// DecoyRegistrarDialer specifies a custom dialer to be used for decoy
    71  	// registration. Only one of API registration or decoy registration can be
    72  	// enabled for a single dial.
    73  	DecoyRegistrarDialer common.NetDialer
    74  
    75  	// DecoyRegistrarWidth specifies how many decoys to use per registration.
    76  	DecoyRegistrarWidth int
    77  
    78  	// DecoyRegistrarDelay specifies how long to wait after a successful API
    79  	// registration before initiating the phantom dial(s), as required by the
    80  	// Conjure protocol.
    81  	//
    82  	// Limitation: this value is not exposed by gotapdance and is currently
    83  	// ignored.
    84  	DecoyRegistrarDelay time.Duration
    85  
    86  	// Transport may be protocol.CONJURE_TRANSPORT_MIN_OSSH or
    87  	// protocol.CONJURE_TRANSPORT_OBFS4_OSSH.
    88  	Transport string
    89  
    90  	// DiagnosticID identifies this dial in diagnostics.
    91  	DiagnosticID string
    92  
    93  	// Logger is used for logging diagnostics.
    94  	Logger common.Logger
    95  }