package module
Version: v0.0.0-...-0efd5d2 Latest Latest

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

Go to latest
Published: Nov 2, 2019 License: MPL-2.0 Imports: 10 Imported by: 0



A lite client library for syncthing, for when you need to upload/download but don't want a full sync



This package provides a ligth client for syncthing, for when you need to upload/download but don't want a full sync.



This section is empty.


This section is empty.


func Handshake

func Handshake(conn *tls.Conn, hello *protocol.Hello, exptectedID protocol.DeviceID) error

func MakeRequst

func MakeRequst(ID int32, rootFolder string, name string, offset int64, size int32, hash []byte) ([]byte, error)

func MakeResponse

func MakeResponse(id int32, data []byte) ([]byte, error)

Rigth now only used for testing


type Callback

type Callback struct {
	CCrecived       chan bool
	IndexRecived    chan bool
	ResponseRecived chan *protocol.Response

TODO: Upload Complete

type Client

type Client struct {
	Remote   Remote            // The remote syncthing instance
	Cert     tls.Certificate   // Your certificate
	DeviceID protocol.DeviceID // Your device ID

func (*Client) AddRemote

func (c *Client) AddRemote(deviceID string) error

AddRemote adds a new remote syncthing client

func (*Client) Download

func (c *Client) Download(from, to string) error

Download retrieves the specified file and stores it in "to"

func (*Client) GetFileList

func (c *Client) GetFileList(folder string) ([]FileInfo, error)

GetFileList retrieves a file list for the folder.

func (*Client) GetSharedFolders

func (c *Client) GetSharedFolders() ([]string, error)

GetSharedFolders retrieves the folders that are shared with this client

func (*Client) LoadCertificate

func (c *Client) LoadCertificate(certFile, keyFile string) error

LoadCertificate loads the syncthing certificate from file

func (*Client) Upload

func (c *Client) Upload(from, to string) error

Upload uploades the "from" file to the remote "to" path specified

type FileInfo

type FileInfo struct {
	Name string
	Size int64
	Type string

type Message

type Message struct {
	HeaderLength  uint16
	Header        []byte
	MessageLength uint32
	Message       []byte

func (*Message) GetHeader

func (msg *Message) GetHeader() *protocol.Header

type Remote

type Remote struct {
	DeviceID protocol.DeviceID // The device ID of the remote instance
	Host     string

	ClusterConfig *protocol.ClusterConfig
	Index         *protocol.Index
	Callback      Callback
	// contains filtered or unexported fields

func (*Remote) MakeClusterConfig

func (remote *Remote) MakeClusterConfig(folderID string) ([]byte, error)

func (*Remote) Send

func (r *Remote) Send(data []byte) error

func (*Remote) SetHost

func (r *Remote) SetHost(Host string)

SetHost sets the remote host name host:port format

Jump to

Keyboard shortcuts

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