common

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: May 6, 2021 License: GPL-3.0 Imports: 14 Imported by: 30

Documentation

Index

Constants

View Source
const (
	KiB = 1024
	MiB = KiB * 1024
	GiB = MiB * 1024
)

Variables

This section is empty.

Functions

func FetchHTTPContent added in v0.10.0

func FetchHTTPContent(target string) ([]byte, error)

func GetAssetLocation added in v0.10.0

func GetAssetLocation(file string) string

func GetProgramDir added in v0.1.0

func GetProgramDir() string

func HumanFriendlyTraffic

func HumanFriendlyTraffic(bytes uint64) string

func Must

func Must(err error)

func Must2 added in v0.2.0

func Must2(_ interface{}, err error)

func PickPort added in v0.6.0

func PickPort(network string, host string) int

func SHA224String

func SHA224String(password string) string

func WriteAllBytes added in v0.10.0

func WriteAllBytes(writer io.Writer, payload []byte) error

func WriteFile added in v0.10.0

func WriteFile(path string, payload []byte) error

Types

type Error

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

func NewError

func NewError(info string) *Error

func (*Error) Base

func (e *Error) Base(err error) *Error

func (*Error) Error

func (e *Error) Error() string

type Notifier added in v0.3.0

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

Notifier is a utility for notifying changes. The change producer may notify changes multiple time, and the consumer may get notified asynchronously.

func NewNotifier added in v0.3.0

func NewNotifier() *Notifier

NewNotifier creates a new Notifier.

func (*Notifier) Signal added in v0.3.0

func (n *Notifier) Signal()

Signal signals a change, usually by producer. This method never blocks.

func (*Notifier) Wait added in v0.3.0

func (n *Notifier) Wait() <-chan struct{}

Wait returns a channel for waiting for changes. The returned channel never gets closed.

type RewindConn added in v0.4.0

type RewindConn struct {
	net.Conn
	*RewindReader
}

func NewRewindConn added in v0.4.0

func NewRewindConn(conn net.Conn) *RewindConn

func (*RewindConn) Read added in v0.4.0

func (c *RewindConn) Read(p []byte) (int, error)

type RewindReader added in v0.3.0

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

func (*RewindReader) Discard added in v0.3.0

func (r *RewindReader) Discard(n int) (int, error)

func (*RewindReader) Read added in v0.3.0

func (r *RewindReader) Read(p []byte) (int, error)

func (*RewindReader) ReadByte added in v0.3.0

func (r *RewindReader) ReadByte() (byte, error)

func (*RewindReader) Rewind added in v0.3.0

func (r *RewindReader) Rewind()

func (*RewindReader) SetBufferSize added in v0.3.0

func (r *RewindReader) SetBufferSize(size int)

func (*RewindReader) StopBuffering added in v0.3.0

func (r *RewindReader) StopBuffering()

type Runnable

type Runnable interface {
	Run() error
	Close() error
}

type StickyWriter added in v0.4.12

type StickyWriter struct {
	MaxBuffered int
	// contains filtered or unexported fields
}

func (*StickyWriter) Write added in v0.4.12

func (w *StickyWriter) Write(p []byte) (int, error)

Directories

Path Synopsis
Package geodata includes utilities to decode and parse the geoip & geosite dat files.
Package geodata includes utilities to decode and parse the geoip & geosite dat files.

Jump to

Keyboard shortcuts

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