-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from suutaku/dev
Dev
- Loading branch information
Showing
32 changed files
with
1,065 additions
and
1,396 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 2,3 @@ | |
./signaling | ||
./sshx | ||
./sshx-linux | ||
|
||
sshx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 1,49 @@ | ||
package main | ||
|
||
import ( | ||
"encoding/gob" | ||
|
||
"github.com/suutaku/sshx/pkg/types" | ||
|
||
cli "github.com/jawher/mow.cli" | ||
"github.com/sirupsen/logrus" | ||
"github.com/suutaku/sshx/pkg/conf" | ||
"github.com/suutaku/sshx/pkg/impl" | ||
) | ||
|
||
func cmdStatus(cmd *cli.Cmd) { | ||
// cmd.Spec = "[-t]" | ||
// typeFilter := cmd.StringOpt("t type","","application type filter") | ||
cmd.Spec = "[ -t ]" | ||
treeOpt := cmd.BoolOpt("t", false, "display in tree view") | ||
cmd.Action = func() { | ||
cm := conf.NewConfManager(getRootPath()) | ||
dialer := impl.NewStatImpl() | ||
defer dialer.Close() | ||
param := impl.ImplParam{ | ||
Config: *cm.Conf, | ||
imp := impl.NewSTAT() | ||
err := imp.Preper() | ||
if err != nil { | ||
logrus.Error(err) | ||
return | ||
} | ||
dialer.Init(param) | ||
err := dialer.Dial() | ||
|
||
sender := impl.NewSender(imp, types.OPTION_TYPE_STAT) | ||
if sender == nil { | ||
logrus.Error("cannot create sender") | ||
return | ||
} | ||
conn, err := sender.SendDetach() | ||
if err != nil { | ||
logrus.Info(err) | ||
logrus.Error(err) | ||
return | ||
} | ||
defer conn.Close() | ||
logrus.Debug("impl responsed") | ||
var pld []types.Status | ||
err = gob.NewDecoder(conn).Decode(&pld) | ||
if err != nil { | ||
logrus.Error(err) | ||
return | ||
} | ||
logrus.Debug("show response") | ||
displayStyle := impl.DISPLAY_TABLE | ||
if *treeOpt { | ||
displayStyle = impl.DISPLAY_TREE | ||
} | ||
imp.ShowStatus(pld, displayStyle) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 1,49 @@ | ||
package main | ||
|
||
import ( | ||
cli "github.com/jawher/mow.cli" | ||
"github.com/sirupsen/logrus" | ||
"github.com/suutaku/sshx/pkg/impl" | ||
"github.com/suutaku/sshx/pkg/types" | ||
) | ||
|
||
func cmdStartVNCService(cmd *cli.Cmd) { | ||
cmd.Spec = "[-P]" | ||
vncServerPort := cmd.IntOpt("P", 80, "local proxy port") | ||
cmd.Action = func() { | ||
imp := impl.NewVNCService(int32(*vncServerPort)) | ||
err := imp.Preper() | ||
if err != nil { | ||
logrus.Error(err) | ||
return | ||
} | ||
sender := impl.NewSender(imp, types.OPTION_TYPE_UP) | ||
if sender == nil { | ||
logrus.Error("can not create impl") | ||
return | ||
} | ||
_, err = sender.SendDetach() | ||
if err != nil { | ||
logrus.Error(err) | ||
return | ||
} | ||
} | ||
} | ||
|
||
func cmdStopVNCService(cmd *cli.Cmd) { | ||
cmd.Spec = "PID" | ||
pidOpt := cmd.StringArg("PID", "", "vnc server pair Id") | ||
cmd.Action = func() { | ||
if pidOpt == nil || *pidOpt == "" { | ||
return | ||
} | ||
sender := impl.NewSender(&impl.VNCService{}, types.OPTION_TYPE_DOWN) | ||
sender.PairId = []byte(*pidOpt) | ||
sender.SendDetach() | ||
} | ||
} | ||
|
||
func cmdVNCService(cmd *cli.Cmd) { | ||
cmd.Command("start", "start vnc service", cmdStartVNCService) | ||
cmd.Command("stop", "stop vnc service", cmdStopVNCService) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.