added diabled crypto
This commit is contained in:
@@ -5,84 +5,84 @@
|
|||||||
package core
|
package core
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/Akilan1999/remotegameplay/config"
|
"github.com/Akilan1999/remotegameplay/config"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Barrier It's preferred that the IP address used is a IPV6 address
|
// Barrier It's preferred that the IP address used is a IPV6 address
|
||||||
type Barrier struct {
|
type Barrier struct {
|
||||||
NodeName string
|
NodeName string
|
||||||
IPAddress string
|
IPAddress string
|
||||||
Mode string
|
Mode string
|
||||||
Process *exec.Cmd
|
Process *exec.Cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateBarrierSession Command to run "barrier.barrierc --debug INFO -f 192.168.0.175"
|
// CreateBarrierSession Command to run "barrier.barrierc --debug INFO -f 192.168.0.175"
|
||||||
func (b *Barrier) CreateBarrierSession() error {
|
func (b *Barrier) CreateBarrierSession() error {
|
||||||
//Checks if barrier client exists
|
//Checks if barrier client exists
|
||||||
|
|
||||||
if err := DetectBarrier(); err != nil {
|
if err := DetectBarrier(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
//Get username from config file
|
//Get username from config file
|
||||||
configResp, err := config.ConfigInit()
|
configResp, err := config.ConfigInit()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd := exec.Command("sudo", "-u", configResp.SystemUsername, "barrierc", "-f", "--debug", "DEBUG", "--log", "/tmp/barrier.log", b.IPAddress)
|
cmd := exec.Command("sudo", "-u", configResp.SystemUsername, "barrierc", "-f", "--disable-crypto", "--debug", "DEBUG", "--log", "/tmp/barrier.log", b.IPAddress)
|
||||||
|
|
||||||
// USE THE FOLLOWING TO DEBUG
|
// USE THE FOLLOWING TO DEBUG
|
||||||
//cmdReader, err := cmd.StdoutPipe()
|
//cmdReader, err := cmd.StdoutPipe()
|
||||||
//if err != nil {
|
//if err != nil {
|
||||||
// fmt.Fprintln(os.Stderr, "Error creating StdoutPipe for Cmd", err)
|
// fmt.Fprintln(os.Stderr, "Error creating StdoutPipe for Cmd", err)
|
||||||
// return
|
// return
|
||||||
//}
|
//}
|
||||||
//
|
//
|
||||||
//// the following is used to print output of the command
|
//// the following is used to print output of the command
|
||||||
//// as it makes progress...
|
//// as it makes progress...
|
||||||
//scanner := bufio.NewScanner(cmdReader)
|
//scanner := bufio.NewScanner(cmdReader)
|
||||||
//go func() {
|
//go func() {
|
||||||
// for scanner.Scan() {
|
// for scanner.Scan() {
|
||||||
// fmt.Printf("%s\n", scanner.Text())
|
// fmt.Printf("%s\n", scanner.Text())
|
||||||
// //
|
// //
|
||||||
// // TODO:
|
// // TODO:
|
||||||
// // send output to server
|
// // send output to server
|
||||||
// }
|
// }
|
||||||
//}()
|
//}()
|
||||||
//
|
//
|
||||||
//if err := cmd.Start(); err != nil {
|
//if err := cmd.Start(); err != nil {
|
||||||
// return err
|
// return err
|
||||||
//}
|
//}
|
||||||
|
|
||||||
if err := cmd.Start(); err != nil {
|
if err := cmd.Start(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
println(cmd.Path)
|
println(cmd.Path)
|
||||||
|
|
||||||
// Saves the state of the command in the struct
|
// Saves the state of the command in the struct
|
||||||
b.Process = cmd
|
b.Process = cmd
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteBarrierSession Deletes barrier client session running
|
// DeleteBarrierSession Deletes barrier client session running
|
||||||
func (b *Barrier) DeleteBarrierSession() error {
|
func (b *Barrier) DeleteBarrierSession() error {
|
||||||
// Halts the process
|
// Halts the process
|
||||||
cmd := exec.Command("pkill", "barrierc")
|
cmd := exec.Command("pkill", "barrierc")
|
||||||
if err := cmd.Run(); err != nil {
|
if err := cmd.Run(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// DetectBarrier This function ensures that the server has barrier client installed
|
// DetectBarrier This function ensures that the server has barrier client installed
|
||||||
func DetectBarrier() error {
|
func DetectBarrier() error {
|
||||||
_, err := exec.LookPath("barrierc")
|
_, err := exec.LookPath("barrierc")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user