common

package
v0.0.0-...-7873af1 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2023 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

func B64Decrypt

func B64Decrypt(input string) string

func B64Encrypt

func B64Encrypt(input string) string

func BlowfishDecrypt

func BlowfishDecrypt(input string) string

func BlowfishEncrypt

func BlowfishEncrypt(input string) string

func DesDecrypt

func DesDecrypt(input string) string

func DesEncrypt

func DesEncrypt(input string) string

func FetchHTTPContent

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

func GetAssetLocation

func GetAssetLocation(file string) string

func GetProgramDir

func GetProgramDir() string

func HumanFriendlyTraffic

func HumanFriendlyTraffic(bytes uint64) string

func Init

func Init()

func Must

func Must(err error)

func Must2

func Must2(_ interface{}, err error)

func PickPort

func PickPort(network string, host string) int

func SHA224String

func SHA224String(password string) string

func UUID

func UUID() string

func WriteAllBytes

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

func WriteFile

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

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

func NewNotifier() *Notifier

NewNotifier creates a new Notifier.

func (*Notifier) Signal

func (n *Notifier) Signal()

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

func (*Notifier) Wait

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

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

type Result

type Result struct {
	Name       string `yaml:"name"`
	LocalAddr  string `yaml:"local_addr"`
	LocalPort  int    `yaml:"local_port"`
	RemoteAddr string `yaml:"remote_addr"`
	RemotePort int    `yaml:"remote_port"`
}

type RewindConn

type RewindConn struct {
	net.Conn
	*RewindReader
}

func NewRewindConn

func NewRewindConn(conn net.Conn) *RewindConn

func (*RewindConn) Read

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

type RewindReader

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

func (*RewindReader) Discard

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

func (*RewindReader) Read

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

func (*RewindReader) ReadByte

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

func (*RewindReader) Rewind

func (r *RewindReader) Rewind()

func (*RewindReader) SetBufferSize

func (r *RewindReader) SetBufferSize(size int)

func (*RewindReader) StopBuffering

func (r *RewindReader) StopBuffering()

type Runnable

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

type StickyWriter

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

func (*StickyWriter) Write

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