1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-21 17:46:58 -05:00

refactor protos

This commit is contained in:
Darien Raymond 2016-10-12 18:43:55 +02:00
parent c1f91567ad
commit fc6a706166
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169
44 changed files with 331 additions and 313 deletions

View File

@ -8,8 +8,8 @@ import (
func (this *Config) GetInternalHosts() map[string]net.IP {
hosts := make(map[string]net.IP)
for domain, addressPB := range this.GetHosts() {
address := addressPB.AsAddress()
for domain, ipOrDomain := range this.GetHosts() {
address := ipOrDomain.AsAddress()
if address.Family().IsDomain() {
log.Warning("DNS: Ignoring domain address in static hosts: ", address.Domain())
continue

View File

@ -31,8 +31,8 @@ var _ = math.Inf
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
type Config struct {
NameServers []*v2ray_core_common_net2.DestinationPB `protobuf:"bytes,1,rep,name=NameServers,json=nameServers" json:"NameServers,omitempty"`
Hosts map[string]*v2ray_core_common_net.AddressPB `protobuf:"bytes,2,rep,name=Hosts,json=hosts" json:"Hosts,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
NameServers []*v2ray_core_common_net2.Endpoint `protobuf:"bytes,1,rep,name=NameServers,json=nameServers" json:"NameServers,omitempty"`
Hosts map[string]*v2ray_core_common_net.IPOrDomain `protobuf:"bytes,2,rep,name=Hosts,json=hosts" json:"Hosts,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
}
func (m *Config) Reset() { *m = Config{} }
@ -40,14 +40,14 @@ func (m *Config) String() string { return proto.CompactTextString(m)
func (*Config) ProtoMessage() {}
func (*Config) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
func (m *Config) GetNameServers() []*v2ray_core_common_net2.DestinationPB {
func (m *Config) GetNameServers() []*v2ray_core_common_net2.Endpoint {
if m != nil {
return m.NameServers
}
return nil
}
func (m *Config) GetHosts() map[string]*v2ray_core_common_net.AddressPB {
func (m *Config) GetHosts() map[string]*v2ray_core_common_net.IPOrDomain {
if m != nil {
return m.Hosts
}
@ -61,22 +61,23 @@ func init() {
func init() { proto.RegisterFile("v2ray.com/core/app/dns/config.proto", fileDescriptor0) }
var fileDescriptor0 = []byte{
// 270 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x74, 0x90, 0xcb, 0x4a, 0xc4, 0x30,
0x14, 0x86, 0x49, 0x4b, 0x07, 0x4c, 0x37, 0x92, 0x85, 0x94, 0xae, 0x8a, 0x17, 0x2c, 0x0a, 0x09,
0x54, 0x10, 0xd1, 0x95, 0xf5, 0x82, 0x2b, 0x29, 0x75, 0x37, 0xbb, 0xd8, 0x1c, 0xb5, 0x68, 0x4f,
0x4a, 0x12, 0x0b, 0x7d, 0x64, 0xdf, 0x42, 0xda, 0x20, 0x15, 0x9d, 0xd9, 0x1d, 0xc2, 0xf7, 0x5f,
0xf2, 0xd3, 0x83, 0xa1, 0x30, 0x72, 0xe4, 0x8d, 0xee, 0x44, 0xa3, 0x0d, 0x08, 0xd9, 0xf7, 0x42,
0xa1, 0x15, 0x8d, 0xc6, 0x97, 0xf6, 0x95, 0xf7, 0x46, 0x3b, 0xcd, 0xd8, 0x0f, 0x64, 0x80, 0xcb,
0xbe, 0xe7, 0x0a, 0x6d, 0x7a, 0xfc, 0x47, 0xd8, 0xe8, 0xae, 0xd3, 0x28, 0x10, 0x9c, 0x90, 0x4a,
0x19, 0xb0, 0xd6, 0x8b, 0xd3, 0xd3, 0xed, 0xa0, 0x02, 0xeb, 0x5a, 0x94, 0xae, 0xd5, 0xe8, 0xe1,
0xfd, 0x2f, 0x42, 0x57, 0x37, 0x73, 0x34, 0xbb, 0xa7, 0xf1, 0xa3, 0xec, 0xe0, 0x09, 0xcc, 0x00,
0xc6, 0x26, 0x24, 0x0b, 0xf3, 0xb8, 0x38, 0xe4, 0xbf, 0xaa, 0x78, 0x27, 0x8e, 0xe0, 0xf8, 0xed,
0xe2, 0x54, 0x95, 0x75, 0x8c, 0x8b, 0x90, 0x5d, 0xd1, 0xe8, 0x41, 0x5b, 0x67, 0x93, 0x60, 0x76,
0x38, 0xe2, 0xff, 0x3f, 0xc3, 0x7d, 0x24, 0x9f, 0xb9, 0x3b, 0x74, 0x66, 0xac, 0xa3, 0xb7, 0xe9,
0x4e, 0xd7, 0x94, 0x2e, 0x8f, 0x6c, 0x97, 0x86, 0xef, 0x30, 0x26, 0x24, 0x23, 0xf9, 0x4e, 0x3d,
0x9d, 0xec, 0x9c, 0x46, 0x83, 0xfc, 0xf8, 0x84, 0x24, 0xc8, 0x48, 0x1e, 0x17, 0xd9, 0x96, 0x7a,
0xd7, 0x7e, 0x91, 0xaa, 0xac, 0x3d, 0x7e, 0x19, 0x5c, 0x90, 0xf2, 0x84, 0xee, 0x35, 0xba, 0xdb,
0x50, 0xa7, 0x8c, 0x7d, 0x9f, 0x6a, 0x9a, 0x64, 0x1d, 0x2a, 0xb4, 0xcf, 0xab, 0x79, 0x9e, 0xb3,
0xef, 0x00, 0x00, 0x00, 0xff, 0xff, 0x17, 0x9a, 0x1d, 0xee, 0xaf, 0x01, 0x00, 0x00,
// 276 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x74, 0x90, 0xc1, 0x4a, 0xc4, 0x30,
0x10, 0x86, 0xc9, 0x2e, 0x5d, 0x30, 0xbd, 0x48, 0x0e, 0x52, 0x7a, 0xb1, 0x2a, 0x62, 0x51, 0x48,
0xa0, 0x1e, 0x14, 0x3d, 0xb9, 0xba, 0xa0, 0x17, 0x5d, 0xea, 0x4d, 0x4f, 0xb1, 0x89, 0x5a, 0x34,
0x33, 0x21, 0x89, 0x85, 0x3e, 0xb0, 0xef, 0x21, 0x6d, 0x90, 0x15, 0x75, 0x6f, 0x43, 0xf8, 0xfe,
0xcc, 0x37, 0x3f, 0xdd, 0x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75, 0x3c, 0x4c, 0x15,
0xf8, 0xa7, 0xd9, 0x58, 0xcd, 0xf1, 0x57, 0x00, 0x00, 0x00, 0xff, 0xff, 0x6b, 0xfe, 0xd2, 0x23,
0xab, 0x01, 0x00, 0x00,
}

View File

@ -9,6 +9,6 @@ import "v2ray.com/core/common/net/address.proto";
import "v2ray.com/core/common/net/destination.proto";
message Config {
repeated v2ray.core.common.net.DestinationPB NameServers = 1;
map<string, v2ray.core.common.net.AddressPB> Hosts = 2;
repeated v2ray.core.common.net.Endpoint NameServers = 1;
map<string, v2ray.core.common.net.IPOrDomain> Hosts = 2;
}

View File

@ -10,16 +10,16 @@ import (
func (this *Config) UnmarshalJSON(data []byte) error {
type JsonConfig struct {
Servers []*v2net.AddressPB `json:"servers"`
Hosts map[string]*v2net.AddressPB `json:"hosts"`
Servers []*v2net.IPOrDomain `json:"servers"`
Hosts map[string]*v2net.IPOrDomain `json:"hosts"`
}
jsonConfig := new(JsonConfig)
if err := json.Unmarshal(data, jsonConfig); err != nil {
return err
}
this.NameServers = make([]*v2net.DestinationPB, len(jsonConfig.Servers))
this.NameServers = make([]*v2net.Endpoint, len(jsonConfig.Servers))
for idx, server := range jsonConfig.Servers {
this.NameServers[idx] = &v2net.DestinationPB{
this.NameServers[idx] = &v2net.Endpoint{
Network: v2net.Network_UDP,
Address: server,
Port: 53,

View File

@ -37,10 +37,10 @@ func TestDnsAdd(t *testing.T) {
domain := "local.v2ray.com"
server := NewCacheServer(space, &Config{
NameServers: []*v2net.DestinationPB{{
NameServers: []*v2net.Endpoint{{
Network: v2net.Network_UDP,
Address: &v2net.AddressPB{
Address: &v2net.AddressPB_Ip{
Address: &v2net.IPOrDomain{
Address: &v2net.IPOrDomain_Ip{
Ip: []byte{8, 8, 8, 8},
},
},

View File

@ -187,15 +187,15 @@ func (this *domainAddress) Equals(another Address) bool {
return this.Domain() == anotherDomain.Domain()
}
func (this *AddressPB) AsAddress() Address {
func (this *IPOrDomain) AsAddress() Address {
if this == nil {
return nil
}
switch addr := this.Address.(type) {
case *AddressPB_Ip:
case *IPOrDomain_Ip:
return IPAddress(addr.Ip)
case *AddressPB_Domain:
case *IPOrDomain_Domain:
return DomainAddress(addr.Domain)
}
panic("Common|Net: Invalid AddressPB.")
panic("Common|Net: Invalid address.")
}

View File

@ -12,8 +12,8 @@ It is generated from these files:
v2ray.com/core/common/net/port.proto
It has these top-level messages:
AddressPB
DestinationPB
IPOrDomain
Endpoint
NetworkList
PortRange
*/
@ -34,109 +34,109 @@ var _ = math.Inf
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
type AddressPB struct {
type IPOrDomain struct {
// Types that are valid to be assigned to Address:
// *AddressPB_Ip
// *AddressPB_Domain
Address isAddressPB_Address `protobuf_oneof:"address"`
// *IPOrDomain_Ip
// *IPOrDomain_Domain
Address isIPOrDomain_Address `protobuf_oneof:"address"`
}
func (m *AddressPB) Reset() { *m = AddressPB{} }
func (m *AddressPB) String() string { return proto.CompactTextString(m) }
func (*AddressPB) ProtoMessage() {}
func (*AddressPB) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
func (m *IPOrDomain) Reset() { *m = IPOrDomain{} }
func (m *IPOrDomain) String() string { return proto.CompactTextString(m) }
func (*IPOrDomain) ProtoMessage() {}
func (*IPOrDomain) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
type isAddressPB_Address interface {
isAddressPB_Address()
type isIPOrDomain_Address interface {
isIPOrDomain_Address()
}
type AddressPB_Ip struct {
type IPOrDomain_Ip struct {
Ip []byte `protobuf:"bytes,1,opt,name=ip,proto3,oneof"`
}
type AddressPB_Domain struct {
type IPOrDomain_Domain struct {
Domain string `protobuf:"bytes,2,opt,name=domain,oneof"`
}
func (*AddressPB_Ip) isAddressPB_Address() {}
func (*AddressPB_Domain) isAddressPB_Address() {}
func (*IPOrDomain_Ip) isIPOrDomain_Address() {}
func (*IPOrDomain_Domain) isIPOrDomain_Address() {}
func (m *AddressPB) GetAddress() isAddressPB_Address {
func (m *IPOrDomain) GetAddress() isIPOrDomain_Address {
if m != nil {
return m.Address
}
return nil
}
func (m *AddressPB) GetIp() []byte {
if x, ok := m.GetAddress().(*AddressPB_Ip); ok {
func (m *IPOrDomain) GetIp() []byte {
if x, ok := m.GetAddress().(*IPOrDomain_Ip); ok {
return x.Ip
}
return nil
}
func (m *AddressPB) GetDomain() string {
if x, ok := m.GetAddress().(*AddressPB_Domain); ok {
func (m *IPOrDomain) GetDomain() string {
if x, ok := m.GetAddress().(*IPOrDomain_Domain); ok {
return x.Domain
}
return ""
}
// XXX_OneofFuncs is for the internal use of the proto package.
func (*AddressPB) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
return _AddressPB_OneofMarshaler, _AddressPB_OneofUnmarshaler, _AddressPB_OneofSizer, []interface{}{
(*AddressPB_Ip)(nil),
(*AddressPB_Domain)(nil),
func (*IPOrDomain) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
return _IPOrDomain_OneofMarshaler, _IPOrDomain_OneofUnmarshaler, _IPOrDomain_OneofSizer, []interface{}{
(*IPOrDomain_Ip)(nil),
(*IPOrDomain_Domain)(nil),
}
}
func _AddressPB_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
m := msg.(*AddressPB)
func _IPOrDomain_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
m := msg.(*IPOrDomain)
// address
switch x := m.Address.(type) {
case *AddressPB_Ip:
case *IPOrDomain_Ip:
b.EncodeVarint(1<<3 | proto.WireBytes)
b.EncodeRawBytes(x.Ip)
case *AddressPB_Domain:
case *IPOrDomain_Domain:
b.EncodeVarint(2<<3 | proto.WireBytes)
b.EncodeStringBytes(x.Domain)
case nil:
default:
return fmt.Errorf("AddressPB.Address has unexpected type %T", x)
return fmt.Errorf("IPOrDomain.Address has unexpected type %T", x)
}
return nil
}
func _AddressPB_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
m := msg.(*AddressPB)
func _IPOrDomain_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
m := msg.(*IPOrDomain)
switch tag {
case 1: // address.ip
if wire != proto.WireBytes {
return true, proto.ErrInternalBadWireType
}
x, err := b.DecodeRawBytes(true)
m.Address = &AddressPB_Ip{x}
m.Address = &IPOrDomain_Ip{x}
return true, err
case 2: // address.domain
if wire != proto.WireBytes {
return true, proto.ErrInternalBadWireType
}
x, err := b.DecodeStringBytes()
m.Address = &AddressPB_Domain{x}
m.Address = &IPOrDomain_Domain{x}
return true, err
default:
return false, nil
}
}
func _AddressPB_OneofSizer(msg proto.Message) (n int) {
m := msg.(*AddressPB)
func _IPOrDomain_OneofSizer(msg proto.Message) (n int) {
m := msg.(*IPOrDomain)
// address
switch x := m.Address.(type) {
case *AddressPB_Ip:
case *IPOrDomain_Ip:
n += proto.SizeVarint(1<<3 | proto.WireBytes)
n += proto.SizeVarint(uint64(len(x.Ip)))
n += len(x.Ip)
case *AddressPB_Domain:
case *IPOrDomain_Domain:
n += proto.SizeVarint(2<<3 | proto.WireBytes)
n += proto.SizeVarint(uint64(len(x.Domain)))
n += len(x.Domain)
@ -148,21 +148,22 @@ func _AddressPB_OneofSizer(msg proto.Message) (n int) {
}
func init() {
proto.RegisterType((*AddressPB)(nil), "v2ray.core.common.net.AddressPB")
proto.RegisterType((*IPOrDomain)(nil), "v2ray.core.common.net.IPOrDomain")
}
func init() { proto.RegisterFile("v2ray.com/core/common/net/address.proto", fileDescriptor0) }
var fileDescriptor0 = []byte{
// 159 bytes of a gzipped FileDescriptorProto
// 163 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x52, 0x2f, 0x33, 0x2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29, 0x30, 0x6a, 0x70, 0x7a, 0x30, 0x04,
0x41, 0xf9, 0x4e, 0x9c, 0x5c, 0xec, 0x50, 0x1b, 0x9c, 0xf4, 0xb8, 0x24, 0x93, 0xf3, 0x73, 0xf5,
0xb0, 0xda, 0xe0, 0xc4, 0xe3, 0x08, 0x51, 0x15, 0x00, 0x72, 0x46, 0x14, 0x73, 0x5e, 0x6a, 0x49,
0x12, 0x1b, 0xd8, 0x49, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x02, 0x40, 0xbb, 0x8c, 0xbd,
0x00, 0x00, 0x00,
}

View File

@ -5,7 +5,7 @@ option go_package = "net";
option java_package = "com.v2ray.core.common.net";
option java_outer_classname = "AddressProto";
message AddressPB {
message IPOrDomain {
oneof address {
bytes ip = 1;
string domain = 2;

View File

@ -6,7 +6,7 @@ import (
"encoding/json"
)
func (this *AddressPB) UnmarshalJSON(data []byte) error {
func (this *IPOrDomain) UnmarshalJSON(data []byte) error {
var rawStr string
if err := json.Unmarshal(data, &rawStr); err != nil {
return err
@ -14,11 +14,11 @@ func (this *AddressPB) UnmarshalJSON(data []byte) error {
addr := ParseAddress(rawStr)
switch addr.Family() {
case AddressFamilyIPv4, AddressFamilyIPv6:
this.Address = &AddressPB_Ip{
this.Address = &IPOrDomain_Ip{
Ip: []byte(addr.IP()),
}
case AddressFamilyDomain:
this.Address = &AddressPB_Domain{
this.Address = &IPOrDomain_Domain{
Domain: addr.Domain(),
}
}

View File

@ -14,7 +14,7 @@ func TestIPParsing(t *testing.T) {
assert := assert.On(t)
rawJson := "\"8.8.8.8\""
var address AddressPB
var address IPOrDomain
err := json.Unmarshal([]byte(rawJson), &address)
assert.Error(err).IsNil()
assert.Bytes(address.GetIp()).Equals([]byte{8, 8, 8, 8})
@ -24,7 +24,7 @@ func TestDomainParsing(t *testing.T) {
assert := assert.On(t)
rawJson := "\"v2ray.com\""
var address AddressPB
var address IPOrDomain
err := json.Unmarshal([]byte(rawJson), &address)
assert.Error(err).IsNil()
assert.String(address.GetDomain()).Equals("v2ray.com")
@ -34,7 +34,7 @@ func TestInvalidAddressJson(t *testing.T) {
assert := assert.On(t)
rawJson := "1234"
var address AddressPB
var address IPOrDomain
err := json.Unmarshal([]byte(rawJson), &address)
assert.Error(err).IsNotNil()
}

View File

@ -52,7 +52,7 @@ func (this Destination) Equals(another Destination) bool {
return this.Network == another.Network && this.Port == another.Port && this.Address.Equals(another.Address)
}
func (this *DestinationPB) AsDestination() Destination {
func (this *Endpoint) AsDestination() Destination {
return Destination{
Network: this.Network,
Address: this.Address.AsAddress(),

View File

@ -13,18 +13,18 @@ var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
type DestinationPB struct {
Network Network `protobuf:"varint,1,opt,name=network,enum=v2ray.core.common.net.Network" json:"network,omitempty"`
Address *AddressPB `protobuf:"bytes,2,opt,name=address" json:"address,omitempty"`
Port uint32 `protobuf:"varint,3,opt,name=port" json:"port,omitempty"`
type Endpoint struct {
Network Network `protobuf:"varint,1,opt,name=network,enum=v2ray.core.common.net.Network" json:"network,omitempty"`
Address *IPOrDomain `protobuf:"bytes,2,opt,name=address" json:"address,omitempty"`
Port uint32 `protobuf:"varint,3,opt,name=port" json:"port,omitempty"`
}
func (m *DestinationPB) Reset() { *m = DestinationPB{} }
func (m *DestinationPB) String() string { return proto.CompactTextString(m) }
func (*DestinationPB) ProtoMessage() {}
func (*DestinationPB) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{0} }
func (m *Endpoint) Reset() { *m = Endpoint{} }
func (m *Endpoint) String() string { return proto.CompactTextString(m) }
func (*Endpoint) ProtoMessage() {}
func (*Endpoint) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{0} }
func (m *DestinationPB) GetAddress() *AddressPB {
func (m *Endpoint) GetAddress() *IPOrDomain {
if m != nil {
return m.Address
}
@ -32,25 +32,25 @@ func (m *DestinationPB) GetAddress() *AddressPB {
}
func init() {
proto.RegisterType((*DestinationPB)(nil), "v2ray.core.common.net.DestinationPB")
proto.RegisterType((*Endpoint)(nil), "v2ray.core.common.net.Endpoint")
}
func init() { proto.RegisterFile("v2ray.com/core/common/net/destination.proto", fileDescriptor1) }
var fileDescriptor1 = []byte{
// 209 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0xd2, 0x2e, 0x33, 0x2a, 0x4a,
0xac, 0xd4, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xce, 0x2f, 0x4a, 0xd5, 0x4f, 0xce, 0xcf, 0xcd, 0xcd,
0xcf, 0xd3, 0xcf, 0x4b, 0x2d, 0xd1, 0x4f, 0x49, 0x2d, 0x2e, 0xc9, 0xcc, 0x4b, 0x2c, 0xc9, 0xcc,
0xcf, 0xd3, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x85, 0x29, 0x2e, 0x4a, 0xd5, 0x83, 0x28,
0xd4, 0xcb, 0x4b, 0x2d, 0x91, 0x52, 0xc7, 0x6d, 0x46, 0x5e, 0x6a, 0x49, 0x79, 0x7e, 0x51, 0x36,
0x44, 0x3f, 0x3e, 0x85, 0x89, 0x29, 0x29, 0x45, 0xa9, 0xc5, 0xc5, 0x10, 0x85, 0x4a, 0x33, 0x19,
0xb9, 0x78, 0x5d, 0x10, 0xd6, 0x07, 0x38, 0x09, 0x59, 0x70, 0xb1, 0x43, 0xcd, 0x92, 0x60, 0x54,
0x60, 0xd4, 0xe0, 0x33, 0x92, 0xd3, 0xc3, 0xea, 0x18, 0x3d, 0x3f, 0x88, 0xaa, 0x20, 0x98, 0x72,
0x21, 0x2b, 0x2e, 0x76, 0xa8, 0xe1, 0x12, 0x4c, 0x0a, 0x8c, 0x1a, 0xdc, 0x46, 0x0a, 0x38, 0x74,
0x3a, 0x42, 0x54, 0x05, 0x38, 0x05, 0xc1, 0x34, 0x08, 0x09, 0x71, 0xb1, 0x14, 0xe4, 0x17, 0x95,
0x48, 0x30, 0x2b, 0x30, 0x6a, 0xf0, 0x06, 0x81, 0xd9, 0x4e, 0x46, 0x5c, 0x92, 0xc9, 0xf9, 0xb9,
0xd8, 0xcd, 0x70, 0x12, 0x40, 0x76, 0x35, 0xc8, 0x2b, 0x51, 0xcc, 0x79, 0xa9, 0x25, 0x49, 0x6c,
0x60, 0x6f, 0x19, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0xe2, 0xd7, 0x78, 0x9a, 0x6e, 0x01, 0x00,
0x00,
// 219 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x7c, 0x90, 0x31, 0x4b, 0x04, 0x31,
0x10, 0x46, 0x89, 0x27, 0x9e, 0x44, 0x14, 0x09, 0x08, 0xab, 0x85, 0xac, 0x36, 0x2e, 0x08, 0x09,
0xc4, 0x46, 0xb0, 0x3b, 0xce, 0xc2, 0x46, 0x8f, 0x2d, 0xed, 0x62, 0x32, 0x45, 0x90, 0xcc, 0x2c,
0xb3, 0x83, 0xe2, 0x0f, 0xf1, 0xff, 0x8a, 0x97, 0x5b, 0x6c, 0xee, 0xec, 0x52, 0xbc, 0xf7, 0xc8,
0x37, 0xfa, 0xf6, 0xc3, 0x73, 0xf8, 0xb2, 0x91, 0x8a, 0x8b, 0xc4, 0xe0, 0x22, 0x95, 0x42, 0xe8,
0x10, 0xc4, 0x25, 0x18, 0x25, 0x63, 0x90, 0x4c, 0x68, 0x07, 0x26, 0x21, 0x73, 0x36, 0xc1, 0x0c,
0xb6, 0x82, 0x16, 0x41, 0x2e, 0x6e, 0x76, 0x37, 0x10, 0xe4, 0x93, 0xf8, 0xbd, 0xfa, 0xff, 0x81,
0x21, 0x25, 0x86, 0x71, 0xac, 0xe0, 0xf5, 0xb7, 0xd2, 0x87, 0x8f, 0x98, 0x06, 0xca, 0x28, 0xe6,
0x5e, 0xcf, 0x37, 0x99, 0x46, 0xb5, 0xaa, 0x3b, 0xf1, 0x97, 0x76, 0xeb, 0x3f, 0xec, 0x73, 0xa5,
0xfa, 0x09, 0x37, 0x0f, 0x7a, 0xbe, 0xe9, 0x36, 0x7b, 0xad, 0xea, 0x8e, 0xfc, 0xd5, 0x0e, 0xf3,
0x69, 0xf5, 0xc2, 0x4b, 0x2a, 0x21, 0x63, 0x3f, 0x19, 0xc6, 0xe8, 0xfd, 0x81, 0x58, 0x9a, 0x59,
0xab, 0xba, 0xe3, 0x7e, 0xfd, 0x5e, 0x78, 0x7d, 0x1e, 0xa9, 0x6c, 0x8f, 0x2c, 0x4e, 0x97, 0x7f,
0x07, 0x5b, 0xfd, 0xce, 0x78, 0x9d, 0x21, 0xc8, 0xdb, 0xc1, 0x7a, 0xd2, 0xdd, 0x4f, 0x00, 0x00,
0x00, 0xff, 0xff, 0x97, 0xbf, 0x9f, 0x8e, 0x6a, 0x01, 0x00, 0x00,
}

View File

@ -8,8 +8,8 @@ option java_outer_classname = "DestinationProto";
import "v2ray.com/core/common/net/network.proto";
import "v2ray.com/core/common/net/address.proto";
message DestinationPB {
message Endpoint {
Network network = 1;
AddressPB address = 2;
IPOrDomain address = 2;
uint32 port = 3;
}

View File

@ -60,7 +60,7 @@ func NewServerSpec(newAccount NewAccountFactory, dest v2net.Destination, valid V
}
}
func NewServerSpecFromPB(newAccount NewAccountFactory, spec ServerSpecPB) *ServerSpec {
func NewServerSpecFromPB(newAccount NewAccountFactory, spec ServerEndpoint) *ServerSpec {
dest := v2net.TCPDestination(spec.Address.AsAddress(), v2net.Port(spec.Port))
return NewServerSpec(newAccount, dest, AlwaysValid(), spec.User...)
}

View File

@ -10,7 +10,7 @@ It is generated from these files:
v2ray.com/core/common/protocol/user.proto
It has these top-level messages:
ServerSpecPB
ServerEndpoint
User
*/
package protocol
@ -31,25 +31,25 @@ var _ = math.Inf
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
type ServerSpecPB struct {
Address *v2ray_core_common_net.AddressPB `protobuf:"bytes,1,opt,name=address" json:"address,omitempty"`
Port uint32 `protobuf:"varint,2,opt,name=port" json:"port,omitempty"`
User []*User `protobuf:"bytes,3,rep,name=user" json:"user,omitempty"`
type ServerEndpoint struct {
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"`
User []*User `protobuf:"bytes,3,rep,name=user" json:"user,omitempty"`
}
func (m *ServerSpecPB) Reset() { *m = ServerSpecPB{} }
func (m *ServerSpecPB) String() string { return proto.CompactTextString(m) }
func (*ServerSpecPB) ProtoMessage() {}
func (*ServerSpecPB) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
func (m *ServerEndpoint) Reset() { *m = ServerEndpoint{} }
func (m *ServerEndpoint) String() string { return proto.CompactTextString(m) }
func (*ServerEndpoint) ProtoMessage() {}
func (*ServerEndpoint) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
func (m *ServerSpecPB) GetAddress() *v2ray_core_common_net.AddressPB {
func (m *ServerEndpoint) GetAddress() *v2ray_core_common_net.IPOrDomain {
if m != nil {
return m.Address
}
return nil
}
func (m *ServerSpecPB) GetUser() []*User {
func (m *ServerEndpoint) GetUser() []*User {
if m != nil {
return m.User
}
@ -57,25 +57,26 @@ func (m *ServerSpecPB) GetUser() []*User {
}
func init() {
proto.RegisterType((*ServerSpecPB)(nil), "v2ray.core.common.protocol.ServerSpecPB")
proto.RegisterType((*ServerEndpoint)(nil), "v2ray.core.common.protocol.ServerEndpoint")
}
func init() { proto.RegisterFile("v2ray.com/core/common/protocol/server_spec.proto", fileDescriptor0) }
var fileDescriptor0 = []byte{
// 216 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x84, 0x8e, 0x3f, 0x4b, 0xc7, 0x30,
0x10, 0x86, 0x89, 0xbf, 0xa2, 0x12, 0x15, 0x21, 0x53,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c6, 0x1e, 0xae, 0x7e, 0x01, 0x00, 0x00,
// 230 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x84, 0x8f, 0x3d, 0x4b, 0x04, 0x31,
0x10, 0x86, 0x59, 0xef, 0x50, 0xc9, 0xa1, 0x42, 0xaa, 0x65, 0x0b, 0x89, 0x36, 0xae, 0xcd, 0x44,
0x56, 0xbb, 0xeb, 0x0e, 0x2d, 0xac, 0x3c, 0xf6, 0xb0, 0xb1, 0x91, 0x35, 0x3b, 0xc5, 0x81, 0xc9,
0x84, 0x49, 0x3c, 0xf0, 0x97, 0xf8, 0x77, 0x65, 0x13, 0x53, 0xf9, 0xd5, 0x0d, 0x6f, 0x9e, 0xf7,
0x23, 0xe2, 0x6a, 0xd7, 0xf1, 0xf0, 0x0e, 0x86, 0xac, 0x36, 0xc4, 0xa8, 0x0d, 0x59, 0x4b, 0x4e,
0x7b, 0xa6, 0x48, 0x86, 0x5e, 0x75, 0x40, 0xde, 0x21, 0x3f, 0x07, 0x8f, 0x06, 0x92, 0x28, 0x9b,
0xe2, 0x60, 0x84, 0x4c, 0x43, 0xa1, 0x9b, 0x8b, 0x9f, 0xd3, 0x1c, 0x46, 0x3d, 0x8c, 0x23, 0x63,
0x08, 0x99, 0x6d, 0x2e, 0xff, 0xa9, 0x7d, 0x0b, 0xc8, 0x19, 0x3d, 0xff, 0xa8, 0xc4, 0xf1, 0x26,
0xad, 0xb8, 0x73, 0xa3, 0xa7, 0xad, 0x8b, 0x72, 0x29, 0x0e, 0xbe, 0xe2, 0xea, 0x4a, 0x55, 0xed,
0xa2, 0x3b, 0x83, 0xef, 0xa3, 0x1c, 0x46, 0xb8, 0x5f, 0x3f, 0xf0, 0x2d, 0xd9, 0x61, 0xeb, 0xfa,
0xe2, 0x90, 0x52, 0xcc, 0x3d, 0x71, 0xac, 0xf7, 0x54, 0xd5, 0x1e, 0xf5, 0xe9, 0x96, 0x37, 0x62,
0x3e, 0x35, 0xd6, 0x33, 0x35, 0x6b, 0x17, 0x9d, 0x82, 0xdf, 0xbf, 0x08, 0x8f, 0x01, 0xb9, 0x4f,
0xf4, 0x6a, 0x29, 0x4e, 0x0d, 0xd9, 0x3f, 0xe0, 0xd5, 0x49, 0x1e, 0xbe, 0xf1, 0x68, 0xd6, 0x93,
0xf6, 0x74, 0x58, 0x9e, 0x5e, 0xf6, 0xd3, 0x75, 0xfd, 0x19, 0x00, 0x00, 0xff, 0xff, 0xbd, 0x28,
0xb3, 0x3a, 0x81, 0x01, 0x00, 0x00,
}

View File

@ -8,8 +8,8 @@ option java_outer_classname = "ServerSpecProto";
import "v2ray.com/core/common/net/address.proto";
import "v2ray.com/core/common/protocol/user.proto";
message ServerSpecPB {
v2ray.core.common.net.AddressPB address = 1;
message ServerEndpoint {
v2ray.core.common.net.IPOrDomain address = 1;
uint32 port = 2;
repeated v2ray.core.common.protocol.User user = 3;
}

13
config.proto Normal file
View File

@ -0,0 +1,13 @@
syntax = "proto3";
package v2ray.core;
option go_package = "core";
option java_package = "com.v2ray.core";
option java_outer_classname = "ConfigProto";
message InboundConnectionConfig {
string protocol = 1;
}

View File

@ -53,10 +53,10 @@ func (this *Config) UnmarshalJSON(data []byte) error {
this.OutboundDetours = jsonConfig.OutboundDetours
if jsonConfig.DNSConfig == nil {
jsonConfig.DNSConfig = &dns.Config{
NameServers: []*v2net.DestinationPB{{
NameServers: []*v2net.Endpoint{{
Network: v2net.Network_UDP,
Address: &v2net.AddressPB{
Address: &v2net.AddressPB_Domain{
Address: &v2net.IPOrDomain{
Address: &v2net.IPOrDomain_Domain{
Domain: "localhost",
},
},
@ -72,7 +72,7 @@ func (this *Config) UnmarshalJSON(data []byte) error {
func (this *InboundConnectionConfig) UnmarshalJSON(data []byte) error {
type JsonConfig struct {
Port uint16 `json:"port"`
Listen *v2net.AddressPB `json:"listen"`
Listen *v2net.IPOrDomain `json:"listen"`
Protocol string `json:"protocol"`
StreamSetting *internet.StreamConfig `json:"streamSettings"`
Settings json.RawMessage `json:"settings"`
@ -104,7 +104,7 @@ func (this *InboundConnectionConfig) UnmarshalJSON(data []byte) error {
func (this *OutboundConnectionConfig) UnmarshalJSON(data []byte) error {
type JsonConnectionConfig struct {
Protocol string `json:"protocol"`
SendThrough *v2net.AddressPB `json:"sendThrough"`
SendThrough *v2net.IPOrDomain `json:"sendThrough"`
StreamSetting *internet.StreamConfig `json:"streamSettings"`
Settings json.RawMessage `json:"settings"`
}
@ -159,7 +159,7 @@ func (this *InboundDetourConfig) UnmarshalJSON(data []byte) error {
type JsonInboundDetourConfig struct {
Protocol string `json:"protocol"`
PortRange *v2net.PortRange `json:"port"`
ListenOn *v2net.AddressPB `json:"listen"`
ListenOn *v2net.IPOrDomain `json:"listen"`
Settings json.RawMessage `json:"settings"`
Tag string `json:"tag"`
Allocation *InboundDetourAllocationConfig `json:"allocate"`
@ -202,7 +202,7 @@ func (this *InboundDetourConfig) UnmarshalJSON(data []byte) error {
func (this *OutboundDetourConfig) UnmarshalJSON(data []byte) error {
type JsonOutboundDetourConfig struct {
Protocol string `json:"protocol"`
SendThrough *v2net.AddressPB `json:"sendThrough"`
SendThrough *v2net.IPOrDomain `json:"sendThrough"`
Tag string `json:"tag"`
Settings json.RawMessage `json:"settings"`
StreamSetting *internet.StreamConfig `json:"streamSettings"`

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, 0x77, 0xfd, 0x25, 0xe2, 0x6e, 0x82, 0x22, 0xd4, 0xdb, 0xce, 0xcb,
0xb3, 0xcf, 0x0c, 0xaf, 0xb8, 0x7a, 0x9f, 0xd3, 0x6a, 0xa7, 0x2d, 0x3a, 0x63, 0x91, 0xc0, 0x34,
0x84, 0x1f, 0x3b, 0x53, 0xe2, 0x06, 0x4b, 0x70, 0x68, 0x2c, 0xfa, 0x75, 0xf5, 0xaa, 0x1b, 0x42,
0x46, 0x79, 0xde, 0xb3, 0x04, 0x3a, 0x70, 0xba, 0xe7, 0x2e, 0x66, 0x7f, 0x34, 0x16, 0x9d, 0x43,
0x6f, 0x3c, 0xb0, 0x59, 0x95, 0x25, 0x41, 0xdb, 0x46, 0xc7, 0x7f, 0xa0, 0x07, 0xde, 0x22, 0x6d,
0x22, 0x38, 0xfd, 0x4c, 0xc4, 0xf0, 0x3e, 0x6c, 0x97, 0xb7, 0x62, 0xd4, 0x49, 0x54, 0x92, 0x26,
0xd9, 0x64, 0x9e, 0xea, 0x5f, 0x97, 0x44, 0x83, 0xf6, 0xc0, 0xfa, 0x2e, 0x52, 0x8b, 0xbc, 0xe8,
0x3f, 0x48, 0x29, 0x06, 0x0d, 0x12, 0xab, 0x83, 0x34, 0xc9, 0x4e, 0x8a, 0xf0, 0x96, 0x0f, 0xe2,
0xb8, 0xdb, 0xb5, 0xac, 0xab, 0x96, 0xd5, 0x61, 0x90, 0x4e, 0xf7, 0x48, 0x9f, 0x22, 0xfa, 0x58,
0xb5, 0x5c, 0x4c, 0xfc, 0xcf, 0x20, 0x95, 0x18, 0x71, 0xe5, 0x00, 0xdf, 0x58, 0x0d, 0x82, 0xbd,
0x1f, 0xe5, 0x4c, 0x9c, 0xad, 0xb1, 0xae, 0x71, 0xbb, 0x24, 0x28, 0x2b, 0x02, 0xcb, 0xea, 0x28,
0x4d, 0xb2, 0x71, 0x71, 0x1a, 0xe3, 0xa2, 0x4b, 0xf3, 0x1b, 0x71, 0x69, 0xd1, 0xe9, 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, 0x9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 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, 0x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xed, 0x86, 0x15, 0xe5, 0xd1, 0xe6, 0x13, 0xdc, 0x9b,
0xf6, 0x5d, 0xcb, 0xb9, 0x75, 0xd1, 0xbf, 0xe1, 0x2f, 0x75, 0x4c, 0xc0, 0xb9, 0x60, 0x74, 0x16,
0xc6, 0x47, 0xde, 0xcb, 0xef, 0x00, 0x7f, 0x2b, 0x61, 0x04, 0xad, 0xe5, 0xf4, 0xf3, 0xf4, 0xcb,
0xd7, 0xa9, 0xfd, 0x00, 0x3f, 0x01, 0x14, 0x0c, 0xe7, 0xc9, 0x6b, 0xff, 0x43, 0x12, 0x8d, 0x42,
0xdb, 0x6a, 0x16, 0xfe, 0xbb, 0xf7, 0x7a, 0x71, 0x83, 0x3b, 0xd0, 0x8e, 0xc6, 0x41, 0x34, 0x0e,
0xfc, 0x81, 0x7d, 0x8b, 0x9f, 0xc2, 0xa3, 0x66, 0x4a, 0x26, 0xc3, 0xd1, 0xc2, 0xbe, 0x0b, 0x3f,
0x82, 0x43, 0x79, 0x7e, 0xf5, 0xa2, 0x21, 0x32, 0x5d, 0x66, 0x87, 0x98, 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, 0x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0xf4, 0x28, 0x81, 0x7e, 0xb4, 0x2d, 0x58, 0x55, 0x1f, 0x6d, 0x42, 0xb8, 0x35,
0xed, 0x07, 0x96, 0x73, 0xed, 0x22, 0xff, 0xfe, 0x92, 0x8e, 0x09, 0x18, 0x57, 0xb9, 0xe0, 0x45,
0x55, 0x27, 0x47, 0xe6, 0xfd, 0x0f, 0x80, 0x7f, 0xa5, 0x30, 0x82, 0xbb, 0xd5, 0xfc, 0xf3, 0xfc,
0xcb, 0xb7, 0xb9, 0xfd, 0x08, 0x3f, 0x03, 0x14, 0xc4, 0x8b, 0xf4, 0x8d, 0xff, 0x31, 0x8d, 0x26,
0xa1, 0x6d, 0x75, 0x0b, 0xff, 0xfd, 0x07, 0xbd, 0xb8, 0xc2, 0x7d, 0xe8, 0x45, 0xd3, 0x20, 0x9a,
0x06, 0xfe, 0xd8, 0xbe, 0xc6, 0xcf, 0xe1, 0x49, 0x37, 0xa5, 0xb3, 0x78, 0xb2, 0xb4, 0x6f, 0xc2,
0x4f, 0xe0, 0x50, 0x5e, 0x5e, 0xbc, 0x69, 0x88, 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, 0xb5, 0xc6, 0xe9, 0x18, 0xec,
0x25, 0xa8, 0xf2, 0x6d, 0x0d, 0xb5, 0x25, 0x21, 0xc9, 0xd9, 0xfc, 0x31, 0xf7, 0x8d, 0x46, 0x2c,
0xbb, 0xac, 0x25, 0x7d, 0xd3, 0xe9, 0xfe, 0xf7, 0xbf, 0xbb, 0xdf, 0xc1, 0xdb, 0xdd, 0x52, 0xb3,
0x96, 0x72, 0x59, 0xa7, 0x5c, 0x6a, 0x4c, 0x95, 0x96, 0x7f, 0xda, 0xd4, 0x48, 0x7e, 0x67, 0x52,
0x2e, 0xc5, 0xcf, 0xed, 0x2f, 0xaa, 0xb4, 0xb4, 0x92, 0xbc, 0x1a, 0x84, 0x1a, 0x69, 0x27, 0xa2,
0x9d, 0x28, 0x7a, 0x6c, 0xc0, 0x65, 0x5d, 0x4b, 0x91, 0x0a, 0xb4, 0x29, 0x2b, 0x4b, 0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x98, 0x88, 0xcc, 0x61, 0x7c, 0x87, 0x6d, 0x8f, 0x76, 0xff, 0x24, 0x2f,
0x61, 0xb2, 0x63, 0x55, 0x83, 0x3d, 0x52, 0x17, 0x9c, 0x8d, 0x3e, 0x78, 0x8b, 0x1c, 0x66, 0xe7,
0xd5, 0x16, 0x85, 0xed, 0x91, 0x7e, 0x86, 0x23, 0x77, 0xbb, 0xd0, 0xeb, 0x88, 0x24, 0x07, 0x56,
0x18, 0xae, 0xdc, 0x53, 0x59, 0x2b, 0xe4, 0xf9, 0xaa, 0xe8, 0xeb, 0xde, 0xbd, 0x01, 0x7f, 0x60,
0x4d, 0x02, 0x98, 0x5e, 0x5e, 0x6d, 0xb2, 0x6f, 0xd7, 0x5f, 0xe7, 0xcf, 0xc8, 0x0c, 0xfc, 0x3c,
0x5b, 0xaf, 0xbf, 0x5f, 0x15, 0x5f, 0xe6, 0xde, 0xea, 0x14, 0x22, 0x2e, 0xeb, 0x27, 0x78, 0xaf,
0x02, 0x37, 0x4e, 0xbe, 0xef, 0xf4, 0x63, 0xd2, 0xfd, 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,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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, 0x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, 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()