refactor: change FunctionNames to be more generic
This commit is contained in:
parent
ebc11dd507
commit
35dd5d7885
1 changed files with 10 additions and 10 deletions
20
main.go
20
main.go
|
|
@ -61,7 +61,7 @@ func init() {
|
||||||
|
|
||||||
func connect() {
|
func connect() {
|
||||||
runCommand("timew", "start", "work")
|
runCommand("timew", "start", "work")
|
||||||
wakeLou()
|
wakeWorkstation()
|
||||||
sshClient, err := ssh.Dial("tcp", cfg.SSHHost+":"+fmt.Sprintf("%v", cfg.SSHPort), makeSSHClient())
|
sshClient, err := ssh.Dial("tcp", cfg.SSHHost+":"+fmt.Sprintf("%v", cfg.SSHPort), makeSSHClient())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal("Failed to dial: ", err)
|
log.Fatal("Failed to dial: ", err)
|
||||||
|
|
@ -78,7 +78,7 @@ func connect() {
|
||||||
|
|
||||||
go forwardPort(sshClient, "6000", cfg.WorkstationIP, "3389")
|
go forwardPort(sshClient, "6000", cfg.WorkstationIP, "3389")
|
||||||
|
|
||||||
connectToLou()
|
connectToWorkstation()
|
||||||
}
|
}
|
||||||
|
|
||||||
func forwardPort(sshConn *ssh.Client, localPort, remoteHost, remotePort string) {
|
func forwardPort(sshConn *ssh.Client, localPort, remoteHost, remotePort string) {
|
||||||
|
|
@ -149,11 +149,11 @@ func runCommand(name string, args ...string) {
|
||||||
|
|
||||||
func startSequence() {
|
func startSequence() {
|
||||||
runCommand("timew", "start", "work")
|
runCommand("timew", "start", "work")
|
||||||
wakeLou()
|
wakeWorkstation()
|
||||||
connectToVarda()
|
connectToJump()
|
||||||
}
|
}
|
||||||
|
|
||||||
func wakeLou() {
|
func wakeWorkstation() {
|
||||||
sshCommand := fmt.Sprintf("ssh -tt -p %s %s@%s ssh -tt %s@%s \"wakeonlan %s && exit\"",
|
sshCommand := fmt.Sprintf("ssh -tt -p %s %s@%s ssh -tt %s@%s \"wakeonlan %s && exit\"",
|
||||||
fmt.Sprintf("%v", cfg.SSHPort),
|
fmt.Sprintf("%v", cfg.SSHPort),
|
||||||
cfg.SSHUser,
|
cfg.SSHUser,
|
||||||
|
|
@ -166,7 +166,7 @@ func wakeLou() {
|
||||||
runCommand("ssh", args[1:]...)
|
runCommand("ssh", args[1:]...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func connectToVarda() {
|
func connectToJump() {
|
||||||
sshCommand := fmt.Sprintf("ssh -tt -L 2048:%s:22 %s@%s",
|
sshCommand := fmt.Sprintf("ssh -tt -L 2048:%s:22 %s@%s",
|
||||||
cfg.WorkstationHost,
|
cfg.WorkstationHost,
|
||||||
cfg.SSHUser,
|
cfg.SSHUser,
|
||||||
|
|
@ -175,7 +175,7 @@ func connectToVarda() {
|
||||||
runCommand("ssh", args[1:]...)
|
runCommand("ssh", args[1:]...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func connectToLou() {
|
func connectToWorkstation() {
|
||||||
sshCommand := fmt.Sprintf("ssh -tt -L 6000:%s:3389 -p 2048 %s@127.0.0.1",
|
sshCommand := fmt.Sprintf("ssh -tt -L 6000:%s:3389 -p 2048 %s@127.0.0.1",
|
||||||
cfg.WorkstationHost,
|
cfg.WorkstationHost,
|
||||||
cfg.SSHUser)
|
cfg.SSHUser)
|
||||||
|
|
@ -236,11 +236,11 @@ func makeChoice() {
|
||||||
case "show month summary":
|
case "show month summary":
|
||||||
runCommand("timew", "summary", ":month", "work")
|
runCommand("timew", "summary", ":month", "work")
|
||||||
case "wake lou":
|
case "wake lou":
|
||||||
wakeLou()
|
wakeWorkstation()
|
||||||
case "connect to varda":
|
case "connect to varda":
|
||||||
connectToVarda()
|
connectToJump()
|
||||||
case "connect to lou":
|
case "connect to lou":
|
||||||
connectToLou()
|
connectToWorkstation()
|
||||||
case "start rdp connection":
|
case "start rdp connection":
|
||||||
startRDPConnection()
|
startRDPConnection()
|
||||||
case "export":
|
case "export":
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue