1
0
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:
v2ray
2016-01-19 01:21:07 +01:00
parent 65d5c07533
commit 6eff759b05
9 changed files with 140 additions and 25 deletions

View File

@@ -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
}