Documentation
¶
Index ¶
- Constants
- Variables
- func DefaultIDHash(key []byte) hash.Hash
- func IsDomainTooLong(domain string) bool
- type Account
- type AddressType
- type AsAccount
- type CommandSwitchAccount
- type ID
- type IDHash
- type MemoryUser
- type RequestCommand
- type RequestHeader
- type ResponseCommand
- type ResponseHeader
- type RoundRobinServerPicker
- type SecurityType
- func (SecurityType) Descriptor() protoreflect.EnumDescriptor
- func (x SecurityType) Enum() *SecurityType
- func (SecurityType) EnumDescriptor() ([]byte, []int)deprecated
- func (sc SecurityType) GetSecurityType() SecurityType
- func (x SecurityType) Number() protoreflect.EnumNumber
- func (x SecurityType) String() string
- func (SecurityType) Type() protoreflect.EnumType
- type ServerList
- type ServerPicker
- type ServerSpec
- type Timestamp
- type TimestampGenerator
- type TransferType
- 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 RequestOptionGlobalPadding bitmask.Byte = 0x08 RequestOptionAuthenticatedLength bitmask.Byte = 0x10 )
View Source
const (
IDBytesLen = 16
)
View Source
const (
ResponseOptionConnectionReuse bitmask.Byte = 0x01
)
Variables ¶
View Source
var ( SecurityType_name = map[int32]string{ 0: "UNKNOWN", 1: "LEGACY", 2: "AUTO", 3: "AES128_GCM", 4: "CHACHA20_POLY1305", 5: "NONE", 6: "ZERO", } SecurityType_value = map[string]int32{ "UNKNOWN": 0, "LEGACY": 1, "AUTO": 2, "AES128_GCM": 3, "CHACHA20_POLY1305": 4, "NONE": 5, "ZERO": 6, } )
Enum value maps for SecurityType.
View Source
var ErrNoClue = errors.New("not enough information for making a decision")
View Source
var ErrProtoNeedMoreData = errors.New("protocol matches, but need more data to complete sniffing")
View Source
var File_common_protocol_protocol_proto protoreflect.FileDescriptor
Functions ¶
func DefaultIDHash ¶
func IsDomainTooLong ¶
Types ¶
type AddressType ¶
type AddressType byte
const ( AddressTypeIPv4 AddressType = 1 AddressTypeDomain AddressType = 2 AddressTypeIPv6 AddressType = 3 )
type CommandSwitchAccount ¶
type ID ¶
type ID struct {
// contains filtered or unexported fields
}
The ID of en entity, in the form of a UUID.
func NewAlterIDs ¶
type MemoryUser ¶
type MemoryUser struct {
// Account is the parsed account of the protocol.
Account Account
Email string
Level uint32
}
MemoryUser is a parsed form of User, to reduce number of parsing of Account proto.
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
Port net.Port
Address net.Address
Option bitmask.Byte
Security SecurityType
User string // used in server
Account interface{} // used in client
}
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 ¶
func NewRoundRobinServerPicker ¶
func NewRoundRobinServerPicker(serverlist *ServerList) *RoundRobinServerPicker
func (*RoundRobinServerPicker) AddServer ¶
func (p *RoundRobinServerPicker) AddServer(server *ServerSpec)
func (*RoundRobinServerPicker) PickServer ¶
func (p *RoundRobinServerPicker) PickServer() *ServerSpec
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 SecurityType_ZERO SecurityType = 6 )
func (SecurityType) Descriptor ¶
func (SecurityType) Descriptor() protoreflect.EnumDescriptor
func (SecurityType) Enum ¶
func (x SecurityType) Enum() *SecurityType
func (SecurityType) EnumDescriptor
deprecated
func (SecurityType) EnumDescriptor() ([]byte, []int)
Deprecated: Use SecurityType.Descriptor instead.
func (SecurityType) GetSecurityType ¶
func (sc SecurityType) GetSecurityType() SecurityType
func (SecurityType) Number ¶
func (x SecurityType) Number() protoreflect.EnumNumber
func (SecurityType) String ¶
func (x SecurityType) String() string
func (SecurityType) Type ¶
func (SecurityType) Type() protoreflect.EnumType
type ServerList ¶
func NewServerList ¶
func NewServerList() *ServerList
func (*ServerList) AddServer ¶
func (sl *ServerList) AddServer(server *ServerSpec)
func (*ServerList) GetServer ¶
func (sl *ServerList) GetServer(idx uint32) *ServerSpec
func (*ServerList) Size ¶
func (sl *ServerList) Size() uint32
type ServerPicker ¶
type ServerPicker interface {
AddServer(server *ServerSpec)
PickServer() *ServerSpec
}
type ServerSpec ¶
func NewServerSpec ¶
func NewServerSpec(dest net.Destination, valid ValidationStrategy, ps interface{}) *ServerSpec
func (*ServerSpec) Destination ¶
func (s *ServerSpec) Destination() net.Destination
func (*ServerSpec) GetProtocolSetting ¶
func (s *ServerSpec) GetProtocolSetting() interface{}
func (*ServerSpec) Invalidate ¶
func (s *ServerSpec) Invalidate()
func (*ServerSpec) IsValid ¶
func (s *ServerSpec) IsValid() bool
type TimestampGenerator ¶
type TimestampGenerator func() Timestamp
func NewTimestampGenerator ¶
func NewTimestampGenerator(base Timestamp, delta int) TimestampGenerator
type TransferType ¶
type TransferType byte
const ( TransferTypeStream TransferType = 0 TransferTypePacket TransferType = 1 )
type ValidationStrategy ¶
type ValidationStrategy interface {
IsValid() bool
Invalidate()
}
func AlwaysValid ¶
func AlwaysValid() ValidationStrategy
func BeforeTime ¶
func BeforeTime(t time.Time) ValidationStrategy
Source Files
¶
Click to show internal directories.
Click to hide internal directories.