diff --git a/sshRpc.go b/sshRpc.go new file mode 100644 index 000000000..78ac90f82 --- /dev/null +++ b/sshRpc.go @@ -0,0 +1,34 @@ +package liveshare + +import ( + "context" + "errors" +) + +type SshRpc struct { + client *Client +} + +func NewSSHRpc(client *Client) (*SshRpc, error) { + if !client.hasJoined() { + return nil, errors.New("client must join before creating server") + } + return &SshRpc{client: client}, nil +} + +type SshServerStartResult struct { + Result bool `json:"result"` + ServerPort string `json:"serverPort"` + User string `json:"user"` + Message string `json:"message"` +} + +func (s *SshRpc) StartRemoteServer(ctx context.Context) (SshServerStartResult, error) { + var response SshServerStartResult + + if err := s.client.rpc.do(ctx, "ISshServerHostService.startRemoteServer", []string{}, &response); err != nil { + return response, err + } + + return response, nil +}