Help us shape the future of Go! Take the 2026 Go Developer Survey

dmsgcurl

package
v1.3.100 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Overview

Package dmsgcurl pkg/dmsg/dmsgcurl/dmsgcurl.go c1-net-dmsg

Package dmsgcurl pkg/dmsg/dmsgcurl/flags.go c1-net-dmsg

Package dmsgcurl pkg/dmsg/dmsgcurl/progress_writer.go c1-net-dmsg

Package dmsgcurl pkg/dmsg/dmsgcurl/url.go c1-net-dmsg

Index

Constants

View Source
const ExecName = "dmsgcurl"

ExecName contains the execution name.

Variables

View Source
var (
	ErrNoURLs                   = errors.New("no URLs provided")
	ErrMultipleURLsNotSupported = errors.New("multiple URLs is not yet supported")
)

Errors related to URLs.

View Source
var Version = buildinfo.Version()

Version contains the version string.

Functions

func CancellableCopy

func CancellableCopy(ctx context.Context, w io.Writer, body io.ReadCloser, length int64) (int64, error)

CancellableCopy will call the Reader and Writer interface multiple time, in order to copy by chunk (avoiding loading the whole file in memory).

func Download

func Download(ctx context.Context, log logrus.FieldLogger, httpC *http.Client, w io.Writer, urlStr string, maxSize int64) error

Download downloads a file from the given URL into 'w'.

Types

type DmsgCurl

type DmsgCurl struct {
	// contains filtered or unexported fields
}

DmsgCurl contains the logic for dmsgcurl (curl over dmsg).

func New

func New(fs *flag.FlagSet) *DmsgCurl

New creates a new DmsgCurl instance.

func (*DmsgCurl) Run

func (dg *DmsgCurl) Run(ctx context.Context, log *logging.Logger, skStr string, args []string) (err error)

Run runs the download logic.

func (*DmsgCurl) StartDmsg

func (dg *DmsgCurl) StartDmsg(ctx context.Context, log *logging.Logger, pk cipher.PubKey, sk cipher.SecKey) (dmsgC *dmsg.Client, stop func(), err error)

StartDmsg create dsmg client instance

func (*DmsgCurl) String

func (dg *DmsgCurl) String() string

String implements io.Stringer

type FlagGroup

type FlagGroup interface {
	Name() string
	Init(fs *flag.FlagSet)
}

FlagGroup represents a group of flags.

type ProgressWriter

type ProgressWriter struct {
	// atomic requires 64-bit alignment for struct field access
	Current int64
	Total   int64
}

ProgressWriter prints the progress of a download to stdout.

func (*ProgressWriter) Write

func (pw *ProgressWriter) Write(p []byte) (int, error)

Write implements io.Writer

type URL

type URL struct {
	dmsg.Addr
	url.URL
}

URL represents a dmsg http URL.

func (*URL) Fill

func (du *URL) Fill(str string) error

Fill fills the internal fields from an URL string.

Jump to

Keyboard shortcuts

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