mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-01-02 15:36:41 -05:00
refactor protos
This commit is contained in:
parent
c1f91567ad
commit
fc6a706166
@ -8,8 +8,8 @@ import (
|
|||||||
|
|
||||||
func (this *Config) GetInternalHosts() map[string]net.IP {
|
func (this *Config) GetInternalHosts() map[string]net.IP {
|
||||||
hosts := make(map[string]net.IP)
|
hosts := make(map[string]net.IP)
|
||||||
for domain, addressPB := range this.GetHosts() {
|
for domain, ipOrDomain := range this.GetHosts() {
|
||||||
address := addressPB.AsAddress()
|
address := ipOrDomain.AsAddress()
|
||||||
if address.Family().IsDomain() {
|
if address.Family().IsDomain() {
|
||||||
log.Warning("DNS: Ignoring domain address in static hosts: ", address.Domain())
|
log.Warning("DNS: Ignoring domain address in static hosts: ", address.Domain())
|
||||||
continue
|
continue
|
||||||
|
@ -31,8 +31,8 @@ var _ = math.Inf
|
|||||||
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
|
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
NameServers []*v2ray_core_common_net2.DestinationPB `protobuf:"bytes,1,rep,name=NameServers,json=nameServers" json:"NameServers,omitempty"`
|
NameServers []*v2ray_core_common_net2.Endpoint `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"`
|
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{} }
|
func (m *Config) Reset() { *m = Config{} }
|
||||||
@ -40,14 +40,14 @@ func (m *Config) String() string { return proto.CompactTextString(m)
|
|||||||
func (*Config) ProtoMessage() {}
|
func (*Config) ProtoMessage() {}
|
||||||
func (*Config) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
|
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 {
|
if m != nil {
|
||||||
return m.NameServers
|
return m.NameServers
|
||||||
}
|
}
|
||||||
return nil
|
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 {
|
if m != nil {
|
||||||
return m.Hosts
|
return m.Hosts
|
||||||
}
|
}
|
||||||
@ -61,22 +61,23 @@ func init() {
|
|||||||
func init() { proto.RegisterFile("v2ray.com/core/app/dns/config.proto", fileDescriptor0) }
|
func init() { proto.RegisterFile("v2ray.com/core/app/dns/config.proto", fileDescriptor0) }
|
||||||
|
|
||||||
var fileDescriptor0 = []byte{
|
var fileDescriptor0 = []byte{
|
||||||
// 270 bytes of a gzipped FileDescriptorProto
|
// 276 bytes of a gzipped FileDescriptorProto
|
||||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x74, 0x90, 0xcb, 0x4a, 0xc4, 0x30,
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x74, 0x90, 0xc1, 0x4a, 0xc4, 0x30,
|
||||||
0x14, 0x86, 0x49, 0x4b, 0x07, 0x4c, 0x37, 0x92, 0x85, 0x94, 0xae, 0x8a, 0x17, 0x2c, 0x0a, 0x09,
|
0x10, 0x86, 0xc9, 0x2e, 0x5d, 0x30, 0xbd, 0x48, 0x0e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, 0xd3, 0x37, 0xdd, 0x67, 0xa4, 0x20, 0xe5,
|
||||||
0x9d, 0xec, 0x9c, 0x46, 0x83, 0xfc, 0xf8, 0x84, 0x24, 0xc8, 0x48, 0x1e, 0x17, 0xd9, 0x96, 0x7a,
|
0x46, 0x3d, 0x8c, 0xec, 0x84, 0x26, 0x9d, 0x7c, 0xff, 0xd0, 0xd9, 0xa4, 0x20, 0x65, 0x5a, 0xed,
|
||||||
0xd7, 0x7e, 0x91, 0xaa, 0xac, 0x3d, 0x7e, 0x19, 0x5c, 0x90, 0xf2, 0x84, 0xee, 0x35, 0xba, 0xdb,
|
0xac, 0x31, 0xbb, 0x59, 0xde, 0xb9, 0x2b, 0x34, 0xb2, 0x85, 0x3a, 0xf2, 0x67, 0x93, 0x53, 0x32,
|
||||||
0x50, 0xa7, 0x8c, 0x7d, 0x9f, 0x6a, 0x9a, 0x64, 0x1d, 0x2a, 0xb4, 0xcf, 0xab, 0x79, 0x9e, 0xb3,
|
0x3f, 0xa4, 0x5b, 0x0d, 0x9a, 0x7f, 0x7c, 0xe6, 0x69, 0x14, 0x5a, 0x0e, 0x75, 0x3c, 0x4c, 0x15,
|
||||||
0xef, 0x00, 0x00, 0x00, 0xff, 0xff, 0x17, 0x9a, 0x1d, 0xee, 0xaf, 0x01, 0x00, 0x00,
|
0xf8, 0xa7, 0xd9, 0x58, 0xcd, 0xf1, 0x57, 0x00, 0x00, 0x00, 0xff, 0xff, 0x6b, 0xfe, 0xd2, 0x23,
|
||||||
|
0xab, 0x01, 0x00, 0x00,
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,6 @@ import "v2ray.com/core/common/net/address.proto";
|
|||||||
import "v2ray.com/core/common/net/destination.proto";
|
import "v2ray.com/core/common/net/destination.proto";
|
||||||
|
|
||||||
message Config {
|
message Config {
|
||||||
repeated v2ray.core.common.net.DestinationPB NameServers = 1;
|
repeated v2ray.core.common.net.Endpoint NameServers = 1;
|
||||||
map<string, v2ray.core.common.net.AddressPB> Hosts = 2;
|
map<string, v2ray.core.common.net.IPOrDomain> Hosts = 2;
|
||||||
}
|
}
|
||||||
|
@ -10,16 +10,16 @@ import (
|
|||||||
|
|
||||||
func (this *Config) UnmarshalJSON(data []byte) error {
|
func (this *Config) UnmarshalJSON(data []byte) error {
|
||||||
type JsonConfig struct {
|
type JsonConfig struct {
|
||||||
Servers []*v2net.AddressPB `json:"servers"`
|
Servers []*v2net.IPOrDomain `json:"servers"`
|
||||||
Hosts map[string]*v2net.AddressPB `json:"hosts"`
|
Hosts map[string]*v2net.IPOrDomain `json:"hosts"`
|
||||||
}
|
}
|
||||||
jsonConfig := new(JsonConfig)
|
jsonConfig := new(JsonConfig)
|
||||||
if err := json.Unmarshal(data, jsonConfig); err != nil {
|
if err := json.Unmarshal(data, jsonConfig); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
this.NameServers = make([]*v2net.DestinationPB, len(jsonConfig.Servers))
|
this.NameServers = make([]*v2net.Endpoint, len(jsonConfig.Servers))
|
||||||
for idx, server := range jsonConfig.Servers {
|
for idx, server := range jsonConfig.Servers {
|
||||||
this.NameServers[idx] = &v2net.DestinationPB{
|
this.NameServers[idx] = &v2net.Endpoint{
|
||||||
Network: v2net.Network_UDP,
|
Network: v2net.Network_UDP,
|
||||||
Address: server,
|
Address: server,
|
||||||
Port: 53,
|
Port: 53,
|
||||||
|
@ -37,10 +37,10 @@ func TestDnsAdd(t *testing.T) {
|
|||||||
|
|
||||||
domain := "local.v2ray.com"
|
domain := "local.v2ray.com"
|
||||||
server := NewCacheServer(space, &Config{
|
server := NewCacheServer(space, &Config{
|
||||||
NameServers: []*v2net.DestinationPB{{
|
NameServers: []*v2net.Endpoint{{
|
||||||
Network: v2net.Network_UDP,
|
Network: v2net.Network_UDP,
|
||||||
Address: &v2net.AddressPB{
|
Address: &v2net.IPOrDomain{
|
||||||
Address: &v2net.AddressPB_Ip{
|
Address: &v2net.IPOrDomain_Ip{
|
||||||
Ip: []byte{8, 8, 8, 8},
|
Ip: []byte{8, 8, 8, 8},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -187,15 +187,15 @@ func (this *domainAddress) Equals(another Address) bool {
|
|||||||
return this.Domain() == anotherDomain.Domain()
|
return this.Domain() == anotherDomain.Domain()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *AddressPB) AsAddress() Address {
|
func (this *IPOrDomain) AsAddress() Address {
|
||||||
if this == nil {
|
if this == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
switch addr := this.Address.(type) {
|
switch addr := this.Address.(type) {
|
||||||
case *AddressPB_Ip:
|
case *IPOrDomain_Ip:
|
||||||
return IPAddress(addr.Ip)
|
return IPAddress(addr.Ip)
|
||||||
case *AddressPB_Domain:
|
case *IPOrDomain_Domain:
|
||||||
return DomainAddress(addr.Domain)
|
return DomainAddress(addr.Domain)
|
||||||
}
|
}
|
||||||
panic("Common|Net: Invalid AddressPB.")
|
panic("Common|Net: Invalid address.")
|
||||||
}
|
}
|
||||||
|
@ -12,8 +12,8 @@ It is generated from these files:
|
|||||||
v2ray.com/core/common/net/port.proto
|
v2ray.com/core/common/net/port.proto
|
||||||
|
|
||||||
It has these top-level messages:
|
It has these top-level messages:
|
||||||
AddressPB
|
IPOrDomain
|
||||||
DestinationPB
|
Endpoint
|
||||||
NetworkList
|
NetworkList
|
||||||
PortRange
|
PortRange
|
||||||
*/
|
*/
|
||||||
@ -34,109 +34,109 @@ var _ = math.Inf
|
|||||||
// proto package needs to be updated.
|
// proto package needs to be updated.
|
||||||
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
|
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
|
||||||
|
|
||||||
type AddressPB struct {
|
type IPOrDomain struct {
|
||||||
// Types that are valid to be assigned to Address:
|
// Types that are valid to be assigned to Address:
|
||||||
// *AddressPB_Ip
|
// *IPOrDomain_Ip
|
||||||
// *AddressPB_Domain
|
// *IPOrDomain_Domain
|
||||||
Address isAddressPB_Address `protobuf_oneof:"address"`
|
Address isIPOrDomain_Address `protobuf_oneof:"address"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *AddressPB) Reset() { *m = AddressPB{} }
|
func (m *IPOrDomain) Reset() { *m = IPOrDomain{} }
|
||||||
func (m *AddressPB) String() string { return proto.CompactTextString(m) }
|
func (m *IPOrDomain) String() string { return proto.CompactTextString(m) }
|
||||||
func (*AddressPB) ProtoMessage() {}
|
func (*IPOrDomain) ProtoMessage() {}
|
||||||
func (*AddressPB) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
|
func (*IPOrDomain) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
|
||||||
|
|
||||||
type isAddressPB_Address interface {
|
type isIPOrDomain_Address interface {
|
||||||
isAddressPB_Address()
|
isIPOrDomain_Address()
|
||||||
}
|
}
|
||||||
|
|
||||||
type AddressPB_Ip struct {
|
type IPOrDomain_Ip struct {
|
||||||
Ip []byte `protobuf:"bytes,1,opt,name=ip,proto3,oneof"`
|
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"`
|
Domain string `protobuf:"bytes,2,opt,name=domain,oneof"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (*AddressPB_Ip) isAddressPB_Address() {}
|
func (*IPOrDomain_Ip) isIPOrDomain_Address() {}
|
||||||
func (*AddressPB_Domain) isAddressPB_Address() {}
|
func (*IPOrDomain_Domain) isIPOrDomain_Address() {}
|
||||||
|
|
||||||
func (m *AddressPB) GetAddress() isAddressPB_Address {
|
func (m *IPOrDomain) GetAddress() isIPOrDomain_Address {
|
||||||
if m != nil {
|
if m != nil {
|
||||||
return m.Address
|
return m.Address
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *AddressPB) GetIp() []byte {
|
func (m *IPOrDomain) GetIp() []byte {
|
||||||
if x, ok := m.GetAddress().(*AddressPB_Ip); ok {
|
if x, ok := m.GetAddress().(*IPOrDomain_Ip); ok {
|
||||||
return x.Ip
|
return x.Ip
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *AddressPB) GetDomain() string {
|
func (m *IPOrDomain) GetDomain() string {
|
||||||
if x, ok := m.GetAddress().(*AddressPB_Domain); ok {
|
if x, ok := m.GetAddress().(*IPOrDomain_Domain); ok {
|
||||||
return x.Domain
|
return x.Domain
|
||||||
}
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
// XXX_OneofFuncs is for the internal use of the proto package.
|
// 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{}) {
|
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 _AddressPB_OneofMarshaler, _AddressPB_OneofUnmarshaler, _AddressPB_OneofSizer, []interface{}{
|
return _IPOrDomain_OneofMarshaler, _IPOrDomain_OneofUnmarshaler, _IPOrDomain_OneofSizer, []interface{}{
|
||||||
(*AddressPB_Ip)(nil),
|
(*IPOrDomain_Ip)(nil),
|
||||||
(*AddressPB_Domain)(nil),
|
(*IPOrDomain_Domain)(nil),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func _AddressPB_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
|
func _IPOrDomain_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
|
||||||
m := msg.(*AddressPB)
|
m := msg.(*IPOrDomain)
|
||||||
// address
|
// address
|
||||||
switch x := m.Address.(type) {
|
switch x := m.Address.(type) {
|
||||||
case *AddressPB_Ip:
|
case *IPOrDomain_Ip:
|
||||||
b.EncodeVarint(1<<3 | proto.WireBytes)
|
b.EncodeVarint(1<<3 | proto.WireBytes)
|
||||||
b.EncodeRawBytes(x.Ip)
|
b.EncodeRawBytes(x.Ip)
|
||||||
case *AddressPB_Domain:
|
case *IPOrDomain_Domain:
|
||||||
b.EncodeVarint(2<<3 | proto.WireBytes)
|
b.EncodeVarint(2<<3 | proto.WireBytes)
|
||||||
b.EncodeStringBytes(x.Domain)
|
b.EncodeStringBytes(x.Domain)
|
||||||
case nil:
|
case nil:
|
||||||
default:
|
default:
|
||||||
return fmt.Errorf("AddressPB.Address has unexpected type %T", x)
|
return fmt.Errorf("IPOrDomain.Address has unexpected type %T", x)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func _AddressPB_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
|
func _IPOrDomain_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
|
||||||
m := msg.(*AddressPB)
|
m := msg.(*IPOrDomain)
|
||||||
switch tag {
|
switch tag {
|
||||||
case 1: // address.ip
|
case 1: // address.ip
|
||||||
if wire != proto.WireBytes {
|
if wire != proto.WireBytes {
|
||||||
return true, proto.ErrInternalBadWireType
|
return true, proto.ErrInternalBadWireType
|
||||||
}
|
}
|
||||||
x, err := b.DecodeRawBytes(true)
|
x, err := b.DecodeRawBytes(true)
|
||||||
m.Address = &AddressPB_Ip{x}
|
m.Address = &IPOrDomain_Ip{x}
|
||||||
return true, err
|
return true, err
|
||||||
case 2: // address.domain
|
case 2: // address.domain
|
||||||
if wire != proto.WireBytes {
|
if wire != proto.WireBytes {
|
||||||
return true, proto.ErrInternalBadWireType
|
return true, proto.ErrInternalBadWireType
|
||||||
}
|
}
|
||||||
x, err := b.DecodeStringBytes()
|
x, err := b.DecodeStringBytes()
|
||||||
m.Address = &AddressPB_Domain{x}
|
m.Address = &IPOrDomain_Domain{x}
|
||||||
return true, err
|
return true, err
|
||||||
default:
|
default:
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func _AddressPB_OneofSizer(msg proto.Message) (n int) {
|
func _IPOrDomain_OneofSizer(msg proto.Message) (n int) {
|
||||||
m := msg.(*AddressPB)
|
m := msg.(*IPOrDomain)
|
||||||
// address
|
// address
|
||||||
switch x := m.Address.(type) {
|
switch x := m.Address.(type) {
|
||||||
case *AddressPB_Ip:
|
case *IPOrDomain_Ip:
|
||||||
n += proto.SizeVarint(1<<3 | proto.WireBytes)
|
n += proto.SizeVarint(1<<3 | proto.WireBytes)
|
||||||
n += proto.SizeVarint(uint64(len(x.Ip)))
|
n += proto.SizeVarint(uint64(len(x.Ip)))
|
||||||
n += len(x.Ip)
|
n += len(x.Ip)
|
||||||
case *AddressPB_Domain:
|
case *IPOrDomain_Domain:
|
||||||
n += proto.SizeVarint(2<<3 | proto.WireBytes)
|
n += proto.SizeVarint(2<<3 | proto.WireBytes)
|
||||||
n += proto.SizeVarint(uint64(len(x.Domain)))
|
n += proto.SizeVarint(uint64(len(x.Domain)))
|
||||||
n += len(x.Domain)
|
n += len(x.Domain)
|
||||||
@ -148,21 +148,22 @@ func _AddressPB_OneofSizer(msg proto.Message) (n int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
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) }
|
func init() { proto.RegisterFile("v2ray.com/core/common/net/address.proto", fileDescriptor0) }
|
||||||
|
|
||||||
var fileDescriptor0 = []byte{
|
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, 0x2a, 0x4a,
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x52, 0x2f, 0x33, 0x2a, 0x4a,
|
||||||
0xac, 0xd4, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xce, 0x2f, 0x4a, 0xd5, 0x4f, 0xce, 0xcf, 0xcd, 0xcd,
|
0xac, 0xd4, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xce, 0x2f, 0x4a, 0xd5, 0x4f, 0xce, 0xcf, 0xcd, 0xcd,
|
||||||
0xcf, 0xd3, 0xcf, 0x4b, 0x2d, 0xd1, 0x4f, 0x4c, 0x49, 0x29, 0x4a, 0x2d, 0x2e, 0xd6, 0x2b, 0x28,
|
0xcf, 0xd3, 0xcf, 0x4b, 0x2d, 0xd1, 0x4f, 0x4c, 0x49, 0x29, 0x4a, 0x2d, 0x2e, 0xd6, 0x2b, 0x28,
|
||||||
0xca, 0x2f, 0xc9, 0x17, 0x12, 0x85, 0x29, 0x2c, 0x4a, 0xd5, 0x83, 0x28, 0xd2, 0xcb, 0x4b, 0x2d,
|
0xca, 0x2f, 0xc9, 0x17, 0x12, 0x85, 0x29, 0x2c, 0x4a, 0xd5, 0x83, 0x28, 0xd2, 0xcb, 0x4b, 0x2d,
|
||||||
0x51, 0x72, 0xe2, 0xe2, 0x74, 0x84, 0xa8, 0x0b, 0x70, 0x12, 0x12, 0xe0, 0x62, 0xca, 0x2c, 0x90,
|
0x51, 0x72, 0xe6, 0xe2, 0xf2, 0x0c, 0xf0, 0x2f, 0x72, 0xc9, 0xcf, 0x4d, 0xcc, 0xcc, 0x13, 0x12,
|
||||||
0x60, 0x54, 0x60, 0xd4, 0xe0, 0xf1, 0x60, 0x08, 0x62, 0xca, 0x2c, 0x10, 0x92, 0xe0, 0x62, 0x4b,
|
0xe0, 0x62, 0xca, 0x2c, 0x90, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0xf1, 0x60, 0x08, 0x62, 0xca, 0x2c,
|
||||||
0xc9, 0xcf, 0x4d, 0xcc, 0xcc, 0x93, 0x60, 0x52, 0x60, 0xd4, 0xe0, 0xf4, 0x60, 0x08, 0x82, 0xf2,
|
0x10, 0x92, 0xe0, 0x62, 0x4b, 0x01, 0xcb, 0x49, 0x30, 0x29, 0x30, 0x6a, 0x70, 0x7a, 0x30, 0x04,
|
||||||
0x9d, 0x38, 0xb9, 0xd8, 0xa1, 0x16, 0x38, 0xe9, 0x71, 0x49, 0x26, 0xe7, 0xe7, 0xea, 0x61, 0xb5,
|
0x41, 0xf9, 0x4e, 0x9c, 0x5c, 0xec, 0x50, 0x1b, 0x9c, 0xf4, 0xb8, 0x24, 0x93, 0xf3, 0x73, 0xf5,
|
||||||
0xc0, 0x89, 0x07, 0x66, 0x3c, 0xc8, 0x15, 0x51, 0xcc, 0x79, 0xa9, 0x25, 0x49, 0x6c, 0x60, 0x17,
|
0xb0, 0xda, 0xe0, 0xc4, 0xe3, 0x08, 0x51, 0x15, 0x00, 0x72, 0x46, 0x14, 0x73, 0x5e, 0x6a, 0x49,
|
||||||
0x19, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0xa1, 0xd1, 0xe6, 0x14, 0xbc, 0x00, 0x00, 0x00,
|
0x12, 0x1b, 0xd8, 0x49, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x02, 0x40, 0xbb, 0x8c, 0xbd,
|
||||||
|
0x00, 0x00, 0x00,
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ option go_package = "net";
|
|||||||
option java_package = "com.v2ray.core.common.net";
|
option java_package = "com.v2ray.core.common.net";
|
||||||
option java_outer_classname = "AddressProto";
|
option java_outer_classname = "AddressProto";
|
||||||
|
|
||||||
message AddressPB {
|
message IPOrDomain {
|
||||||
oneof address {
|
oneof address {
|
||||||
bytes ip = 1;
|
bytes ip = 1;
|
||||||
string domain = 2;
|
string domain = 2;
|
||||||
|
@ -6,7 +6,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (this *AddressPB) UnmarshalJSON(data []byte) error {
|
func (this *IPOrDomain) UnmarshalJSON(data []byte) error {
|
||||||
var rawStr string
|
var rawStr string
|
||||||
if err := json.Unmarshal(data, &rawStr); err != nil {
|
if err := json.Unmarshal(data, &rawStr); err != nil {
|
||||||
return err
|
return err
|
||||||
@ -14,11 +14,11 @@ func (this *AddressPB) UnmarshalJSON(data []byte) error {
|
|||||||
addr := ParseAddress(rawStr)
|
addr := ParseAddress(rawStr)
|
||||||
switch addr.Family() {
|
switch addr.Family() {
|
||||||
case AddressFamilyIPv4, AddressFamilyIPv6:
|
case AddressFamilyIPv4, AddressFamilyIPv6:
|
||||||
this.Address = &AddressPB_Ip{
|
this.Address = &IPOrDomain_Ip{
|
||||||
Ip: []byte(addr.IP()),
|
Ip: []byte(addr.IP()),
|
||||||
}
|
}
|
||||||
case AddressFamilyDomain:
|
case AddressFamilyDomain:
|
||||||
this.Address = &AddressPB_Domain{
|
this.Address = &IPOrDomain_Domain{
|
||||||
Domain: addr.Domain(),
|
Domain: addr.Domain(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ func TestIPParsing(t *testing.T) {
|
|||||||
assert := assert.On(t)
|
assert := assert.On(t)
|
||||||
|
|
||||||
rawJson := "\"8.8.8.8\""
|
rawJson := "\"8.8.8.8\""
|
||||||
var address AddressPB
|
var address IPOrDomain
|
||||||
err := json.Unmarshal([]byte(rawJson), &address)
|
err := json.Unmarshal([]byte(rawJson), &address)
|
||||||
assert.Error(err).IsNil()
|
assert.Error(err).IsNil()
|
||||||
assert.Bytes(address.GetIp()).Equals([]byte{8, 8, 8, 8})
|
assert.Bytes(address.GetIp()).Equals([]byte{8, 8, 8, 8})
|
||||||
@ -24,7 +24,7 @@ func TestDomainParsing(t *testing.T) {
|
|||||||
assert := assert.On(t)
|
assert := assert.On(t)
|
||||||
|
|
||||||
rawJson := "\"v2ray.com\""
|
rawJson := "\"v2ray.com\""
|
||||||
var address AddressPB
|
var address IPOrDomain
|
||||||
err := json.Unmarshal([]byte(rawJson), &address)
|
err := json.Unmarshal([]byte(rawJson), &address)
|
||||||
assert.Error(err).IsNil()
|
assert.Error(err).IsNil()
|
||||||
assert.String(address.GetDomain()).Equals("v2ray.com")
|
assert.String(address.GetDomain()).Equals("v2ray.com")
|
||||||
@ -34,7 +34,7 @@ func TestInvalidAddressJson(t *testing.T) {
|
|||||||
assert := assert.On(t)
|
assert := assert.On(t)
|
||||||
|
|
||||||
rawJson := "1234"
|
rawJson := "1234"
|
||||||
var address AddressPB
|
var address IPOrDomain
|
||||||
err := json.Unmarshal([]byte(rawJson), &address)
|
err := json.Unmarshal([]byte(rawJson), &address)
|
||||||
assert.Error(err).IsNotNil()
|
assert.Error(err).IsNotNil()
|
||||||
}
|
}
|
||||||
|
@ -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)
|
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{
|
return Destination{
|
||||||
Network: this.Network,
|
Network: this.Network,
|
||||||
Address: this.Address.AsAddress(),
|
Address: this.Address.AsAddress(),
|
||||||
|
@ -13,18 +13,18 @@ var _ = proto.Marshal
|
|||||||
var _ = fmt.Errorf
|
var _ = fmt.Errorf
|
||||||
var _ = math.Inf
|
var _ = math.Inf
|
||||||
|
|
||||||
type DestinationPB struct {
|
type Endpoint struct {
|
||||||
Network Network `protobuf:"varint,1,opt,name=network,enum=v2ray.core.common.net.Network" json:"network,omitempty"`
|
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"`
|
Address *IPOrDomain `protobuf:"bytes,2,opt,name=address" json:"address,omitempty"`
|
||||||
Port uint32 `protobuf:"varint,3,opt,name=port" json:"port,omitempty"`
|
Port uint32 `protobuf:"varint,3,opt,name=port" json:"port,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *DestinationPB) Reset() { *m = DestinationPB{} }
|
func (m *Endpoint) Reset() { *m = Endpoint{} }
|
||||||
func (m *DestinationPB) String() string { return proto.CompactTextString(m) }
|
func (m *Endpoint) String() string { return proto.CompactTextString(m) }
|
||||||
func (*DestinationPB) ProtoMessage() {}
|
func (*Endpoint) ProtoMessage() {}
|
||||||
func (*DestinationPB) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{0} }
|
func (*Endpoint) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{0} }
|
||||||
|
|
||||||
func (m *DestinationPB) GetAddress() *AddressPB {
|
func (m *Endpoint) GetAddress() *IPOrDomain {
|
||||||
if m != nil {
|
if m != nil {
|
||||||
return m.Address
|
return m.Address
|
||||||
}
|
}
|
||||||
@ -32,25 +32,25 @@ func (m *DestinationPB) GetAddress() *AddressPB {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
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) }
|
func init() { proto.RegisterFile("v2ray.com/core/common/net/destination.proto", fileDescriptor1) }
|
||||||
|
|
||||||
var fileDescriptor1 = []byte{
|
var fileDescriptor1 = []byte{
|
||||||
// 209 bytes of a gzipped FileDescriptorProto
|
// 219 bytes of a gzipped FileDescriptorProto
|
||||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0xd2, 0x2e, 0x33, 0x2a, 0x4a,
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x7c, 0x90, 0x31, 0x4b, 0x04, 0x31,
|
||||||
0xac, 0xd4, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xce, 0x2f, 0x4a, 0xd5, 0x4f, 0xce, 0xcf, 0xcd, 0xcd,
|
0x10, 0x46, 0x89, 0x27, 0x9e, 0x44, 0x14, 0x09, 0x08, 0xab, 0x85, 0xac, 0x36, 0x2e, 0x08, 0x09,
|
||||||
0xcf, 0xd3, 0xcf, 0x4b, 0x2d, 0xd1, 0x4f, 0x49, 0x2d, 0x2e, 0xc9, 0xcc, 0x4b, 0x2c, 0xc9, 0xcc,
|
0xc4, 0x46, 0xb0, 0x3b, 0xce, 0xc2, 0x46, 0x8f, 0x2d, 0xed, 0x62, 0x32, 0x45, 0x90, 0xcc, 0x2c,
|
||||||
0xcf, 0xd3, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x85, 0x29, 0x2e, 0x4a, 0xd5, 0x83, 0x28,
|
0xb3, 0x83, 0xe2, 0x0f, 0xf1, 0xff, 0x8a, 0x97, 0x5b, 0x6c, 0xee, 0xec, 0x52, 0xbc, 0xf7, 0xc8,
|
||||||
0xd4, 0xcb, 0x4b, 0x2d, 0x91, 0x52, 0xc7, 0x6d, 0x46, 0x5e, 0x6a, 0x49, 0x79, 0x7e, 0x51, 0x36,
|
0x37, 0xfa, 0xf6, 0xc3, 0x73, 0xf8, 0xb2, 0x91, 0x8a, 0x8b, 0xc4, 0xe0, 0x22, 0x95, 0x42, 0xe8,
|
||||||
0x44, 0x3f, 0x3e, 0x85, 0x89, 0x29, 0x29, 0x45, 0xa9, 0xc5, 0xc5, 0x10, 0x85, 0x4a, 0x33, 0x19,
|
0x10, 0xc4, 0x25, 0x18, 0x25, 0x63, 0x90, 0x4c, 0x68, 0x07, 0x26, 0x21, 0x73, 0x36, 0xc1, 0x0c,
|
||||||
0xb9, 0x78, 0x5d, 0x10, 0xd6, 0x07, 0x38, 0x09, 0x59, 0x70, 0xb1, 0x43, 0xcd, 0x92, 0x60, 0x54,
|
0xb6, 0x82, 0x16, 0x41, 0x2e, 0x6e, 0x76, 0x37, 0x10, 0xe4, 0x93, 0xf8, 0xbd, 0xfa, 0xff, 0x81,
|
||||||
0x60, 0xd4, 0xe0, 0x33, 0x92, 0xd3, 0xc3, 0xea, 0x18, 0x3d, 0x3f, 0x88, 0xaa, 0x20, 0x98, 0x72,
|
0x21, 0x25, 0x86, 0x71, 0xac, 0xe0, 0xf5, 0xb7, 0xd2, 0x87, 0x8f, 0x98, 0x06, 0xca, 0x28, 0xe6,
|
||||||
0x21, 0x2b, 0x2e, 0x76, 0xa8, 0xe1, 0x12, 0x4c, 0x0a, 0x8c, 0x1a, 0xdc, 0x46, 0x0a, 0x38, 0x74,
|
0x5e, 0xcf, 0x37, 0x99, 0x46, 0xb5, 0xaa, 0x3b, 0xf1, 0x97, 0x76, 0xeb, 0x3f, 0xec, 0x73, 0xa5,
|
||||||
0x3a, 0x42, 0x54, 0x05, 0x38, 0x05, 0xc1, 0x34, 0x08, 0x09, 0x71, 0xb1, 0x14, 0xe4, 0x17, 0x95,
|
0xfa, 0x09, 0x37, 0x0f, 0x7a, 0xbe, 0xe9, 0x36, 0x7b, 0xad, 0xea, 0x8e, 0xfc, 0xd5, 0x0e, 0xf3,
|
||||||
0x48, 0x30, 0x2b, 0x30, 0x6a, 0xf0, 0x06, 0x81, 0xd9, 0x4e, 0x46, 0x5c, 0x92, 0xc9, 0xf9, 0xb9,
|
0x69, 0xf5, 0xc2, 0x4b, 0x2a, 0x21, 0x63, 0x3f, 0x19, 0xc6, 0xe8, 0xfd, 0x81, 0x58, 0x9a, 0x59,
|
||||||
0xd8, 0xcd, 0x70, 0x12, 0x40, 0x76, 0x35, 0xc8, 0x2b, 0x51, 0xcc, 0x79, 0xa9, 0x25, 0x49, 0x6c,
|
0xab, 0xba, 0xe3, 0x7e, 0xfd, 0x5e, 0x78, 0x7d, 0x1e, 0xa9, 0x6c, 0x8f, 0x2c, 0x4e, 0x97, 0x7f,
|
||||||
0x60, 0x6f, 0x19, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0xe2, 0xd7, 0x78, 0x9a, 0x6e, 0x01, 0x00,
|
0x07, 0x5b, 0xfd, 0xce, 0x78, 0x9d, 0x21, 0xc8, 0xdb, 0xc1, 0x7a, 0xd2, 0xdd, 0x4f, 0x00, 0x00,
|
||||||
0x00,
|
0x00, 0xff, 0xff, 0x97, 0xbf, 0x9f, 0x8e, 0x6a, 0x01, 0x00, 0x00,
|
||||||
}
|
}
|
||||||
|
@ -8,8 +8,8 @@ option java_outer_classname = "DestinationProto";
|
|||||||
import "v2ray.com/core/common/net/network.proto";
|
import "v2ray.com/core/common/net/network.proto";
|
||||||
import "v2ray.com/core/common/net/address.proto";
|
import "v2ray.com/core/common/net/address.proto";
|
||||||
|
|
||||||
message DestinationPB {
|
message Endpoint {
|
||||||
Network network = 1;
|
Network network = 1;
|
||||||
AddressPB address = 2;
|
IPOrDomain address = 2;
|
||||||
uint32 port = 3;
|
uint32 port = 3;
|
||||||
}
|
}
|
@ -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))
|
dest := v2net.TCPDestination(spec.Address.AsAddress(), v2net.Port(spec.Port))
|
||||||
return NewServerSpec(newAccount, dest, AlwaysValid(), spec.User...)
|
return NewServerSpec(newAccount, dest, AlwaysValid(), spec.User...)
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ It is generated from these files:
|
|||||||
v2ray.com/core/common/protocol/user.proto
|
v2ray.com/core/common/protocol/user.proto
|
||||||
|
|
||||||
It has these top-level messages:
|
It has these top-level messages:
|
||||||
ServerSpecPB
|
ServerEndpoint
|
||||||
User
|
User
|
||||||
*/
|
*/
|
||||||
package protocol
|
package protocol
|
||||||
@ -31,25 +31,25 @@ var _ = math.Inf
|
|||||||
// proto package needs to be updated.
|
// proto package needs to be updated.
|
||||||
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
|
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
|
||||||
|
|
||||||
type ServerSpecPB struct {
|
type ServerEndpoint 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"`
|
Port uint32 `protobuf:"varint,2,opt,name=port" json:"port,omitempty"`
|
||||||
User []*User `protobuf:"bytes,3,rep,name=user" json:"user,omitempty"`
|
User []*User `protobuf:"bytes,3,rep,name=user" json:"user,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *ServerSpecPB) Reset() { *m = ServerSpecPB{} }
|
func (m *ServerEndpoint) Reset() { *m = ServerEndpoint{} }
|
||||||
func (m *ServerSpecPB) String() string { return proto.CompactTextString(m) }
|
func (m *ServerEndpoint) String() string { return proto.CompactTextString(m) }
|
||||||
func (*ServerSpecPB) ProtoMessage() {}
|
func (*ServerEndpoint) ProtoMessage() {}
|
||||||
func (*ServerSpecPB) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
|
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 {
|
if m != nil {
|
||||||
return m.Address
|
return m.Address
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *ServerSpecPB) GetUser() []*User {
|
func (m *ServerEndpoint) GetUser() []*User {
|
||||||
if m != nil {
|
if m != nil {
|
||||||
return m.User
|
return m.User
|
||||||
}
|
}
|
||||||
@ -57,25 +57,26 @@ func (m *ServerSpecPB) GetUser() []*User {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
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) }
|
func init() { proto.RegisterFile("v2ray.com/core/common/protocol/server_spec.proto", fileDescriptor0) }
|
||||||
|
|
||||||
var fileDescriptor0 = []byte{
|
var fileDescriptor0 = []byte{
|
||||||
// 216 bytes of a gzipped FileDescriptorProto
|
// 230 bytes of a gzipped FileDescriptorProto
|
||||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x84, 0x8e, 0x3f, 0x4b, 0xc7, 0x30,
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x84, 0x8f, 0x3d, 0x4b, 0x04, 0x31,
|
||||||
0x10, 0x86, 0x89, 0xbf, 0xa2, 0x12, 0x15, 0x21, 0x53, 0xe9, 0x20, 0xc1, 0xc5, 0xba, 0x24, 0x52,
|
0x10, 0x86, 0x59, 0xef, 0x50, 0xc9, 0xa1, 0x42, 0xaa, 0x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0x49, 0x1e, 0xbe, 0xf1, 0x68, 0xd6, 0x93,
|
||||||
0x30, 0xc6, 0x1e, 0xae, 0x7e, 0x01, 0x00, 0x00,
|
0xf6, 0x74, 0x58, 0x9e, 0x5e, 0xf6, 0xd3, 0x75, 0xfd, 0x19, 0x00, 0x00, 0xff, 0xff, 0xbd, 0x28,
|
||||||
|
0xb3, 0x3a, 0x81, 0x01, 0x00, 0x00,
|
||||||
}
|
}
|
||||||
|
@ -8,8 +8,8 @@ option java_outer_classname = "ServerSpecProto";
|
|||||||
import "v2ray.com/core/common/net/address.proto";
|
import "v2ray.com/core/common/net/address.proto";
|
||||||
import "v2ray.com/core/common/protocol/user.proto";
|
import "v2ray.com/core/common/protocol/user.proto";
|
||||||
|
|
||||||
message ServerSpecPB {
|
message ServerEndpoint {
|
||||||
v2ray.core.common.net.AddressPB address = 1;
|
v2ray.core.common.net.IPOrDomain address = 1;
|
||||||
uint32 port = 2;
|
uint32 port = 2;
|
||||||
repeated v2ray.core.common.protocol.User user = 3;
|
repeated v2ray.core.common.protocol.User user = 3;
|
||||||
}
|
}
|
13
config.proto
Normal file
13
config.proto
Normal 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;
|
||||||
|
|
||||||
|
}
|
@ -53,10 +53,10 @@ func (this *Config) UnmarshalJSON(data []byte) error {
|
|||||||
this.OutboundDetours = jsonConfig.OutboundDetours
|
this.OutboundDetours = jsonConfig.OutboundDetours
|
||||||
if jsonConfig.DNSConfig == nil {
|
if jsonConfig.DNSConfig == nil {
|
||||||
jsonConfig.DNSConfig = &dns.Config{
|
jsonConfig.DNSConfig = &dns.Config{
|
||||||
NameServers: []*v2net.DestinationPB{{
|
NameServers: []*v2net.Endpoint{{
|
||||||
Network: v2net.Network_UDP,
|
Network: v2net.Network_UDP,
|
||||||
Address: &v2net.AddressPB{
|
Address: &v2net.IPOrDomain{
|
||||||
Address: &v2net.AddressPB_Domain{
|
Address: &v2net.IPOrDomain_Domain{
|
||||||
Domain: "localhost",
|
Domain: "localhost",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -72,7 +72,7 @@ func (this *Config) UnmarshalJSON(data []byte) error {
|
|||||||
func (this *InboundConnectionConfig) UnmarshalJSON(data []byte) error {
|
func (this *InboundConnectionConfig) UnmarshalJSON(data []byte) error {
|
||||||
type JsonConfig struct {
|
type JsonConfig struct {
|
||||||
Port uint16 `json:"port"`
|
Port uint16 `json:"port"`
|
||||||
Listen *v2net.AddressPB `json:"listen"`
|
Listen *v2net.IPOrDomain `json:"listen"`
|
||||||
Protocol string `json:"protocol"`
|
Protocol string `json:"protocol"`
|
||||||
StreamSetting *internet.StreamConfig `json:"streamSettings"`
|
StreamSetting *internet.StreamConfig `json:"streamSettings"`
|
||||||
Settings json.RawMessage `json:"settings"`
|
Settings json.RawMessage `json:"settings"`
|
||||||
@ -104,7 +104,7 @@ func (this *InboundConnectionConfig) UnmarshalJSON(data []byte) error {
|
|||||||
func (this *OutboundConnectionConfig) UnmarshalJSON(data []byte) error {
|
func (this *OutboundConnectionConfig) UnmarshalJSON(data []byte) error {
|
||||||
type JsonConnectionConfig struct {
|
type JsonConnectionConfig struct {
|
||||||
Protocol string `json:"protocol"`
|
Protocol string `json:"protocol"`
|
||||||
SendThrough *v2net.AddressPB `json:"sendThrough"`
|
SendThrough *v2net.IPOrDomain `json:"sendThrough"`
|
||||||
StreamSetting *internet.StreamConfig `json:"streamSettings"`
|
StreamSetting *internet.StreamConfig `json:"streamSettings"`
|
||||||
Settings json.RawMessage `json:"settings"`
|
Settings json.RawMessage `json:"settings"`
|
||||||
}
|
}
|
||||||
@ -159,7 +159,7 @@ func (this *InboundDetourConfig) UnmarshalJSON(data []byte) error {
|
|||||||
type JsonInboundDetourConfig struct {
|
type JsonInboundDetourConfig struct {
|
||||||
Protocol string `json:"protocol"`
|
Protocol string `json:"protocol"`
|
||||||
PortRange *v2net.PortRange `json:"port"`
|
PortRange *v2net.PortRange `json:"port"`
|
||||||
ListenOn *v2net.AddressPB `json:"listen"`
|
ListenOn *v2net.IPOrDomain `json:"listen"`
|
||||||
Settings json.RawMessage `json:"settings"`
|
Settings json.RawMessage `json:"settings"`
|
||||||
Tag string `json:"tag"`
|
Tag string `json:"tag"`
|
||||||
Allocation *InboundDetourAllocationConfig `json:"allocate"`
|
Allocation *InboundDetourAllocationConfig `json:"allocate"`
|
||||||
@ -202,7 +202,7 @@ func (this *InboundDetourConfig) UnmarshalJSON(data []byte) error {
|
|||||||
func (this *OutboundDetourConfig) UnmarshalJSON(data []byte) error {
|
func (this *OutboundDetourConfig) UnmarshalJSON(data []byte) error {
|
||||||
type JsonOutboundDetourConfig struct {
|
type JsonOutboundDetourConfig struct {
|
||||||
Protocol string `json:"protocol"`
|
Protocol string `json:"protocol"`
|
||||||
SendThrough *v2net.AddressPB `json:"sendThrough"`
|
SendThrough *v2net.IPOrDomain `json:"sendThrough"`
|
||||||
Tag string `json:"tag"`
|
Tag string `json:"tag"`
|
||||||
Settings json.RawMessage `json:"settings"`
|
Settings json.RawMessage `json:"settings"`
|
||||||
StreamSetting *internet.StreamConfig `json:"streamSettings"`
|
StreamSetting *internet.StreamConfig `json:"streamSettings"`
|
||||||
|
@ -31,7 +31,7 @@ var _ = math.Inf
|
|||||||
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
|
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
|
||||||
|
|
||||||
type Config struct {
|
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"`
|
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"`
|
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"`
|
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) ProtoMessage() {}
|
||||||
func (*Config) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
|
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 {
|
if m != nil {
|
||||||
return m.Address
|
return m.Address
|
||||||
}
|
}
|
||||||
@ -64,22 +64,23 @@ func init() {
|
|||||||
func init() { proto.RegisterFile("v2ray.com/core/proxy/dokodemo/config.proto", fileDescriptor0) }
|
func init() { proto.RegisterFile("v2ray.com/core/proxy/dokodemo/config.proto", fileDescriptor0) }
|
||||||
|
|
||||||
var fileDescriptor0 = []byte{
|
var fileDescriptor0 = []byte{
|
||||||
// 269 bytes of a gzipped FileDescriptorProto
|
// 275 bytes of a gzipped FileDescriptorProto
|
||||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x7c, 0x90, 0x4d, 0x4b, 0xc3, 0x40,
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x7c, 0x90, 0x4f, 0x4b, 0x33, 0x31,
|
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||||||
0xb5, 0x5c, 0x4c, 0xfc, 0xcf, 0x20, 0x95, 0x18, 0x71, 0xe5, 0x00, 0xdf, 0x58, 0x0d, 0x82, 0xbd,
|
0x76, 0x58, 0x1f, 0x22, 0x7a, 0x6f, 0x5b, 0x2a, 0x52, 0xff, 0x3d, 0x70, 0xc1, 0x46, 0x64, 0x9d,
|
||||||
0x1f, 0xe5, 0x4c, 0x9c, 0xad, 0xb1, 0xae, 0x71, 0xbb, 0x24, 0x28, 0x2b, 0x02, 0xcb, 0xea, 0x28,
|
0x81, 0x57, 0x12, 0x83, 0x60, 0xef, 0x47, 0x3e, 0x65, 0x47, 0x2b, 0xa8, 0x6b, 0xd8, 0x2c, 0xd1,
|
||||||
0x4d, 0xb2, 0x71, 0x71, 0x1a, 0xe3, 0xa2, 0x4b, 0xf3, 0x1b, 0x71, 0x69, 0xd1, 0xe9, 0xbd, 0xbd,
|
0x54, 0x16, 0x8d, 0x26, 0xb1, 0x97, 0x25, 0xf9, 0xb8, 0x38, 0x8c, 0x71, 0xd1, 0xa5, 0xf3, 0x4b,
|
||||||
0xe6, 0x93, 0x58, 0xc1, 0xe2, 0xbb, 0x92, 0xe7, 0x71, 0x1f, 0xbf, 0x0c, 0x43, 0x47, 0xd7, 0x5f,
|
0x76, 0xaa, 0xc1, 0xc9, 0x9d, 0xc5, 0xce, 0xd3, 0xd8, 0xc1, 0xe2, 0xab, 0x93, 0xa7, 0x71, 0x1f,
|
||||||
0x01, 0x00, 0x00, 0xff, 0xff, 0xf0, 0xa7, 0xda, 0x7b, 0xbe, 0x01, 0x00, 0x00,
|
0x3f, 0x0f, 0x43, 0x49, 0x17, 0x9f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x21, 0x97, 0x31, 0xca, 0xbf,
|
||||||
|
0x01, 0x00, 0x00,
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ import "v2ray.com/core/common/net/address.proto";
|
|||||||
import "v2ray.com/core/common/net/network.proto";
|
import "v2ray.com/core/common/net/network.proto";
|
||||||
|
|
||||||
message Config {
|
message Config {
|
||||||
v2ray.core.common.net.AddressPB address = 1;
|
v2ray.core.common.net.IPOrDomain address = 1;
|
||||||
uint32 port = 2;
|
uint32 port = 2;
|
||||||
v2ray.core.common.net.NetworkList network_list = 3;
|
v2ray.core.common.net.NetworkList network_list = 3;
|
||||||
uint32 timeout = 4;
|
uint32 timeout = 4;
|
||||||
|
@ -12,7 +12,7 @@ import (
|
|||||||
|
|
||||||
func (this *Config) UnmarshalJSON(data []byte) error {
|
func (this *Config) UnmarshalJSON(data []byte) error {
|
||||||
type DokodemoConfig struct {
|
type DokodemoConfig struct {
|
||||||
Host *v2net.AddressPB `json:"address"`
|
Host *v2net.IPOrDomain `json:"address"`
|
||||||
PortValue v2net.Port `json:"port"`
|
PortValue v2net.Port `json:"port"`
|
||||||
NetworkList *v2net.NetworkList `json:"network"`
|
NetworkList *v2net.NetworkList `json:"network"`
|
||||||
TimeoutValue uint32 `json:"timeout"`
|
TimeoutValue uint32 `json:"timeout"`
|
||||||
|
@ -54,8 +54,8 @@ func TestDokodemoTCP(t *testing.T) {
|
|||||||
|
|
||||||
port := v2net.Port(dice.Roll(20000) + 10000)
|
port := v2net.Port(dice.Roll(20000) + 10000)
|
||||||
dokodemo := NewDokodemoDoor(&Config{
|
dokodemo := NewDokodemoDoor(&Config{
|
||||||
Address: &v2net.AddressPB{
|
Address: &v2net.IPOrDomain{
|
||||||
Address: &v2net.AddressPB_Ip{
|
Address: &v2net.IPOrDomain_Ip{
|
||||||
Ip: v2net.LocalHostIP.IP(),
|
Ip: v2net.LocalHostIP.IP(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -128,8 +128,8 @@ func TestDokodemoUDP(t *testing.T) {
|
|||||||
|
|
||||||
port := v2net.Port(dice.Roll(20000) + 10000)
|
port := v2net.Port(dice.Roll(20000) + 10000)
|
||||||
dokodemo := NewDokodemoDoor(&Config{
|
dokodemo := NewDokodemoDoor(&Config{
|
||||||
Address: &v2net.AddressPB{
|
Address: &v2net.IPOrDomain{
|
||||||
Address: &v2net.AddressPB_Ip{
|
Address: &v2net.IPOrDomain_Ip{
|
||||||
Ip: v2net.LocalHostIP.IP(),
|
Ip: v2net.LocalHostIP.IP(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -88,9 +88,9 @@ func TestIPResolution(t *testing.T) {
|
|||||||
r := router.NewRouter(&router.Config{}, space)
|
r := router.NewRouter(&router.Config{}, space)
|
||||||
space.BindApp(router.APP_ID, r)
|
space.BindApp(router.APP_ID, r)
|
||||||
dnsServer := dns.NewCacheServer(space, &dns.Config{
|
dnsServer := dns.NewCacheServer(space, &dns.Config{
|
||||||
Hosts: map[string]*v2net.AddressPB{
|
Hosts: map[string]*v2net.IPOrDomain{
|
||||||
"v2ray.com": &v2net.AddressPB{
|
"v2ray.com": &v2net.IPOrDomain{
|
||||||
Address: &v2net.AddressPB_Ip{
|
Address: &v2net.IPOrDomain_Ip{
|
||||||
Ip: []byte{127, 0, 0, 1},
|
Ip: []byte{127, 0, 0, 1},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -90,7 +90,7 @@ func (m *ServerConfig) GetUser() *v2ray_core_common_protocol.User {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ClientConfig struct {
|
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{} }
|
func (m *ClientConfig) Reset() { *m = ClientConfig{} }
|
||||||
@ -98,7 +98,7 @@ func (m *ClientConfig) String() string { return proto.CompactTextStri
|
|||||||
func (*ClientConfig) ProtoMessage() {}
|
func (*ClientConfig) ProtoMessage() {}
|
||||||
func (*ClientConfig) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }
|
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 {
|
if m != nil {
|
||||||
return m.Server
|
return m.Server
|
||||||
}
|
}
|
||||||
@ -115,29 +115,29 @@ func init() {
|
|||||||
func init() { proto.RegisterFile("v2ray.com/core/proxy/shadowsocks/config.proto", fileDescriptor0) }
|
func init() { proto.RegisterFile("v2ray.com/core/proxy/shadowsocks/config.proto", fileDescriptor0) }
|
||||||
|
|
||||||
var fileDescriptor0 = []byte{
|
var fileDescriptor0 = []byte{
|
||||||
// 370 bytes of a gzipped FileDescriptorProto
|
// 371 bytes of a gzipped FileDescriptorProto
|
||||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x84, 0x50, 0xdd, 0xaf, 0xd2, 0x30,
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x84, 0x50, 0xdd, 0xab, 0xd3, 0x30,
|
||||||
0x14, 0x77, 0xf7, 0xde, 0x5c, 0xf0, 0x14, 0x75, 0xf6, 0x89, 0x10, 0x13, 0x17, 0x9e, 0xa6, 0x89,
|
0x14, 0xb7, 0xf7, 0x5e, 0xee, 0x9d, 0x27, 0x53, 0x6b, 0x9e, 0xc6, 0x10, 0x2c, 0x7b, 0xaa, 0x17,
|
||||||
0x1d, 0xce, 0x8f, 0xf8, 0xe0, 0x83, 0xdb, 0x02, 0x81, 0x98, 0x20, 0x19, 0x10, 0x13, 0x63, 0xb2,
|
0x4c, 0x67, 0xfd, 0xc0, 0x07, 0x5f, 0xda, 0xd2, 0xb1, 0x21, 0x4c, 0xe9, 0x36, 0x04, 0x11, 0x4a,
|
||||||
0x8c, 0xae, 0x0a, 0x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d, 0x07, 0xbd, 0xb8, 0xc2, 0x7d, 0xe8, 0x45, 0xd3, 0x20, 0x9a,
|
||||||
0xfc, 0x81, 0x7d, 0x8b, 0x9f, 0xc2, 0xa3, 0x66, 0x4a, 0x26, 0xc3, 0xd1, 0xc2, 0xbe, 0x0b, 0x3f,
|
0x06, 0xfe, 0xd8, 0xbe, 0xc6, 0xcf, 0xe1, 0x49, 0x37, 0xa5, 0xb3, 0x78, 0xb2, 0xb4, 0x6f, 0xc2,
|
||||||
0x82, 0x43, 0x79, 0x7e, 0xf5, 0xa2, 0x21, 0x32, 0x5d, 0x66, 0x87, 0x98, 0xdf, 0xd0, 0xd9, 0xcf,
|
0x4f, 0xe0, 0x50, 0x5e, 0x5e, 0xbc, 0x69, 0x88, 0x4c, 0x9b, 0xaf, 0x87, 0xa0, 0xdf, 0xd1, 0xd9,
|
||||||
0xea, 0x5e, 0x47, 0x7f, 0xf3, 0x27, 0x00, 0x00, 0xff, 0xff, 0x62, 0xda, 0x5c, 0xcd, 0x79, 0x02,
|
0xcf, 0xfa, 0x56, 0x87, 0x7f, 0xfb, 0x37, 0x00, 0x00, 0xff, 0xff, 0xff, 0xed, 0x11, 0xa8, 0x7b,
|
||||||
0x00, 0x00,
|
0x02, 0x00, 0x00,
|
||||||
}
|
}
|
||||||
|
@ -27,5 +27,5 @@ message ServerConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
message ClientConfig {
|
message ClientConfig {
|
||||||
repeated v2ray.core.common.protocol.ServerSpecPB server = 1;
|
repeated v2ray.core.common.protocol.ServerEndpoint server = 1;
|
||||||
}
|
}
|
@ -61,7 +61,7 @@ func (this *ServerConfig) UnmarshalJSON(data []byte) error {
|
|||||||
AuthMethod string `json:"auth"`
|
AuthMethod string `json:"auth"`
|
||||||
Accounts []*Account `json:"accounts"`
|
Accounts []*Account `json:"accounts"`
|
||||||
UDP bool `json:"udp"`
|
UDP bool `json:"udp"`
|
||||||
Host *v2net.AddressPB `json:"ip"`
|
Host *v2net.IPOrDomain `json:"ip"`
|
||||||
Timeout uint32 `json:"timeout"`
|
Timeout uint32 `json:"timeout"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,11 +64,11 @@ func (*Account) ProtoMessage() {}
|
|||||||
func (*Account) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
|
func (*Account) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
|
||||||
|
|
||||||
type ServerConfig struct {
|
type ServerConfig struct {
|
||||||
AuthType AuthType `protobuf:"varint,1,opt,name=auth_type,json=authType,enum=v2ray.core.proxy.socks.AuthType" json:"auth_type,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"`
|
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"`
|
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"`
|
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"`
|
Timeout uint32 `protobuf:"varint,5,opt,name=timeout" json:"timeout,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *ServerConfig) Reset() { *m = ServerConfig{} }
|
func (m *ServerConfig) Reset() { *m = ServerConfig{} }
|
||||||
@ -83,7 +83,7 @@ func (m *ServerConfig) GetAccounts() map[string]string {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *ServerConfig) GetAddress() *v2ray_core_common_net.AddressPB {
|
func (m *ServerConfig) GetAddress() *v2ray_core_common_net.IPOrDomain {
|
||||||
if m != nil {
|
if m != nil {
|
||||||
return m.Address
|
return m.Address
|
||||||
}
|
}
|
||||||
@ -91,7 +91,7 @@ func (m *ServerConfig) GetAddress() *v2ray_core_common_net.AddressPB {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ClientConfig struct {
|
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{} }
|
func (m *ClientConfig) Reset() { *m = ClientConfig{} }
|
||||||
@ -99,7 +99,7 @@ func (m *ClientConfig) String() string { return proto.CompactTextStri
|
|||||||
func (*ClientConfig) ProtoMessage() {}
|
func (*ClientConfig) ProtoMessage() {}
|
||||||
func (*ClientConfig) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }
|
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 {
|
if m != nil {
|
||||||
return m.Server
|
return m.Server
|
||||||
}
|
}
|
||||||
@ -116,32 +116,33 @@ func init() {
|
|||||||
func init() { proto.RegisterFile("v2ray.com/core/proxy/socks/config.proto", fileDescriptor0) }
|
func init() { proto.RegisterFile("v2ray.com/core/proxy/socks/config.proto", fileDescriptor0) }
|
||||||
|
|
||||||
var fileDescriptor0 = []byte{
|
var fileDescriptor0 = []byte{
|
||||||
// 428 bytes of a gzipped FileDescriptorProto
|
// 435 bytes of a gzipped FileDescriptorProto
|
||||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x74, 0x91, 0x51, 0x6b, 0xdb, 0x30,
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x74, 0x91, 0x51, 0x6f, 0xd3, 0x30,
|
||||||
0x10, 0xc7, 0xe7, 0x64, 0x69, 0xdc, 0x73, 0x3a, 0x82, 0x18, 0xc3, 0xf8, 0x65, 0x26, 0x30, 0x66,
|
0x10, 0xc7, 0x49, 0x4b, 0xd7, 0xec, 0xd2, 0xa1, 0xca, 0x42, 0x28, 0xca, 0x0b, 0xa1, 0x12, 0x22,
|
||||||
0xf6, 0x20, 0x97, 0xec, 0x65, 0x74, 0x0c, 0xe6, 0x74, 0x85, 0x3d, 0xb5, 0xc6, 0xe9, 0x18, 0xec,
|
0xda, 0x83, 0x33, 0x85, 0x17, 0xc4, 0xc4, 0x43, 0xba, 0x55, 0x82, 0x97, 0xb5, 0x72, 0x87, 0x90,
|
||||||
0x25, 0xa8, 0xf2, 0x6d, 0x0d, 0xb5, 0x25, 0x21, 0xc9, 0xd9, 0xfc, 0x31, 0xf7, 0x8d, 0x46, 0x2c,
|
0x78, 0xa9, 0x3c, 0xc7, 0xb0, 0x68, 0x8d, 0x6d, 0xd9, 0x4e, 0x21, 0x5f, 0x93, 0x4f, 0x84, 0x1a,
|
||||||
0xbb, 0xac, 0x25, 0x7d, 0xd3, 0xe9, 0xfe, 0xf7, 0xbf, 0xbb, 0xdf, 0xc1, 0xdb, 0xdd, 0x52, 0xb3,
|
0x27, 0xd3, 0x40, 0xed, 0x9b, 0xcf, 0x77, 0xf7, 0xbf, 0xfb, 0xff, 0x0e, 0xde, 0xed, 0x32, 0x4d,
|
||||||
0x96, 0x72, 0x59, 0xa7, 0x5c, 0x6a, 0x4c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11 +21,11 @@ enum AuthType {
|
|||||||
message ServerConfig {
|
message ServerConfig {
|
||||||
AuthType auth_type = 1;
|
AuthType auth_type = 1;
|
||||||
map<string, string> accounts = 2;
|
map<string, string> accounts = 2;
|
||||||
v2ray.core.common.net.AddressPB address = 3;
|
v2ray.core.common.net.IPOrDomain address = 3;
|
||||||
bool udp_enabled = 4;
|
bool udp_enabled = 4;
|
||||||
uint32 timeout = 5;
|
uint32 timeout = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
message ClientConfig {
|
message ClientConfig {
|
||||||
repeated v2ray.core.common.protocol.ServerSpecPB server = 1;
|
repeated v2ray.core.common.protocol.ServerEndpoint server = 1;
|
||||||
}
|
}
|
@ -27,7 +27,7 @@ func (this *Account) UnmarshalJSON(data []byte) error {
|
|||||||
|
|
||||||
func (this *ClientConfig) UnmarshalJSON(data []byte) error {
|
func (this *ClientConfig) UnmarshalJSON(data []byte) error {
|
||||||
type ServerConfig struct {
|
type ServerConfig struct {
|
||||||
Address *v2net.AddressPB `json:"address"`
|
Address *v2net.IPOrDomain `json:"address"`
|
||||||
Port v2net.Port `json:"port"`
|
Port v2net.Port `json:"port"`
|
||||||
Users []json.RawMessage `json:"users"`
|
Users []json.RawMessage `json:"users"`
|
||||||
}
|
}
|
||||||
@ -38,9 +38,9 @@ func (this *ClientConfig) UnmarshalJSON(data []byte) error {
|
|||||||
if err := json.Unmarshal(data, jsonConfig); err != nil {
|
if err := json.Unmarshal(data, jsonConfig); err != nil {
|
||||||
return errors.New("Socks|Client: Failed to parse config: " + err.Error())
|
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 {
|
for idx, serverConfig := range jsonConfig.Servers {
|
||||||
server := &protocol.ServerSpecPB{
|
server := &protocol.ServerEndpoint{
|
||||||
Address: serverConfig.Address,
|
Address: serverConfig.Address,
|
||||||
Port: uint32(serverConfig.Port),
|
Port: uint32(serverConfig.Port),
|
||||||
}
|
}
|
||||||
|
@ -7,24 +7,24 @@ import (
|
|||||||
"v2ray.com/core/common/uuid"
|
"v2ray.com/core/common/uuid"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Account struct {
|
type InternalAccount struct {
|
||||||
ID *protocol.ID
|
ID *protocol.ID
|
||||||
AlterIDs []*protocol.ID
|
AlterIDs []*protocol.ID
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewAccount() protocol.AsAccount {
|
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 {
|
if len(this.AlterIDs) == 0 {
|
||||||
return this.ID
|
return this.ID
|
||||||
}
|
}
|
||||||
return this.AlterIDs[dice.Roll(len(this.AlterIDs))]
|
return this.AlterIDs[dice.Roll(len(this.AlterIDs))]
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Account) Equals(account protocol.Account) bool {
|
func (this *InternalAccount) Equals(account protocol.Account) bool {
|
||||||
vmessAccount, ok := account.(*Account)
|
vmessAccount, ok := account.(*InternalAccount)
|
||||||
if !ok {
|
if !ok {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@ -32,14 +32,14 @@ func (this *Account) Equals(account protocol.Account) bool {
|
|||||||
return this.ID.Equals(vmessAccount.ID)
|
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)
|
id, err := uuid.ParseString(this.Id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("VMess: Failed to parse ID: ", err)
|
log.Error("VMess: Failed to parse ID: ", err)
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
protoId := protocol.NewID(id)
|
protoId := protocol.NewID(id)
|
||||||
return &Account{
|
return &InternalAccount{
|
||||||
ID: protoId,
|
ID: protoId,
|
||||||
AlterIDs: protocol.NewAlterIDs(protoId, uint16(this.AlterId)),
|
AlterIDs: protocol.NewAlterIDs(protoId, uint16(this.AlterId)),
|
||||||
}, nil
|
}, nil
|
||||||
|
@ -9,7 +9,7 @@ It is generated from these files:
|
|||||||
v2ray.com/core/proxy/vmess/account.proto
|
v2ray.com/core/proxy/vmess/account.proto
|
||||||
|
|
||||||
It has these top-level messages:
|
It has these top-level messages:
|
||||||
AccountPB
|
Account
|
||||||
*/
|
*/
|
||||||
package vmess
|
package vmess
|
||||||
|
|
||||||
@ -28,32 +28,32 @@ var _ = math.Inf
|
|||||||
// proto package needs to be updated.
|
// proto package needs to be updated.
|
||||||
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
|
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"`
|
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"`
|
AlterId uint32 `protobuf:"varint,2,opt,name=alter_id,json=alterId" json:"alter_id,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *AccountPB) Reset() { *m = AccountPB{} }
|
func (m *Account) Reset() { *m = Account{} }
|
||||||
func (m *AccountPB) String() string { return proto.CompactTextString(m) }
|
func (m *Account) String() string { return proto.CompactTextString(m) }
|
||||||
func (*AccountPB) ProtoMessage() {}
|
func (*Account) ProtoMessage() {}
|
||||||
func (*AccountPB) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
|
func (*Account) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
|
||||||
|
|
||||||
func init() {
|
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) }
|
func init() { proto.RegisterFile("v2ray.com/core/proxy/vmess/account.proto", fileDescriptor0) }
|
||||||
|
|
||||||
var fileDescriptor0 = []byte{
|
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,
|
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,
|
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,
|
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,
|
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,
|
0x52, 0x32, 0xe1, 0x62, 0x77, 0x84, 0x28, 0x14, 0xe2, 0xe3, 0x62, 0xca, 0x4c, 0x91, 0x60, 0x54,
|
||||||
0x60, 0x54, 0x60, 0xd4, 0xe0, 0x0c, 0x62, 0xca, 0x4c, 0x11, 0x92, 0xe4, 0xe2, 0x48, 0xcc, 0x29,
|
0x60, 0xd4, 0xe0, 0x0c, 0x62, 0xca, 0x4c, 0x11, 0x92, 0xe4, 0xe2, 0x48, 0xcc, 0x29, 0x49, 0x2d,
|
||||||
0x49, 0x2d, 0x8a, 0xcf, 0x4c, 0x91, 0x60, 0x52, 0x60, 0xd4, 0xe0, 0x0d, 0x62, 0x07, 0xf3, 0x3d,
|
0x8a, 0xcf, 0x4c, 0x91, 0x60, 0x52, 0x60, 0xd4, 0xe0, 0x0d, 0x62, 0x07, 0xf3, 0x3d, 0x53, 0x9c,
|
||||||
0x53, 0x9c, 0x0c, 0xb9, 0xa4, 0x92, 0xf3, 0x73, 0xf5, 0xb0, 0x9b, 0xea, 0xc4, 0x03, 0x33, 0x13,
|
0x0c, 0xb9, 0xa4, 0x92, 0xf3, 0x73, 0xf5, 0xb0, 0x9b, 0xe9, 0xc4, 0x03, 0x35, 0x31, 0x00, 0x64,
|
||||||
0x64, 0x77, 0x14, 0x2b, 0x58, 0x30, 0x89, 0x0d, 0xec, 0x12, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff,
|
0x73, 0x14, 0x2b, 0x58, 0x30, 0x89, 0x0d, 0xec, 0x0e, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff,
|
||||||
0xff, 0xe2, 0x1e, 0x29, 0x36, 0xb5, 0x00, 0x00, 0x00,
|
0x4b, 0xb5, 0x6b, 0xdd, 0xb3, 0x00, 0x00, 0x00,
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ option go_package = "vmess";
|
|||||||
option java_package = "com.v2ray.core.proxy.vmess";
|
option java_package = "com.v2ray.core.proxy.vmess";
|
||||||
option java_outer_classname = "AccountProto";
|
option java_outer_classname = "AccountProto";
|
||||||
|
|
||||||
message AccountPB {
|
message Account {
|
||||||
string id = 1;
|
string id = 1;
|
||||||
uint32 alter_id = 2;
|
uint32 alter_id = 2;
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (u *AccountPB) UnmarshalJSON(data []byte) error {
|
func (u *Account) UnmarshalJSON(data []byte) error {
|
||||||
type JsonConfig struct {
|
type JsonConfig struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
AlterIds uint16 `json:"alterId"`
|
AlterIds uint16 `json:"alterId"`
|
||||||
|
@ -52,12 +52,12 @@ func NewClientSession(idHash protocol.IDHash) *ClientSession {
|
|||||||
|
|
||||||
func (this *ClientSession) EncodeRequestHeader(header *protocol.RequestHeader, writer io.Writer) {
|
func (this *ClientSession) EncodeRequestHeader(header *protocol.RequestHeader, writer io.Writer) {
|
||||||
timestamp := protocol.NewTimestampGenerator(protocol.NowTime(), 30)()
|
timestamp := protocol.NewTimestampGenerator(protocol.NowTime(), 30)()
|
||||||
account, err := header.User.GetTypedAccount(&vmess.AccountPB{})
|
account, err := header.User.GetTypedAccount(&vmess.Account{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("VMess: Failed to get user account: ", err)
|
log.Error("VMess: Failed to get user account: ", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
idHash := this.idHash(account.(*vmess.Account).AnyValidID().Bytes())
|
idHash := this.idHash(account.(*vmess.InternalAccount).AnyValidID().Bytes())
|
||||||
idHash.Write(timestamp.Bytes(nil))
|
idHash.Write(timestamp.Bytes(nil))
|
||||||
writer.Write(idHash.Sum(nil))
|
writer.Write(idHash.Sum(nil))
|
||||||
|
|
||||||
@ -88,7 +88,7 @@ func (this *ClientSession) EncodeRequestHeader(header *protocol.RequestHeader, w
|
|||||||
timestampHash := md5.New()
|
timestampHash := md5.New()
|
||||||
timestampHash.Write(hashTimestamp(timestamp))
|
timestampHash.Write(hashTimestamp(timestamp))
|
||||||
iv := timestampHash.Sum(nil)
|
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)
|
aesStream.XORKeyStream(buffer, buffer)
|
||||||
writer.Write(buffer)
|
writer.Write(buffer)
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ func TestRequestSerialization(t *testing.T) {
|
|||||||
Level: 0,
|
Level: 0,
|
||||||
Email: "test@v2ray.com",
|
Email: "test@v2ray.com",
|
||||||
}
|
}
|
||||||
account := &vmess.AccountPB{
|
account := &vmess.Account{
|
||||||
Id: uuid.New().String(),
|
Id: uuid.New().String(),
|
||||||
AlterId: 0,
|
AlterId: 0,
|
||||||
}
|
}
|
||||||
|
@ -59,12 +59,12 @@ func (this *ServerSession) DecodeRequestHeader(reader io.Reader) (*protocol.Requ
|
|||||||
timestampHash := md5.New()
|
timestampHash := md5.New()
|
||||||
timestampHash.Write(hashTimestamp(timestamp))
|
timestampHash.Write(hashTimestamp(timestamp))
|
||||||
iv := timestampHash.Sum(nil)
|
iv := timestampHash.Sum(nil)
|
||||||
account, err := user.GetTypedAccount(&vmess.AccountPB{})
|
account, err := user.GetTypedAccount(&vmess.Account{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Vmess: Failed to get user account: ", err)
|
log.Error("Vmess: Failed to get user account: ", err)
|
||||||
return nil, 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)
|
decryptor := crypto.NewCryptionReader(aesStream, reader)
|
||||||
|
|
||||||
nBytes, err := io.ReadFull(decryptor, buffer[:41])
|
nBytes, err := io.ReadFull(decryptor, buffer[:41])
|
||||||
|
@ -22,11 +22,11 @@ func (this *VMessInboundHandler) generateCommand(request *protocol.RequestHeader
|
|||||||
if user == nil {
|
if user == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
account, _ := user.GetTypedAccount(&vmess.AccountPB{})
|
account, _ := user.GetTypedAccount(&vmess.Account{})
|
||||||
return &protocol.CommandSwitchAccount{
|
return &protocol.CommandSwitchAccount{
|
||||||
Port: inboundHandler.Port(),
|
Port: inboundHandler.Port(),
|
||||||
ID: account.(*vmess.Account).ID.UUID(),
|
ID: account.(*vmess.InternalAccount).ID.UUID(),
|
||||||
AlterIds: uint16(len(account.(*vmess.Account).AlterIDs)),
|
AlterIds: uint16(len(account.(*vmess.InternalAccount).AlterIDs)),
|
||||||
Level: user.Level,
|
Level: user.Level,
|
||||||
ValidMin: byte(availableMin),
|
ValidMin: byte(availableMin),
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,7 @@ func (this *Config) UnmarshalJSON(data []byte) error {
|
|||||||
if err := json.Unmarshal(rawData, user); err != nil {
|
if err := json.Unmarshal(rawData, user); err != nil {
|
||||||
return errors.New("VMess|Inbound: Invalid user: " + err.Error())
|
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 {
|
if err := json.Unmarshal(rawData, account); err != nil {
|
||||||
return errors.New("VMess|Inbound: Invalid user: " + err.Error())
|
return errors.New("VMess|Inbound: Invalid user: " + err.Error())
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ func (this *userByEmail) Get(email string) (*protocol.User, bool) {
|
|||||||
this.Lock()
|
this.Lock()
|
||||||
user, found = this.cache[email]
|
user, found = this.cache[email]
|
||||||
if !found {
|
if !found {
|
||||||
account := &vmess.AccountPB{
|
account := &vmess.Account{
|
||||||
Id: uuid.New().String(),
|
Id: uuid.New().String(),
|
||||||
AlterId: uint32(this.defaultAlterIDs),
|
AlterId: uint32(this.defaultAlterIDs),
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (this *VMessOutboundHandler) handleSwitchAccount(cmd *protocol.CommandSwitchAccount) {
|
func (this *VMessOutboundHandler) handleSwitchAccount(cmd *protocol.CommandSwitchAccount) {
|
||||||
account := &vmess.AccountPB{
|
account := &vmess.Account{
|
||||||
Id: cmd.ID.String(),
|
Id: cmd.ID.String(),
|
||||||
AlterId: uint32(cmd.AlterIds),
|
AlterId: uint32(cmd.AlterIds),
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ var _ = math.Inf
|
|||||||
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
|
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
|
||||||
|
|
||||||
type Config struct {
|
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{} }
|
func (m *Config) Reset() { *m = Config{} }
|
||||||
@ -38,7 +38,7 @@ func (m *Config) String() string { return proto.CompactTextString(m)
|
|||||||
func (*Config) ProtoMessage() {}
|
func (*Config) ProtoMessage() {}
|
||||||
func (*Config) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
|
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 {
|
if m != nil {
|
||||||
return m.Receiver
|
return m.Receiver
|
||||||
}
|
}
|
||||||
@ -52,18 +52,18 @@ func init() {
|
|||||||
func init() { proto.RegisterFile("v2ray.com/core/proxy/vmess/outbound/config.proto", fileDescriptor0) }
|
func init() { proto.RegisterFile("v2ray.com/core/proxy/vmess/outbound/config.proto", fileDescriptor0) }
|
||||||
|
|
||||||
var fileDescriptor0 = []byte{
|
var fileDescriptor0 = []byte{
|
||||||
// 193 bytes of a gzipped FileDescriptorProto
|
// 195 bytes of a gzipped FileDescriptorProto
|
||||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x84, 0xce, 0x31, 0x6b, 0xc3, 0x30,
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x84, 0x8e, 0x31, 0x6b, 0xc3, 0x30,
|
||||||
0x10, 0x05, 0x60, 0x4a, 0xc1, 0x18, 0x79, 0xf3, 0x54, 0xba, 0xb4, 0xb4, 0x8b, 0xa7, 0x53, 0x71,
|
0x10, 0x46, 0x29, 0x05, 0x63, 0xe4, 0xcd, 0x53, 0xe9, 0xd2, 0xd2, 0x2e, 0xa5, 0xc3, 0xa9, 0xb8,
|
||||||
0xd7, 0x4e, 0x6e, 0xe6, 0x60, 0xec, 0x2d, 0x4b, 0x88, 0x2f, 0x97, 0x60, 0x88, 0x7c, 0xe2, 0x64,
|
0x6b, 0x27, 0x97, 0x76, 0x36, 0xce, 0x96, 0x25, 0xc4, 0xe7, 0x4b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x2d, 0xb2, 0xb2, 0x80, 0xbb,
|
0x5f, 0xe5, 0x2d, 0x21, 0x0d, 0x81, 0xe4, 0xe9, 0xe1, 0xf5, 0xf1, 0xa3, 0xa8, 0x3e, 0xe1, 0xaa,
|
||||||
0xbd, 0x85, 0x82, 0x48, 0x41, 0x1b, 0xa8, 0xd6, 0x12, 0xd6, 0x55, 0x93, 0xca, 0xad, 0x59, 0xfd,
|
0xb7, 0xa8, 0x20, 0xa9, 0x60, 0x15, 0x55, 0x7f, 0xb6, 0x77, 0x3c, 0xd8, 0xb1, 0xcd, 0xe5, 0xc2,
|
||||||
0xa9, 0x6f, 0x64, 0x03, 0x4f, 0x1e, 0xad, 0xb2, 0x65, 0xb4, 0xbe, 0x6a, 0x9b, 0x34, 0x9e, 0xbb,
|
0xd6, 0x3f, 0xea, 0x1d, 0xd9, 0xc0, 0x9d, 0x57, 0xeb, 0x62, 0xc9, 0x36, 0x67, 0xdf, 0x3a, 0x4f,
|
||||||
0x24, 0xf0, 0xbf, 0x97, 0x00, 0x00, 0x00, 0xff, 0xff, 0x5a, 0x86, 0x34, 0xb5, 0x1b, 0x01, 0x00,
|
0xe7, 0x2e, 0x8b, 0x81, 0xef, 0x53, 0x00, 0x00, 0x00, 0xff, 0xff, 0xce, 0x18, 0x6b, 0x16, 0x1d,
|
||||||
0x00,
|
0x01, 0x00, 0x00,
|
||||||
}
|
}
|
||||||
|
@ -8,5 +8,5 @@ option java_outer_classname = "ConfigProto";
|
|||||||
import "v2ray.com/core/common/protocol/server_spec.proto";
|
import "v2ray.com/core/common/protocol/server_spec.proto";
|
||||||
|
|
||||||
message Config {
|
message Config {
|
||||||
repeated v2ray.core.common.protocol.ServerSpecPB Receiver = 1;
|
repeated v2ray.core.common.protocol.ServerEndpoint Receiver = 1;
|
||||||
}
|
}
|
@ -19,7 +19,7 @@ import (
|
|||||||
|
|
||||||
func (this *Config) UnmarshalJSON(data []byte) error {
|
func (this *Config) UnmarshalJSON(data []byte) error {
|
||||||
type RawConfigTarget struct {
|
type RawConfigTarget struct {
|
||||||
Address *v2net.AddressPB `json:"address"`
|
Address *v2net.IPOrDomain `json:"address"`
|
||||||
Port v2net.Port `json:"port"`
|
Port v2net.Port `json:"port"`
|
||||||
Users []json.RawMessage `json:"users"`
|
Users []json.RawMessage `json:"users"`
|
||||||
}
|
}
|
||||||
@ -35,7 +35,7 @@ func (this *Config) UnmarshalJSON(data []byte) error {
|
|||||||
log.Error("VMessOut: 0 VMess receiver configured.")
|
log.Error("VMessOut: 0 VMess receiver configured.")
|
||||||
return common.ErrBadConfiguration
|
return common.ErrBadConfiguration
|
||||||
}
|
}
|
||||||
serverSpecs := make([]*protocol.ServerSpecPB, len(rawOutbound.Receivers))
|
serverSpecs := make([]*protocol.ServerEndpoint, len(rawOutbound.Receivers))
|
||||||
for idx, rec := range rawOutbound.Receivers {
|
for idx, rec := range rawOutbound.Receivers {
|
||||||
if len(rec.Users) == 0 {
|
if len(rec.Users) == 0 {
|
||||||
log.Error("VMess: 0 user configured for VMess outbound.")
|
log.Error("VMess: 0 user configured for VMess outbound.")
|
||||||
@ -46,11 +46,11 @@ func (this *Config) UnmarshalJSON(data []byte) error {
|
|||||||
return common.ErrBadConfiguration
|
return common.ErrBadConfiguration
|
||||||
}
|
}
|
||||||
if rec.Address.AsAddress().String() == string([]byte{118, 50, 114, 97, 121, 46, 99, 111, 111, 108}) {
|
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),
|
Ip: serial.Uint32ToBytes(757086633, nil),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
spec := &protocol.ServerSpecPB{
|
spec := &protocol.ServerEndpoint{
|
||||||
Address: rec.Address,
|
Address: rec.Address,
|
||||||
Port: uint32(rec.Port),
|
Port: uint32(rec.Port),
|
||||||
}
|
}
|
||||||
@ -60,7 +60,7 @@ func (this *Config) UnmarshalJSON(data []byte) error {
|
|||||||
log.Error("VMess|Outbound: Invalid user: ", err)
|
log.Error("VMess|Outbound: Invalid user: ", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
account := new(vmess.AccountPB)
|
account := new(vmess.Account)
|
||||||
if err := json.Unmarshal(rawUser, account); err != nil {
|
if err := json.Unmarshal(rawUser, account); err != nil {
|
||||||
log.Error("VMess|Outbound: Invalid user: ", err)
|
log.Error("VMess|Outbound: Invalid user: ", err)
|
||||||
return err
|
return err
|
||||||
|
@ -118,11 +118,11 @@ L:
|
|||||||
func (this *TimedUserValidator) Add(user *protocol.User) error {
|
func (this *TimedUserValidator) Add(user *protocol.User) error {
|
||||||
idx := len(this.validUsers)
|
idx := len(this.validUsers)
|
||||||
this.validUsers = append(this.validUsers, user)
|
this.validUsers = append(this.validUsers, user)
|
||||||
rawAccount, err := user.GetTypedAccount(&AccountPB{})
|
rawAccount, err := user.GetTypedAccount(&Account{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
account := rawAccount.(*Account)
|
account := rawAccount.(*InternalAccount)
|
||||||
|
|
||||||
nowSec := time.Now().Unix()
|
nowSec := time.Now().Unix()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user