WIP
This commit is contained in:
@@ -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
24
cmd/ports.go
Normal 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
|
||||
}
|
||||
@@ -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())
|
||||
}
|
||||
|
||||
1
internal/space_worker/ports.go
Normal file
1
internal/space_worker/ports.go
Normal file
@@ -0,0 +1 @@
|
||||
package space_worker
|
||||
12
internal/types/openports.go
Normal file
12
internal/types/openports.go
Normal 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.
Reference in New Issue
Block a user