Documentation ¶
Overview ¶
Package protocol is a generated protocol buffer package.
It is generated from these files:
v2ray.com/core/common/protocol/headers.proto v2ray.com/core/common/protocol/server_spec.proto v2ray.com/core/common/protocol/user.proto
It has these top-level messages:
SecurityConfig ServerEndpoint User
Index ¶
- Constants
- Variables
- func DefaultIDHash(key []byte) hash.Hash
- type Account
- type AlwaysValidStrategy
- type AsAccount
- type CommandSwitchAccount
- type ID
- type IDHash
- type RequestCommand
- type RequestHeader
- type RequestOption
- type ResponseCommand
- type ResponseHeader
- type ResponseOption
- type RoundRobinServerPicker
- type Security
- type SecurityConfig
- type SecurityType
- type ServerEndpoint
- type ServerList
- type ServerPicker
- type ServerSpec
- type TimeoutValidStrategy
- type Timestamp
- type TimestampGenerator
- type User
- type UserSettings
- type UserValidator
- type ValidationStrategy
Constants ¶
View Source
const ( RequestCommandTCP = RequestCommand(0x01) RequestCommandUDP = RequestCommand(0x02) )
View Source
const ( RequestOptionChunkStream = RequestOption(0x01) RequestOptionConnectionReuse = RequestOption(0x02) )
View Source
const (
IDBytesLen = 16
)
View Source
const (
ResponseOptionConnectionReuse = ResponseOption(1)
)
Variables ¶
View Source
var ( ErrInvalidUser = errors.New("Invalid user.") ErrInvalidVersion = errors.New("Invalid version.") )
View Source
var ( ErrUserMissing = errors.New("User is not specified.") ErrAccountMissing = errors.New("Account is not specified.") ErrNonMessageType = errors.New("Not a protobuf message.") ErrUnknownAccountType = errors.New("Unknown account type.") )
View Source
var SecurityType_name = map[int32]string{
0: "NONE",
1: "LEGACY",
2: "AUTO",
3: "AES128_GCM",
4: "CHACHA20_POLY1305",
}
View Source
var SecurityType_value = map[string]int32{
"NONE": 0,
"LEGACY": 1,
"AUTO": 2,
"AES128_GCM": 3,
"CHACHA20_POLY1305": 4,
}
Functions ¶
func DefaultIDHash ¶
Types ¶
type AlwaysValidStrategy ¶ added in v1.21.2
type AlwaysValidStrategy struct{}
func (AlwaysValidStrategy) Invalidate ¶ added in v1.21.2
func (v AlwaysValidStrategy) Invalidate()
func (AlwaysValidStrategy) IsValid ¶ added in v1.21.2
func (v AlwaysValidStrategy) IsValid() bool
type CommandSwitchAccount ¶
type ID ¶
type ID struct {
// contains filtered or unexported fields
}
The ID of en entity, in the form of an UUID.
func NewAlterIDs ¶
type RequestCommand ¶
type RequestCommand byte
type RequestHeader ¶
type RequestHeader struct { Version byte User *User Command RequestCommand Option RequestOption Security Security Address v2net.Address Port v2net.Port }
func (*RequestHeader) Destination ¶
func (v *RequestHeader) Destination() v2net.Destination
type RequestOption ¶ added in v1.9.1
type RequestOption byte
func (*RequestOption) Clear ¶ added in v1.17.1
func (v *RequestOption) Clear(option RequestOption)
func (RequestOption) Has ¶ added in v1.17.1
func (v RequestOption) Has(option RequestOption) bool
func (*RequestOption) Set ¶ added in v1.17.1
func (v *RequestOption) Set(option RequestOption)
type ResponseCommand ¶
type ResponseCommand interface{}
type ResponseHeader ¶
type ResponseHeader struct { Option ResponseOption Command ResponseCommand }
type ResponseOption ¶ added in v1.17.1
type ResponseOption byte
func (*ResponseOption) Clear ¶ added in v1.17.1
func (v *ResponseOption) Clear(option ResponseOption)
func (ResponseOption) Has ¶ added in v1.17.1
func (v ResponseOption) Has(option ResponseOption) bool
func (*ResponseOption) Set ¶ added in v1.17.1
func (v *ResponseOption) Set(option ResponseOption)
type RoundRobinServerPicker ¶
func NewRoundRobinServerPicker ¶
func NewRoundRobinServerPicker(serverlist *ServerList) *RoundRobinServerPicker
func (*RoundRobinServerPicker) PickServer ¶
func (v *RoundRobinServerPicker) PickServer() *ServerSpec
type SecurityConfig ¶
type SecurityConfig struct {
Type SecurityType `protobuf:"varint,1,opt,name=type,enum=v2ray.core.common.protocol.SecurityType" json:"type,omitempty"`
}
func (*SecurityConfig) AsSecurity ¶
func (v *SecurityConfig) AsSecurity() Security
func (*SecurityConfig) Descriptor ¶
func (*SecurityConfig) Descriptor() ([]byte, []int)
func (*SecurityConfig) ProtoMessage ¶
func (*SecurityConfig) ProtoMessage()
func (*SecurityConfig) Reset ¶
func (m *SecurityConfig) Reset()
func (*SecurityConfig) String ¶
func (m *SecurityConfig) String() string
type SecurityType ¶
type SecurityType int32
const ( SecurityType_NONE SecurityType = 0 SecurityType_LEGACY SecurityType = 1 SecurityType_AUTO SecurityType = 2 SecurityType_AES128_GCM SecurityType = 3 SecurityType_CHACHA20_POLY1305 SecurityType = 4 )
func (SecurityType) EnumDescriptor ¶
func (SecurityType) EnumDescriptor() ([]byte, []int)
func (SecurityType) String ¶
func (x SecurityType) String() string
type ServerEndpoint ¶
type ServerEndpoint struct { Address *v2ray_core_common_net.IPOrDomain `protobuf:"bytes,1,opt,name=address" json:"address,omitempty"` Port uint32 `protobuf:"varint,2,opt,name=port" json:"port,omitempty"` User []*User `protobuf:"bytes,3,rep,name=user" json:"user,omitempty"` }
func (*ServerEndpoint) Descriptor ¶
func (*ServerEndpoint) Descriptor() ([]byte, []int)
func (*ServerEndpoint) GetAddress ¶
func (m *ServerEndpoint) GetAddress() *v2ray_core_common_net.IPOrDomain
func (*ServerEndpoint) GetUser ¶
func (m *ServerEndpoint) GetUser() []*User
func (*ServerEndpoint) ProtoMessage ¶
func (*ServerEndpoint) ProtoMessage()
func (*ServerEndpoint) Reset ¶
func (m *ServerEndpoint) Reset()
func (*ServerEndpoint) String ¶
func (m *ServerEndpoint) String() string
type ServerList ¶
func NewServerList ¶
func NewServerList() *ServerList
func (*ServerList) AddServer ¶
func (v *ServerList) AddServer(server *ServerSpec)
func (*ServerList) GetServer ¶
func (v *ServerList) GetServer(idx uint32) *ServerSpec
func (*ServerList) RemoveServer ¶ added in v1.21.1
func (v *ServerList) RemoveServer(idx uint32)
Private: Visible for testing.
func (*ServerList) Size ¶
func (v *ServerList) Size() uint32
type ServerPicker ¶
type ServerPicker interface {
PickServer() *ServerSpec
}
type ServerSpec ¶
func NewServerSpec ¶
func NewServerSpec(dest v2net.Destination, valid ValidationStrategy, users ...*User) *ServerSpec
func NewServerSpecFromPB ¶
func NewServerSpecFromPB(spec ServerEndpoint) *ServerSpec
func (*ServerSpec) AddUser ¶
func (v *ServerSpec) AddUser(user *User)
func (*ServerSpec) Destination ¶
func (v *ServerSpec) Destination() v2net.Destination
func (*ServerSpec) HasUser ¶
func (v *ServerSpec) HasUser(user *User) bool
func (*ServerSpec) Invalidate ¶
func (v *ServerSpec) Invalidate()
func (*ServerSpec) IsValid ¶
func (v *ServerSpec) IsValid() bool
func (*ServerSpec) PickUser ¶
func (v *ServerSpec) PickUser() *User
type TimeoutValidStrategy ¶ added in v1.21.2
type TimeoutValidStrategy struct {
// contains filtered or unexported fields
}
func (*TimeoutValidStrategy) Invalidate ¶ added in v1.21.2
func (v *TimeoutValidStrategy) Invalidate()
func (*TimeoutValidStrategy) IsValid ¶ added in v1.21.2
func (v *TimeoutValidStrategy) IsValid() bool
type TimestampGenerator ¶
type TimestampGenerator func() Timestamp
func NewTimestampGenerator ¶
func NewTimestampGenerator(base Timestamp, delta int) TimestampGenerator
type User ¶
type User struct { Level uint32 `protobuf:"varint,1,opt,name=level" json:"level,omitempty"` Email string `protobuf:"bytes,2,opt,name=email" json:"email,omitempty"` // Protocol specific account information. Account *v2ray_core_common_loader.TypedSettings `protobuf:"bytes,3,opt,name=account" json:"account,omitempty"` }
func (*User) Descriptor ¶
func (*User) GetAccount ¶
func (m *User) GetAccount() *v2ray_core_common_loader.TypedSettings
func (*User) GetSettings ¶
func (v *User) GetSettings() UserSettings
func (*User) GetTypedAccount ¶
func (*User) ProtoMessage ¶
func (*User) ProtoMessage()
type UserSettings ¶ added in v1.9.1
type UserSettings struct {
PayloadReadTimeout uint32
}
type UserValidator ¶ added in v1.9.1
type ValidationStrategy ¶
type ValidationStrategy interface { IsValid() bool Invalidate() }
func AlwaysValid ¶
func AlwaysValid() ValidationStrategy
func BeforeTime ¶
func BeforeTime(t time.Time) ValidationStrategy
Click to show internal directories.
Click to hide internal directories.