github.com/ipfans/trojan-go@v0.11.0/tunnel/tls/config.go (about)

     1  package tls
     2  
     3  import (
     4  	"github.com/ipfans/trojan-go/config"
     5  )
     6  
     7  type Config struct {
     8  	RemoteHost string          `json:"remote_addr" yaml:"remote-addr"`
     9  	RemotePort int             `json:"remote_port" yaml:"remote-port"`
    10  	TLS        TLSConfig       `json:"ssl" yaml:"ssl"`
    11  	Websocket  WebsocketConfig `json:"websocket" yaml:"websocket"`
    12  }
    13  
    14  type WebsocketConfig struct {
    15  	Enabled bool `json:"enabled" yaml:"enabled"`
    16  }
    17  
    18  type TLSConfig struct {
    19  	Verify               bool     `json:"verify" yaml:"verify"`
    20  	VerifyHostName       bool     `json:"verify_hostname" yaml:"verify-hostname"`
    21  	CertPath             string   `json:"cert" yaml:"cert"`
    22  	KeyPath              string   `json:"key" yaml:"key"`
    23  	KeyPassword          string   `json:"key_password" yaml:"key-password"`
    24  	Cipher               string   `json:"cipher" yaml:"cipher"`
    25  	PreferServerCipher   bool     `json:"prefer_server_cipher" yaml:"prefer-server-cipher"`
    26  	SNI                  string   `json:"sni" yaml:"sni"`
    27  	HTTPResponseFileName string   `json:"plain_http_response" yaml:"plain-http-response"`
    28  	FallbackHost         string   `json:"fallback_addr" yaml:"fallback-addr"`
    29  	FallbackPort         int      `json:"fallback_port" yaml:"fallback-port"`
    30  	ReuseSession         bool     `json:"reuse_session" yaml:"reuse-session"`
    31  	ALPN                 []string `json:"alpn" yaml:"alpn"`
    32  	Curves               string   `json:"curves" yaml:"curves"`
    33  	Fingerprint          string   `json:"fingerprint" yaml:"fingerprint"`
    34  	KeyLogPath           string   `json:"key_log" yaml:"key-log"`
    35  	CertCheckRate        int      `json:"cert_check_rate" yaml:"cert-check-rate"`
    36  }
    37  
    38  func init() {
    39  	config.RegisterConfigCreator(Name, func() interface{} {
    40  		return &Config{
    41  			TLS: TLSConfig{
    42  				Verify:         true,
    43  				VerifyHostName: true,
    44  				Fingerprint:    "chrome",
    45  				ALPN:           []string{"http/1.1"},
    46  			},
    47  		}
    48  	})
    49  }