forked from p4gefau1t/trojan-go
-
Notifications
You must be signed in to change notification settings - Fork 1
/
config.go
60 lines (51 loc) · 1.48 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
50
51
52
53
54
55
56
57
58
59
60
package vmess
import "github.com/faireal/trojan-go/config"
// Request Options
const (
OptBasicFormat byte = 0 // 不加密传输
OptChunkStream byte = 1 // 分块传输,每个分块使用如下Security方法加密
// OptReuseTCPConnection byte = 2
// OptMetadataObfuscate byte = 4
)
// Security types
const (
SecurityAES128GCM byte = 3
SecurityChacha20Poly1305 byte = 4
SecurityNone byte = 5
)
// CMD types
const (
CmdTCP byte = 1
CmdUDP byte = 2
)
// Atyp
const (
AtypIP4 byte = 1
AtypDomain byte = 2
AtypIP6 byte = 3
)
type Config struct {
LocalHost string `json:"local_addr" yaml:"local-addr"`
LocalPort int `json:"local_port" yaml:"local-port"`
RemoteHost string `json:"remote_addr" yaml:"remote-addr"`
RemotePort int `json:"remote_port" yaml:"remote-port"`
UUID string `json:"uuid" yaml:"uuid"`
AlterID int `json:"alterId" yaml:"alterId"`
Security string `json:"security" yaml:"security"`
Port string `json:"port" yaml:"port"`
HostName string `json:"hostName" yaml:"hostName"`
IsAead bool `json:"isAead" yaml:"isAead"`
MySQL MySQLConfig `json:"mysql" yaml:"mysql"`
API APIConfig `json:"api" yaml:"api"`
}
type MySQLConfig struct {
Enabled bool `json:"enabled" yaml:"enabled"`
}
type APIConfig struct {
Enabled bool `json:"enabled" yaml:"enabled"`
}
func init() {
config.RegisterConfigCreator(Name, func() interface{} {
return &Config{}
})
}