github.com/sagernet/sing-box@v1.9.0-rc.20/option/tls.go (about)

     1  package option
     2  
     3  type InboundTLSOptions struct {
     4  	Enabled         bool                   `json:"enabled,omitempty"`
     5  	ServerName      string                 `json:"server_name,omitempty"`
     6  	Insecure        bool                   `json:"insecure,omitempty"`
     7  	ALPN            Listable[string]       `json:"alpn,omitempty"`
     8  	MinVersion      string                 `json:"min_version,omitempty"`
     9  	MaxVersion      string                 `json:"max_version,omitempty"`
    10  	CipherSuites    Listable[string]       `json:"cipher_suites,omitempty"`
    11  	Certificate     Listable[string]       `json:"certificate,omitempty"`
    12  	CertificatePath string                 `json:"certificate_path,omitempty"`
    13  	Key             Listable[string]       `json:"key,omitempty"`
    14  	KeyPath         string                 `json:"key_path,omitempty"`
    15  	ACME            *InboundACMEOptions    `json:"acme,omitempty"`
    16  	ECH             *InboundECHOptions     `json:"ech,omitempty"`
    17  	Reality         *InboundRealityOptions `json:"reality,omitempty"`
    18  }
    19  
    20  type InboundTLSOptionsContainer struct {
    21  	TLS *InboundTLSOptions `json:"tls,omitempty"`
    22  }
    23  
    24  type InboundTLSOptionsWrapper interface {
    25  	TakeInboundTLSOptions() *InboundTLSOptions
    26  	ReplaceInboundTLSOptions(options *InboundTLSOptions)
    27  }
    28  
    29  func (o *InboundTLSOptionsContainer) TakeInboundTLSOptions() *InboundTLSOptions {
    30  	return o.TLS
    31  }
    32  
    33  func (o *InboundTLSOptionsContainer) ReplaceInboundTLSOptions(options *InboundTLSOptions) {
    34  	o.TLS = options
    35  }
    36  
    37  type OutboundTLSOptions struct {
    38  	Enabled         bool                    `json:"enabled,omitempty"`
    39  	DisableSNI      bool                    `json:"disable_sni,omitempty"`
    40  	ServerName      string                  `json:"server_name,omitempty"`
    41  	Insecure        bool                    `json:"insecure,omitempty"`
    42  	ALPN            Listable[string]        `json:"alpn,omitempty"`
    43  	MinVersion      string                  `json:"min_version,omitempty"`
    44  	MaxVersion      string                  `json:"max_version,omitempty"`
    45  	CipherSuites    Listable[string]        `json:"cipher_suites,omitempty"`
    46  	Certificate     Listable[string]        `json:"certificate,omitempty"`
    47  	CertificatePath string                  `json:"certificate_path,omitempty"`
    48  	ECH             *OutboundECHOptions     `json:"ech,omitempty"`
    49  	UTLS            *OutboundUTLSOptions    `json:"utls,omitempty"`
    50  	Reality         *OutboundRealityOptions `json:"reality,omitempty"`
    51  }
    52  
    53  type OutboundTLSOptionsContainer struct {
    54  	TLS *OutboundTLSOptions `json:"tls,omitempty"`
    55  }
    56  
    57  type OutboundTLSOptionsWrapper interface {
    58  	TakeOutboundTLSOptions() *OutboundTLSOptions
    59  	ReplaceOutboundTLSOptions(options *OutboundTLSOptions)
    60  }
    61  
    62  func (o *OutboundTLSOptionsContainer) TakeOutboundTLSOptions() *OutboundTLSOptions {
    63  	return o.TLS
    64  }
    65  
    66  func (o *OutboundTLSOptionsContainer) ReplaceOutboundTLSOptions(options *OutboundTLSOptions) {
    67  	o.TLS = options
    68  }
    69  
    70  type InboundRealityOptions struct {
    71  	Enabled           bool                           `json:"enabled,omitempty"`
    72  	Handshake         InboundRealityHandshakeOptions `json:"handshake,omitempty"`
    73  	PrivateKey        string                         `json:"private_key,omitempty"`
    74  	ShortID           Listable[string]               `json:"short_id,omitempty"`
    75  	MaxTimeDifference Duration                       `json:"max_time_difference,omitempty"`
    76  }
    77  
    78  type InboundRealityHandshakeOptions struct {
    79  	ServerOptions
    80  	DialerOptions
    81  }
    82  
    83  type InboundECHOptions struct {
    84  	Enabled                     bool             `json:"enabled,omitempty"`
    85  	PQSignatureSchemesEnabled   bool             `json:"pq_signature_schemes_enabled,omitempty"`
    86  	DynamicRecordSizingDisabled bool             `json:"dynamic_record_sizing_disabled,omitempty"`
    87  	Key                         Listable[string] `json:"key,omitempty"`
    88  	KeyPath                     string           `json:"key_path,omitempty"`
    89  }
    90  
    91  type OutboundECHOptions struct {
    92  	Enabled                     bool             `json:"enabled,omitempty"`
    93  	PQSignatureSchemesEnabled   bool             `json:"pq_signature_schemes_enabled,omitempty"`
    94  	DynamicRecordSizingDisabled bool             `json:"dynamic_record_sizing_disabled,omitempty"`
    95  	Config                      Listable[string] `json:"config,omitempty"`
    96  	ConfigPath                  string           `json:"config_path,omitempty"`
    97  }
    98  
    99  type OutboundUTLSOptions struct {
   100  	Enabled     bool   `json:"enabled,omitempty"`
   101  	Fingerprint string `json:"fingerprint,omitempty"`
   102  }
   103  
   104  type OutboundRealityOptions struct {
   105  	Enabled   bool   `json:"enabled,omitempty"`
   106  	PublicKey string `json:"public_key,omitempty"`
   107  	ShortID   string `json:"short_id,omitempty"`
   108  }