1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- package api
- /* ----------- 连接返回信息------------------ */
- // 服务器和数据库连接信息
- type ConnectInfoRequest struct {
- // Id string `json:"id" toml:"id"`
- Ssh SshInfo `json:"ssh_info"`
- Db DbInfo `json:"db_info"`
- }
- // 返回服务器和数据库连接信息
- type ConnectInfoResopnse struct {
- BaseFileName string `json:"base_filename" toml:"base_filename"`
- ConnInfo map[string]ConnectInfo `json:"conn_info"`
- }
- type ConnectInfo struct {
- Ssh SshInfo `json:"ssh_info"`
- Db DbInfo `json:"db_info"`
- }
- type SshInfo struct {
- Username string `json:"username" toml:"ssh_username"`
- Password string `json:"password" toml:"ssh_password"`
- Host string `json:"host" toml:"ssh_ip"`
- Port string `json:"port" toml:"ssh_port"`
- }
- type DbInfo struct {
- User string `json:"user" toml:"db_user"`
- Password string `json:"password" toml:"db_password"`
- Database string `json:"database" toml:"db_database"`
- Port string `json:"port" toml:"db_port"`
- }
- func SetConnectInfo(sshName, sshpw, sship, sshport, dbname, dbuser, dbpw, dbport string) ConnectInfo {
- return ConnectInfo{
- Ssh: SshInfo{
- Username: sshName,
- Password: sshpw,
- Host: sship,
- Port: sshport,
- },
- Db: DbInfo{
- User: dbuser,
- Password: dbpw,
- Database: dbname,
- Port: dbport,
- },
- }
- }
- /* ----------- 服务器信息------------------ */
- type ServerInfoRequest struct {
- BaseFileName string `json:"base_filename" toml:"base_filename"`
- Username string `json:"username" toml:"ssh_username"`
- Password string `json:"password" toml:"ssh_password"`
- Host string `json:"host" toml:"ssh_ip"`
- Port string `json:"port" toml:"ssh_port"`
- }
|