summaryrefslogtreecommitdiff
path: root/internal/control/models.go
blob: bec8e89ff3c32bce5c567a59e749203c3787966e (plain)
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
61
62
63
64
65
66
package control

type Node struct {
	ID        string            `yaml:"id" json:"id"`
	Name      string            `yaml:"name" json:"name"`
	Provider  string            `yaml:"provider" json:"provider"`
	Region    string            `yaml:"region" json:"region"`
	Host      string            `yaml:"host" json:"host"`
	Domain    string            `yaml:"domain,omitempty" json:"domain,omitempty"`
	ACMEEmail string            `yaml:"acme_email,omitempty" json:"acme_email,omitempty"`
	Enabled   bool              `yaml:"enabled" json:"enabled"`
	SSH       SSHConfig         `yaml:"ssh" json:"ssh"`
	Protocols []ProtocolProfile `yaml:"protocols" json:"protocols"`
	Tags      []string          `yaml:"tags,omitempty" json:"tags,omitempty"`
	Metadata  map[string]string `yaml:"metadata,omitempty" json:"metadata,omitempty"`
}

type SSHConfig struct {
	User         string `yaml:"user" json:"user"`
	Port         int    `yaml:"port" json:"port"`
	Auth         string `yaml:"auth" json:"auth"`
	IdentityFile string `yaml:"identity_file,omitempty" json:"identity_file,omitempty"`
	PasswordEnv  string `yaml:"password_env,omitempty" json:"password_env,omitempty"`
	Password     string `yaml:"-" json:"-"`
}

type ProtocolProfile struct {
	Type      string               `yaml:"type" json:"type"`
	Enabled   bool                 `yaml:"enabled" json:"enabled"`
	Port      int                  `yaml:"port" json:"port"`
	TLS       *TLSProfile          `yaml:"tls,omitempty" json:"tls,omitempty"`
	Auth      *AuthProfile         `yaml:"auth,omitempty" json:"auth,omitempty"`
	Reality   *VLESSRealityProfile `yaml:"reality,omitempty" json:"reality,omitempty"`
	Hysteria2 *Hysteria2Profile    `yaml:"hysteria2,omitempty" json:"hysteria2,omitempty"`
	Extra     map[string]any       `yaml:"extra,omitempty" json:"extra,omitempty"`
}

type TLSProfile struct {
	Enabled    bool   `yaml:"enabled" json:"enabled"`
	ServerName string `yaml:"server_name,omitempty" json:"server_name,omitempty"`
}

type AuthProfile struct {
	UUID     string `yaml:"uuid,omitempty" json:"uuid,omitempty"`
	Method   string `yaml:"method,omitempty" json:"method,omitempty"`
	Password string `yaml:"password,omitempty" json:"password,omitempty"`
}

type VLESSRealityProfile struct {
	ServerName  string `yaml:"server_name" json:"server_name"`
	ServerPort  int    `yaml:"server_port,omitempty" json:"server_port,omitempty"`
	PrivateKey  string `yaml:"private_key,omitempty" json:"private_key,omitempty"`
	PublicKey   string `yaml:"public_key,omitempty" json:"public_key,omitempty"`
	ShortID     string `yaml:"short_id,omitempty" json:"short_id,omitempty"`
	Fingerprint string `yaml:"fingerprint,omitempty" json:"fingerprint,omitempty"`
}

type Hysteria2Profile struct {
	Port         int    `yaml:"port,omitempty" json:"port,omitempty"`
	UpMbps       int    `yaml:"up_mbps,omitempty" json:"up_mbps,omitempty"`
	DownMbps     int    `yaml:"down_mbps,omitempty" json:"down_mbps,omitempty"`
	ObfsPassword string `yaml:"obfs_password,omitempty" json:"obfs_password,omitempty"`
	UserPassword string `yaml:"user_password,omitempty" json:"user_password,omitempty"`
	CertPath     string `yaml:"cert_path,omitempty" json:"cert_path,omitempty"`
	KeyPath      string `yaml:"key_path,omitempty" json:"key_path,omitempty"`
}