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

helper

package
v1.1.7 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CompressSnappy is the Snappy compression format
	CompressSnappy = iota
	CompressGzip
	CompressZstd
)
View Source
const (
	DirectionModeSend    = "send"
	DirectionModeReceive = "receive"
)

Variables

This section is empty.

Functions

func NewCompressConn

func NewCompressConn(conn net.Conn, compressType CompressType, isReader bool) (net.Conn, error)

NewCompressConn creates a unidirectional compressed connection for backward compatibility isReader=true: creates a read-only connection for receiving compressed data isReader=false: creates a write-only connection for sending compressed data

func NewCompressReader

func NewCompressReader(conn net.Conn, compressType CompressType) (net.Conn, error)

NewCompressReader creates a read-only compressed connection

func NewCompressWriter

func NewCompressWriter(conn net.Conn, compressType CompressType) (net.Conn, error)

NewCompressWriter creates a write-only compressed connection

Types

type Client

type Client interface {
	Run() error
}

Client is the common interface for all client-side operations.

func NewConcurrentClient

func NewConcurrentClient(config *Config) Client

func NewOneTimeClient

func NewOneTimeClient(config *Config) Client

type CommaIntFlags

type CommaIntFlags []string

func (*CommaIntFlags) Set

func (c *CommaIntFlags) Set(value string) error

func (*CommaIntFlags) String

func (c *CommaIntFlags) String() string

func (*CommaIntFlags) Type

func (c *CommaIntFlags) Type() string

type CommaStringFlags

type CommaStringFlags []string

func (*CommaStringFlags) Set

func (c *CommaStringFlags) Set(value string) error

func (*CommaStringFlags) String

func (c *CommaStringFlags) String() string

func (*CommaStringFlags) Type

func (c *CommaStringFlags) Type() string

type CompressType

type CompressType int

CompressType is the compression format

type ConcurrentClient

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

ConcurrentClient handles receiving data from multiple sources concurrently.

func (*ConcurrentClient) Run

func (c *ConcurrentClient) Run() error

Run executes the concurrent receive operation.

type ConcurrentServer

type ConcurrentServer struct {
	ServerBase
	// contains filtered or unexported fields
}

func (*ConcurrentServer) Stop

func (c *ConcurrentServer) Stop()

type Config

type Config struct {
	Hosts         CommaStringFlags
	Ports         CommaIntFlags
	DataPortRange DashIntFlags
	ListenMode    bool
	NoCompression bool
	ToResolve     string
	CmdID         string
	SegID         int
	PrintVersion  bool
	MD5XORMode    bool
	TransCompType string
	NumClients    CommaIntFlags
	Direction     string
	NumDests      int
}

func NewConfig

func NewConfig() *Config

func (*Config) InitFlags

func (c *Config) InitFlags()

func (*Config) Parse

func (c *Config) Parse() (bool, error)

type DashIntFlags

type DashIntFlags []int

func (*DashIntFlags) Set

func (d *DashIntFlags) Set(value string) error

func (*DashIntFlags) String

func (d *DashIntFlags) String() string

func (*DashIntFlags) Type

func (d *DashIntFlags) Type() string

type Handler

type Handler interface {
	// contains filtered or unexported methods
}

type Helper

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

func NewHelper

func NewHelper(cfg *Config) *Helper

func (*Helper) Cleanup

func (h *Helper) Cleanup(isTerminated bool)

func (*Helper) GetErrCode

func (h *Helper) GetErrCode() int

func (*Helper) Run

func (h *Helper) Run() error

func (*Helper) Start

func (h *Helper) Start()

func (*Helper) Stop

func (h *Helper) Stop()

type OneTimeClient

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

OneTimeClient handles single connection scenarios for sending or receiving data.

func (*OneTimeClient) Run

func (c *OneTimeClient) Run() error

Run executes the client operation.

type OneTimeServer

type OneTimeServer struct {
	ServerBase
}

func (*OneTimeServer) Serve

func (o *OneTimeServer) Serve()

func (*OneTimeServer) Stop

func (o *OneTimeServer) Stop()

func (*OneTimeServer) WaitForFinished

func (o *OneTimeServer) WaitForFinished()

type ReadOnlyCompressConn

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

func (*ReadOnlyCompressConn) Close

func (conn *ReadOnlyCompressConn) Close() error

func (*ReadOnlyCompressConn) Read

func (conn *ReadOnlyCompressConn) Read(bytes []byte) (int, error)

func (*ReadOnlyCompressConn) Write

func (conn *ReadOnlyCompressConn) Write(bytes []byte) (int, error)

type Server

type Server interface {
	Start() int
	Serve()
	Stop()
	WaitForFinished()
	Err() error
}

func NewConcurrentServer

func NewConcurrentServer(numConn int32, config *Config) Server

func NewOneTimeServer

func NewOneTimeServer(config *Config) Server

type ServerBase

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

func (*ServerBase) Err

func (t *ServerBase) Err() error

func (*ServerBase) Serve

func (t *ServerBase) Serve()

func (*ServerBase) Start

func (t *ServerBase) Start() int

func (*ServerBase) WaitForFinished

func (t *ServerBase) WaitForFinished()

type WriteOnlyCompressConn

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

func (*WriteOnlyCompressConn) Close

func (conn *WriteOnlyCompressConn) Close() error

Close properly closes both the compressor and underlying connection

func (*WriteOnlyCompressConn) Read

func (conn *WriteOnlyCompressConn) Read(bytes []byte) (int, error)

func (*WriteOnlyCompressConn) Write

func (conn *WriteOnlyCompressConn) Write(bytes []byte) (int, error)

Jump to

Keyboard shortcuts

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