Documentation ¶
Index ¶
- Constants
- Variables
- func DefaultIDHash(key []byte) hash.Hash
- type Account
- type CommandSwitchAccount
- type ID
- type IDHash
- type RequestCommand
- type RequestDecoder
- type RequestEncoder
- type RequestHeader
- type RequestOption
- type ResponseCommand
- type ResponseDecoder
- type ResponseEncoder
- type ResponseHeader
- type TimedUserValidator
- type Timestamp
- type TimestampGenerator
- type User
- type UserLevel
- type UserSettings
- type UserValidator
Constants ¶
View Source
const ( RequestCommandTCP = RequestCommand(0x01) RequestCommandUDP = RequestCommand(0x02) )
View Source
const ( UserLevelAdmin = UserLevel(255) UserLevelUntrusted = UserLevel(0) )
View Source
const (
IDBytesLen = 16
)
View Source
const (
RequestOptionChunkStream = RequestOption(0x01)
)
Variables ¶
View Source
var ( ErrorInvalidUser = errors.New("Invalid user.") ErrorInvalidVersion = 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.
type RequestCommand ¶
type RequestCommand byte
type RequestDecoder ¶ added in v1.9.1
type RequestEncoder ¶ added in v1.9.1
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 ¶ added in v1.9.1
type RequestOption byte
func (RequestOption) IsChunkStream ¶ added in v1.9.1
func (this RequestOption) IsChunkStream() bool
type ResponseCommand ¶
type ResponseCommand interface{}
type ResponseDecoder ¶ added in v1.9.1
type ResponseEncoder ¶ added in v1.9.1
type ResponseHeader ¶
type ResponseHeader struct {
Command ResponseCommand
}
type TimedUserValidator ¶ added in v1.9.1
type TimedUserValidator struct {
// contains filtered or unexported fields
}
func (*TimedUserValidator) Add ¶ added in v1.9.1
func (this *TimedUserValidator) Add(user *User) error
func (*TimedUserValidator) Get ¶ added in v1.9.1
func (this *TimedUserValidator) Get(userHash []byte) (*User, Timestamp, bool)
func (*TimedUserValidator) Release ¶ added in v1.12.1
func (this *TimedUserValidator) Release()
type TimestampGenerator ¶
type TimestampGenerator func() Timestamp
func NewTimestampGenerator ¶
func NewTimestampGenerator(base Timestamp, delta int) TimestampGenerator
type UserSettings ¶ added in v1.9.1
type UserSettings struct {
PayloadReadTimeout int
}
func GetUserSettings ¶ added in v1.9.1
func GetUserSettings(level UserLevel) UserSettings
type UserValidator ¶ added in v1.9.1
type UserValidator interface { common.Releasable Add(user *User) error Get(timeHash []byte) (*User, Timestamp, bool) }
func NewTimedUserValidator ¶ added in v1.9.1
func NewTimedUserValidator(hasher IDHash) UserValidator
Source Files ¶
Click to show internal directories.
Click to hide internal directories.