remoteportforward

package
v0.6.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 9, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MakeInputFileCmd = &cobra.Command{
	Use:   "make-input-file",
	Short: "make input file skelton for exec",
	Run: func(cmd *cobra.Command, args []string) {
		input.MakeInputFile(input.RemotePortForwardInput{}, "remoteportforward-input.json")
	},
}
View Source
var RemoteportforwardCmd = &cobra.Command{
	Use:   "remoteportforward",
	Short: "like start-session --document-name AWS-StartPortForwardingSessionToRemote",
	Run: func(cmd *cobra.Command, args []string) {
		var remotePortforwardInput input.RemotePortForwardInput

		inputFile, err := cmd.Flags().GetString(inputFileName)
		if err != nil {
			log.Fatalln(err)
		}

		if inputFile != "" {
			input.ReadInputFile(&remotePortforwardInput, inputFile)
		}

		if remotePortforwardInput.RemotePortNumber == "" {
			remote, err := cmd.Flags().GetString("remote-port")
			if err != nil {
				log.Fatalln(err)
			}

			remotePortforwardInput.RemotePortNumber = remote
		}

		if remotePortforwardInput.LocalPortNumber == "" {
			local, err := cmd.Flags().GetString("local-port")
			if err != nil {
				log.Fatalln(err)
			}

			if local == "" {
				l, err := port.AvailablePort()
				if err != nil {
					log.Fatalln(err)
				}
				local = strconv.Itoa(l)
			}

			remotePortforwardInput.LocalPortNumber = local
		}

		if remotePortforwardInput.Host == "" {
			host, err := cmd.Flags().GetString("host")
			if err != nil {
				log.Fatalln(err)
			}

			remotePortforwardInput.Host = host
		}

		errorMsgs := validateInput(remotePortforwardInput)
		if len(errorMsgs) != 0 {
			log.Fatalln(strings.Join(errorMsgs, "\n"))
		}

		err = handler.RemotePortforwardHandler(remotePortforwardInput)
		if err != nil {
			log.Fatalln(err)
		}
	},
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL