mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-01-02 23:47:07 -05:00
comments
This commit is contained in:
parent
5040817a7b
commit
76d2e5517b
@ -6,7 +6,7 @@ option go_package = "net";
|
||||
option java_package = "com.v2ray.core.common.net";
|
||||
option java_multiple_files = true;
|
||||
|
||||
// Address of a network host. It may be an IP address or a domain address.
|
||||
// Address of a network host. It may be either an IP address or a domain address.
|
||||
message IPOrDomain {
|
||||
oneof address {
|
||||
// IP address. Must by either 4 or 16 bytes.
|
||||
|
@ -14,6 +14,7 @@ enum Network {
|
||||
UDP = 3;
|
||||
}
|
||||
|
||||
// NetworkList is a list of Networks.
|
||||
message NetworkList {
|
||||
repeated Network network = 1;
|
||||
}
|
||||
|
@ -13,4 +13,4 @@ message ServerEndpoint {
|
||||
v2ray.core.common.net.IPOrDomain address = 1;
|
||||
uint32 port = 2;
|
||||
repeated v2ray.core.common.protocol.User user = 3;
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ option java_multiple_files = true;
|
||||
|
||||
import "v2ray.com/core/common/serial/typed_message.proto";
|
||||
|
||||
// User is a generic user for all procotols.
|
||||
message User {
|
||||
uint32 level = 1;
|
||||
string email = 2;
|
||||
|
@ -9,10 +9,12 @@ func ByteToHexString(value byte) string {
|
||||
return hex.EncodeToString([]byte{value})
|
||||
}
|
||||
|
||||
// BytesToUint16 deserializes a byte array to an uint16 in big endian order. The byte array must have at least 2 elements.
|
||||
func BytesToUint16(value []byte) uint16 {
|
||||
return uint16(value[0])<<8 | uint16(value[1])
|
||||
}
|
||||
|
||||
// BytesToUint32 deserializes a byte array to an uint32 in big endian order. The byte array must have at least 4 elements.
|
||||
func BytesToUint32(value []byte) uint32 {
|
||||
return uint32(value[0])<<24 |
|
||||
uint32(value[1])<<16 |
|
||||
@ -20,6 +22,7 @@ func BytesToUint32(value []byte) uint32 {
|
||||
uint32(value[3])
|
||||
}
|
||||
|
||||
// BytesToInt64 deserializes a byte array to an int64 in big endian order. The byte array must have at least 8 elements.
|
||||
func BytesToInt64(value []byte) int64 {
|
||||
return int64(value[0])<<56 |
|
||||
int64(value[1])<<48 |
|
||||
|
@ -1,10 +0,0 @@
|
||||
package serial
|
||||
|
||||
import "hash"
|
||||
|
||||
func WriteHash(h hash.Hash) func([]byte) (int, error) {
|
||||
return func(b []byte) (int, error) {
|
||||
h.Sum(b[:0])
|
||||
return h.Size(), nil
|
||||
}
|
||||
}
|
@ -2,6 +2,7 @@ package serial
|
||||
|
||||
import "strconv"
|
||||
|
||||
// Uint16ToBytes serializes an uint16 into bytes in big endian order.
|
||||
func Uint16ToBytes(value uint16, b []byte) []byte {
|
||||
return append(b, byte(value>>8), byte(value))
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
// ToString serialize an abitrary value into string.
|
||||
func ToString(v interface{}) string {
|
||||
if v == nil {
|
||||
return " "
|
||||
|
Loading…
Reference in New Issue
Block a user