Documentation ¶
Overview ¶
Package protocol is a generated protocol buffer package.
It is generated from these files:
v2ray.com/core/common/protocol/server_spec.proto v2ray.com/core/common/protocol/user.proto
It has these top-level messages:
ServerSpecPB User
Index ¶
- Constants
- Variables
- func DefaultIDHash(key []byte) hash.Hash
- type Account
- type AlwaysValidStrategy
- type AsAccount
- type CommandSwitchAccount
- type ID
- type IDHash
- type NewAccountFactory
- type RequestCommand
- type RequestHeader
- type RequestOption
- type ResponseCommand
- type ResponseHeader
- type ResponseOption
- type RoundRobinServerPicker
- type ServerList
- type ServerPicker
- type ServerSpec
- type ServerSpecPB
- 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.") )
View Source
var (
InvalidID = errors.New("Invalid ID.")
)
Functions ¶
func DefaultIDHash ¶
Types ¶
type AlwaysValidStrategy ¶ added in v1.21.2
type AlwaysValidStrategy struct{}
func (AlwaysValidStrategy) Invalidate ¶ added in v1.21.2
func (this AlwaysValidStrategy) Invalidate()
func (AlwaysValidStrategy) IsValid ¶ added in v1.21.2
func (this 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 ¶ added in v1.12.8
type NewAccountFactory ¶
type NewAccountFactory func() AsAccount
type RequestCommand ¶
type RequestCommand byte
type RequestHeader ¶
type RequestHeader struct { Version byte User *User Command RequestCommand Option RequestOption Address v2net.Address Port v2net.Port }
func (*RequestHeader) Destination ¶
func (this *RequestHeader) Destination() v2net.Destination
type RequestOption ¶
type RequestOption byte
func (*RequestOption) Clear ¶ added in v1.17.2
func (this *RequestOption) Clear(option RequestOption)
func (RequestOption) Has ¶ added in v1.17.2
func (this RequestOption) Has(option RequestOption) bool
func (*RequestOption) Set ¶ added in v1.17.2
func (this *RequestOption) Set(option RequestOption)
type ResponseCommand ¶
type ResponseCommand interface{}
type ResponseHeader ¶
type ResponseHeader struct { Option ResponseOption Command ResponseCommand }
type ResponseOption ¶ added in v1.17.2
type ResponseOption byte
func (*ResponseOption) Clear ¶ added in v1.17.2
func (this *ResponseOption) Clear(option ResponseOption)
func (ResponseOption) Has ¶ added in v1.17.2
func (this ResponseOption) Has(option ResponseOption) bool
func (*ResponseOption) Set ¶ added in v1.17.2
func (this *ResponseOption) Set(option ResponseOption)
type RoundRobinServerPicker ¶ added in v1.21.2
func NewRoundRobinServerPicker ¶ added in v1.21.2
func NewRoundRobinServerPicker(serverlist *ServerList) *RoundRobinServerPicker
func (*RoundRobinServerPicker) PickServer ¶ added in v1.21.2
func (this *RoundRobinServerPicker) PickServer() *ServerSpec
type ServerList ¶ added in v1.21.2
func NewServerList ¶ added in v1.21.2
func NewServerList() *ServerList
func (*ServerList) AddServer ¶ added in v1.21.2
func (this *ServerList) AddServer(server *ServerSpec)
func (*ServerList) GetServer ¶ added in v1.21.2
func (this *ServerList) GetServer(idx uint32) *ServerSpec
func (*ServerList) RemoveServer ¶ added in v1.21.2
func (this *ServerList) RemoveServer(idx uint32)
Private: Visible for testing.
func (*ServerList) Size ¶ added in v1.21.2
func (this *ServerList) Size() uint32
type ServerPicker ¶ added in v1.21.2
type ServerPicker interface {
PickServer() *ServerSpec
}
type ServerSpec ¶ added in v1.21.2
func NewServerSpec ¶ added in v1.21.2
func NewServerSpec(newAccount NewAccountFactory, dest v2net.Destination, valid ValidationStrategy, users ...*User) *ServerSpec
func NewServerSpecFromPB ¶
func NewServerSpecFromPB(newAccount NewAccountFactory, spec ServerSpecPB) *ServerSpec
func (*ServerSpec) AddUser ¶ added in v1.21.2
func (this *ServerSpec) AddUser(user *User)
func (*ServerSpec) Destination ¶ added in v1.21.2
func (this *ServerSpec) Destination() v2net.Destination
func (*ServerSpec) HasUser ¶ added in v1.21.2
func (this *ServerSpec) HasUser(user *User) bool
func (*ServerSpec) Invalidate ¶ added in v1.21.2
func (this *ServerSpec) Invalidate()
func (*ServerSpec) IsValid ¶ added in v1.21.2
func (this *ServerSpec) IsValid() bool
func (*ServerSpec) PickUser ¶ added in v1.21.2
func (this *ServerSpec) PickUser() *User
type ServerSpecPB ¶
type ServerSpecPB struct { Address *com_v2ray_core_common_net.AddressPB `protobuf:"bytes,1,opt,name=address" json:"address,omitempty"` Port uint32 `protobuf:"varint,2,opt,name=port" json:"port,omitempty"` Users []*User `protobuf:"bytes,3,rep,name=users" json:"users,omitempty"` }
func (*ServerSpecPB) Descriptor ¶
func (*ServerSpecPB) Descriptor() ([]byte, []int)
func (*ServerSpecPB) GetAddress ¶
func (m *ServerSpecPB) GetAddress() *com_v2ray_core_common_net.AddressPB
func (*ServerSpecPB) GetUsers ¶
func (m *ServerSpecPB) GetUsers() []*User
func (*ServerSpecPB) ProtoMessage ¶
func (*ServerSpecPB) ProtoMessage()
func (*ServerSpecPB) Reset ¶
func (m *ServerSpecPB) Reset()
func (*ServerSpecPB) String ¶
func (m *ServerSpecPB) String() string
type TimeoutValidStrategy ¶ added in v1.21.2
type TimeoutValidStrategy struct {
// contains filtered or unexported fields
}
func (*TimeoutValidStrategy) Invalidate ¶ added in v1.21.2
func (this *TimeoutValidStrategy) Invalidate()
func (*TimeoutValidStrategy) IsValid ¶ added in v1.21.2
func (this *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"` Account *google_protobuf.Any `protobuf:"bytes,3,opt,name=account" json:"account,omitempty"` }
func (*User) Descriptor ¶
func (*User) GetAccount ¶
func (m *User) GetAccount() *google_protobuf.Any
func (*User) GetSettings ¶
func (this *User) GetSettings() UserSettings
func (*User) GetTypedAccount ¶
func (*User) ProtoMessage ¶
func (*User) ProtoMessage()
type UserSettings ¶
type UserSettings struct {
PayloadReadTimeout uint32
}
type UserValidator ¶
type ValidationStrategy ¶ added in v1.21.2
type ValidationStrategy interface { IsValid() bool Invalidate() }
func AlwaysValid ¶ added in v1.21.2
func AlwaysValid() ValidationStrategy
func BeforeTime ¶ added in v1.21.2
func BeforeTime(t time.Time) ValidationStrategy
Click to show internal directories.
Click to hide internal directories.