tortugasync

package module
v0.0.0-...-f2f22b1 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2024 License: GPL-3.0 Imports: 11 Imported by: 0

README

TortugaSync

My own custom cloud system for Kobo eBooks.

To use Tortuga Sync you need to have:

  • A new pair of passwordless ssh keys: ssh-keygen -t ed25519 -f tortuga_key
  • A host_key file containing the server public key: go run hostkey.go myhostname (requires ssh-keyscan, replace 'myhostname' with your actual hostname)
  • A host_address file containing the address and port to use for the server (can be an IP) (www.example.com:22), make sure to not include a new line at the end of the file.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bay

type Bay struct {
	*sftp.Client
}

func Connect

func Connect(url string, key, hostKey []byte) (Bay, error)

func (Bay) Fetch

func (b Bay) Fetch(localPath, remotePath string) ([]byte, error)

Fetch downloads a book from tortuga@{remote}:{remotePath} to localPath and returns its just calculated MD5SUM and an error if any.

func (Bay) Metadata

func (b Bay) Metadata(path string) (Cache, error)

Metadata returns a map of MD5 hashes as keys and file paths as values read from the server.

type Cache

type Cache map[string]string

func NewCacheFromFile

func NewCacheFromFile(path string) (cc Cache, err error)

Expects a JSON formatted file path and returns the parsed Cache.

func (Cache) Diff

func (cc Cache) Diff(a Cache) Cache

Diff returns the difference between cc and a. This is used to evaluate what has to be fetched from the server. Since the file hash in the local cache is computed locally this mechanism intrinsically makes sure that if the file is corrupted it will be re downloaded next time.

func (Cache) WriteToFile

func (cc Cache) WriteToFile(path string) error

Writes the Cache to the given path encoded in JSON format.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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