mirror of
https://github.com/rwinkhart/libmutton.git
synced 2026-08-27 20:36:29 -04:00
Rename syncclient "oneOff" functions to be less redundant
This commit is contained in:
+1
-1
@@ -80,7 +80,7 @@ func LibmuttonInit(inputCB func(prompt string) string, clientSpecificIniData [][
|
||||
return errors.New("unable to write config file: " + err.Error())
|
||||
}
|
||||
// generate and register device ID
|
||||
sshEntryRoot, sshAgeDir, sshIsWindows, err := syncclient.DeviceIDGenFromClient(oldDeviceID, "")
|
||||
sshEntryRoot, sshAgeDir, sshIsWindows, err := syncclient.GenDeviceID(oldDeviceID, "")
|
||||
if err != nil {
|
||||
return errors.New("unable to generate device ID: " + err.Error())
|
||||
}
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ func WriteEntry(realPath string, decSlice []string, passwordIsNew bool) error {
|
||||
return errors.New("unable to update age data: " + err.Error())
|
||||
}
|
||||
} else { // if the password change was a removal, remove the associated age file
|
||||
err = syncclient.ShearRemoteFromClient(global.GetVanityPath(realPath), true)
|
||||
err = syncclient.ShearRemote(global.GetVanityPath(realPath), true)
|
||||
if err != nil {
|
||||
return errors.New("unable to remove age data: " + err.Error())
|
||||
}
|
||||
|
||||
@@ -15,13 +15,13 @@ import (
|
||||
"github.com/rwinkhart/libmutton/synccommon"
|
||||
)
|
||||
|
||||
// ShearRemoteFromClient removes the target file or directory from
|
||||
// ShearRemote removes the target file or directory from
|
||||
// the local system and calls the server to remove it remotely and
|
||||
// add it to the deletions list.
|
||||
// It can safely be called in offline mode, as well, so this is
|
||||
// the intended interface for shearing (ShearLocal should only
|
||||
// be used directly by the server binary).
|
||||
func ShearRemoteFromClient(vanityPath string, onlyShearAgeFile bool) error {
|
||||
func ShearRemote(vanityPath string, onlyShearAgeFile bool) error {
|
||||
deviceID, isDir, err := synccommon.ShearLocal(vanityPath, "", onlyShearAgeFile) // remove the target from the local system and get the device ID of the client
|
||||
if err != nil {
|
||||
return errors.New("unable to shear target locally: " + err.Error())
|
||||
@@ -73,7 +73,7 @@ end:
|
||||
// old target to the deletions list.
|
||||
// It can safely be called in offline mode, as well, so this is the intended
|
||||
// interface for renaming (RenameLocal should only be used directly by the server binary).
|
||||
func RenameRemoteFromClient(oldVanityPath, newVanityPath string) error {
|
||||
func RenameRemote(oldVanityPath, newVanityPath string) error {
|
||||
err := synccommon.RenameLocal(oldVanityPath, newVanityPath) // move the target on the local system
|
||||
if err != nil {
|
||||
return errors.New("unable to rename target locally: " + err.Error())
|
||||
@@ -125,7 +125,7 @@ end:
|
||||
// It can safely be called in offline mode, as well, so this is the
|
||||
// intended interface for adding folders (AddFolderLocal should only be
|
||||
// used directly by the server binary).
|
||||
func AddFolderRemoteFromClient(vanityPath string) error {
|
||||
func AddFolderRemote(vanityPath string) error {
|
||||
err := synccommon.AddFolderLocal(vanityPath) // add the folder on the local system
|
||||
if err != nil {
|
||||
return errors.New("unable to add folder locally: " + err.Error())
|
||||
@@ -161,13 +161,13 @@ end:
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeviceIDGenFromClient generates a new client device ID
|
||||
// GenDeviceID generates a new client device ID
|
||||
// and registers it with the server (will replace existing one).
|
||||
// Device IDs are only needed for online synchronization.
|
||||
// Device IDs are guaranteed unique as the current UNIX time is appended to them.
|
||||
// Leave prefix empty to use the current hostname as the prefix.
|
||||
// Returns: the remote EntryRoot, the remote AgeDir, and OS type indicator.
|
||||
func DeviceIDGenFromClient(oldDeviceID, prefix string) (string, string, string, error) {
|
||||
func GenDeviceID(oldDeviceID, prefix string) (string, string, string, error) {
|
||||
// generate new device ID
|
||||
if prefix == "" {
|
||||
prefix, _ = os.Hostname()
|
||||
|
||||
Reference in New Issue
Block a user