1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2026-05-16 09:29:07 -04:00

SwitchAccount command

This commit is contained in:
v2ray
2015-12-12 13:11:49 +01:00
parent 47f35b1c3e
commit fed5697dc3
10 changed files with 196 additions and 9 deletions

23
common/serial/bytes.go Normal file
View File

@@ -0,0 +1,23 @@
package serial
type Bytes interface {
Bytes() []byte
}
type BytesLiteral []byte
func (this BytesLiteral) Value() []byte {
return []byte(this)
}
func (this BytesLiteral) Int64Value() int64 {
value := this.Value()
return int64(value[0])<<56 +
int64(value[1])<<48 +
int64(value[2])<<40 +
int64(value[3])<<32 +
int64(value[4])<<24 +
int64(value[5])<<16 +
int64(value[6])<<8 +
int64(value[7])
}

View File

@@ -31,3 +31,27 @@ func (this IntLiteral) String() string {
func (this IntLiteral) Value() int {
return int(this)
}
type Int64Literal int64
func (this Int64Literal) String() string {
return strconv.FormatInt(this.Value(), 10)
}
func (this Int64Literal) Value() int64 {
return int64(this)
}
func (this Int64Literal) Bytes() []byte {
value := this.Value()
return []byte{
byte(value >> 56),
byte(value >> 48),
byte(value >> 40),
byte(value >> 32),
byte(value >> 24),
byte(value >> 16),
byte(value >> 8),
byte(value),
}
}