mirror of
https://github.com/Buriburizaem0n/nezha_domains.git
synced 2026-02-04 04:30:05 +00:00
feat: terminal api
This commit is contained in:
@@ -47,36 +47,6 @@ const (
|
||||
ConfigCoverIgnoreAll
|
||||
)
|
||||
|
||||
type AgentConfig struct {
|
||||
HardDrivePartitionAllowlist []string
|
||||
NICAllowlist map[string]bool
|
||||
v *viper.Viper
|
||||
}
|
||||
|
||||
// Read 从给定的文件目录加载配置文件
|
||||
func (c *AgentConfig) Read(path string) error {
|
||||
c.v = viper.New()
|
||||
c.v.SetConfigFile(path)
|
||||
err := c.v.ReadInConfig()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = c.v.Unmarshal(c)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *AgentConfig) Save() error {
|
||||
data, err := yaml.Marshal(c)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return os.WriteFile(c.v.ConfigFileUsed(), data, 0600)
|
||||
}
|
||||
|
||||
// Config 站点配置
|
||||
type Config struct {
|
||||
Debug bool // debug模式开关
|
||||
|
||||
|
||||
12
model/terminal_api.go
Normal file
12
model/terminal_api.go
Normal file
@@ -0,0 +1,12 @@
|
||||
package model
|
||||
|
||||
type TerminalForm struct {
|
||||
Protocol string `json:"protocol,omitempty"`
|
||||
ServerID uint64 `json:"server_id,omitempty"`
|
||||
}
|
||||
|
||||
type CreateTerminalResponse struct {
|
||||
SessionID string `json:"session_id,omitempty"`
|
||||
ServerID uint64 `json:"server_id,omitempty"`
|
||||
ServerName string `json:"server_name,omitempty"`
|
||||
}
|
||||
Reference in New Issue
Block a user