mirror of
https://github.com/rwinkhart/rcw.git
synced 2026-09-05 08:37:27 -04:00
Add high-level function for calling the daemon if it is open
This commit is contained in:
+2
-12
@@ -7,7 +7,7 @@ import (
|
||||
)
|
||||
|
||||
var daemonHash []byte
|
||||
var passphrase string
|
||||
var globalPassphrase string
|
||||
|
||||
// RCWService provides an RPC method.
|
||||
type RCWService struct{}
|
||||
@@ -15,7 +15,7 @@ type RCWService struct{}
|
||||
// GetPass is the RPC method.
|
||||
// For now (as a test/example), it returns "hello" if the input is "hi".
|
||||
func (h *RCWService) GetPass(request string, reply *string) error {
|
||||
*reply = passphrase
|
||||
*reply = globalPassphrase
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -26,13 +26,3 @@ func getFileHash(path string) []byte {
|
||||
io.Copy(hash, file)
|
||||
return hash.Sum(nil)
|
||||
}
|
||||
|
||||
// daemonIsOpen checks if the socket/named pipe for the rcw
|
||||
// daemon exists and returns a boolean indicator.
|
||||
func daemonIsOpen() bool {
|
||||
fileInfo, err := os.Stat(socketPath)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
return !fileInfo.IsDir()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user