mirror of
https://github.com/v2fly/v2ray-core.git
synced 2026-04-24 14:39:10 -04:00
more fields in switch account command
This commit is contained in:
@@ -10,6 +10,17 @@ type Uint16 interface {
|
||||
|
||||
type Uint16Literal uint16
|
||||
|
||||
func ParseUint16(data []byte) Uint16Literal {
|
||||
switch len(data) {
|
||||
case 0:
|
||||
return Uint16Literal(0)
|
||||
case 1:
|
||||
return Uint16Literal(uint16(data[0]))
|
||||
default:
|
||||
return Uint16Literal(uint16(data[0])<<8 + uint16(data[1]))
|
||||
}
|
||||
}
|
||||
|
||||
func (this Uint16Literal) String() string {
|
||||
return strconv.Itoa(int(this))
|
||||
}
|
||||
@@ -18,6 +29,10 @@ func (this Uint16Literal) Value() uint16 {
|
||||
return uint16(this)
|
||||
}
|
||||
|
||||
func (this Uint16Literal) Bytes() []byte {
|
||||
return []byte{byte(this >> 8), byte(this)}
|
||||
}
|
||||
|
||||
type Int interface {
|
||||
Value() int
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user