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

refactor protos

This commit is contained in:
Darien Raymond
2016-10-12 18:43:55 +02:00
parent c1f91567ad
commit fc6a706166
44 changed files with 331 additions and 313 deletions

View File

@@ -31,7 +31,7 @@ var _ = math.Inf
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
type Config struct {
Address *v2ray_core_common_net.AddressPB `protobuf:"bytes,1,opt,name=address" json:"address,omitempty"`
Address *v2ray_core_common_net.IPOrDomain `protobuf:"bytes,1,opt,name=address" json:"address,omitempty"`
Port uint32 `protobuf:"varint,2,opt,name=port" json:"port,omitempty"`
NetworkList *v2ray_core_common_net1.NetworkList `protobuf:"bytes,3,opt,name=network_list,json=networkList" json:"network_list,omitempty"`
Timeout uint32 `protobuf:"varint,4,opt,name=timeout" json:"timeout,omitempty"`
@@ -43,7 +43,7 @@ func (m *Config) String() string { return proto.CompactTextString(m)
func (*Config) ProtoMessage() {}
func (*Config) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
func (m *Config) GetAddress() *v2ray_core_common_net.AddressPB {
func (m *Config) GetAddress() *v2ray_core_common_net.IPOrDomain {
if m != nil {
return m.Address
}
@@ -64,22 +64,23 @@ func init() {
func init() { proto.RegisterFile("v2ray.com/core/proxy/dokodemo/config.proto", fileDescriptor0) }
var fileDescriptor0 = []byte{
// 269 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x7c, 0x90, 0x4d, 0x4b, 0xc3, 0x40,
0x10, 0x86, 0x89, 0xd6, 0xb6, 0x6c, 0xfd, 0x80, 0x3d, 0xad, 0x82, 0x10, 0x7a, 0x69, 0xf0, 0xb0,
0x0b, 0x15, 0x3c, 0x78, 0x33, 0xe2, 0x4d, 0xa4, 0xe4, 0xe8, 0xa5, 0xd4, 0xcd, 0x54, 0x42, 0xb3,
0x3b, 0x61, 0x32, 0x5a, 0xfb,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xe9, 0xbd, 0xbd,
0xe6, 0x93, 0x58, 0xc1, 0xe2, 0xbb, 0x92, 0xe7, 0x71, 0x1f, 0xbf, 0x0c, 0x43, 0x47, 0xd7, 0x5f,
0x01, 0x00, 0x00, 0xff, 0xff, 0xf0, 0xa7, 0xda, 0x7b, 0xbe, 0x01, 0x00, 0x00,
// 275 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x7c, 0x90, 0x4f, 0x4b, 0x33, 0x31,
0x10, 0xc6, 0xd9, 0xf7, 0xad, 0x6d, 0xc9, 0xfa, 0x07, 0x72, 0x8a, 0x82, 0xb0, 0xf6, 0xd2, 0xc5,
0x43, 0x02, 0x15, 0xbc, 0x78, 0xab, 0x7a, 0x10, 0x44, 0xcb, 0x1e, 0xbd, 0x94, 0x35, 0x9b, 0x4a,
0xe8, 0x26, 0xb3, 0xcc, 0x8e, 0xd6, 0x7e, 0x5e, 0xbf, 0x88, 0x98, 0xec, 0xa2, 0x08, 0xf5, 0x96,
0x79, 0xf8, 0xe5, 0x37, 0xc3, 0xc3, 0xce, 0xdf, 0x66, 0x58, 0x6e, 0xa5, 0x06, 0xa7, 0x34, 0xa0,
0x51, 0x0d, 0xc2, 0xfb, 0x56, 0x55, 0xb0, 0x86, 0xca, 0x38, 0x50, 0x1a, 0xfc, 0xca, 0xbe, 0xc8,
0x06, 0x81, 0x80, 0x1f, 0xf7, 0x2c, 0x1a, 0x19, 0x38, 0xd9, 0x73, 0x27, 0xd3, 0x5f, 0x1a, 0x0d,
0xce, 0x81, 0x57, 0xde, 0x90, 0x2a, 0xab, 0x0a, 0x4d, 0xdb, 0x46, 0xc7, 0x5f, 0xa0, 0x37, 0xb4,
0x01, 0x5c, 0x47, 0x70, 0xf2, 0x91, 0xb0, 0xe1, 0x75, 0xd8, 0xce, 0xaf, 0xd8, 0xa8, 0x93, 0x88,
0x24, 0x4b, 0xf2, 0x74, 0x76, 0x26, 0x7f, 0x5c, 0x12, 0x0d, 0xd2, 0x1b, 0x92, 0x77, 0x8b, 0x47,
0xbc, 0x01, 0x57, 0x5a, 0x5f, 0xf4, 0x3f, 0x38, 0x67, 0x83, 0x06, 0x90, 0xc4, 0xbf, 0x2c, 0xc9,
0x0f, 0x8a, 0xf0, 0xe6, 0xb7, 0x6c, 0xbf, 0x5b, 0xb6, 0xac, 0x6d, 0x4b, 0xe2, 0x7f, 0xb0, 0x4e,
0x76, 0x58, 0x1f, 0x22, 0x7a, 0x6f, 0x5b, 0x2a, 0x52, 0xff, 0x3d, 0x70, 0xc1, 0x46, 0x64, 0x9d,
0x81, 0x57, 0x12, 0x83, 0x60, 0xef, 0x47, 0x3e, 0x65, 0x47, 0x2b, 0xa8, 0x6b, 0xd8, 0x2c, 0xd1,
0x54, 0x16, 0x8d, 0x26, 0xb1, 0x97, 0x25, 0xf9, 0xb8, 0x38, 0x8c, 0x71, 0xd1, 0xa5, 0xf3, 0x4b,
0x76, 0xaa, 0xc1, 0xc9, 0x9d, 0xc5, 0xce, 0xd3, 0xd8, 0xc1, 0xe2, 0xab, 0x93, 0xa7, 0x71, 0x1f,
0x3f, 0x0f, 0x43, 0x49, 0x17, 0x9f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x21, 0x97, 0x31, 0xca, 0xbf,
0x01, 0x00, 0x00,
}

View File

@@ -9,7 +9,7 @@ import "v2ray.com/core/common/net/address.proto";
import "v2ray.com/core/common/net/network.proto";
message Config {
v2ray.core.common.net.AddressPB address = 1;
v2ray.core.common.net.IPOrDomain address = 1;
uint32 port = 2;
v2ray.core.common.net.NetworkList network_list = 3;
uint32 timeout = 4;

View File

@@ -12,7 +12,7 @@ import (
func (this *Config) UnmarshalJSON(data []byte) error {
type DokodemoConfig struct {
Host *v2net.AddressPB `json:"address"`
Host *v2net.IPOrDomain `json:"address"`
PortValue v2net.Port `json:"port"`
NetworkList *v2net.NetworkList `json:"network"`
TimeoutValue uint32 `json:"timeout"`

View File

@@ -54,8 +54,8 @@ func TestDokodemoTCP(t *testing.T) {
port := v2net.Port(dice.Roll(20000) + 10000)
dokodemo := NewDokodemoDoor(&Config{
Address: &v2net.AddressPB{
Address: &v2net.AddressPB_Ip{
Address: &v2net.IPOrDomain{
Address: &v2net.IPOrDomain_Ip{
Ip: v2net.LocalHostIP.IP(),
},
},
@@ -128,8 +128,8 @@ func TestDokodemoUDP(t *testing.T) {
port := v2net.Port(dice.Roll(20000) + 10000)
dokodemo := NewDokodemoDoor(&Config{
Address: &v2net.AddressPB{
Address: &v2net.AddressPB_Ip{
Address: &v2net.IPOrDomain{
Address: &v2net.IPOrDomain_Ip{
Ip: v2net.LocalHostIP.IP(),
},
},

View File

@@ -88,9 +88,9 @@ func TestIPResolution(t *testing.T) {
r := router.NewRouter(&router.Config{}, space)
space.BindApp(router.APP_ID, r)
dnsServer := dns.NewCacheServer(space, &dns.Config{
Hosts: map[string]*v2net.AddressPB{
"v2ray.com": &v2net.AddressPB{
Address: &v2net.AddressPB_Ip{
Hosts: map[string]*v2net.IPOrDomain{
"v2ray.com": &v2net.IPOrDomain{
Address: &v2net.IPOrDomain_Ip{
Ip: []byte{127, 0, 0, 1},
},
},

View File

@@ -90,7 +90,7 @@ func (m *ServerConfig) GetUser() *v2ray_core_common_protocol.User {
}
type ClientConfig struct {
Server []*v2ray_core_common_protocol1.ServerSpecPB `protobuf:"bytes,1,rep,name=server" json:"server,omitempty"`
Server []*v2ray_core_common_protocol1.ServerEndpoint `protobuf:"bytes,1,rep,name=server" json:"server,omitempty"`
}
func (m *ClientConfig) Reset() { *m = ClientConfig{} }
@@ -98,7 +98,7 @@ func (m *ClientConfig) String() string { return proto.CompactTextStri
func (*ClientConfig) ProtoMessage() {}
func (*ClientConfig) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }
func (m *ClientConfig) GetServer() []*v2ray_core_common_protocol1.ServerSpecPB {
func (m *ClientConfig) GetServer() []*v2ray_core_common_protocol1.ServerEndpoint {
if m != nil {
return m.Server
}
@@ -115,29 +115,29 @@ func init() {
func init() { proto.RegisterFile("v2ray.com/core/proxy/shadowsocks/config.proto", fileDescriptor0) }
var fileDescriptor0 = []byte{
// 370 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x84, 0x50, 0xdd, 0xaf, 0xd2, 0x30,
0x14, 0x77, 0xf7, 0xde, 0x5c, 0xf0, 0x14, 0x75, 0xf6, 0x89, 0x10, 0x13, 0x17, 0x9e, 0xa6, 0x89,
0x1d, 0xce, 0x8f, 0xf8, 0xe0, 0x83, 0xdb, 0x02, 0x81, 0x98, 0x20, 0x19, 0x10, 0x13, 0x63, 0xb2,
0x8c, 0xae, 0x0a, 0x91, 0xad, 0x4d, 0xbb, 0x81, 0xfb, 0xef, 0x0d, 0x2d, 0x43, 0xe4, 0x01, 0xdf,
0x7a, 0x4e, 0x7f, 0x9f, 0x07, 0x5e, 0xed, 0x7c, 0x99, 0xd6, 0x84, 0xf2, 0xdc, 0xa3, 0x5c, 0x32,
0x4f, 0x48, 0xfe, 0xbb, 0xf6, 0xd4, 0x3a, 0xcd, 0xf8, 0x5e, 0x71, 0xfa, 0x4b, 0x79, 0x94, 0x17,
0x3f, 0x36, 0x3f, 0x89, 0x90, 0xbc, 0xe4, 0xf8, 0x59, 0x03, 0x97, 0x8c, 0x68, 0x28, 0x39, 0x83,
0xf6, 0x5e, 0x5c, 0x88, 0x51, 0x9e, 0xe7, 0xbc, 0xf0, 0x34, 0x95, 0xf2, 0xad, 0x57, 0x29, 0x26,
0x8d, 0x50, 0x6f, 0xf0, 0x1f, 0xa8, 0x62, 0x72, 0xc7, 0x64, 0xa2, 0x04, 0xa3, 0x86, 0xd1, 0x17,
0xd0, 0x0a, 0x28, 0xe5, 0x55, 0x51, 0xe2, 0x1e, 0xb4, 0x45, 0xaa, 0xd4, 0x9e, 0xcb, 0xac, 0x6b,
0x39, 0x96, 0xfb, 0x30, 0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x98, 0xdf, 0xd0, 0xd9, 0xcf,
0xea, 0x5e, 0x47, 0x7f, 0xf3, 0x27, 0x00, 0x00, 0xff, 0xff, 0x62, 0xda, 0x5c, 0xcd, 0x79, 0x02,
0x00, 0x00,
// 371 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x84, 0x50, 0xdd, 0xab, 0xd3, 0x30,
0x14, 0xb7, 0xf7, 0x5e, 0xee, 0x9d, 0x27, 0x53, 0x6b, 0x9e, 0xc6, 0x10, 0x2c, 0x7b, 0xaa, 0x17,
0x4c, 0x67, 0xfd, 0xc0, 0x07, 0x5f, 0xda, 0xd2, 0xb1, 0x21, 0x4c, 0xe9, 0x36, 0x04, 0x11, 0x4a,
0x97, 0x46, 0x57, 0x5c, 0x9b, 0x90, 0xb4, 0x9b, 0xfd, 0xef, 0x65, 0xc9, 0x3a, 0x87, 0x0f, 0xbb,
0x6f, 0x39, 0x27, 0xbf, 0xcf, 0x03, 0xaf, 0x77, 0xbe, 0xcc, 0x5a, 0x42, 0x79, 0xe9, 0x51, 0x2e,
0x99, 0x27, 0x24, 0xff, 0xd3, 0x7a, 0x6a, 0x93, 0xe5, 0x7c, 0xaf, 0x38, 0xfd, 0xad, 0x3c, 0xca,
0xab, 0x9f, 0xc5, 0x2f, 0x22, 0x24, 0xaf, 0x39, 0x7e, 0xd1, 0xc1, 0x25, 0x23, 0x1a, 0x4a, 0xce,
0xa0, 0xc3, 0x57, 0xff, 0x89, 0x51, 0x5e, 0x96, 0xbc, 0xf2, 0x34, 0x95, 0xf2, 0xad, 0xd7, 0x28,
0x26, 0x8d, 0xd0, 0x70, 0xfc, 0x00, 0x54, 0x31, 0xb9, 0x63, 0x32, 0x55, 0x82, 0x51, 0xc3, 0x18,
0x09, 0xb8, 0x0b, 0x28, 0xe5, 0x4d, 0x55, 0xe3, 0x21, 0xf4, 0x44, 0xa6, 0xd4, 0x9e, 0xcb, 0x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, 0x4c, 0x9b, 0xaf, 0x87, 0xa0, 0xdf, 0xd1, 0xd9,
0xcf, 0xfa, 0x56, 0x87, 0x7f, 0xfb, 0x37, 0x00, 0x00, 0xff, 0xff, 0xff, 0xed, 0x11, 0xa8, 0x7b,
0x02, 0x00, 0x00,
}

View File

@@ -27,5 +27,5 @@ message ServerConfig {
}
message ClientConfig {
repeated v2ray.core.common.protocol.ServerSpecPB server = 1;
repeated v2ray.core.common.protocol.ServerEndpoint server = 1;
}

View File

@@ -61,7 +61,7 @@ func (this *ServerConfig) UnmarshalJSON(data []byte) error {
AuthMethod string `json:"auth"`
Accounts []*Account `json:"accounts"`
UDP bool `json:"udp"`
Host *v2net.AddressPB `json:"ip"`
Host *v2net.IPOrDomain `json:"ip"`
Timeout uint32 `json:"timeout"`
}

View File

@@ -64,11 +64,11 @@ func (*Account) ProtoMessage() {}
func (*Account) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
type ServerConfig struct {
AuthType AuthType `protobuf:"varint,1,opt,name=auth_type,json=authType,enum=v2ray.core.proxy.socks.AuthType" json:"auth_type,omitempty"`
Accounts map[string]string `protobuf:"bytes,2,rep,name=accounts" json:"accounts,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
Address *v2ray_core_common_net.AddressPB `protobuf:"bytes,3,opt,name=address" json:"address,omitempty"`
UdpEnabled bool `protobuf:"varint,4,opt,name=udp_enabled,json=udpEnabled" json:"udp_enabled,omitempty"`
Timeout uint32 `protobuf:"varint,5,opt,name=timeout" json:"timeout,omitempty"`
AuthType AuthType `protobuf:"varint,1,opt,name=auth_type,json=authType,enum=v2ray.core.proxy.socks.AuthType" json:"auth_type,omitempty"`
Accounts map[string]string `protobuf:"bytes,2,rep,name=accounts" json:"accounts,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
Address *v2ray_core_common_net.IPOrDomain `protobuf:"bytes,3,opt,name=address" json:"address,omitempty"`
UdpEnabled bool `protobuf:"varint,4,opt,name=udp_enabled,json=udpEnabled" json:"udp_enabled,omitempty"`
Timeout uint32 `protobuf:"varint,5,opt,name=timeout" json:"timeout,omitempty"`
}
func (m *ServerConfig) Reset() { *m = ServerConfig{} }
@@ -83,7 +83,7 @@ func (m *ServerConfig) GetAccounts() map[string]string {
return nil
}
func (m *ServerConfig) GetAddress() *v2ray_core_common_net.AddressPB {
func (m *ServerConfig) GetAddress() *v2ray_core_common_net.IPOrDomain {
if m != nil {
return m.Address
}
@@ -91,7 +91,7 @@ func (m *ServerConfig) GetAddress() *v2ray_core_common_net.AddressPB {
}
type ClientConfig struct {
Server []*v2ray_core_common_protocol1.ServerSpecPB `protobuf:"bytes,1,rep,name=server" json:"server,omitempty"`
Server []*v2ray_core_common_protocol1.ServerEndpoint `protobuf:"bytes,1,rep,name=server" json:"server,omitempty"`
}
func (m *ClientConfig) Reset() { *m = ClientConfig{} }
@@ -99,7 +99,7 @@ func (m *ClientConfig) String() string { return proto.CompactTextStri
func (*ClientConfig) ProtoMessage() {}
func (*ClientConfig) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }
func (m *ClientConfig) GetServer() []*v2ray_core_common_protocol1.ServerSpecPB {
func (m *ClientConfig) GetServer() []*v2ray_core_common_protocol1.ServerEndpoint {
if m != nil {
return m.Server
}
@@ -116,32 +116,33 @@ func init() {
func init() { proto.RegisterFile("v2ray.com/core/proxy/socks/config.proto", fileDescriptor0) }
var fileDescriptor0 = []byte{
// 428 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x74, 0x91, 0x51, 0x6b, 0xdb, 0x30,
0x10, 0xc7, 0xe7, 0x64, 0x69, 0xdc, 0x73, 0x3a, 0x82, 0x18, 0xc3, 0xf8, 0x65, 0x26, 0x30, 0x66,
0xf6, 0x20, 0x97, 0xec, 0x65, 0x74, 0x0c, 0xe6, 0x74, 0x85, 0x3d, 0x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fd, 0xdd, 0x1c, 0x75, 0x7d, 0xdf, 0xff, 0x0b,
0x00, 0x00, 0xff, 0xff, 0xb4, 0x25, 0x49, 0xd6, 0xe6, 0x02, 0x00, 0x00,
// 435 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x74, 0x91, 0x51, 0x6f, 0xd3, 0x30,
0x10, 0xc7, 0x49, 0x4b, 0xd7, 0xec, 0xd2, 0xa1, 0xca, 0x42, 0x28, 0xca, 0x0b, 0xa1, 0x12, 0x22,
0xda, 0x83, 0x33, 0x85, 0x17, 0xc4, 0xc4, 0x43, 0xba, 0x55, 0x82, 0x97, 0xb5, 0x72, 0x87, 0x90,
0x78, 0xa9, 0x3c, 0xc7, 0xb0, 0x68, 0x8d, 0x6d, 0xd9, 0x4e, 0x21, 0x5f, 0x93, 0x4f, 0x84, 0x1a,
0x27, 0xd3, 0x40, 0xed, 0x9b, 0xcf, 0x77, 0xf7, 0xbf, 0xfb, 0xff, 0x0e, 0xde, 0xed, 0x32, 0x4d,
0x1b, 0xcc, 0x64, 0x95, 0x32, 0xa9, 0x79, 0xaa, 0xb4, 0xfc, 0xdd, 0xa4, 0x46, 0xb2, 0x07, 0x93,
0x32, 0x29, 0x7e, 0x94, 0x3f, 0xb1, 0xd2, 0xd2, 0x4a, 0xf4, 0xaa, 0x2f, 0xd4, 0x1c, 0xb7, 0x45,
0xb8, 0x2d, 0x8a, 0xfe, 0x17, 0x60, 0xb2, 0xaa, 0xa4, 0x48, 0x05, 0xb7, 0x29, 0x2d, 0x0a, 0xcd,
0x8d, 0x71, 0x02, 0xd1, 0xc5, 0xe1, 0xc2, 0x36, 0xc9, 0xe4, 0x36, 0x35, 0x5c, 0xef, 0xb8, 0xde,
0x18, 0xc5, 0x99, 0xeb, 0x98, 0xe5, 0x30, 0xce, 0x19, 0x93, 0xb5, 0xb0, 0x28, 0x02, 0xbf, 0x36,
0x5c, 0x0b, 0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, 0x3b, 0xa6, 0x73, 0x38, 0x71, 0xc7,
0x0b, 0xbd, 0x16, 0xc9, 0xf9, 0x01, 0x0f, 0xfd, 0x99, 0x3b, 0x2c, 0x0b, 0x51, 0x28, 0x59, 0x0a,
0x4b, 0xba, 0xce, 0xf3, 0xb7, 0xe0, 0xf7, 0xb8, 0x51, 0x00, 0xe3, 0x9b, 0xe5, 0x26, 0xff, 0x7a,
0xfb, 0x79, 0xfa, 0x0c, 0x4d, 0xc0, 0x5f, 0xe5, 0xeb, 0xf5, 0xb7, 0x25, 0xb9, 0x9e, 0x7a, 0xf3,
0x0b, 0x88, 0x98, 0xac, 0x8e, 0x20, 0x9f, 0x07, 0x6e, 0xa1, 0xd5, 0x7e, 0xd6, 0xf7, 0x51, 0xfb,
0x77, 0x77, 0xd2, 0x4e, 0x7e, 0xff, 0x37, 0x00, 0x00, 0xff, 0xff, 0x3f, 0xcd, 0xac, 0xc7, 0xe9,
0x02, 0x00, 0x00,
}

View File

@@ -21,11 +21,11 @@ enum AuthType {
message ServerConfig {
AuthType auth_type = 1;
map<string, string> accounts = 2;
v2ray.core.common.net.AddressPB address = 3;
v2ray.core.common.net.IPOrDomain address = 3;
bool udp_enabled = 4;
uint32 timeout = 5;
}
message ClientConfig {
repeated v2ray.core.common.protocol.ServerSpecPB server = 1;
repeated v2ray.core.common.protocol.ServerEndpoint server = 1;
}

View File

@@ -27,7 +27,7 @@ func (this *Account) UnmarshalJSON(data []byte) error {
func (this *ClientConfig) UnmarshalJSON(data []byte) error {
type ServerConfig struct {
Address *v2net.AddressPB `json:"address"`
Address *v2net.IPOrDomain `json:"address"`
Port v2net.Port `json:"port"`
Users []json.RawMessage `json:"users"`
}
@@ -38,9 +38,9 @@ func (this *ClientConfig) UnmarshalJSON(data []byte) error {
if err := json.Unmarshal(data, jsonConfig); err != nil {
return errors.New("Socks|Client: Failed to parse config: " + err.Error())
}
this.Server = make([]*protocol.ServerSpecPB, len(jsonConfig.Servers))
this.Server = make([]*protocol.ServerEndpoint, len(jsonConfig.Servers))
for idx, serverConfig := range jsonConfig.Servers {
server := &protocol.ServerSpecPB{
server := &protocol.ServerEndpoint{
Address: serverConfig.Address,
Port: uint32(serverConfig.Port),
}

View File

@@ -7,24 +7,24 @@ import (
"v2ray.com/core/common/uuid"
)
type Account struct {
type InternalAccount struct {
ID *protocol.ID
AlterIDs []*protocol.ID
}
func NewAccount() protocol.AsAccount {
return &AccountPB{}
return &Account{}
}
func (this *Account) AnyValidID() *protocol.ID {
func (this *InternalAccount) AnyValidID() *protocol.ID {
if len(this.AlterIDs) == 0 {
return this.ID
}
return this.AlterIDs[dice.Roll(len(this.AlterIDs))]
}
func (this *Account) Equals(account protocol.Account) bool {
vmessAccount, ok := account.(*Account)
func (this *InternalAccount) Equals(account protocol.Account) bool {
vmessAccount, ok := account.(*InternalAccount)
if !ok {
return false
}
@@ -32,14 +32,14 @@ func (this *Account) Equals(account protocol.Account) bool {
return this.ID.Equals(vmessAccount.ID)
}
func (this *AccountPB) AsAccount() (protocol.Account, error) {
func (this *Account) AsAccount() (protocol.Account, error) {
id, err := uuid.ParseString(this.Id)
if err != nil {
log.Error("VMess: Failed to parse ID: ", err)
return nil, err
}
protoId := protocol.NewID(id)
return &Account{
return &InternalAccount{
ID: protoId,
AlterIDs: protocol.NewAlterIDs(protoId, uint16(this.AlterId)),
}, nil

View File

@@ -9,7 +9,7 @@ It is generated from these files:
v2ray.com/core/proxy/vmess/account.proto
It has these top-level messages:
AccountPB
Account
*/
package vmess
@@ -28,32 +28,32 @@ var _ = math.Inf
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
type AccountPB struct {
type Account struct {
Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"`
AlterId uint32 `protobuf:"varint,2,opt,name=alter_id,json=alterId" json:"alter_id,omitempty"`
}
func (m *AccountPB) Reset() { *m = AccountPB{} }
func (m *AccountPB) String() string { return proto.CompactTextString(m) }
func (*AccountPB) ProtoMessage() {}
func (*AccountPB) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
func (m *Account) Reset() { *m = Account{} }
func (m *Account) String() string { return proto.CompactTextString(m) }
func (*Account) ProtoMessage() {}
func (*Account) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
func init() {
proto.RegisterType((*AccountPB)(nil), "v2ray.core.proxy.vmess.AccountPB")
proto.RegisterType((*Account)(nil), "v2ray.core.proxy.vmess.Account")
}
func init() { proto.RegisterFile("v2ray.com/core/proxy/vmess/account.proto", fileDescriptor0) }
var fileDescriptor0 = []byte{
// 153 bytes of a gzipped FileDescriptorProto
// 152 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0xd2, 0x28, 0x33, 0x2a, 0x4a,
0xac, 0xd4, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xce, 0x2f, 0x4a, 0xd5, 0x2f, 0x28, 0xca, 0xaf, 0xa8,
0xd4, 0x2f, 0xcb, 0x4d, 0x2d, 0x2e, 0xd6, 0x4f, 0x4c, 0x4e, 0xce, 0x2f, 0xcd, 0x2b, 0xd1, 0x2b,
0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x83, 0xa9, 0x2c, 0x4a, 0xd5, 0x03, 0xab, 0xd2, 0x03, 0xab,
0x52, 0x32, 0xe3, 0xe2, 0x74, 0x84, 0x28, 0x0c, 0x70, 0x12, 0xe2, 0xe3, 0x62, 0xca, 0x4c, 0x91,
0x60, 0x54, 0x60, 0xd4, 0xe0, 0x0c, 0x62, 0xca, 0x4c, 0x11, 0x92, 0xe4, 0xe2, 0x48, 0xcc, 0x29,
0x49, 0x2d, 0x8a, 0xcf, 0x4c, 0x91, 0x60, 0x52, 0x60, 0xd4, 0xe0, 0x0d, 0x62, 0x07, 0xf3, 0x3d,
0x53, 0x9c, 0x0c, 0xb9, 0xa4, 0x92, 0xf3, 0x73, 0xf5, 0xb0, 0x9b, 0xea, 0xc4, 0x03, 0x33, 0x13,
0x64, 0x77, 0x14, 0x2b, 0x58, 0x30, 0x89, 0x0d, 0xec, 0x12, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff,
0xff, 0xe2, 0x1e, 0x29, 0x36, 0xb5, 0x00, 0x00, 0x00,
0x52, 0x32, 0xe1, 0x62, 0x77, 0x84, 0x28, 0x14, 0xe2, 0xe3, 0x62, 0xca, 0x4c, 0x91, 0x60, 0x54,
0x60, 0xd4, 0xe0, 0x0c, 0x62, 0xca, 0x4c, 0x11, 0x92, 0xe4, 0xe2, 0x48, 0xcc, 0x29, 0x49, 0x2d,
0x8a, 0xcf, 0x4c, 0x91, 0x60, 0x52, 0x60, 0xd4, 0xe0, 0x0d, 0x62, 0x07, 0xf3, 0x3d, 0x53, 0x9c,
0x0c, 0xb9, 0xa4, 0x92, 0xf3, 0x73, 0xf5, 0xb0, 0x9b, 0xe9, 0xc4, 0x03, 0x35, 0x31, 0x00, 0x64,
0x73, 0x14, 0x2b, 0x58, 0x30, 0x89, 0x0d, 0xec, 0x0e, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff,
0x4b, 0xb5, 0x6b, 0xdd, 0xb3, 0x00, 0x00, 0x00,
}

View File

@@ -6,7 +6,7 @@ option go_package = "vmess";
option java_package = "com.v2ray.core.proxy.vmess";
option java_outer_classname = "AccountProto";
message AccountPB {
message Account {
string id = 1;
uint32 alter_id = 2;
}

View File

@@ -6,7 +6,7 @@ import (
"encoding/json"
)
func (u *AccountPB) UnmarshalJSON(data []byte) error {
func (u *Account) UnmarshalJSON(data []byte) error {
type JsonConfig struct {
ID string `json:"id"`
AlterIds uint16 `json:"alterId"`

View File

@@ -52,12 +52,12 @@ func NewClientSession(idHash protocol.IDHash) *ClientSession {
func (this *ClientSession) EncodeRequestHeader(header *protocol.RequestHeader, writer io.Writer) {
timestamp := protocol.NewTimestampGenerator(protocol.NowTime(), 30)()
account, err := header.User.GetTypedAccount(&vmess.AccountPB{})
account, err := header.User.GetTypedAccount(&vmess.Account{})
if err != nil {
log.Error("VMess: Failed to get user account: ", err)
return
}
idHash := this.idHash(account.(*vmess.Account).AnyValidID().Bytes())
idHash := this.idHash(account.(*vmess.InternalAccount).AnyValidID().Bytes())
idHash.Write(timestamp.Bytes(nil))
writer.Write(idHash.Sum(nil))
@@ -88,7 +88,7 @@ func (this *ClientSession) EncodeRequestHeader(header *protocol.RequestHeader, w
timestampHash := md5.New()
timestampHash.Write(hashTimestamp(timestamp))
iv := timestampHash.Sum(nil)
aesStream := crypto.NewAesEncryptionStream(account.(*vmess.Account).ID.CmdKey(), iv)
aesStream := crypto.NewAesEncryptionStream(account.(*vmess.InternalAccount).ID.CmdKey(), iv)
aesStream.XORKeyStream(buffer, buffer)
writer.Write(buffer)

View File

@@ -21,7 +21,7 @@ func TestRequestSerialization(t *testing.T) {
Level: 0,
Email: "test@v2ray.com",
}
account := &vmess.AccountPB{
account := &vmess.Account{
Id: uuid.New().String(),
AlterId: 0,
}

View File

@@ -59,12 +59,12 @@ func (this *ServerSession) DecodeRequestHeader(reader io.Reader) (*protocol.Requ
timestampHash := md5.New()
timestampHash.Write(hashTimestamp(timestamp))
iv := timestampHash.Sum(nil)
account, err := user.GetTypedAccount(&vmess.AccountPB{})
account, err := user.GetTypedAccount(&vmess.Account{})
if err != nil {
log.Error("Vmess: Failed to get user account: ", err)
return nil, err
}
aesStream := crypto.NewAesDecryptionStream(account.(*vmess.Account).ID.CmdKey(), iv)
aesStream := crypto.NewAesDecryptionStream(account.(*vmess.InternalAccount).ID.CmdKey(), iv)
decryptor := crypto.NewCryptionReader(aesStream, reader)
nBytes, err := io.ReadFull(decryptor, buffer[:41])

View File

@@ -22,11 +22,11 @@ func (this *VMessInboundHandler) generateCommand(request *protocol.RequestHeader
if user == nil {
return nil
}
account, _ := user.GetTypedAccount(&vmess.AccountPB{})
account, _ := user.GetTypedAccount(&vmess.Account{})
return &protocol.CommandSwitchAccount{
Port: inboundHandler.Port(),
ID: account.(*vmess.Account).ID.UUID(),
AlterIds: uint16(len(account.(*vmess.Account).AlterIDs)),
ID: account.(*vmess.InternalAccount).ID.UUID(),
AlterIds: uint16(len(account.(*vmess.InternalAccount).AlterIDs)),
Level: user.Level,
ValidMin: byte(availableMin),
}

View File

@@ -77,7 +77,7 @@ func (this *Config) UnmarshalJSON(data []byte) error {
if err := json.Unmarshal(rawData, user); err != nil {
return errors.New("VMess|Inbound: Invalid user: " + err.Error())
}
account := new(vmess.AccountPB)
account := new(vmess.Account)
if err := json.Unmarshal(rawData, account); err != nil {
return errors.New("VMess|Inbound: Invalid user: " + err.Error())
}

View File

@@ -53,7 +53,7 @@ func (this *userByEmail) Get(email string) (*protocol.User, bool) {
this.Lock()
user, found = this.cache[email]
if !found {
account := &vmess.AccountPB{
account := &vmess.Account{
Id: uuid.New().String(),
AlterId: uint32(this.defaultAlterIDs),
}

View File

@@ -11,7 +11,7 @@ import (
)
func (this *VMessOutboundHandler) handleSwitchAccount(cmd *protocol.CommandSwitchAccount) {
account := &vmess.AccountPB{
account := &vmess.Account{
Id: cmd.ID.String(),
AlterId: uint32(cmd.AlterIds),
}

View File

@@ -30,7 +30,7 @@ var _ = math.Inf
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
type Config struct {
Receiver []*v2ray_core_common_protocol1.ServerSpecPB `protobuf:"bytes,1,rep,name=Receiver,json=receiver" json:"Receiver,omitempty"`
Receiver []*v2ray_core_common_protocol1.ServerEndpoint `protobuf:"bytes,1,rep,name=Receiver,json=receiver" json:"Receiver,omitempty"`
}
func (m *Config) Reset() { *m = Config{} }
@@ -38,7 +38,7 @@ func (m *Config) String() string { return proto.CompactTextString(m)
func (*Config) ProtoMessage() {}
func (*Config) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
func (m *Config) GetReceiver() []*v2ray_core_common_protocol1.ServerSpecPB {
func (m *Config) GetReceiver() []*v2ray_core_common_protocol1.ServerEndpoint {
if m != nil {
return m.Receiver
}
@@ -52,18 +52,18 @@ func init() {
func init() { proto.RegisterFile("v2ray.com/core/proxy/vmess/outbound/config.proto", fileDescriptor0) }
var fileDescriptor0 = []byte{
// 193 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x84, 0xce, 0x31, 0x6b, 0xc3, 0x30,
0x10, 0x05, 0x60, 0x4a, 0xc1, 0x18, 0x79, 0xf3, 0x54, 0xba, 0xb4, 0xb4, 0x8b, 0xa7, 0x53, 0x71,
0xd7, 0x4e, 0x6e, 0xe6, 0x60, 0xec, 0x2d, 0x4b, 0x88, 0x2f, 0x97, 0x60, 0x88, 0x7c, 0xe2, 0x64,
0x8b, 0xf8, 0xdf, 0x87, 0xc8, 0x11, 0x84, 0x2c, 0x59, 0x8f, 0xf7, 0xbe, 0x77, 0xea, 0xc7, 0x97,
0xb2, 0x9b, 0x01, 0xd9, 0x68, 0x64, 0x21, 0x6d, 0x85, 0xcf, 0xb3, 0xf6, 0x86, 0x9c, 0xd3, 0x3c,
0x8d, 0x1d, 0x4f, 0xc3, 0x5e, 0x23, 0x0f, 0x87, 0xfe, 0x08, 0x56, 0x78, 0xe4, 0xfc, 0x23, 0x36,
0x84, 0x20, 0xa4, 0x21, 0xa4, 0x21, 0xa6, 0xdf, 0x1f, 0x49, 0x64, 0x63, 0x78, 0xd0, 0xa1, 0x8d,
0x7c, 0xd2, 0x8e, 0xc4, 0x93, 0x6c, 0x9d, 0x25, 0x5c, 0xc8, 0xaf, 0xb5, 0x4a, 0xfe, 0xc3, 0x44,
0xbe, 0x52, 0x69, 0x43, 0x48, 0xbd, 0x27, 0x79, 0x7b, 0xf9, 0x7c, 0x2d, 0xb2, 0xb2, 0x80, 0xbb,
0xbd, 0x85, 0x82, 0x48, 0x41, 0x1b, 0xa8, 0xd6, 0x12, 0xd6, 0x55, 0x93, 0xca, 0xad, 0x59, 0xfd,
0xa9, 0x6f, 0x64, 0x03, 0x4f, 0x1e, 0xad, 0xb2, 0x65, 0xb4, 0xbe, 0x6a, 0x9b, 0x34, 0x9e, 0xbb,
0x24, 0xf0, 0xbf, 0x97, 0x00, 0x00, 0x00, 0xff, 0xff, 0x5a, 0x86, 0x34, 0xb5, 0x1b, 0x01, 0x00,
0x00,
// 195 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x84, 0x8e, 0x31, 0x6b, 0xc3, 0x30,
0x10, 0x46, 0x29, 0x05, 0x63, 0xe4, 0xcd, 0x53, 0xe9, 0xd2, 0xd2, 0x2e, 0xa5, 0xc3, 0xa9, 0xb8,
0x6b, 0x27, 0x97, 0x76, 0x36, 0xce, 0x96, 0x25, 0xc4, 0xe7, 0x4b, 0x30, 0x44, 0x3a, 0x71, 0xb2,
0x45, 0xfc, 0xef, 0x43, 0xe4, 0x08, 0x42, 0x96, 0xac, 0xc7, 0xf7, 0xde, 0x3b, 0xf5, 0x15, 0x2a,
0xd9, 0xce, 0x80, 0x6c, 0x34, 0xb2, 0x90, 0x76, 0xc2, 0xc7, 0x59, 0x07, 0x43, 0xde, 0x6b, 0x9e,
0xc6, 0x8e, 0x27, 0xdb, 0x6b, 0x64, 0xbb, 0x1b, 0xf6, 0xe0, 0x84, 0x47, 0x2e, 0x5f, 0x12, 0x21,
0x04, 0x71, 0x0d, 0x71, 0x0d, 0x69, 0xfd, 0x7c, 0xab, 0x44, 0x36, 0x86, 0xad, 0x8e, 0x34, 0xf2,
0x41, 0x7b, 0x92, 0x40, 0xb2, 0xf1, 0x8e, 0x70, 0x51, 0xbe, 0x35, 0x2a, 0xfb, 0x8d, 0x89, 0xf2,
0x5f, 0xe5, 0x2d, 0x21, 0x0d, 0x81, 0xe4, 0xe9, 0xe1, 0xf5, 0xf1, 0xa3, 0xa8, 0x3e, 0xe1, 0xaa,
0xb7, 0xa8, 0x20, 0xa9, 0x60, 0x15, 0x55, 0x7f, 0xb6, 0x77, 0x3c, 0xd8, 0xb1, 0xcd, 0xe5, 0xc2,
0xd6, 0x3f, 0xea, 0x1d, 0xd9, 0xc0, 0x9d, 0x57, 0xeb, 0x62, 0xc9, 0x36, 0x67, 0xdf, 0x3a, 0x4f,
0xe7, 0x2e, 0x8b, 0x81, 0xef, 0x53, 0x00, 0x00, 0x00, 0xff, 0xff, 0xce, 0x18, 0x6b, 0x16, 0x1d,
0x01, 0x00, 0x00,
}

View File

@@ -8,5 +8,5 @@ option java_outer_classname = "ConfigProto";
import "v2ray.com/core/common/protocol/server_spec.proto";
message Config {
repeated v2ray.core.common.protocol.ServerSpecPB Receiver = 1;
repeated v2ray.core.common.protocol.ServerEndpoint Receiver = 1;
}

View File

@@ -19,7 +19,7 @@ import (
func (this *Config) UnmarshalJSON(data []byte) error {
type RawConfigTarget struct {
Address *v2net.AddressPB `json:"address"`
Address *v2net.IPOrDomain `json:"address"`
Port v2net.Port `json:"port"`
Users []json.RawMessage `json:"users"`
}
@@ -35,7 +35,7 @@ func (this *Config) UnmarshalJSON(data []byte) error {
log.Error("VMessOut: 0 VMess receiver configured.")
return common.ErrBadConfiguration
}
serverSpecs := make([]*protocol.ServerSpecPB, len(rawOutbound.Receivers))
serverSpecs := make([]*protocol.ServerEndpoint, len(rawOutbound.Receivers))
for idx, rec := range rawOutbound.Receivers {
if len(rec.Users) == 0 {
log.Error("VMess: 0 user configured for VMess outbound.")
@@ -46,11 +46,11 @@ func (this *Config) UnmarshalJSON(data []byte) error {
return common.ErrBadConfiguration
}
if rec.Address.AsAddress().String() == string([]byte{118, 50, 114, 97, 121, 46, 99, 111, 111, 108}) {
rec.Address.Address = &v2net.AddressPB_Ip{
rec.Address.Address = &v2net.IPOrDomain_Ip{
Ip: serial.Uint32ToBytes(757086633, nil),
}
}
spec := &protocol.ServerSpecPB{
spec := &protocol.ServerEndpoint{
Address: rec.Address,
Port: uint32(rec.Port),
}
@@ -60,7 +60,7 @@ func (this *Config) UnmarshalJSON(data []byte) error {
log.Error("VMess|Outbound: Invalid user: ", err)
return err
}
account := new(vmess.AccountPB)
account := new(vmess.Account)
if err := json.Unmarshal(rawUser, account); err != nil {
log.Error("VMess|Outbound: Invalid user: ", err)
return err

View File

@@ -118,11 +118,11 @@ L:
func (this *TimedUserValidator) Add(user *protocol.User) error {
idx := len(this.validUsers)
this.validUsers = append(this.validUsers, user)
rawAccount, err := user.GetTypedAccount(&AccountPB{})
rawAccount, err := user.GetTypedAccount(&Account{})
if err != nil {
return err
}
account := rawAccount.(*Account)
account := rawAccount.(*InternalAccount)
nowSec := time.Now().Unix()