core

package module
v2.13.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2017 License: MIT Imports: 22 Imported by: 0

README

Project V2Ray

[![Build Status][1]][2] [![codecov.io][3]][4] [![Go Report][5]][6] [![GoDoc][7]][8] [![codebeat][9]][10] [1]: https://travis-ci.org/v2ray/v2ray-core.svg?branch=master "Build Status badge" [2]: https://travis-ci.org/v2ray/v2ray-core "Travis-CI Build Status" [3]: https://codecov.io/github/v2ray/v2ray-core/coverage.svg?branch=master "Coverage badge" [4]: https://codecov.io/github/v2ray/v2ray-core?branch=master "Codecov Status" [5]: https://goreportcard.com/badge/v2ray.com/core "Go Report badge" [6]: https://goreportcard.com/report/v2ray.com/core "Go Report" [7]: https://godoc.org/v2ray.com/core?status.svg "GoDoc badge" [8]: https://godoc.org/v2ray.com/core "GoDoc" [9]: https://codebeat.co/badges/f2354ca8-3e24-463d-a2e3-159af73b2477 "Codebeat badge" [10]: https://codebeat.co/projects/github-com-v2ray-v2ray-core "Codebeat"

V2Ray 是一个模块化的代理软件包,它的目标是提供常用的代理软件模块,简化网络代理软件的开发。

官方网站

V2Ray provides building blocks for network proxy development. Read our Wiki for more information.

License

The MIT License (MIT)

Documentation

Overview

Package core provides common definitions and functionalities of V2Ray.

Index

Constants

This section is empty.

Variables

View Source
var AllocationStrategy_Type_name = map[int32]string{
	0: "Always",
	1: "Random",
	2: "External",
}
View Source
var AllocationStrategy_Type_value = map[string]int32{
	"Always":   0,
	"Random":   1,
	"External": 2,
}
View Source
var ConfigFormat_name = map[int32]string{
	0: "Protobuf",
	1: "JSON",
}
View Source
var ConfigFormat_value = map[string]int32{
	"Protobuf": 0,
	"JSON":     1,
}

Functions

func PrintVersion added in v0.9.1

func PrintVersion()

func RegisterConfigLoader

func RegisterConfigLoader(format ConfigFormat, loader ConfigLoader) error

func Version

func Version() string

Version returns V2Ray's version as a string.

Types

type AllocationStrategy

type AllocationStrategy struct {
	Type AllocationStrategy_Type `protobuf:"varint,1,opt,name=type,enum=v2ray.core.AllocationStrategy_Type" json:"type,omitempty"`
	// Number of handlers (ports) running in parallel.
	// Default value is 3 if unset.
	Concurrency *AllocationStrategyConcurrency `protobuf:"bytes,2,opt,name=concurrency" json:"concurrency,omitempty"`
	// Number of minutes before a handler is regenerated.
	// Default value is 5 if unset.
	Refresh *AllocationStrategyRefresh `protobuf:"bytes,3,opt,name=refresh" json:"refresh,omitempty"`
}

func (*AllocationStrategy) Descriptor

func (*AllocationStrategy) Descriptor() ([]byte, []int)

func (*AllocationStrategy) GetConcurrency

func (*AllocationStrategy) GetConcurrencyValue

func (v *AllocationStrategy) GetConcurrencyValue() uint32

func (*AllocationStrategy) GetRefresh

func (*AllocationStrategy) GetRefreshValue

func (v *AllocationStrategy) GetRefreshValue() uint32

func (*AllocationStrategy) GetType

func (*AllocationStrategy) ProtoMessage

func (*AllocationStrategy) ProtoMessage()

func (*AllocationStrategy) Reset

func (m *AllocationStrategy) Reset()

func (*AllocationStrategy) String

func (m *AllocationStrategy) String() string

type AllocationStrategyConcurrency

type AllocationStrategyConcurrency struct {
	Value uint32 `protobuf:"varint,1,opt,name=value" json:"value,omitempty"`
}

func (*AllocationStrategyConcurrency) Descriptor

func (*AllocationStrategyConcurrency) Descriptor() ([]byte, []int)

func (*AllocationStrategyConcurrency) GetValue

func (m *AllocationStrategyConcurrency) GetValue() uint32

func (*AllocationStrategyConcurrency) ProtoMessage

func (*AllocationStrategyConcurrency) ProtoMessage()

func (*AllocationStrategyConcurrency) Reset

func (m *AllocationStrategyConcurrency) Reset()

func (*AllocationStrategyConcurrency) String

type AllocationStrategyRefresh

type AllocationStrategyRefresh struct {
	Value uint32 `protobuf:"varint,1,opt,name=value" json:"value,omitempty"`
}

func (*AllocationStrategyRefresh) Descriptor

func (*AllocationStrategyRefresh) Descriptor() ([]byte, []int)

func (*AllocationStrategyRefresh) GetValue

func (m *AllocationStrategyRefresh) GetValue() uint32

func (*AllocationStrategyRefresh) ProtoMessage

func (*AllocationStrategyRefresh) ProtoMessage()

func (*AllocationStrategyRefresh) Reset

func (m *AllocationStrategyRefresh) Reset()

func (*AllocationStrategyRefresh) String

func (m *AllocationStrategyRefresh) String() string

type AllocationStrategy_Type

type AllocationStrategy_Type int32
const (
	// Always allocate all connection handlers.
	AllocationStrategy_Always AllocationStrategy_Type = 0
	// Randomly allocate specific range of handlers.
	AllocationStrategy_Random AllocationStrategy_Type = 1
	// External. Not supported yet.
	AllocationStrategy_External AllocationStrategy_Type = 2
)

func (AllocationStrategy_Type) EnumDescriptor

func (AllocationStrategy_Type) EnumDescriptor() ([]byte, []int)

func (AllocationStrategy_Type) String

func (x AllocationStrategy_Type) String() string

type Config

type Config struct {
	// Inbound handler configurations. Must have at least one item.
	Inbound []*InboundConnectionConfig `protobuf:"bytes,1,rep,name=inbound" json:"inbound,omitempty"`
	// Outbound handler configurations. Must have at least one item. The first item is used as default for routing.
	Outbound []*OutboundConnectionConfig   `protobuf:"bytes,2,rep,name=outbound" json:"outbound,omitempty"`
	Log      *v2ray_core_common_log.Config `protobuf:"bytes,3,opt,name=log" json:"log,omitempty"`
	// App configuration. Must be one in the app directory.
	App       []*v2ray_core_common_serial.TypedMessage `protobuf:"bytes,4,rep,name=app" json:"app,omitempty"`
	Transport *v2ray_core_transport.Config             `protobuf:"bytes,5,opt,name=transport" json:"transport,omitempty"`
}

func LoadConfig

func LoadConfig(format ConfigFormat, input io.Reader) (*Config, error)

func LoadProtobufConfig

func LoadProtobufConfig(input io.Reader) (*Config, error)

func (*Config) Descriptor

func (*Config) Descriptor() ([]byte, []int)

func (*Config) GetApp

func (*Config) GetInbound

func (m *Config) GetInbound() []*InboundConnectionConfig

func (*Config) GetLog

func (m *Config) GetLog() *v2ray_core_common_log.Config

func (*Config) GetOutbound

func (m *Config) GetOutbound() []*OutboundConnectionConfig

func (*Config) GetTransport

func (m *Config) GetTransport() *v2ray_core_transport.Config

func (*Config) ProtoMessage

func (*Config) ProtoMessage()

func (*Config) Reset

func (m *Config) Reset()

func (*Config) String

func (m *Config) String() string

type ConfigFormat

type ConfigFormat int32

Configuration serialization format.

const (
	ConfigFormat_Protobuf ConfigFormat = 0
	ConfigFormat_JSON     ConfigFormat = 1
)

func (ConfigFormat) EnumDescriptor

func (ConfigFormat) EnumDescriptor() ([]byte, []int)

func (ConfigFormat) String

func (x ConfigFormat) String() string

type ConfigLoader

type ConfigLoader func(input io.Reader) (*Config, error)

type InboundConnectionConfig

type InboundConnectionConfig struct {
	// Protocol specific settings. Must be one of the supported protocols.
	Settings *v2ray_core_common_serial.TypedMessage `protobuf:"bytes,1,opt,name=settings" json:"settings,omitempty"`
	// Range of port number to run on. Both inclusive.
	PortRange *v2ray_core_common_net.PortRange `protobuf:"bytes,2,opt,name=port_range,json=portRange" json:"port_range,omitempty"`
	// IP address to listen on. 0.0.0.0 if unset.
	ListenOn *v2ray_core_common_net1.IPOrDomain `protobuf:"bytes,3,opt,name=listen_on,json=listenOn" json:"listen_on,omitempty"`
	// Tag of this handler.
	Tag                    string                                      `protobuf:"bytes,4,opt,name=tag" json:"tag,omitempty"`
	AllocationStrategy     *AllocationStrategy                         `protobuf:"bytes,5,opt,name=allocation_strategy,json=allocationStrategy" json:"allocation_strategy,omitempty"`
	StreamSettings         *v2ray_core_transport_internet.StreamConfig `protobuf:"bytes,6,opt,name=stream_settings,json=streamSettings" json:"stream_settings,omitempty"`
	AllowPassiveConnection bool                                        `protobuf:"varint,7,opt,name=allow_passive_connection,json=allowPassiveConnection" json:"allow_passive_connection,omitempty"`
}

Config for an inbound connection handler.

func (*InboundConnectionConfig) Descriptor

func (*InboundConnectionConfig) Descriptor() ([]byte, []int)

func (*InboundConnectionConfig) GetAllocationStrategy

func (m *InboundConnectionConfig) GetAllocationStrategy() *AllocationStrategy

func (*InboundConnectionConfig) GetAllocationStrategyValue

func (v *InboundConnectionConfig) GetAllocationStrategyValue() *AllocationStrategy

func (*InboundConnectionConfig) GetAllowPassiveConnection

func (m *InboundConnectionConfig) GetAllowPassiveConnection() bool

func (*InboundConnectionConfig) GetListenOn

func (*InboundConnectionConfig) GetListenOnValue

func (v *InboundConnectionConfig) GetListenOnValue() v2net.Address

func (*InboundConnectionConfig) GetPortRange

func (*InboundConnectionConfig) GetSettings

func (*InboundConnectionConfig) GetStreamSettings

func (*InboundConnectionConfig) GetTag

func (m *InboundConnectionConfig) GetTag() string

func (*InboundConnectionConfig) GetTypedSettings

func (v *InboundConnectionConfig) GetTypedSettings() (interface{}, error)

func (*InboundConnectionConfig) ProtoMessage

func (*InboundConnectionConfig) ProtoMessage()

func (*InboundConnectionConfig) Reset

func (m *InboundConnectionConfig) Reset()

func (*InboundConnectionConfig) String

func (m *InboundConnectionConfig) String() string

type InboundDetourHandler

type InboundDetourHandler interface {
	Start() error
	Close()
	GetConnectionHandler() (proxy.InboundHandler, int)
}

type InboundDetourHandlerAlways

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

InboundDetourHandlerAlways is a handler for inbound detour connections.

func NewInboundDetourHandlerAlways

func NewInboundDetourHandlerAlways(space app.Space, config *InboundConnectionConfig) (*InboundDetourHandlerAlways, error)

func (*InboundDetourHandlerAlways) Close

func (v *InboundDetourHandlerAlways) Close()

func (*InboundDetourHandlerAlways) GetConnectionHandler

func (v *InboundDetourHandlerAlways) GetConnectionHandler() (proxy.InboundHandler, int)

func (*InboundDetourHandlerAlways) Start

func (v *InboundDetourHandlerAlways) Start() error

Start starts the inbound connection handler.

type InboundDetourHandlerDynamic

type InboundDetourHandlerDynamic struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewInboundDetourHandlerDynamic

func NewInboundDetourHandlerDynamic(space app.Space, config *InboundConnectionConfig) (*InboundDetourHandlerDynamic, error)

func (*InboundDetourHandlerDynamic) Close

func (v *InboundDetourHandlerDynamic) Close()

func (*InboundDetourHandlerDynamic) GetConnectionHandler

func (v *InboundDetourHandlerDynamic) GetConnectionHandler() (proxy.InboundHandler, int)

func (*InboundDetourHandlerDynamic) RecyleHandles

func (v *InboundDetourHandlerDynamic) RecyleHandles()

func (*InboundDetourHandlerDynamic) Start

type OutboundConnectionConfig

type OutboundConnectionConfig struct {
	Settings *v2ray_core_common_serial.TypedMessage `protobuf:"bytes,1,opt,name=settings" json:"settings,omitempty"`
	// IP address to send data through. 0.0.0.0 if unset.
	SendThrough    *v2ray_core_common_net1.IPOrDomain          `protobuf:"bytes,2,opt,name=send_through,json=sendThrough" json:"send_through,omitempty"`
	StreamSettings *v2ray_core_transport_internet.StreamConfig `protobuf:"bytes,3,opt,name=stream_settings,json=streamSettings" json:"stream_settings,omitempty"`
	ProxySettings  *v2ray_core_transport_internet.ProxyConfig  `protobuf:"bytes,5,opt,name=proxy_settings,json=proxySettings" json:"proxy_settings,omitempty"`
	Tag            string                                      `protobuf:"bytes,4,opt,name=tag" json:"tag,omitempty"`
}

Config for an outbound connection handler.

func (*OutboundConnectionConfig) Descriptor

func (*OutboundConnectionConfig) Descriptor() ([]byte, []int)

func (*OutboundConnectionConfig) GetProxySettings

func (*OutboundConnectionConfig) GetSendThrough

func (*OutboundConnectionConfig) GetSendThroughValue

func (v *OutboundConnectionConfig) GetSendThroughValue() v2net.Address

func (*OutboundConnectionConfig) GetSettings

func (*OutboundConnectionConfig) GetStreamSettings

func (*OutboundConnectionConfig) GetTag

func (m *OutboundConnectionConfig) GetTag() string

func (*OutboundConnectionConfig) GetTypedSettings

func (v *OutboundConnectionConfig) GetTypedSettings() (interface{}, error)

func (*OutboundConnectionConfig) ProtoMessage

func (*OutboundConnectionConfig) ProtoMessage()

func (*OutboundConnectionConfig) Reset

func (m *OutboundConnectionConfig) Reset()

func (*OutboundConnectionConfig) String

func (m *OutboundConnectionConfig) String() string

type Point

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

Point shell of V2Ray.

func NewPoint

func NewPoint(pConfig *Config) (*Point, error)

NewPoint returns a new Point server based on given configuration. The server is not started at this point.

func (*Point) Close

func (v *Point) Close()

func (*Point) GetHandler

func (v *Point) GetHandler(tag string) (proxy.InboundHandler, int)

func (*Point) Release

func (v *Point) Release()

func (*Point) Start

func (v *Point) Start() error

Start starts the Point server, and return any error during the process. In the case of any errors, the state of the server is unpredicatable.

Directories

Path Synopsis
app
api
dns
proxyman
Package proxyman defines applications for manageing inbound and outbound proxies.
Package proxyman defines applications for manageing inbound and outbound proxies.
web
Package common contains common utilities that are shared among other packages.
Package common contains common utilities that are shared among other packages.
buf
Package buf provides a light-weight memory allocation mechanism.
Package buf provides a light-weight memory allocation mechanism.
bufio
Package bufio is a replacement of the standard golang package bufio.
Package bufio is a replacement of the standard golang package bufio.
crypto
Package crypto provides common crypto libraries for V2Ray.
Package crypto provides common crypto libraries for V2Ray.
crypto/internal
GENERATED CODE.
GENERATED CODE.
dice
Package dice contains common functions to generate random number.
Package dice contains common functions to generate random number.
log
net
Package net contains common network utilities.
Package net contains common network utilities.
web
Package proxy contains all proxies used by V2Ray.
Package proxy contains all proxies used by V2Ray.
blackhole
Package blackhole is an outbound handler that blocks all connections.
Package blackhole is an outbound handler that blocks all connections.
shadowsocks
Package shadowsocks provides compatible functionality to Shadowsocks.
Package shadowsocks provides compatible functionality to Shadowsocks.
vmess
Package vmess contains the implementation of VMess protocol and transportation.
Package vmess contains the implementation of VMess protocol and transportation.
testing
Package tools contains utilities that is not directly linked into V2Ray binary.
Package tools contains utilities that is not directly linked into V2Ray binary.
git
internet/kcp
Package kcp - A Fast and Reliable ARQ Protocol
Package kcp - A Fast and Reliable ARQ Protocol
internet/websocket
Package websocket implements Websocket transport
Package websocket implements Websocket transport
ray

Jump to

Keyboard shortcuts

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