Documentation
¶
Overview ¶
ctx.go
Index ¶
- Constants
- Variables
- func CopyToClipboard(value string, quiet bool, extended bool)
- func Debug(debug bool)
- func GetFilesInfo(fnames []string, zipfolder bool, ignoreGit bool, exclusions []string) (filesInfo []FileInfo, emptyFolders []FileInfo, totalNumberFolders int, ...)
- func GetFilesInfoContext(ctx context.Context, fnames []string, zipfolder bool, ignoreGit bool, ...) (filesInfo []FileInfo, emptyFolders []FileInfo, totalNumberFolders int, ...)
- func GetFilesInfoWithExactExclusions(fnames []string, zipfolder bool, ignoreGit bool, ...) (filesInfo []FileInfo, emptyFolders []FileInfo, totalNumberFolders int, ...)
- func GetFilesInfoWithExactExclusionsContext(ctx context.Context, fnames []string, zipfolder bool, ignoreGit bool, ...) (filesInfo []FileInfo, emptyFolders []FileInfo, totalNumberFolders int, ...)
- func ShowReceiveCommandQrCode(command string)
- type Chunk
- type Client
- type FileInfo
- type Options
- type QUICConfig
- type RemoteFileRequest
- type SenderInfo
- type SimpleMessage
- type TransferOptions
- type TransportMode
Constants ¶
const (
ReconnectVersion = 1
)
Variables ¶
var ( ErrRelayConnection = errors.New("relay connection failed") // ErrDERPConnection is the compatibility sentinel for failures in the // Tailcat-backed data path selected by --transport derp. ErrDERPConnection = errors.New("DERP connection failed") )
ErrRelayConnection marks a failure to establish a relay control or data connection. Callers may use it to invalidate cached relay selections without treating peer or transfer failures as relay availability failures.
Functions ¶
func CopyToClipboard ¶
CopyToClipboard copies a croc share value using the platform clipboard helper.
func GetFilesInfo ¶
func GetFilesInfo(fnames []string, zipfolder bool, ignoreGit bool, exclusions []string) (filesInfo []FileInfo, emptyFolders []FileInfo, totalNumberFolders int, err error)
This function retrieves the important file information for every file that will be transferred
func GetFilesInfoContext ¶
func GetFilesInfoContext(ctx context.Context, fnames []string, zipfolder bool, ignoreGit bool, exclusions []string) (filesInfo []FileInfo, emptyFolders []FileInfo, totalNumberFolders int, err error)
GetFilesInfoContext is GetFilesInfo with cancellation support.
func GetFilesInfoWithExactExclusions ¶
func GetFilesInfoWithExactExclusions(fnames []string, zipfolder bool, ignoreGit bool, exclusions, exactExclusions []string) (filesInfo []FileInfo, emptyFolders []FileInfo, totalNumberFolders int, err error)
GetFilesInfoWithExactExclusions retrieves file information while applying both the legacy substring exclusions and exact relative-path exclusions.
func GetFilesInfoWithExactExclusionsContext ¶
func GetFilesInfoWithExactExclusionsContext(ctx context.Context, fnames []string, zipfolder bool, ignoreGit bool, exclusions, exactExclusions []string) (filesInfo []FileInfo, emptyFolders []FileInfo, totalNumberFolders int, err error)
GetFilesInfoWithExactExclusionsContext retrieves file information while allowing a large directory walk or zip operation to be canceled.
func ShowReceiveCommandQrCode ¶
func ShowReceiveCommandQrCode(command string)
ShowReceiveCommandQrCode prints a QR code for a share URL.
Types ¶
type Client ¶
type Client struct {
Options Options
Pake *pake.Pake
Key []byte
ExternalIP, ExternalIPConnected string
Step1ChannelSecured bool
Step2FileInfoTransferred bool
Step3RecipientRequestFile bool
Step4FileTransferred bool
Step5CloseChannels bool
SuccessfulTransfer bool
// send / receive information of all files
FilesToTransfer []FileInfo
EmptyFoldersToTransfer []FileInfo
TotalNumberOfContents int
TotalNumberFolders int
FilesToTransferCurrentNum int
FilesHasFinished map[int]struct{}
TotalFilesIgnored int
// send / receive information of current file
CurrentFile *os.File
CurrentFileChunkRanges []int64
CurrentFileChunkCount int
CurrentFileIsClosed bool
LastFolder string
TotalSent int64
TotalChunksTransferred int
// contains filtered or unexported fields
}
Client holds the state of the croc transfer
func NewQUICCtx ¶
NewQUICCtx retains Croc's transfer engine and PAKE while requiring native QUIC data streams, mutual TLS, and a Flock-capable peer. No TCP data fallback.
func (Client) Cancel ¶
func (s Client) Cancel()
Cancel initiates interruption of my loops and goroutines
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,omitzero"`
IsCompressed bool `json:"c"`
IsEncrypted bool `json:"e,omitempty"`
Symlink string `json:"sy,omitempty"`
Mode os.FileMode `json:"md,omitempty"`
TempFile bool `json:"tf,omitempty"`
IsIgnored bool `json:"ig,omitempty"`
Prepared bool `json:"p,omitempty"`
// contains filtered or unexported fields
}
FileInfo registers the information about the file
type Options ¶
type Options struct {
Agent bool `json:"-"`
OnProgress func(int64) `json:"-"`
OnTransport func(string) `json:"-"`
OnOffer func([]FileInfo, []FileInfo) error `json:"-"`
IsSender bool
RoomName string
Debug bool
RelayAddress string
RelayAddress6 string
PublicRelay bool
RelayPorts []string
RelayPassword string
Stdout bool
NoPrompt bool
NoMultiplexing bool
DisableLocal bool
OnlyLocal bool
IgnoreStdin bool
Ask bool
SendingText bool
NoCompress bool
IP string
Overwrite bool
Rename bool
Curve string
HashAlgorithm string
ThrottleUpload string
ZipFolder bool
TestFlag bool
GitIgnore bool
MulticastAddress string
ShowQrCode bool
Exclude []string
ExcludeFile []string
Quiet bool
DisableClipboard bool
ExtendedClipboard bool
Transport TransportMode `json:",omitempty"`
}
Options specifies user specific options
type QUICConfig ¶
QUICConfig selects directly reachable UDP file-data endpoints. The Croc relay is used only for the PAKE-authenticated control channel.
type RemoteFileRequest ¶
type RemoteFileRequest struct {
CurrentFileChunkRanges []int64
FilesToTransferCurrentNum int
MachineID string
ExternalIP string `json:",omitempty"`
ReconnectVersion int
Features []string `json:",omitempty"`
}
RemoteFileRequest requests specific bytes
type SenderInfo ¶
type SenderInfo struct {
FilesToTransfer []FileInfo
EmptyFoldersToTransfer []FileInfo
TotalNumberFolders int
MachineID string
ExternalIP string `json:",omitempty"`
Ask bool
SendingText bool
NoCompress bool
HashAlgorithm string
ReconnectVersion int
NextReconnectRoom string
Features []string `json:",omitempty"`
}
SenderInfo lists the files to be transferred
type SimpleMessage ¶
type TransferOptions ¶
TransferOptions for sending
type TransportMode ¶
type TransportMode string
TransportMode controls how a sender selects the file-data connection after the PAKE-authenticated control channel is established. Receivers must use TransportAuto and follow the sender's negotiated selection.
const ( TransportAuto TransportMode = "auto" TransportDERP TransportMode = "derp" TransportRelay TransportMode = "relay" )
func ParseTransportMode ¶
func ParseTransportMode(value string) (TransportMode, error)
ParseTransportMode validates and normalizes a transport name. An empty value is the API-compatible spelling of the default auto mode.
func ResolveTransportMode ¶
func ResolveTransportMode(value string) (effective TransportMode, downgraded bool, err error)
ResolveTransportMode validates a transport name and resolves it against the capabilities compiled into this binary. Relay-only builds downgrade strict Tailcat requests to the croc relay and report that choice to the caller.