Documentation ¶
Index ¶
- Constants
- Variables
- func ContextWithUser(ctx context.Context, user *User) context.Context
- func DefaultIDHash(key []byte) hash.Hash
- type Account
- type AddressOption
- type AddressParser
- type AddressType
- type AddressTypeParser
- type AlternativeOutboundConfig
- func (*AlternativeOutboundConfig) Descriptor() ([]byte, []int)
- func (m *AlternativeOutboundConfig) GetSettings() *v2ray_core_common_serial.TypedMessage
- func (m *AlternativeOutboundConfig) GetStreamSettings() *v2ray_core_transport_internet.StreamConfig
- func (*AlternativeOutboundConfig) ProtoMessage()
- func (m *AlternativeOutboundConfig) Reset()
- func (m *AlternativeOutboundConfig) String() string
- type AsAccount
- type CommandSwitchAccount
- type ID
- type IDHash
- type RequestCommand
- type RequestHeader
- type ResponseCommand
- type ResponseHeader
- type RoundRobinServerPicker
- type SecurityConfig
- type SecurityType
- type ServerEndpoint
- func (*ServerEndpoint) Descriptor() ([]byte, []int)
- func (m *ServerEndpoint) GetAddress() *v2ray_core_common_net.IPOrDomain
- func (m *ServerEndpoint) GetPort() uint32
- func (m *ServerEndpoint) GetUser() []*User
- func (*ServerEndpoint) ProtoMessage()
- func (m *ServerEndpoint) Reset()
- func (m *ServerEndpoint) String() string
- type ServerList
- type ServerPicker
- type ServerSpec
- type Timestamp
- type TimestampGenerator
- type TransferType
- type User
- func (*User) Descriptor() ([]byte, []int)
- func (m *User) GetAccount() *v2ray_core_common_serial.TypedMessage
- func (m *User) GetEmail() string
- func (m *User) GetLevel() uint32
- func (u *User) GetTypedAccount() (Account, error)
- func (*User) ProtoMessage()
- func (m *User) Reset()
- func (m *User) String() string
- type UserValidator
- type ValidationStrategy
Constants ¶
View Source
const ( RequestCommandTCP = RequestCommand(0x01) RequestCommandUDP = RequestCommand(0x02) RequestCommandMux = RequestCommand(0x03) )
View Source
const ( // RequestOptionChunkStream indicates request payload is chunked. Each chunk consists of length, authentication and payload. RequestOptionChunkStream bitmask.Byte = 0x01 // RequestOptionConnectionReuse indicates client side expects to reuse the connection. RequestOptionConnectionReuse bitmask.Byte = 0x02 RequestOptionChunkMasking bitmask.Byte = 0x04 )
View Source
const (
IDBytesLen = 16
)
Variables ¶
Functions ¶
func ContextWithUser ¶
ContextWithUser returns a context combined with an User.
Types ¶
type Account ¶ added in v1.11.1
Account is an user identity used for authentication.
type AddressOption ¶
type AddressOption func(*AddressParser)
func AddressFamilyByte ¶
func AddressFamilyByte(b byte, f net.AddressFamily) AddressOption
func PortThenAddress ¶
func PortThenAddress() AddressOption
func WithAddressTypeParser ¶
func WithAddressTypeParser(atp AddressTypeParser) AddressOption
type AddressParser ¶
type AddressParser struct {
// contains filtered or unexported fields
}
func NewAddressParser ¶
func NewAddressParser(options ...AddressOption) *AddressParser
func (*AddressParser) ReadAddressPort ¶
type AddressType ¶
type AddressType byte
const ( AddressTypeIPv4 AddressType = 1 AddressTypeDomain AddressType = 2 AddressTypeIPv6 AddressType = 3 )
type AlternativeOutboundConfig ¶
type AlternativeOutboundConfig struct { Settings *v2ray_core_common_serial.TypedMessage `protobuf:"bytes,1,opt,name=settings" json:"settings,omitempty"` StreamSettings *v2ray_core_transport_internet.StreamConfig `protobuf:"bytes,3,opt,name=stream_settings,json=streamSettings" json:"stream_settings,omitempty"` }
func (*AlternativeOutboundConfig) Descriptor ¶
func (*AlternativeOutboundConfig) Descriptor() ([]byte, []int)
func (*AlternativeOutboundConfig) GetSettings ¶
func (m *AlternativeOutboundConfig) GetSettings() *v2ray_core_common_serial.TypedMessage
func (*AlternativeOutboundConfig) GetStreamSettings ¶
func (m *AlternativeOutboundConfig) GetStreamSettings() *v2ray_core_transport_internet.StreamConfig
func (*AlternativeOutboundConfig) ProtoMessage ¶
func (*AlternativeOutboundConfig) ProtoMessage()
func (*AlternativeOutboundConfig) Reset ¶
func (m *AlternativeOutboundConfig) Reset()
func (*AlternativeOutboundConfig) String ¶
func (m *AlternativeOutboundConfig) String() string
type AsAccount ¶
AsAccount is an object can be converted into account.
type CommandSwitchAccount ¶
type ID ¶
type ID struct {
// contains filtered or unexported fields
}
The ID of en entity, in the form of an UUID.
func (*ID) Equals ¶
Equals returns true if this ID equals to the other one.
type RequestCommand ¶
type RequestCommand byte
RequestCommand is a custom command in a proxy request.
func (RequestCommand) TransferType ¶
func (c RequestCommand) TransferType() TransferType
type RequestHeader ¶
type RequestHeader struct { Version byte Command RequestCommand Option bitmask.Byte Security SecurityType Port net.Port Address net.Address User *User }
func (*RequestHeader) Destination ¶
func (h *RequestHeader) Destination() net.Destination
type ResponseCommand ¶
type ResponseCommand interface{}
type ResponseHeader ¶
type ResponseHeader struct { Option bitmask.Byte Command ResponseCommand }
type RoundRobinServerPicker ¶ added in v1.21.1
func NewRoundRobinServerPicker ¶ added in v1.21.1
func NewRoundRobinServerPicker(serverlist *ServerList) *RoundRobinServerPicker
func (*RoundRobinServerPicker) PickServer ¶ added in v1.21.1
func (p *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) Descriptor ¶
func (*SecurityConfig) Descriptor() ([]byte, []int)
func (*SecurityConfig) GetSecurityType ¶
func (sc *SecurityConfig) GetSecurityType() SecurityType
func (*SecurityConfig) GetType ¶
func (m *SecurityConfig) GetType() SecurityType
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_UNKNOWN SecurityType = 0 SecurityType_LEGACY SecurityType = 1 SecurityType_AUTO SecurityType = 2 SecurityType_AES128_GCM SecurityType = 3 SecurityType_CHACHA20_POLY1305 SecurityType = 4 SecurityType_NONE SecurityType = 5 )
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) GetPort ¶
func (m *ServerEndpoint) GetPort() uint32
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 ¶ added in v1.21.1
func NewServerList ¶ added in v1.21.1
func NewServerList() *ServerList
func (*ServerList) AddServer ¶ added in v1.21.1
func (sl *ServerList) AddServer(server *ServerSpec)
func (*ServerList) GetServer ¶ added in v1.21.1
func (sl *ServerList) GetServer(idx uint32) *ServerSpec
func (*ServerList) Size ¶ added in v1.21.1
func (sl *ServerList) Size() uint32
type ServerPicker ¶ added in v1.21.1
type ServerPicker interface {
PickServer() *ServerSpec
}
type ServerSpec ¶ added in v1.21.1
func NewServerSpec ¶ added in v1.21.1
func NewServerSpec(dest net.Destination, valid ValidationStrategy, users ...*User) *ServerSpec
func NewServerSpecFromPB ¶
func NewServerSpecFromPB(spec ServerEndpoint) *ServerSpec
func (*ServerSpec) AddUser ¶ added in v1.21.1
func (s *ServerSpec) AddUser(user *User)
func (*ServerSpec) Destination ¶ added in v1.21.1
func (s *ServerSpec) Destination() net.Destination
func (*ServerSpec) HasUser ¶ added in v1.21.1
func (s *ServerSpec) HasUser(user *User) bool
func (*ServerSpec) Invalidate ¶ added in v1.21.2
func (v *ServerSpec) Invalidate()
func (*ServerSpec) IsValid ¶ added in v1.21.1
func (v *ServerSpec) IsValid() bool
func (*ServerSpec) PickUser ¶ added in v1.21.1
func (s *ServerSpec) PickUser() *User
type TimestampGenerator ¶
type TimestampGenerator func() Timestamp
func NewTimestampGenerator ¶
func NewTimestampGenerator(base Timestamp, delta int) TimestampGenerator
type TransferType ¶
type TransferType int
const ( TransferTypeStream TransferType = 0 TransferTypePacket TransferType = 1 )
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. Must be the account proto in one of the proxies. Account *v2ray_core_common_serial.TypedMessage `protobuf:"bytes,3,opt,name=account" json:"account,omitempty"` }
User is a generic user for all procotols.
func UserFromContext ¶
UserFromContext extracts an User from the given context, if any.
func (*User) GetAccount ¶
func (m *User) GetAccount() *v2ray_core_common_serial.TypedMessage
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
Source Files ¶
Click to show internal directories.
Click to hide internal directories.