Documentation ¶
Index ¶
- Constants
- Variables
- func DefaultIDHash(key []byte) hash.Hash
- type Account
- type CommandSwitchAccount
- type ID
- type IDHash
- type RequestCommand
- type RequestHeader
- type RequestOption
- type ResponseCommand
- type ResponseHeader
- type ResponseOption
- type RoundRobinServerPicker
- type ServerList
- type ServerPicker
- type ServerSpec
- type TimedUserValidator
- type TimeoutServerSpec
- type Timestamp
- type TimestampGenerator
- type User
- type UserLevel
- type UserSettings
- type UserValidator
- type VMessAccount
Constants ¶
View Source
const ( RequestCommandTCP = RequestCommand(0x01) RequestCommandUDP = RequestCommand(0x02) )
View Source
const ( RequestOptionChunkStream = RequestOption(0x01) RequestOptionConnectionReuse = RequestOption(0x02) )
View Source
const ( UserLevelAdmin = UserLevel(255) UserLevelUntrusted = UserLevel(0) )
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 (
InvalidID = errors.New("Invalid ID.")
)
Functions ¶
func DefaultIDHash ¶
Types ¶
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.7
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.1
func (this *RequestOption) Clear(option RequestOption)
func (RequestOption) Has ¶ added in v1.17.1
func (this RequestOption) Has(option RequestOption) bool
func (*RequestOption) Set ¶ added in v1.17.1
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.1
type ResponseOption byte
func (*ResponseOption) Clear ¶ added in v1.17.1
func (this *ResponseOption) Clear(option ResponseOption)
func (ResponseOption) Has ¶ added in v1.17.1
func (this ResponseOption) Has(option ResponseOption) bool
func (*ResponseOption) Set ¶ added in v1.17.1
func (this *ResponseOption) Set(option ResponseOption)
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 (this *RoundRobinServerPicker) PickServer() *ServerSpec
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 (this *ServerList) AddServer(server *ServerSpec)
func (*ServerList) GetServer ¶ added in v1.21.1
func (this *ServerList) GetServer(idx uint32) *ServerSpec
func (*ServerList) RemoveServer ¶ added in v1.21.1
func (this *ServerList) RemoveServer(idx uint32)
@Private
func (*ServerList) Size ¶ added in v1.21.1
func (this *ServerList) Size() uint32
type ServerPicker ¶ added in v1.21.1
type ServerPicker interface {
PickServer() *ServerSpec
}
type ServerSpec ¶ added in v1.21.1
type ServerSpec struct { sync.RWMutex Destination v2net.Destination // contains filtered or unexported fields }
func NewServerSpec ¶ added in v1.21.1
func NewServerSpec(dest v2net.Destination, users ...*User) *ServerSpec
func (*ServerSpec) AddUser ¶ added in v1.21.1
func (this *ServerSpec) AddUser(user *User)
func (*ServerSpec) HasUser ¶ added in v1.21.1
func (this *ServerSpec) HasUser(user *User) bool
func (*ServerSpec) IsValid ¶ added in v1.21.1
func (this *ServerSpec) IsValid() bool
func (*ServerSpec) PickUser ¶ added in v1.21.1
func (this *ServerSpec) PickUser() *User
func (*ServerSpec) SetValid ¶ added in v1.21.1
func (this *ServerSpec) SetValid(b bool)
type TimedUserValidator ¶
func (*TimedUserValidator) Add ¶
func (this *TimedUserValidator) Add(user *User) error
func (*TimedUserValidator) Get ¶
func (this *TimedUserValidator) Get(userHash []byte) (*User, Timestamp, bool)
func (*TimedUserValidator) Release ¶ added in v1.12.1
func (this *TimedUserValidator) Release()
type TimeoutServerSpec ¶ added in v1.21.1
type TimeoutServerSpec struct { *ServerSpec // contains filtered or unexported fields }
func NewTimeoutServerSpec ¶ added in v1.21.1
func NewTimeoutServerSpec(spec *ServerSpec, until time.Time) *TimeoutServerSpec
func (*TimeoutServerSpec) IsValid ¶ added in v1.21.1
func (this *TimeoutServerSpec) IsValid() bool
func (*TimeoutServerSpec) SetValid ¶ added in v1.21.1
func (this *TimeoutServerSpec) SetValid(b bool)
type TimestampGenerator ¶
type TimestampGenerator func() Timestamp
func NewTimestampGenerator ¶
func NewTimestampGenerator(base Timestamp, delta int) TimestampGenerator
type UserSettings ¶
type UserSettings struct {
PayloadReadTimeout int
}
func GetUserSettings ¶
func GetUserSettings(level UserLevel) UserSettings
type UserValidator ¶
type UserValidator interface { common.Releasable Add(user *User) error Get(timeHash []byte) (*User, Timestamp, bool) }
func NewTimedUserValidator ¶
func NewTimedUserValidator(hasher IDHash) UserValidator
type VMessAccount ¶ added in v1.17.1
func (*VMessAccount) AnyValidID ¶ added in v1.17.1
func (this *VMessAccount) AnyValidID() *ID
func (*VMessAccount) Equals ¶ added in v1.21.1
func (this *VMessAccount) Equals(account Account) bool
Click to show internal directories.
Click to hide internal directories.