common

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2025 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	OneKB uint64 = 1024
	TenKB uint64 = 10 * OneKB
	OneMB uint64 = 1024 * OneKB
	TenMB uint64 = 10 * OneMB
)
View Source
var ErrClosed = errors.New("closed")
View Source
var ErrInvalidConfig = errors.New("invalid config")
View Source
var MaxTime = time.Date(9999, 12, 31, 23, 59, 59, 999999999, time.UTC)
View Source
var (
	Version = "debug"
)

Functions

func Close

func Close(obj interface{}) error

func CloseAll

func CloseAll(l ...interface{}) error

func Error2

func Error2(v interface{}, err error) error

Error2 returns the err from the 2nd parameter.

func GetIndex

func GetIndex(list []uint32, value uint32) int

func Interrupt

func Interrupt(obj interface{})

func IsClosedChan

func IsClosedChan(c <-chan struct{}) bool

func Log

func Log()

func Must

func Must(err error)

func Must2

func Must2(v interface{}, err error) interface{}

func Start

func Start(obj interface{}) error

func StartAll

func StartAll(l ...interface{}) error

StartAll starts all the Startable objects in the list. It returns the first error encountered, if any. And it closes all the started objects when an error occurs.

func Uint16ToString

func Uint16ToString(n uint16) string

Types

type ChainedClosable

type ChainedClosable []Closable

ChainedClosable is a Closable that consists of multiple Closable objects.

func (ChainedClosable) Close

func (cc ChainedClosable) Close() error

Close implements Closable.

type Closable

type Closable interface {
	Close() error
}

type Components

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

func NewComponents

func NewComponents() *Components

func (*Components) AddComponent

func (in *Components) AddComponent(feature interface{})

func (*Components) AllComponents

func (c *Components) AllComponents() []interface{}

func (*Components) Close

func (s *Components) Close() error

func (*Components) GetComponent

func (in *Components) GetComponent(t reflect.Type) interface{}

func (*Components) RemoveComponent

func (in *Components) RemoveComponent(feature interface{})

func (*Components) Start

func (s *Components) Start() error

type CtxKey

type CtxKey int
const (
	InstanceKey CtxKey = iota
	InboundManagerKey
	OutboundManagerKey
	PolicyKey
	UserManagerKey
	BufferSizePerConnection
	PiperKey
	DnsKey
	StatsManagerKey
	DispatcherKey
	RouterKey
	FakeDnsKey
	StatsKey
	GeoKey
)

type HasType

type HasType interface {
	// Type returns the type of the object.
	// Usually it returns (*Type)(nil) of the object.
	Type() interface{}
}

type Interruptible

type Interruptible interface {
	Interrupt()
}

type Runnable

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

type Startable

type Startable interface {
	Start() error
}

Directories

Path Synopsis
Package buf provides a light-weight memory allocation mechanism.
Package buf provides a light-weight memory allocation mechanism.
Package crypto provides common crypto libraries for V2Ray.
Package crypto provides common crypto libraries for V2Ray.
Package dice contains common functions to generate random number.
Package dice contains common functions to generate random number.
geo
net
cnc
udp
tls
Package session provides functions for sessions of incoming requests.
Package session provides functions for sessions of incoming requests.
Package mph implements a minimal perfect hash table over strings.
Package mph implements a minimal perfect hash table over strings.
udp
mux

Jump to

Keyboard shortcuts

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