adret

package
v0.0.0-...-c2f0dd3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 8, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigRemote

func ConfigRemote(hostname string, port string)

Use to config the information about remote ubac listener to avoid specifying in CLi all the time

func Exist

func Exist(resourceName string, nodes []Node) bool

answer wether a resource exists in the tree or not

func GetChildrenNodes

func GetChildrenNodes(prefix string, nodes []Node) []string

Return all nodes with specific prefix/parent directory (ie prefix == node.Parent) It enables us to retrieve all nodes directly under a specified one (with depth=depth_nodes+1)

func GetDescendantNodes

func GetDescendantNodes(prefix string, nodes []Node) []string

Return all nodes name under the prefix/parent directory (ie node.Parent begin w/ prefix) It enables us to retrieve all nodes under a specified one

func GetRmPatch

func GetRmPatch(key string, tree Tree, resourceName string) filesystem.Patch

provide the patch to remove a resource on ubac side the patch is a json string with 3 arrays: to_add,to_delete and to_change all the info within structure are encrypted after to be put in patch

func GetRmPatchString

func GetRmPatchString(key string, tree Tree, resourceName string) string

provide the patch (string) to remove a resource on ubac side

func GetRootDir

func GetRootDir(nodes []Node) (rootDir string, err error)

Return root directory path of nodes list

func IsDir

func IsDir(resourceName string, nodes []Node) bool

Return true if the resource/node specified is of type directory

func ParseCatContent

func ParseCatContent(result string, key string) string

Parse the cat result received from ubac utility cat only work on file resource not directory, so we don't have to check the resourceType Error must be manage by ubac (if file doesn't exist or if it is a directory) result structure: base64(Encrypt(Content))

func ParseLsContent

func ParseLsContent(result string, key string) string

Parse the ls result received from ubac utility result structure: resourceType:base64(Encrypt(Content))

func ParseLsDirectoryContent

func ParseLsDirectoryContent(content string, key string) []string

Parse the directory content retrieve from encrypted fs (w/ ubac for example) First decrypt the whole content Then parse the content as each resources is separated by "\"

func PrintCat

func PrintCat(result string, key string)

func PrintCommandMessage

func PrintCommandMessage(f func())

func PrintConfigremoteMessage

func PrintConfigremoteMessage()

Remote

func PrintDarkenpathMessage

func PrintDarkenpathMessage()

Encrypt

func PrintDecryptcatMessage

func PrintDecryptcatMessage()

func PrintDecryptlsMessage

func PrintDecryptlsMessage()

Read access

func PrintDecrypttreeMessage

func PrintDecrypttreeMessage()

func PrintEncryptfsMessage

func PrintEncryptfsMessage()

func PrintHelp

func PrintHelp()

Print all help messages (all available command and their use)

func PrintHelpMessage

func PrintHelpMessage()

func PrintLs

func PrintLs(result string, key string)

func PrintMapInOrder

func PrintMapInOrder(m map[string]func(), order []string)

func PrintNode

func PrintNode(nodes []Node, node Node, last bool, inlast bool)

(recursive) Print the tree under the Node (except the node itself) Retrieve all node under if it is a directory and print it, nothing if it is a file

func PrintRemoteCat

func PrintRemoteCat(resourceName string, key string)

Print the result of a cat on a remote listening ubac (proxing to encrypted fs)

func PrintRemoteLs

func PrintRemoteLs(resourceName string, key string)

func PrintRemoteRm

func PrintRemoteRm(key string, resourceName string)

func PrintRemotecatMessage

func PrintRemotecatMessage()

func PrintRemotelsMessage

func PrintRemotelsMessage()

func PrintRemotermMessage

func PrintRemotermMessage()

func PrintRemotetreeMessage

func PrintRemotetreeMessage()

func PrintRmPatch

func PrintRmPatch(key string, treeJSON string, resourceName string)

func PrintRmPatchMessage

func PrintRmPatchMessage()

func PrintTree

func PrintTree(treeJSON string, key string)

Print the Tree struct (input) in a fashion way (as tree command would do.. I hope)

func RemoteCat

func RemoteCat(resourceName string, key string) string

Perform cat on a remote listening ubac (proxing to encrypted fs) First craft the request, send it (the request instruct ubac to perform a cat) take the reponse and decrypt it

func RemoteExist

func RemoteExist(resourceName string, key string) bool

connect with remote FS and check if the resource is inside ask /tree endpoint of remote ubac and search resource within

func RemoteGetRootDir

func RemoteGetRootDir(key string) (rootDir string, err error)

func RemoteGetTreeJSON

func RemoteGetTreeJSON() string

Retrieve the tree in JSON struct from remote (ubac listener)

func RemoteIsDir

func RemoteIsDir(resourceName string, key string) bool

connect with remote FS and check if the resource is a directory ask /tree endpoint of remote ubac and determine if the resource is a directory

func RemoteLs

func RemoteLs(resourceName string, key string) string

Perform ls on a remote listening ubac (proxing to encrypted fs) First craft the request, send it (the request instruct ubac to perform a ls) take the reponse and decrypt it

func RemoteRm

func RemoteRm(key string, resourceName string) string

Remove a resource on remote encrypted fs. First it retrieve tree from remote Then, it forge the patch to apply and finally send it to remote (to be applied by remote ubac lister)

func RemoteTree

func RemoteTree(key string)

Perform tree on a remote listening ubac (proxing to encrypted fs) First craft the request, send it (the request instruct ubac to perform a tree) take the reponse and decrypt it

Types

type Node

type Node struct {
	Name   string
	Type   string
	Parent string
}

/!\ do not confuse with the Node & Tree struct of ubac package

func CreateNode

func CreateNode(name string, nodeType string, dir string) Node

Create a node from its name, its type and its parent directory

func GetNodeByName

func GetNodeByName(name string, nodes []Node) (node Node, err error)

Get a Node by providing its name, an error is thrown if the Node isn't found

func RemoteGetNodes

func RemoteGetNodes(key string) []Node

Return the Node list of the remote tree

type Tree

type Tree struct {
	Nodes []Node
	// contains filtered or unexported fields
}

func GetTreeStructFromResourcesMap

func GetTreeStructFromResourcesMap(resources map[string]string) Tree

Get tree structure from map. Map: key= resource name and value= resource type

func GetTreeStructFromTreeJson

func GetTreeStructFromTreeJson(treeJSON string, key string) (tree Tree)

Take the Tree from ubac(JSON string format) as input and return it in a struct with decrypted name that help to work with it

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL