magnet

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: May 4, 2022 License: Unlicense Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DirToTar added in v0.0.2

func DirToTar(src string, buf io.Writer) error

DirToTar: take a directory name as input and write the tar content of it in a buffer (~return tar content of a directory without writing archive on disk). Thanks to: https://gist.github.com/mimoo/25fc9716e0f1353791f5908f94d6e726

func Magnet

func Magnet(sender MagnetSender, fileList string, endpoint string, key string, debug bool)

Magnet: wrapper functions to decrypt file list and endpoint and send all the files to the endpoint

func SendFileHTTP added in v0.0.2

func SendFileHTTP(client *http.Client, endpoint string, filename string) (err error)

SendFileHTTP: use HTTP multipart form data request to upload a specific file on specified endpoint

func SendFileTCP added in v0.0.2

func SendFileTCP(endpoint string, filename string) (err error)

func UnfreezeEndpoint

func UnfreezeEndpoint(endpoint string, key string, debug bool) (cEndpoint string)

UnfreezeEndpoint: Decrypt endpoint with xor function

func UnfreezeList

func UnfreezeList(files string, key string, debug bool) (fileList []string)

UnfreezeList: unflat a file list and decrypt them using xor function. if debug mode is enabled, print some information

func UploadHTTP added in v0.0.2

func UploadHTTP(client *http.Client, url string, values map[string]io.Reader, filename string) (err error)

UploadHTTP: construct upload request and submit it. The filename is used for the directory case when we upload an tar gz archive (As it is passed as a buffer we can't access the filename)

Types

type MagnetHTTPSender added in v0.0.2

type MagnetHTTPSender struct {
	Endpoint string
	Key      string
}

MagnetHTTPSender: Sender that uses HTTP to send the files

func (MagnetHTTPSender) Name added in v0.0.2

func (sender MagnetHTTPSender) Name() string

func (MagnetHTTPSender) SendFiles added in v0.0.2

func (sender MagnetHTTPSender) SendFiles(fileList []string, cEndpoint string, debug bool)

Sendfiles: send all files of a list using HTTP multipart-form data request to a specified endpoint

type MagnetSender added in v0.0.2

type MagnetSender interface {
	//SendFiles: send file to target
	SendFiles(fileList []string, cEndpoint string, debug bool)
	//Name: return MagnetSender name
	Name() string
}

func InitMagnetSender added in v0.0.2

func InitMagnetSender(method string) (sender MagnetSender)

InitMagnetSender: return MagnetSender struct regarding the method parameter

type MagnetTCPSender added in v0.0.2

type MagnetTCPSender struct {
}

MagnetTCPSender: Sender that uses raw tcp to send the files

func (MagnetTCPSender) Name added in v0.0.2

func (sender MagnetTCPSender) Name() string

func (MagnetTCPSender) SendFiles added in v0.0.2

func (sender MagnetTCPSender) SendFiles(fileList []string, cEndpoint string, debug bool)

Sendfiles: send all files of a list using TCP raw socket

Jump to

Keyboard shortcuts

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