mirror of
https://github.com/rwinkhart/rcw.git
synced 2026-10-28 22:48:16 -04:00
Add high-level function for calling the daemon if it is open
This commit is contained in:
1 parent
0479447f14
commit
9314852f06
6 files changed
+36
-39
No files matched your search
+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