utils

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrPasswordInterrupted = errors.New("password input interrupted")

ErrPasswordInterrupted returned when password input is interrupted by signal.

Functions

func AskPassword

func AskPassword(prompt string) (string, error)

AskPassword read password with no echo

func AskYesNo

func AskYesNo(prompt string) bool

AskYesNoWithCancel behaves like AskYesNo but terminates the program on Ctrl+C.

func ConfigureZstdParams

func ConfigureZstdParams(level, minSizeB, chunkSizeB int)

func ControlProtocol

func ControlProtocol(base string) string

func DataProtocol

func DataProtocol(base string) string

func DataProtocolZstd

func DataProtocolZstd(base string) string

func GetProtocol

func GetProtocol() string

func GetUserAgent

func GetUserAgent() string

func PipeBothWithIdle

func PipeBothWithIdle(a, b io.ReadWriteCloser, idle time.Duration)

PipeBothWithIdle copies data in both directions between a and b. It closes both sides when any direction finishes or when idle timeout elapses.

Types

type ZstdDuplex

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

func NewZstdDuplex

func NewZstdDuplex(base io.ReadWriteCloser) (*ZstdDuplex, error)

func (*ZstdDuplex) Close

func (z *ZstdDuplex) Close() error

func (*ZstdDuplex) Read

func (z *ZstdDuplex) Read(p []byte) (int, error)

func (*ZstdDuplex) SetInfo

func (z *ZstdDuplex) SetInfo(side, service, peer, protocol string) *ZstdDuplex

func (*ZstdDuplex) Write

func (z *ZstdDuplex) Write(p []byte) (int, error)

Jump to

Keyboard shortcuts

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