summaryrefslogtreecommitdiff
path: root/internal/control/models.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/control/models.go')
-rw-r--r--internal/control/models.go66
1 files changed, 66 insertions, 0 deletions
diff --git a/internal/control/models.go b/internal/control/models.go
new file mode 100644
index 0000000..bec8e89
--- /dev/null
+++ b/internal/control/models.go
@@ -0,0 +1,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"`
+}