Correct way to request a mount in Golang

What would be the right way to trigger the mount of an encrypted volume through Golang rclone mount functions (linux OS) (equivalent of rclone mount encrypted_storage: /encrypted_storage and potentially some options too)? I see a few different options, such as NewMountPoint and NewMountCommand. It seems both need a mount function to be passed in which needs constructing? The Rclone.conf file is present and ready to go with the required mounts, just the trigger that is missing.

I also need to be able to do the mount from an encrypted rclone.conf config file. Should the config file be decrypted first, or is there a way to pass in the password to each mount command?

The easiest way to use rclone programmatically is to use the functions exposed in librclone which expose the API but as an in-process version.

This interface is guaranteed not to change also.

The code for building Rclone in C? I'm a little lost on the approach.

I managed to get it working by replicating the code from the mountRC in my own function. As they are not exposed functions I wasn't able to call them directly, which is why I replicated it in my own code. It seems to be working ok, and the RC snippets act as nice code examples. I had thought there may have been a function like this exposed that I could just pass in the various opts and create a mount.

I haven't yet had a chance to look at how decrypting the config file will fit in with this.

I meant use this code

Which is an in-process API call.

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.