Documentation ¶
Index ¶
- Constants
- Variables
- func DefaultIDHash(key []byte) hash.Hash
- type Account
- type AlwaysValidStrategy
- 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 TimeoutValidStrategy
- type Timestamp
- type TimestampGenerator
- type User
- type UserLevel
- 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 ( 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 AlwaysValidStrategy ¶
type AlwaysValidStrategy struct{}
func (AlwaysValidStrategy) Invalidate ¶
func (this AlwaysValidStrategy) Invalidate()
func (AlwaysValidStrategy) IsValid ¶
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 ¶
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 ¶
func (this *RequestOption) Clear(option RequestOption)
func (RequestOption) Has ¶
func (this RequestOption) Has(option RequestOption) bool
func (*RequestOption) Set ¶
func (this *RequestOption) Set(option RequestOption)
type ResponseCommand ¶
type ResponseCommand interface{}
type ResponseHeader ¶
type ResponseHeader struct { Option ResponseOption Command ResponseCommand }
type ResponseOption ¶
type ResponseOption byte
func (*ResponseOption) Clear ¶
func (this *ResponseOption) Clear(option ResponseOption)
func (ResponseOption) Has ¶
func (this ResponseOption) Has(option ResponseOption) bool
func (*ResponseOption) Set ¶
func (this *ResponseOption) Set(option ResponseOption)
type RoundRobinServerPicker ¶
func NewRoundRobinServerPicker ¶
func NewRoundRobinServerPicker(serverlist *ServerList) *RoundRobinServerPicker
func (*RoundRobinServerPicker) PickServer ¶
func (this *RoundRobinServerPicker) PickServer() *ServerSpec
type ServerList ¶
func NewServerList ¶
func NewServerList() *ServerList
func (*ServerList) AddServer ¶
func (this *ServerList) AddServer(server *ServerSpec)
func (*ServerList) GetServer ¶
func (this *ServerList) GetServer(idx uint32) *ServerSpec
func (*ServerList) Size ¶
func (this *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 (*ServerSpec) AddUser ¶
func (this *ServerSpec) AddUser(user *User)
func (*ServerSpec) Destination ¶
func (this *ServerSpec) Destination() v2net.Destination
func (*ServerSpec) HasUser ¶
func (this *ServerSpec) HasUser(user *User) bool
func (*ServerSpec) Invalidate ¶
func (this *ServerSpec) Invalidate()
func (*ServerSpec) IsValid ¶
func (this *ServerSpec) IsValid() bool
func (*ServerSpec) PickUser ¶
func (this *ServerSpec) PickUser() *User
type TimeoutValidStrategy ¶
type TimeoutValidStrategy struct {
// contains filtered or unexported fields
}
func (*TimeoutValidStrategy) Invalidate ¶
func (this *TimeoutValidStrategy) Invalidate()
func (*TimeoutValidStrategy) IsValid ¶
func (this *TimeoutValidStrategy) IsValid() 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 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.