Archived
1
This commit is contained in:
2024-12-23 01:44:58 +03:00
parent 0c5fa2abd7
commit 2c3f607a92
6 changed files with 38 additions and 25 deletions

View File

@@ -1,24 +0,0 @@
package cmd
import (
"fmt"
"github.com/spf13/cobra"
)
func NewCommandOpenports() *cobra.Command {
spaceCmd := &cobra.Command{
Use: "openports",
Short: "открыть(пробросить) SSH порты",
RunE: openportsRunE,
}
return spaceCmd
}
func openportsRunE(_ *cobra.Command, args []string) error {
fmt.Println("[dummy] openports")
for _, elm := range args {
fmt.Printf("- %s\n", elm)
}
return nil
}

24
cmd/ports.go Normal file
View File

@@ -0,0 +1,24 @@
package cmd
import (
"fmt"
"github.com/spf13/cobra"
)
func NewCommandPorts() *cobra.Command {
spaceCmd := &cobra.Command{
Use: "ports",
Short: "работа с пробросом SSH портов",
RunE: portsRunE,
}
return spaceCmd
}
func portsRunE(_ *cobra.Command, args []string) error {
fmt.Println("[dummy] ports")
for _, elm := range args {
fmt.Printf("- %s\n", elm)
}
return nil
}

View File

@@ -40,7 +40,7 @@ func init() {
rootCmd.AddCommand(NewCommandRole())
rootCmd.AddCommand(NewCommandInstall())
rootCmd.AddCommand(NewCommandHosts())
//mainCmd.AddCommand(cmd.NewCommandOpenports())
rootCmd.AddCommand(NewCommandPorts())
rootCmd.AddCommand(NewCommandBackup())
rootCmd.AddCommand(NewCommandRestore())
}

View File

@@ -0,0 +1 @@
package space_worker

View File

@@ -0,0 +1,12 @@
package types
type TPort struct {
Address string `yaml:"address"`
Port uint16 `yaml:"port"`
}
type TOpenPort struct {
Name string `yaml:"name"`
Local TPort `yaml:"local"`
Remote TPort `yaml:"remote"`
}

Binary file not shown.