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