core: v2ray.com/core/common Index | Files | Directories

package common

import "v2ray.com/core/common"

Package common contains common utilities that are shared among other packages. See each sub-package for detail.

Index

Package Files

common.go errors.generated.go interfaces.go type.go

Variables

var (
    // ErrNoClue is for the situation that existing information is not enough to make a decision. For example, Router may return this error when there is no suitable route.
    ErrNoClue = errors.New("not enough information for making a decision")
)

func Close Uses

func Close(obj interface{}) error

Close closes the obj if it is a Closable.

v2ray:api:beta

func CreateObject Uses

func CreateObject(ctx context.Context, config interface{}) (interface{}, error)

CreateObject creates an object by its config. The config type must be registered through RegisterConfig().

func Error2 Uses

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

Error2 returns the err from the 2nd parameter.

func Interrupt Uses

func Interrupt(obj interface{}) error

Interrupt calls Interrupt() if object implements Interruptible interface, or Close() if the object implements Closable interface.

v2ray:api:beta

func Must Uses

func Must(err error)

Must panics if err is not nil.

func Must2 Uses

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

Must2 panics if the second parameter is not nil, otherwise returns the first parameter.

func RegisterConfig Uses

func RegisterConfig(config interface{}, configCreator ConfigCreator) error

RegisterConfig registers a global config creator. The config can be nil but must have a type.

type ChainedClosable Uses

type ChainedClosable []Closable

ChainedClosable is a Closable that consists of multiple Closable objects.

func (ChainedClosable) Close Uses

func (cc ChainedClosable) Close() error

Close implements Closable.

type Closable Uses

type Closable interface {
    // Close release all resources used by this object, including goroutines.
    Close() error
}

Closable is the interface for objects that can release its resources.

v2ray:api:beta

type ConfigCreator Uses

type ConfigCreator func(ctx context.Context, config interface{}) (interface{}, error)

ConfigCreator is a function to create an object by a config.

type HasType Uses

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

HasType is the interface for objects that knows its type.

type Interruptible Uses

type Interruptible interface {
    Interrupt()
}

Interruptible is an interface for objects that can be stopped before its completion.

v2ray:api:beta

type Runnable Uses

type Runnable interface {
    // Start starts the runnable object. Upon the method returning nil, the object begins to function properly.
    Start() error

    Closable
}

Runnable is the interface for objects that can start to work and stop on demand.

Directories

PathSynopsis
bitmask
bufPackage buf provides a light-weight memory allocation mechanism.
bytespool
cryptoPackage crypto provides common crypto libraries for V2Ray.
crypto/internal
dicePackage dice contains common functions to generate random number.
errorsPackage errors is a drop-in replacement for Golang lib 'errors'.
errors/errorgen
log
mux
netPackage net is a drop-in replacement to Golang's net package, with some more functionalities.
peer
platform
platform/ctlcmd
platform/filesystem
protocol
protocol/bittorrent
protocol/dns
protocol/http
protocol/tls
protocol/tls/cert
protocol/udp
retry
serial
sessionPackage session provides functions for sessions of incoming requests.
signal
signal/done
signal/pubsub
signal/semaphore
stack
strmatcher
task
uuid

Package common imports 3 packages (graph) and is imported by 215 packages. Updated 2019-05-19. Refresh now. Tools for package owners.