Version: v8.6.12 Latest Latest

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

Go to latest
Published: Mar 26, 2021 License: MIT Imports: 29 Imported by: 0




This section is empty.


This section is empty.


func Debug

func Debug(debug bool)

Debug toggles debug mode


type Chunk

type Chunk struct {
	Bytes    []byte `json:"b,omitempty"`
	Location int64  `json:"l,omitempty"`

Chunk contains information about the needed bytes

type Client

type Client struct {
	Options                         Options
	Pake                            *pake.Pake
	Key                             []byte
	ExternalIP, ExternalIPConnected string

	// steps involved in forming relationship
	Step1ChannelSecured       bool
	Step2FileInfoTransfered   bool
	Step3RecipientRequestFile bool
	Step4FileTransfer         bool
	Step5CloseChannels        bool
	SuccessfulTransfer        bool

	// send / receive information of all files
	FilesToTransfer           []FileInfo
	FilesToTransferCurrentNum int
	FilesHasFinished          map[int]struct{}

	// send / receive information of current file
	CurrentFile            *os.File
	CurrentFileChunkRanges []int64
	CurrentFileChunks      []int64

	TotalSent             int64
	TotalChunksTransfered int
	// contains filtered or unexported fields

Client holds the state of the croc transfer

func New

func New(ops Options) (c *Client, err error)

New establishes a new connection for transferring files between two instances.

func (*Client) Receive

func (c *Client) Receive() (err error)

Receive will receive a file

func (*Client) Send

func (c *Client) Send(options TransferOptions) (err error)

Send will send the specified file

type FileInfo

type FileInfo struct {
	Name         string    `json:"n,omitempty"`
	FolderRemote string    `json:"fr,omitempty"`
	FolderSource string    `json:"fs,omitempty"`
	Hash         []byte    `json:"h,omitempty"`
	Size         int64     `json:"s,omitempty"`
	ModTime      time.Time `json:"m,omitempty"`
	IsCompressed bool      `json:"c,omitempty"`
	IsEncrypted  bool      `json:"e,omitempty"`
	Symlink      string    `json:"sy,omitempty"`

FileInfo registers the information about the file

type Options

type Options struct {
	IsSender       bool
	SharedSecret   string
	Debug          bool
	RelayAddress   string
	RelayAddress6  string
	RelayPorts     []string
	RelayPassword  string
	Stdout         bool
	NoPrompt       bool
	NoMultiplexing bool
	DisableLocal   bool
	OnlyLocal      bool
	IgnoreStdin    bool
	Ask            bool
	SendingText    bool
	NoCompress     bool
	IP             string

Options specifies user specific options

type RemoteFileRequest

type RemoteFileRequest struct {
	CurrentFileChunkRanges    []int64
	FilesToTransferCurrentNum int
	MachineID                 string

RemoteFileRequest requests specific bytes

type SenderInfo

type SenderInfo struct {
	FilesToTransfer []FileInfo
	MachineID       string
	Ask             bool
	SendingText     bool
	NoCompress      bool

SenderInfo lists the files to be transferred

type TransferOptions

type TransferOptions struct {
	PathToFiles      []string
	KeepPathInRemote bool

TransferOptions for sending

Source Files

Jump to

Keyboard shortcuts

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