core

package module
v2.7.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2016 License: MIT Imports: 42 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 is a generated protocol buffer package.

It is generated from these files:

v2ray.com/core/config.proto

It has these top-level messages:

AllocationStrategyConcurrency
AllocationStrategyRefresh
AllocationStrategy
InboundConnectionConfig
OutboundConnectionConfig
Config

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) GetRefresh

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 (this *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 (this *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_loader.TypedSettings `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_loader.TypedSettings `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 (this *InboundConnectionConfig) GetAllocationStrategyValue() *AllocationStrategy

func (*InboundConnectionConfig) GetListenOn

func (*InboundConnectionConfig) GetListenOnValue

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

func (*InboundConnectionConfig) GetPortRange

func (*InboundConnectionConfig) GetSettings

func (*InboundConnectionConfig) GetStreamSettings

func (*InboundConnectionConfig) GetTypedSettings

func (this *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
}

Handler for inbound detour connections.

func NewInboundDetourHandlerAlways

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

func (*InboundDetourHandlerAlways) Close

func (this *InboundDetourHandlerAlways) Close()

func (*InboundDetourHandlerAlways) GetConnectionHandler

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

func (*InboundDetourHandlerAlways) Start

func (this *InboundDetourHandlerAlways) Start() error

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 (this *InboundDetourHandlerDynamic) Close()

func (*InboundDetourHandlerDynamic) GetConnectionHandler

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

func (*InboundDetourHandlerDynamic) RecyleHandles

func (this *InboundDetourHandlerDynamic) RecyleHandles()

func (*InboundDetourHandlerDynamic) Start

func (this *InboundDetourHandlerDynamic) Start() error

type OutboundConnectionConfig

type OutboundConnectionConfig struct {
	Settings *v2ray_core_common_loader.TypedSettings `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 (this *OutboundConnectionConfig) GetSendThroughValue() v2net.Address

func (*OutboundConnectionConfig) GetSettings

func (*OutboundConnectionConfig) GetStreamSettings

func (*OutboundConnectionConfig) GetTypedSettings

func (this *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 (this *Point) Close()

func (*Point) GetHandler

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

func (*Point) Release

func (this *Point) Release()

func (*Point) Start

func (this *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
Package dns is a generated protocol buffer package.
Package dns is a generated protocol buffer package.
router
Package router is a generated protocol buffer package.
Package router is a generated protocol buffer package.
Package common contains common utilities that are shared among other packages.
Package common contains common utilities that are shared among other packages.
alloc
Package alloc provides a light-weight memory allocation mechanism.
Package alloc provides a light-weight memory allocation mechanism.
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.
io
loader
Package loader is a generated protocol buffer package.
Package loader is a generated protocol buffer package.
log
Package log is a generated protocol buffer package.
Package log is a generated protocol buffer package.
net
Package net is a generated protocol buffer package.
Package net is a generated protocol buffer package.
protocol
Package protocol is a generated protocol buffer package.
Package protocol is a generated protocol buffer package.
web
Package proxy contains all proxies used by V2Ray.
Package proxy contains all proxies used by V2Ray.
blackhole
Package blackhole is a generated protocol buffer package.
Package blackhole is a generated protocol buffer package.
dokodemo
Package dokodemo is a generated protocol buffer package.
Package dokodemo is a generated protocol buffer package.
freedom
Package freedom is a generated protocol buffer package.
Package freedom is a generated protocol buffer package.
http
Package http is a generated protocol buffer package.
Package http is a generated protocol buffer package.
shadowsocks
Package shadowsocks is a generated protocol buffer package.
Package shadowsocks is a generated protocol buffer package.
socks
Package socks is a generated protocol buffer package.
Package socks is a generated protocol buffer package.
vmess
Package vmess is a generated protocol buffer package.
Package vmess is a generated protocol buffer package.
vmess/inbound
Package inbound is a generated protocol buffer package.
Package inbound is a generated protocol buffer package.
vmess/outbound
Package outbound is a generated protocol buffer package.
Package outbound is a generated protocol buffer package.
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.
geoip
Package geoip is a generated protocol buffer package.
Package geoip is a generated protocol buffer package.
git
Package transport is a generated protocol buffer package.
Package transport is a generated protocol buffer package.
internet
Package internet is a generated protocol buffer package.
Package internet is a generated protocol buffer package.
internet/authenticators/http
Package http is a generated protocol buffer package.
Package http is a generated protocol buffer package.
internet/authenticators/noop
Package noop is a generated protocol buffer package.
Package noop is a generated protocol buffer package.
internet/authenticators/srtp
Package srtp is a generated protocol buffer package.
Package srtp is a generated protocol buffer package.
internet/authenticators/utp
Package utp is a generated protocol buffer package.
Package utp is a generated protocol buffer package.
internet/kcp
Package kcp is a generated protocol buffer package.
Package kcp is a generated protocol buffer package.
internet/tcp
Package tcp is a generated protocol buffer package.
Package tcp is a generated protocol buffer package.
internet/tls
Package tls is a generated protocol buffer package.
Package tls is a generated protocol buffer package.
internet/ws
Package ws is a generated protocol buffer package.
Package ws is a generated protocol buffer package.
ray

Jump to

Keyboard shortcuts

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