func (c *NatOutboundCommand) printNatScripts(pending []natcmd.UnitContainment) { for _, uc := range pending { fmt.Printf("%s:\n", uc.GatewayMachine.Id) natcmd.WriteScriptStart(os.Stdout) natcmd.WriteScriptOutbound(os.Stdout, uc) fmt.Fprintln(os.Stdout) } }
func (c *NatExposeCommand) printNatScripts() { for machineId, fwds := range c.forwards { fmt.Printf("%s:\n", machineId) natcmd.WriteScriptStart(os.Stdout) for _, fwd := range fwds { fwd.Write(os.Stdout) fmt.Println() } } }
func (c *NatOutboundCommand) execNatScripts(pending []natcmd.UnitContainment) { for _, uc := range pending { var natScript bytes.Buffer natcmd.WriteScriptStart(&natScript) natcmd.WriteScriptOutbound(&natScript, uc) err := c.ExecSsh(uc.GatewayMachine, natScript.String()) if err != nil { log.Println("nat script failed on", uc.GatewayMachine.Id(), ":", err) } } }
func (c *NatExposeCommand) execNatScripts() { for machineId, fwds := range c.forwards { machine, ok := c.MachineMap[machineId] if !ok { log.Println("machine", machineId, "not found") continue } var natScript bytes.Buffer natcmd.WriteScriptStart(&natScript) for _, fwd := range fwds { fwd.Write(&natScript) fmt.Fprintln(&natScript) } err := c.ExecSsh(machine, natScript.String()) if err != nil { log.Println("nat script failed on", machine.Id(), ":", err) } } }