mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-10-14 15:03:39 -04:00
rename TypedSettings to TypedMessage
This commit is contained in:
parent
5bbbdc05de
commit
50bc195f7f
@ -8,9 +8,9 @@ import (
|
||||
"v2ray.com/core/app"
|
||||
"v2ray.com/core/app/dispatcher"
|
||||
"v2ray.com/core/common/errors"
|
||||
"v2ray.com/core/common/loader"
|
||||
"v2ray.com/core/common/log"
|
||||
v2net "v2ray.com/core/common/net"
|
||||
"v2ray.com/core/common/serial"
|
||||
|
||||
"github.com/miekg/dns"
|
||||
)
|
||||
@ -125,5 +125,5 @@ func (v CacheServerFactory) AppId() app.ID {
|
||||
}
|
||||
|
||||
func init() {
|
||||
app.RegisterApplicationFactory(loader.GetType(new(Config)), CacheServerFactory{})
|
||||
app.RegisterApplicationFactory(serial.GetMessageType(new(Config)), CacheServerFactory{})
|
||||
}
|
||||
|
@ -4,9 +4,9 @@ import (
|
||||
"v2ray.com/core/app"
|
||||
"v2ray.com/core/app/dns"
|
||||
"v2ray.com/core/common/errors"
|
||||
"v2ray.com/core/common/loader"
|
||||
"v2ray.com/core/common/log"
|
||||
v2net "v2ray.com/core/common/net"
|
||||
"v2ray.com/core/common/serial"
|
||||
"v2ray.com/core/proxy"
|
||||
)
|
||||
|
||||
@ -125,5 +125,5 @@ func (RouterFactory) AppId() app.ID {
|
||||
}
|
||||
|
||||
func init() {
|
||||
app.RegisterApplicationFactory(loader.GetType(new(Config)), RouterFactory{})
|
||||
app.RegisterApplicationFactory(serial.GetMessageType(new(Config)), RouterFactory{})
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ package web
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
import v2ray_core_common_loader "v2ray.com/core/common/loader"
|
||||
import v2ray_core_common_serial "v2ray.com/core/common/serial"
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
@ -162,8 +162,8 @@ func _FileServer_Entry_OneofSizer(msg proto.Message) (n int) {
|
||||
}
|
||||
|
||||
type Server struct {
|
||||
Domain []string `protobuf:"bytes,1,rep,name=domain" json:"domain,omitempty"`
|
||||
Settings *v2ray_core_common_loader.TypedSettings `protobuf:"bytes,2,opt,name=settings" json:"settings,omitempty"`
|
||||
Domain []string `protobuf:"bytes,1,rep,name=domain" json:"domain,omitempty"`
|
||||
Settings *v2ray_core_common_serial.TypedMessage `protobuf:"bytes,2,opt,name=settings" json:"settings,omitempty"`
|
||||
}
|
||||
|
||||
func (m *Server) Reset() { *m = Server{} }
|
||||
@ -171,7 +171,7 @@ func (m *Server) String() string { return proto.CompactTextString(m)
|
||||
func (*Server) ProtoMessage() {}
|
||||
func (*Server) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
|
||||
|
||||
func (m *Server) GetSettings() *v2ray_core_common_loader.TypedSettings {
|
||||
func (m *Server) GetSettings() *v2ray_core_common_serial.TypedMessage {
|
||||
if m != nil {
|
||||
return m.Settings
|
||||
}
|
||||
@ -204,25 +204,25 @@ func init() {
|
||||
func init() { proto.RegisterFile("v2ray.com/core/app/web/config.proto", fileDescriptor0) }
|
||||
|
||||
var fileDescriptor0 = []byte{
|
||||
// 305 bytes of a gzipped FileDescriptorProto
|
||||
// 312 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x6c, 0x91, 0xc1, 0x4b, 0xc3, 0x30,
|
||||
0x14, 0xc6, 0xad, 0xdb, 0x8a, 0x7d, 0xbd, 0x05, 0x19, 0x65, 0x07, 0x19, 0x53, 0xd8, 0xf0, 0x90,
|
||||
0x42, 0xbd, 0x89, 0xa7, 0x6d, 0x8a, 0x37, 0xa5, 0xf3, 0xe4, 0x41, 0x68, 0xb3, 0xe7, 0x0c, 0xac,
|
||||
0x4d, 0x78, 0x0b, 0x2b, 0xfd, 0x8f, 0xfc, 0x33, 0xa5, 0x49, 0x74, 0xa2, 0xbb, 0xe5, 0xe5, 0xfd,
|
||||
0xbe, 0xf7, 0xbe, 0x7c, 0x81, 0xcb, 0x7d, 0x46, 0x45, 0xcb, 0x85, 0xaa, 0x52, 0xa1, 0x08, 0xd3,
|
||||
0x42, 0xeb, 0xb4, 0xc1, 0x32, 0x15, 0xaa, 0x7e, 0x97, 0x1b, 0xae, 0x49, 0x19, 0xc5, 0xd8, 0x37,
|
||||
0x44, 0xc8, 0x0b, 0xad, 0x79, 0x83, 0xe5, 0x68, 0xfa, 0x47, 0x28, 0x54, 0x55, 0xa9, 0x3a, 0xdd,
|
||||
0xaa, 0x62, 0x8d, 0x94, 0x9a, 0x56, 0xa3, 0x13, 0x4f, 0x3e, 0x03, 0x80, 0x07, 0xb9, 0xc5, 0x15,
|
||||
0xd2, 0x1e, 0x89, 0xdd, 0xc2, 0x00, 0x6b, 0x43, 0x6d, 0x12, 0x8c, 0x7b, 0xb3, 0x38, 0xbb, 0xe2,
|
||||
0xff, 0x67, 0xf3, 0x03, 0xce, 0xef, 0x3b, 0x36, 0x77, 0x92, 0xd1, 0x1b, 0x0c, 0x6c, 0xcd, 0xce,
|
||||
0xa1, 0xdf, 0x31, 0x49, 0x30, 0x0e, 0x66, 0xd1, 0xe3, 0x49, 0x6e, 0x2b, 0x76, 0x01, 0xd1, 0x52,
|
||||
0x12, 0x0a, 0xa3, 0xa8, 0x4d, 0x4e, 0x7d, 0xeb, 0x70, 0xc5, 0x18, 0xf4, 0x75, 0x61, 0x3e, 0x92,
|
||||
0x5e, 0xd7, 0xca, 0xed, 0x79, 0x1e, 0x43, 0xd4, 0x69, 0x9f, 0x68, 0x29, 0x69, 0x82, 0x10, 0x7a,
|
||||
0x97, 0x43, 0x08, 0xd7, 0xaa, 0x2a, 0x64, 0x6d, 0x6d, 0x46, 0xb9, 0xaf, 0xd8, 0x02, 0xce, 0x76,
|
||||
0x68, 0x8c, 0xac, 0x37, 0x3b, 0xbb, 0x21, 0xce, 0xa6, 0xbf, 0x1f, 0xe0, 0x42, 0xe0, 0x2e, 0x04,
|
||||
0xfe, 0xd2, 0x6a, 0x5c, 0xaf, 0x3c, 0x9e, 0xff, 0x08, 0x27, 0x77, 0x10, 0x2e, 0x6c, 0xbc, 0x2c,
|
||||
0x83, 0x70, 0x67, 0x17, 0xfa, 0x34, 0x46, 0xc7, 0xd2, 0x70, 0x96, 0x72, 0x4f, 0xce, 0xaf, 0x61,
|
||||
0x28, 0x54, 0x75, 0x04, 0x9c, 0xc7, 0x6e, 0xea, 0x73, 0x17, 0xfb, 0x6b, 0xaf, 0xc1, 0xb2, 0x0c,
|
||||
0xed, 0x17, 0xdc, 0x7c, 0x05, 0x00, 0x00, 0xff, 0xff, 0x27, 0xdc, 0x68, 0xd1, 0xe6, 0x01, 0x00,
|
||||
0x00,
|
||||
0x14, 0xc6, 0xad, 0xdb, 0x8a, 0x7d, 0xbd, 0x05, 0x19, 0x65, 0x07, 0x19, 0x53, 0x64, 0x78, 0x48,
|
||||
0xa5, 0xde, 0xc4, 0x53, 0x9d, 0xe2, 0x45, 0x94, 0xea, 0xc9, 0x83, 0x92, 0x76, 0xcf, 0x19, 0x58,
|
||||
0x9b, 0xf0, 0x1a, 0x56, 0xfa, 0x1f, 0xf9, 0x67, 0x4a, 0x93, 0xea, 0x44, 0x77, 0xcb, 0xcb, 0xfb,
|
||||
0xbe, 0xf7, 0xbe, 0xfc, 0x02, 0xc7, 0x9b, 0x84, 0x44, 0xcb, 0x0b, 0x55, 0xc6, 0x85, 0x22, 0x8c,
|
||||
0x85, 0xd6, 0x71, 0x83, 0x79, 0x5c, 0xa8, 0xea, 0x5d, 0xae, 0xb8, 0x26, 0x65, 0x14, 0x63, 0xdf,
|
||||
0x22, 0x42, 0x2e, 0xb4, 0xe6, 0x0d, 0xe6, 0x93, 0xf3, 0x3f, 0xc6, 0x42, 0x95, 0xa5, 0xaa, 0xe2,
|
||||
0x1a, 0x49, 0x8a, 0x75, 0x6c, 0x5a, 0x8d, 0xcb, 0xb7, 0x12, 0xeb, 0x5a, 0xac, 0xd0, 0x4d, 0x99,
|
||||
0x7d, 0x7a, 0x00, 0xb7, 0x72, 0x8d, 0x4f, 0x48, 0x1b, 0x24, 0x76, 0x09, 0x23, 0xac, 0x0c, 0xb5,
|
||||
0x91, 0x37, 0x1d, 0xcc, 0xc3, 0xe4, 0x84, 0xff, 0x5f, 0xc2, 0xb7, 0x72, 0x7e, 0xd3, 0x69, 0x33,
|
||||
0x67, 0x99, 0xbc, 0xc2, 0xc8, 0xd6, 0xec, 0x10, 0x86, 0x9d, 0x26, 0xf2, 0xa6, 0xde, 0x3c, 0xb8,
|
||||
0xdb, 0xcb, 0x6c, 0xc5, 0x8e, 0x20, 0x58, 0x48, 0xc2, 0xc2, 0x28, 0x6a, 0xa3, 0xfd, 0xbe, 0xb5,
|
||||
0xbd, 0x62, 0x0c, 0x86, 0x5a, 0x98, 0x8f, 0x68, 0xd0, 0xb5, 0x32, 0x7b, 0x4e, 0x43, 0x08, 0x3a,
|
||||
0xef, 0x03, 0x2d, 0x24, 0xcd, 0x96, 0xe0, 0xf7, 0x29, 0xc7, 0xe0, 0x2f, 0x55, 0x29, 0x64, 0x65,
|
||||
0x63, 0x06, 0x59, 0x5f, 0xb1, 0x14, 0x0e, 0x6a, 0x34, 0x46, 0x56, 0xab, 0xda, 0x6e, 0x08, 0x93,
|
||||
0xd3, 0xdf, 0x0f, 0x70, 0x34, 0xb8, 0xa3, 0xc1, 0x9f, 0x3b, 0x1a, 0xf7, 0x0e, 0x46, 0xf6, 0xe3,
|
||||
0x9b, 0x5d, 0x81, 0x7f, 0x6d, 0x31, 0xb3, 0x04, 0xfc, 0xda, 0xee, 0xeb, 0x61, 0x4c, 0x76, 0xc1,
|
||||
0x70, 0x89, 0xb2, 0x5e, 0x99, 0x9e, 0xc1, 0xb8, 0x50, 0xe5, 0x0e, 0x61, 0x1a, 0xba, 0xa9, 0x8f,
|
||||
0x1d, 0xf5, 0x97, 0x41, 0x83, 0x79, 0xee, 0xdb, 0x1f, 0xb8, 0xf8, 0x0a, 0x00, 0x00, 0xff, 0xff,
|
||||
0x21, 0xbf, 0x92, 0xe3, 0xee, 0x01, 0x00, 0x00,
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ option go_package = "web";
|
||||
option java_package = "com.v2ray.core.app.web";
|
||||
option java_outer_classname = "ConfigProto";
|
||||
|
||||
import "v2ray.com/core/common/loader/type.proto";
|
||||
import "v2ray.com/core/common/serial/typed_message.proto";
|
||||
|
||||
message FileServer {
|
||||
message Entry {
|
||||
@ -21,7 +21,7 @@ message FileServer {
|
||||
|
||||
message Server {
|
||||
repeated string domain = 1;
|
||||
v2ray.core.common.loader.TypedSettings settings = 2;
|
||||
v2ray.core.common.serial.TypedMessage settings = 2;
|
||||
}
|
||||
|
||||
message Config {
|
||||
|
@ -1,50 +0,0 @@
|
||||
package loader
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
|
||||
"github.com/golang/protobuf/proto"
|
||||
"v2ray.com/core/common/errors"
|
||||
)
|
||||
|
||||
func NewTypedSettings(message proto.Message) *TypedSettings {
|
||||
if message == nil {
|
||||
return nil
|
||||
}
|
||||
settings, _ := proto.Marshal(message)
|
||||
return &TypedSettings{
|
||||
Type: GetType(message),
|
||||
Settings: settings,
|
||||
}
|
||||
}
|
||||
|
||||
func GetType(message proto.Message) string {
|
||||
return proto.MessageName(message)
|
||||
}
|
||||
|
||||
func GetInstance(messageType string) (interface{}, error) {
|
||||
mType := proto.MessageType(messageType).Elem()
|
||||
if mType == nil {
|
||||
return nil, errors.New("Unknown type: " + messageType)
|
||||
}
|
||||
return reflect.New(mType).Interface(), nil
|
||||
}
|
||||
|
||||
func (v *TypedSettings) Load(message proto.Message) error {
|
||||
targetType := GetType(message)
|
||||
if targetType != v.Type {
|
||||
return errors.New("Have type " + v.Type + ", but retrieved for " + targetType)
|
||||
}
|
||||
return proto.Unmarshal(v.Settings, message)
|
||||
}
|
||||
|
||||
func (v *TypedSettings) GetInstance() (interface{}, error) {
|
||||
instance, err := GetInstance(v.Type)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := proto.Unmarshal(v.Settings, instance.(proto.Message)); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return instance, nil
|
||||
}
|
@ -1,62 +0,0 @@
|
||||
// Code generated by protoc-gen-go.
|
||||
// source: v2ray.com/core/common/loader/type.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
/*
|
||||
Package loader is a generated protocol buffer package.
|
||||
|
||||
It is generated from these files:
|
||||
v2ray.com/core/common/loader/type.proto
|
||||
|
||||
It has these top-level messages:
|
||||
TypedSettings
|
||||
*/
|
||||
package loader
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the proto package it is being compiled against.
|
||||
// A compilation error at this line likely means your copy of the
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
|
||||
|
||||
// Serialized proto message along with its type name.
|
||||
type TypedSettings struct {
|
||||
// The name of the message type, retrieved from protobuf API.
|
||||
Type string `protobuf:"bytes,1,opt,name=type" json:"type,omitempty"`
|
||||
// Serialized proto message.
|
||||
Settings []byte `protobuf:"bytes,2,opt,name=settings,proto3" json:"settings,omitempty"`
|
||||
}
|
||||
|
||||
func (m *TypedSettings) Reset() { *m = TypedSettings{} }
|
||||
func (m *TypedSettings) String() string { return proto.CompactTextString(m) }
|
||||
func (*TypedSettings) ProtoMessage() {}
|
||||
func (*TypedSettings) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*TypedSettings)(nil), "v2ray.core.common.loader.TypedSettings")
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("v2ray.com/core/common/loader/type.proto", fileDescriptor0) }
|
||||
|
||||
var fileDescriptor0 = []byte{
|
||||
// 151 bytes of a gzipped FileDescriptorProto
|
||||
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,
|
||||
0xcf, 0xd3, 0xcf, 0xc9, 0x4f, 0x4c, 0x49, 0x2d, 0xd2, 0x2f, 0xa9, 0x2c, 0x48, 0xd5, 0x2b, 0x28,
|
||||
0xca, 0x2f, 0xc9, 0x17, 0x92, 0x80, 0x29, 0x2c, 0x4a, 0xd5, 0x83, 0x28, 0xd2, 0x83, 0x28, 0x52,
|
||||
0xb2, 0xe7, 0xe2, 0x0d, 0xa9, 0x2c, 0x48, 0x4d, 0x09, 0x4e, 0x2d, 0x29, 0xc9, 0xcc, 0x4b, 0x2f,
|
||||
0x16, 0x12, 0xe2, 0x62, 0x01, 0x69, 0x94, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x0c, 0x02, 0xb3, 0x85,
|
||||
0xa4, 0xb8, 0x38, 0x8a, 0xa1, 0xf2, 0x12, 0x4c, 0x0a, 0x8c, 0x1a, 0x3c, 0x41, 0x70, 0xbe, 0x93,
|
||||
0x21, 0x97, 0x4c, 0x72, 0x7e, 0xae, 0x1e, 0x2e, 0x0b, 0x9c, 0x38, 0x41, 0xc6, 0x07, 0x80, 0x5c,
|
||||
0x11, 0xc5, 0x06, 0x11, 0x4a, 0x62, 0x03, 0x3b, 0xca, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0x24,
|
||||
0xa2, 0x4d, 0x76, 0xbf, 0x00, 0x00, 0x00,
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package v2ray.core.common.loader;
|
||||
option go_package = "loader";
|
||||
option java_package = "com.v2ray.core.common.loader";
|
||||
option java_outer_classname = "TypeProto";
|
||||
|
||||
// Serialized proto message along with its type name.
|
||||
message TypedSettings {
|
||||
// The name of the message type, retrieved from protobuf API.
|
||||
string type = 1;
|
||||
// Serialized proto message.
|
||||
bytes settings = 2;
|
||||
}
|
@ -7,7 +7,7 @@ package protocol
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
import v2ray_core_common_loader "v2ray.com/core/common/loader"
|
||||
import v2ray_core_common_serial "v2ray.com/core/common/serial"
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
@ -18,7 +18,7 @@ type User struct {
|
||||
Level uint32 `protobuf:"varint,1,opt,name=level" json:"level,omitempty"`
|
||||
Email string `protobuf:"bytes,2,opt,name=email" json:"email,omitempty"`
|
||||
// Protocol specific account information.
|
||||
Account *v2ray_core_common_loader.TypedSettings `protobuf:"bytes,3,opt,name=account" json:"account,omitempty"`
|
||||
Account *v2ray_core_common_serial.TypedMessage `protobuf:"bytes,3,opt,name=account" json:"account,omitempty"`
|
||||
}
|
||||
|
||||
func (m *User) Reset() { *m = User{} }
|
||||
@ -26,7 +26,7 @@ func (m *User) String() string { return proto.CompactTextString(m) }
|
||||
func (*User) ProtoMessage() {}
|
||||
func (*User) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{0} }
|
||||
|
||||
func (m *User) GetAccount() *v2ray_core_common_loader.TypedSettings {
|
||||
func (m *User) GetAccount() *v2ray_core_common_serial.TypedMessage {
|
||||
if m != nil {
|
||||
return m.Account
|
||||
}
|
||||
@ -40,18 +40,18 @@ func init() {
|
||||
func init() { proto.RegisterFile("v2ray.com/core/common/protocol/user.proto", fileDescriptor2) }
|
||||
|
||||
var fileDescriptor2 = []byte{
|
||||
// 200 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x74, 0x8f, 0x3f, 0xef, 0x82, 0x30,
|
||||
0x10, 0x86, 0xd3, 0xdf, 0x5f, 0xa9, 0x71, 0x21, 0x0e, 0x84, 0xc1, 0x10, 0x17, 0x70, 0x69, 0x13,
|
||||
0x8c, 0x1f, 0x40, 0x3e, 0x81, 0x41, 0x5d, 0xdc, 0x6a, 0xb9, 0x18, 0x92, 0x96, 0x23, 0xa5, 0x90,
|
||||
0xf0, 0xed, 0x0d, 0x34, 0x9d, 0xd4, 0xad, 0xcf, 0x9b, 0xa7, 0x77, 0xef, 0xd1, 0xdd, 0x90, 0x1b,
|
||||
0x31, 0x32, 0x89, 0x9a, 0x4b, 0x34, 0xc0, 0x25, 0x6a, 0x8d, 0x0d, 0x6f, 0x0d, 0x5a, 0x94, 0xa8,
|
||||
0x78, 0xdf, 0x81, 0x61, 0x33, 0x85, 0xb1, 0x57, 0x0d, 0x30, 0xa7, 0x31, 0xaf, 0xc5, 0xe9, 0xfb,
|
||||
0x31, 0x0a, 0x45, 0x05, 0x86, 0xdb, 0xb1, 0x05, 0xe7, 0x6e, 0x7b, 0xfa, 0x73, 0xed, 0xc0, 0x84,
|
||||
0x6b, 0xfa, 0xab, 0x60, 0x00, 0x15, 0x91, 0x84, 0x64, 0xab, 0xd2, 0xc1, 0x94, 0x82, 0x16, 0xb5,
|
||||
0x8a, 0xbe, 0x12, 0x92, 0x05, 0xa5, 0x83, 0xf0, 0x48, 0xff, 0x85, 0x94, 0xd8, 0x37, 0x36, 0xfa,
|
||||
0x4e, 0x48, 0xb6, 0xcc, 0x53, 0xf6, 0x5a, 0xc5, 0xad, 0x62, 0x97, 0xb1, 0x85, 0xea, 0x0c, 0xd6,
|
||||
0xd6, 0xcd, 0xa3, 0x2b, 0xfd, 0xbf, 0xe2, 0x40, 0x37, 0x12, 0x35, 0xfb, 0x7c, 0x41, 0x11, 0x4c,
|
||||
0xb5, 0x4e, 0x13, 0xdd, 0x16, 0x3e, 0xbc, 0xff, 0xcd, 0xaf, 0xfd, 0x33, 0x00, 0x00, 0xff, 0xff,
|
||||
0x68, 0x83, 0xed, 0x6b, 0x26, 0x01, 0x00, 0x00,
|
||||
// 204 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0xd2, 0x2c, 0x33, 0x2a, 0x4a,
|
||||
0xac, 0xd4, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xce, 0x2f, 0x4a, 0xd5, 0x4f, 0xce, 0xcf, 0xcd, 0xcd,
|
||||
0xcf, 0xd3, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0xce, 0xcf, 0xd1, 0x2f, 0x2d, 0x4e, 0x2d, 0xd2,
|
||||
0x03, 0xf3, 0x84, 0xa4, 0x60, 0x4a, 0x8b, 0x52, 0xf5, 0x20, 0xca, 0xf4, 0x60, 0xca, 0xa4, 0x0c,
|
||||
0xb0, 0x1b, 0x53, 0x9c, 0x5a, 0x94, 0x99, 0x98, 0xa3, 0x5f, 0x52, 0x59, 0x90, 0x9a, 0x12, 0x9f,
|
||||
0x9b, 0x5a, 0x5c, 0x9c, 0x98, 0x9e, 0x0a, 0xd1, 0xa4, 0x54, 0xc2, 0xc5, 0x12, 0x5a, 0x9c, 0x5a,
|
||||
0x24, 0x24, 0xc2, 0xc5, 0x9a, 0x93, 0x5a, 0x96, 0x9a, 0x23, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0x1b,
|
||||
0x04, 0xe1, 0x80, 0x44, 0x53, 0x73, 0x13, 0x33, 0x73, 0x24, 0x98, 0x14, 0x18, 0x35, 0x38, 0x83,
|
||||
0x20, 0x1c, 0x21, 0x07, 0x2e, 0xf6, 0xc4, 0xe4, 0xe4, 0xfc, 0xd2, 0xbc, 0x12, 0x09, 0x66, 0x05,
|
||||
0x46, 0x0d, 0x6e, 0x23, 0x35, 0x3d, 0x4c, 0x37, 0x41, 0xec, 0xd4, 0x0b, 0x01, 0xd9, 0xe9, 0x0b,
|
||||
0xb1, 0x32, 0x08, 0xa6, 0xcd, 0xc9, 0x94, 0x4b, 0x2e, 0x39, 0x3f, 0x57, 0x0f, 0xb7, 0x4f, 0x9c,
|
||||
0x38, 0x41, 0xae, 0x0a, 0x00, 0xf1, 0xa2, 0x38, 0x60, 0x82, 0x49, 0x6c, 0x60, 0x96, 0x31, 0x20,
|
||||
0x00, 0x00, 0xff, 0xff, 0x2e, 0x02, 0xab, 0x48, 0x2e, 0x01, 0x00, 0x00,
|
||||
}
|
||||
|
@ -5,12 +5,12 @@ option go_package = "protocol";
|
||||
option java_package = "com.v2ray.core.common.protocol";
|
||||
option java_outer_classname = "UserProto";
|
||||
|
||||
import "v2ray.com/core/common/loader/type.proto";
|
||||
import "v2ray.com/core/common/serial/typed_message.proto";
|
||||
|
||||
message User {
|
||||
uint32 level = 1;
|
||||
string email = 2;
|
||||
|
||||
// Protocol specific account information.
|
||||
v2ray.core.common.loader.TypedSettings account = 3;
|
||||
v2ray.core.common.serial.TypedMessage account = 3;
|
||||
}
|
42
common/serial/typed_message.go
Normal file
42
common/serial/typed_message.go
Normal file
@ -0,0 +1,42 @@
|
||||
package serial
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"reflect"
|
||||
|
||||
"github.com/golang/protobuf/proto"
|
||||
)
|
||||
|
||||
func ToTypedMessage(message proto.Message) *TypedMessage {
|
||||
if message == nil {
|
||||
return nil
|
||||
}
|
||||
settings, _ := proto.Marshal(message)
|
||||
return &TypedMessage{
|
||||
Type: GetMessageType(message),
|
||||
Value: settings,
|
||||
}
|
||||
}
|
||||
|
||||
func GetMessageType(message proto.Message) string {
|
||||
return proto.MessageName(message)
|
||||
}
|
||||
|
||||
func GetInstance(messageType string) (interface{}, error) {
|
||||
mType := proto.MessageType(messageType).Elem()
|
||||
if mType == nil {
|
||||
return nil, errors.New("Unknown type: " + messageType)
|
||||
}
|
||||
return reflect.New(mType).Interface(), nil
|
||||
}
|
||||
|
||||
func (v *TypedMessage) GetInstance() (interface{}, error) {
|
||||
instance, err := GetInstance(v.Type)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := proto.Unmarshal(v.Value, instance.(proto.Message)); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return instance, nil
|
||||
}
|
62
common/serial/typed_message.pb.go
Normal file
62
common/serial/typed_message.pb.go
Normal file
@ -0,0 +1,62 @@
|
||||
// Code generated by protoc-gen-go.
|
||||
// source: v2ray.com/core/common/serial/typed_message.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
/*
|
||||
Package serial is a generated protocol buffer package.
|
||||
|
||||
It is generated from these files:
|
||||
v2ray.com/core/common/serial/typed_message.proto
|
||||
|
||||
It has these top-level messages:
|
||||
TypedMessage
|
||||
*/
|
||||
package serial
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the proto package it is being compiled against.
|
||||
// A compilation error at this line likely means your copy of the
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
|
||||
|
||||
// Serialized proto message along with its type name.
|
||||
type TypedMessage struct {
|
||||
// The name of the message type, retrieved from protobuf API.
|
||||
Type string `protobuf:"bytes,1,opt,name=type" json:"type,omitempty"`
|
||||
// Serialized proto message.
|
||||
Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
|
||||
}
|
||||
|
||||
func (m *TypedMessage) Reset() { *m = TypedMessage{} }
|
||||
func (m *TypedMessage) String() string { return proto.CompactTextString(m) }
|
||||
func (*TypedMessage) ProtoMessage() {}
|
||||
func (*TypedMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*TypedMessage)(nil), "v2ray.core.common.serial.TypedMessage")
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("v2ray.com/core/common/serial/typed_message.proto", fileDescriptor0) }
|
||||
|
||||
var fileDescriptor0 = []byte{
|
||||
// 156 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x32, 0x28, 0x33, 0x2a, 0x4a,
|
||||
0xac, 0xd4, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xce, 0x2f, 0x4a, 0xd5, 0x4f, 0xce, 0xcf, 0xcd, 0xcd,
|
||||
0xcf, 0xd3, 0x2f, 0x4e, 0x2d, 0xca, 0x4c, 0xcc, 0xd1, 0x2f, 0xa9, 0x2c, 0x48, 0x4d, 0x89, 0xcf,
|
||||
0x4d, 0x2d, 0x2e, 0x4e, 0x4c, 0x4f, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, 0x80, 0xe9,
|
||||
0x28, 0x4a, 0xd5, 0x83, 0xa8, 0xd6, 0x83, 0xa8, 0x56, 0xb2, 0xe0, 0xe2, 0x09, 0x01, 0x69, 0xf0,
|
||||
0x85, 0xa8, 0x17, 0x12, 0xe2, 0x62, 0x01, 0x19, 0x20, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0x19, 0x04,
|
||||
0x66, 0x0b, 0x89, 0x70, 0xb1, 0x96, 0x25, 0xe6, 0x94, 0xa6, 0x4a, 0x30, 0x29, 0x30, 0x6a, 0xf0,
|
||||
0x04, 0x41, 0x38, 0x4e, 0x96, 0x5c, 0x32, 0xc9, 0xf9, 0xb9, 0x7a, 0xb8, 0x4c, 0x76, 0x12, 0x44,
|
||||
0x36, 0x37, 0x00, 0xe4, 0x8c, 0x28, 0x36, 0x88, 0x54, 0x12, 0x1b, 0xd8, 0x55, 0xc6, 0x80, 0x00,
|
||||
0x00, 0x00, 0xff, 0xff, 0xb5, 0x17, 0x99, 0x4c, 0xc9, 0x00, 0x00, 0x00,
|
||||
}
|
14
common/serial/typed_message.proto
Normal file
14
common/serial/typed_message.proto
Normal file
@ -0,0 +1,14 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package v2ray.core.common.serial;
|
||||
option go_package = "serial";
|
||||
option java_package = "com.v2ray.core.common.serial";
|
||||
option java_outer_classname = "TypedMessageProto";
|
||||
|
||||
// Serialized proto message along with its type name.
|
||||
message TypedMessage {
|
||||
// The name of the message type, retrieved from protobuf API.
|
||||
string type = 1;
|
||||
// Serialized proto message.
|
||||
bytes value = 2;
|
||||
}
|
109
config.pb.go
109
config.pb.go
@ -21,7 +21,7 @@ package core
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
import v2ray_core_common_loader "v2ray.com/core/common/loader"
|
||||
import v2ray_core_common_serial "v2ray.com/core/common/serial"
|
||||
import v2ray_core_common_net "v2ray.com/core/common/net"
|
||||
import v2ray_core_common_net1 "v2ray.com/core/common/net"
|
||||
import v2ray_core_common_log "v2ray.com/core/common/log"
|
||||
@ -138,7 +138,7 @@ func (m *AllocationStrategy) GetRefresh() *AllocationStrategyRefresh {
|
||||
// Config for an inbound connection handler.
|
||||
type InboundConnectionConfig struct {
|
||||
// Protocol specific settings. Must be one of the supported protocols.
|
||||
Settings *v2ray_core_common_loader.TypedSettings `protobuf:"bytes,1,opt,name=settings" json:"settings,omitempty"`
|
||||
Settings *v2ray_core_common_serial.TypedMessage `protobuf:"bytes,1,opt,name=settings" json:"settings,omitempty"`
|
||||
// Range of port number to run on. Both inclusive.
|
||||
PortRange *v2ray_core_common_net.PortRange `protobuf:"bytes,2,opt,name=port_range,json=portRange" json:"port_range,omitempty"`
|
||||
// IP address to listen on. 0.0.0.0 if unset.
|
||||
@ -155,7 +155,7 @@ func (m *InboundConnectionConfig) String() string { return proto.Comp
|
||||
func (*InboundConnectionConfig) ProtoMessage() {}
|
||||
func (*InboundConnectionConfig) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} }
|
||||
|
||||
func (m *InboundConnectionConfig) GetSettings() *v2ray_core_common_loader.TypedSettings {
|
||||
func (m *InboundConnectionConfig) GetSettings() *v2ray_core_common_serial.TypedMessage {
|
||||
if m != nil {
|
||||
return m.Settings
|
||||
}
|
||||
@ -192,7 +192,7 @@ func (m *InboundConnectionConfig) GetStreamSettings() *v2ray_core_transport_inte
|
||||
|
||||
// Config for an outbound connection handler.
|
||||
type OutboundConnectionConfig struct {
|
||||
Settings *v2ray_core_common_loader.TypedSettings `protobuf:"bytes,1,opt,name=settings" json:"settings,omitempty"`
|
||||
Settings *v2ray_core_common_serial.TypedMessage `protobuf:"bytes,1,opt,name=settings" json:"settings,omitempty"`
|
||||
// IP address to send data through. 0.0.0.0 if unset.
|
||||
SendThrough *v2ray_core_common_net1.IPOrDomain `protobuf:"bytes,2,opt,name=send_through,json=sendThrough" json:"send_through,omitempty"`
|
||||
StreamSettings *v2ray_core_transport_internet.StreamConfig `protobuf:"bytes,3,opt,name=stream_settings,json=streamSettings" json:"stream_settings,omitempty"`
|
||||
@ -205,7 +205,7 @@ func (m *OutboundConnectionConfig) String() string { return proto.Com
|
||||
func (*OutboundConnectionConfig) ProtoMessage() {}
|
||||
func (*OutboundConnectionConfig) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} }
|
||||
|
||||
func (m *OutboundConnectionConfig) GetSettings() *v2ray_core_common_loader.TypedSettings {
|
||||
func (m *OutboundConnectionConfig) GetSettings() *v2ray_core_common_serial.TypedMessage {
|
||||
if m != nil {
|
||||
return m.Settings
|
||||
}
|
||||
@ -240,8 +240,8 @@ type Config struct {
|
||||
Outbound []*OutboundConnectionConfig `protobuf:"bytes,2,rep,name=outbound" json:"outbound,omitempty"`
|
||||
Log *v2ray_core_common_log.Config `protobuf:"bytes,3,opt,name=log" json:"log,omitempty"`
|
||||
// App configuration. Must be one in the app directory.
|
||||
App []*v2ray_core_common_loader.TypedSettings `protobuf:"bytes,4,rep,name=app" json:"app,omitempty"`
|
||||
Transport *v2ray_core_transport.Config `protobuf:"bytes,5,opt,name=transport" json:"transport,omitempty"`
|
||||
App []*v2ray_core_common_serial.TypedMessage `protobuf:"bytes,4,rep,name=app" json:"app,omitempty"`
|
||||
Transport *v2ray_core_transport.Config `protobuf:"bytes,5,opt,name=transport" json:"transport,omitempty"`
|
||||
}
|
||||
|
||||
func (m *Config) Reset() { *m = Config{} }
|
||||
@ -270,7 +270,7 @@ func (m *Config) GetLog() *v2ray_core_common_log.Config {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Config) GetApp() []*v2ray_core_common_loader.TypedSettings {
|
||||
func (m *Config) GetApp() []*v2ray_core_common_serial.TypedMessage {
|
||||
if m != nil {
|
||||
return m.App
|
||||
}
|
||||
@ -298,50 +298,51 @@ func init() {
|
||||
func init() { proto.RegisterFile("v2ray.com/core/config.proto", fileDescriptor0) }
|
||||
|
||||
var fileDescriptor0 = []byte{
|
||||
// 719 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xb4, 0x95, 0xdd, 0x6e, 0xd3, 0x30,
|
||||
0x1c, 0xc5, 0x97, 0xb6, 0xeb, 0xda, 0x7f, 0xb7, 0x52, 0x19, 0x04, 0x61, 0x30, 0x54, 0xba, 0xaf,
|
||||
0x32, 0x50, 0x2a, 0x8a, 0x10, 0x1f, 0x12, 0x8c, 0xad, 0x03, 0x69, 0x20, 0xd1, 0xe2, 0xee, 0x8a,
|
||||
0x9b, 0xca, 0x4b, 0xbd, 0x2c, 0x52, 0x62, 0x47, 0x8e, 0xbb, 0xad, 0x8f, 0xc0, 0xe3, 0xf0, 0x2a,
|
||||
0x3c, 0x01, 0x8f, 0x82, 0xec, 0xb8, 0x69, 0x47, 0xdb, 0x6d, 0x12, 0xe2, 0x2e, 0x8d, 0xcf, 0xef,
|
||||
0xd8, 0x39, 0xc7, 0x76, 0xe1, 0xc1, 0x59, 0x53, 0x90, 0xa1, 0xe3, 0xf2, 0xb0, 0xe1, 0x72, 0x41,
|
||||
0x1b, 0x2e, 0x67, 0x27, 0xbe, 0xe7, 0x44, 0x82, 0x4b, 0x8e, 0x60, 0x34, 0x28, 0xe8, 0xea, 0xf6,
|
||||
0x94, 0x30, 0x0c, 0x39, 0x6b, 0x04, 0x9c, 0xf4, 0xa9, 0x68, 0xc8, 0x61, 0x44, 0x13, 0x68, 0x75,
|
||||
0x63, 0xb6, 0x90, 0x51, 0xd9, 0x88, 0xb8, 0x90, 0x46, 0xb5, 0x3d, 0x5f, 0x45, 0xfa, 0x7d, 0x41,
|
||||
0xe3, 0xd8, 0x08, 0xb7, 0xe6, 0xcd, 0xeb, 0x5d, 0x5a, 0xeb, 0xaa, 0xf3, 0x97, 0x4e, 0x0a, 0xc2,
|
||||
0x62, 0x35, 0x61, 0xc3, 0x67, 0x92, 0x0a, 0x65, 0x7c, 0x49, 0xbf, 0x39, 0x57, 0x3f, 0x29, 0xab,
|
||||
0xbd, 0x84, 0xb5, 0xbd, 0x20, 0xe0, 0x2e, 0x91, 0x3e, 0x67, 0x5d, 0x29, 0x88, 0xa4, 0xde, 0xb0,
|
||||
0xc5, 0x99, 0x3b, 0x10, 0x82, 0x32, 0x77, 0x88, 0xee, 0xc0, 0xe2, 0x19, 0x09, 0x06, 0xd4, 0xb6,
|
||||
0xaa, 0x56, 0x7d, 0x05, 0x27, 0x3f, 0x6a, 0xcf, 0xe1, 0xfe, 0x34, 0x86, 0xe9, 0x89, 0xa0, 0xf1,
|
||||
0xe9, 0x1c, 0xe4, 0x47, 0x06, 0xd0, 0x34, 0x83, 0x5e, 0x41, 0x4e, 0x85, 0xab, 0xb5, 0xe5, 0xe6,
|
||||
0xba, 0x33, 0xae, 0xc4, 0x99, 0x56, 0x3b, 0x47, 0xc3, 0x88, 0x62, 0x0d, 0xa0, 0x2f, 0x50, 0x72,
|
||||
0xc7, 0xeb, 0xb4, 0x33, 0x55, 0xab, 0x5e, 0x6a, 0x3e, 0xb9, 0x9a, 0x9f, 0xf8, 0x30, 0x3c, 0x49,
|
||||
0xa3, 0x5d, 0x58, 0x12, 0xc9, 0xea, 0xed, 0xac, 0x36, 0xda, 0xbc, 0xda, 0xc8, 0x7c, 0x2a, 0x1e,
|
||||
0x51, 0xb5, 0x67, 0x90, 0x53, 0x6b, 0x43, 0x00, 0xf9, 0xbd, 0xe0, 0x9c, 0x0c, 0xe3, 0xca, 0x82,
|
||||
0x7a, 0xc6, 0x84, 0xf5, 0x79, 0x58, 0xb1, 0xd0, 0x32, 0x14, 0x3e, 0x5e, 0xa8, 0x9e, 0x48, 0x50,
|
||||
0xc9, 0xd4, 0x7e, 0x65, 0xe1, 0xde, 0x21, 0x3b, 0xe6, 0x03, 0xd6, 0x6f, 0x71, 0xc6, 0xa8, 0xab,
|
||||
0xbc, 0x5b, 0xba, 0x17, 0xd4, 0x82, 0x42, 0x4c, 0xa5, 0xf4, 0x99, 0x17, 0xeb, 0x50, 0x4a, 0xcd,
|
||||
0xed, 0xc9, 0xb5, 0x24, 0xfb, 0xc3, 0x49, 0xf6, 0xa5, 0xce, 0xa3, 0xdf, 0x35, 0x72, 0x9c, 0x82,
|
||||
0x68, 0x17, 0x40, 0x75, 0xdd, 0x13, 0x84, 0x79, 0xd4, 0x64, 0x53, 0x9d, 0x61, 0xc3, 0xa8, 0x74,
|
||||
0x3a, 0x5c, 0x48, 0xac, 0x74, 0xb8, 0x18, 0x8d, 0x1e, 0xd1, 0x7b, 0x28, 0x06, 0x7e, 0x2c, 0x29,
|
||||
0xeb, 0x71, 0x66, 0x22, 0x79, 0x3c, 0x87, 0x3f, 0xec, 0xb4, 0xc5, 0x01, 0x0f, 0x89, 0xcf, 0x70,
|
||||
0x21, 0x61, 0xda, 0x0c, 0x55, 0x20, 0x2b, 0x89, 0x67, 0xe7, 0xaa, 0x56, 0xbd, 0x88, 0xd5, 0x23,
|
||||
0x6a, 0xc3, 0x6d, 0x92, 0xe6, 0xd8, 0x8b, 0x4d, 0x90, 0xf6, 0xa2, 0xf6, 0x7e, 0x74, 0x4d, 0xdc,
|
||||
0x88, 0x4c, 0xef, 0x9c, 0x23, 0xb8, 0x15, 0x4b, 0x41, 0x49, 0xd8, 0x4b, 0xf3, 0xca, 0x6b, 0xb3,
|
||||
0xa7, 0x93, 0x66, 0xe9, 0xbe, 0x77, 0x46, 0xe7, 0xc4, 0xe9, 0x6a, 0x2a, 0x89, 0x1b, 0x97, 0x13,
|
||||
0x8f, 0x51, 0x86, 0xe8, 0x35, 0xd8, 0x6a, 0xae, 0xf3, 0x5e, 0x44, 0xe2, 0xd8, 0x3f, 0xa3, 0x3d,
|
||||
0x37, 0x2d, 0xc8, 0x5e, 0xaa, 0x5a, 0xf5, 0x02, 0xbe, 0xab, 0xc7, 0x3b, 0xc9, 0xf0, 0xb8, 0xbe,
|
||||
0xda, 0xef, 0x0c, 0xd8, 0xed, 0x81, 0xfc, 0x8f, 0xad, 0x1e, 0xc0, 0x72, 0x4c, 0x59, 0xbf, 0x27,
|
||||
0x4f, 0x05, 0x1f, 0x78, 0xa7, 0xa6, 0xd7, 0x1b, 0xf4, 0x52, 0x52, 0xd8, 0x51, 0x42, 0xcd, 0xca,
|
||||
0x2d, 0xfb, 0xef, 0xb9, 0x7d, 0x83, 0x72, 0x24, 0xf8, 0xc5, 0x70, 0x6c, 0x9a, 0x34, 0xbb, 0x73,
|
||||
0x8d, 0x69, 0x47, 0x41, 0xc6, 0x73, 0x45, 0x3b, 0xa4, 0x96, 0x53, 0x7b, 0xa8, 0xf6, 0x33, 0x03,
|
||||
0x79, 0x13, 0xe8, 0x3b, 0x58, 0xf2, 0x93, 0x13, 0x64, 0x5b, 0xd5, 0x6c, 0xbd, 0x74, 0xf9, 0xea,
|
||||
0x98, 0x73, 0xb8, 0xf0, 0x88, 0x41, 0x1f, 0xa0, 0xc0, 0x4d, 0x57, 0x76, 0x46, 0xf3, 0x1b, 0x93,
|
||||
0xfc, 0xbc, 0x1e, 0x71, 0x4a, 0xa1, 0x06, 0x64, 0x03, 0xee, 0x99, 0xe8, 0xd6, 0x66, 0x96, 0xe9,
|
||||
0x39, 0x86, 0x52, 0x4a, 0xf4, 0x06, 0xb2, 0x24, 0x8a, 0xec, 0x9c, 0x9e, 0xed, 0xc6, 0xed, 0x2b,
|
||||
0x06, 0xbd, 0x85, 0x62, 0x1a, 0x9d, 0xc9, 0xf5, 0xe1, 0xec, 0x5c, 0xcd, 0x84, 0x63, 0xf9, 0xce,
|
||||
0x16, 0x2c, 0x27, 0x2f, 0x3f, 0x71, 0x11, 0x12, 0xa9, 0x6e, 0xa2, 0x8e, 0xba, 0xfa, 0x8f, 0x07,
|
||||
0x27, 0x95, 0x05, 0x54, 0x80, 0xdc, 0xe7, 0x6e, 0xfb, 0x6b, 0xc5, 0xda, 0x5f, 0x87, 0xb2, 0xcb,
|
||||
0xc3, 0x09, 0xd7, 0xfd, 0x52, 0xc2, 0x69, 0xf5, 0xf7, 0x9c, 0x7a, 0x75, 0x9c, 0xd7, 0xff, 0x1a,
|
||||
0x2f, 0xfe, 0x04, 0x00, 0x00, 0xff, 0xff, 0xe4, 0x6f, 0x70, 0x9e, 0x57, 0x07, 0x00, 0x00,
|
||||
// 733 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xb4, 0x95, 0xed, 0x6e, 0xd3, 0x3a,
|
||||
0x1c, 0xc6, 0x97, 0xb6, 0xeb, 0xda, 0x7f, 0xb7, 0x9e, 0xca, 0xe7, 0xe8, 0x9c, 0x9c, 0xc1, 0x50,
|
||||
0xe9, 0x5e, 0x28, 0x03, 0xa5, 0x50, 0x84, 0x98, 0x90, 0x60, 0xec, 0x05, 0xa4, 0x81, 0xa0, 0x25,
|
||||
0xdd, 0x27, 0xbe, 0x44, 0x5e, 0xea, 0x65, 0x91, 0x12, 0x3b, 0xb2, 0xdd, 0x6d, 0xbd, 0x04, 0xee,
|
||||
0x86, 0x5b, 0xe1, 0x0a, 0xb8, 0x15, 0x64, 0x3b, 0x4d, 0x3b, 0xda, 0x6e, 0x93, 0x10, 0xdf, 0xd2,
|
||||
0xe4, 0xf9, 0x3d, 0x76, 0x9e, 0xe7, 0x1f, 0x17, 0xee, 0x9c, 0xb7, 0x39, 0x1e, 0x3a, 0x3e, 0x8b,
|
||||
0x5b, 0x3e, 0xe3, 0xa4, 0xe5, 0x33, 0x7a, 0x1a, 0x06, 0x4e, 0xc2, 0x99, 0x64, 0x08, 0x46, 0x0f,
|
||||
0x39, 0x59, 0x7d, 0x32, 0x25, 0x8c, 0x63, 0x46, 0x5b, 0x82, 0xf0, 0x10, 0x47, 0x2d, 0x39, 0x4c,
|
||||
0x48, 0xdf, 0x8b, 0x89, 0x10, 0x38, 0x20, 0x86, 0x5e, 0xdd, 0x98, 0x4d, 0x50, 0x22, 0x5b, 0x09,
|
||||
0xe3, 0x32, 0x55, 0x3d, 0x98, 0xaf, 0xc2, 0xfd, 0x3e, 0x27, 0x42, 0xa4, 0xc2, 0xad, 0xd9, 0xc2,
|
||||
0x88, 0x05, 0x57, 0x36, 0xbd, 0xea, 0xfc, 0xa2, 0x93, 0x1c, 0x53, 0xa1, 0x16, 0x6c, 0x85, 0x54,
|
||||
0x12, 0xae, 0x8c, 0xaf, 0xe8, 0x37, 0xe7, 0xea, 0x27, 0x65, 0x8d, 0xe7, 0xb0, 0xb6, 0x17, 0x45,
|
||||
0xcc, 0xc7, 0x32, 0x64, 0xb4, 0x27, 0x39, 0x96, 0x24, 0x18, 0x1e, 0x30, 0xea, 0x0f, 0x38, 0x27,
|
||||
0xd4, 0x1f, 0xa2, 0x7f, 0x60, 0xf1, 0x1c, 0x47, 0x03, 0x62, 0x5b, 0x75, 0xab, 0xb9, 0xe2, 0x9a,
|
||||
0x1f, 0x8d, 0xa7, 0xf0, 0xff, 0x34, 0xe6, 0x92, 0x53, 0x4e, 0xc4, 0xd9, 0x1c, 0xe4, 0x6b, 0x0e,
|
||||
0xd0, 0x34, 0x83, 0x5e, 0x40, 0x41, 0xa5, 0xac, 0xb5, 0xd5, 0xf6, 0xba, 0x33, 0xee, 0xc6, 0x99,
|
||||
0x56, 0x3b, 0xc7, 0xc3, 0x84, 0xb8, 0x1a, 0x40, 0x1f, 0xa0, 0xe2, 0x8f, 0xf7, 0x69, 0xe7, 0xea,
|
||||
0x56, 0xb3, 0xd2, 0x7e, 0x78, 0x3d, 0x3f, 0xf1, 0x62, 0xee, 0x24, 0x8d, 0x76, 0x61, 0x89, 0x9b,
|
||||
0xdd, 0xdb, 0x79, 0x6d, 0xb4, 0x79, 0xbd, 0x51, 0xfa, 0xaa, 0xee, 0x88, 0x6a, 0x3c, 0x86, 0x82,
|
||||
0xda, 0x1b, 0x02, 0x28, 0xee, 0x45, 0x17, 0x78, 0x28, 0x6a, 0x0b, 0xea, 0xda, 0xc5, 0xb4, 0xcf,
|
||||
0xe2, 0x9a, 0x85, 0x96, 0xa1, 0xf4, 0xf6, 0x52, 0xf5, 0x84, 0xa3, 0x5a, 0xae, 0xf1, 0x3d, 0x0f,
|
||||
0xff, 0x1d, 0xd1, 0x13, 0x36, 0xa0, 0xfd, 0x03, 0x46, 0x29, 0xf1, 0x95, 0xf7, 0x81, 0xee, 0x05,
|
||||
0xed, 0x43, 0x49, 0x10, 0x29, 0x43, 0x1a, 0x08, 0x1d, 0x4a, 0xa5, 0xbd, 0x35, 0xb9, 0x17, 0x33,
|
||||
0x1f, 0x8e, 0x19, 0x50, 0x9d, 0x47, 0xff, 0xa3, 0x99, 0x4f, 0x37, 0xe3, 0xd0, 0x2e, 0x80, 0xaa,
|
||||
0xda, 0xe3, 0x98, 0x06, 0x24, 0x8d, 0xa6, 0x3e, 0xc3, 0x85, 0x12, 0xe9, 0x74, 0x19, 0x97, 0xae,
|
||||
0xd2, 0xb9, 0xe5, 0x64, 0x74, 0x89, 0x5e, 0x43, 0x39, 0x0a, 0x85, 0x24, 0xd4, 0x63, 0x34, 0x4d,
|
||||
0xe4, 0xfe, 0x1c, 0xfe, 0xa8, 0xdb, 0xe1, 0x87, 0x2c, 0xc6, 0x21, 0x75, 0x4b, 0x86, 0xe9, 0x50,
|
||||
0x54, 0x83, 0xbc, 0xc4, 0x81, 0x5d, 0xa8, 0x5b, 0xcd, 0xb2, 0xab, 0x2e, 0x51, 0x07, 0xfe, 0xc6,
|
||||
0x59, 0x8c, 0x9e, 0x48, 0x73, 0xb4, 0x17, 0xb5, 0xf7, 0xbd, 0x1b, 0xd2, 0x46, 0x78, 0x7a, 0x70,
|
||||
0x8e, 0xe1, 0x2f, 0x21, 0x39, 0xc1, 0xb1, 0x97, 0xc5, 0x55, 0xd4, 0x66, 0x8f, 0x26, 0xcd, 0xb2,
|
||||
0xb1, 0x77, 0x46, 0x9f, 0x89, 0xd3, 0xd3, 0x94, 0x49, 0xdb, 0xad, 0x1a, 0x8f, 0xde, 0x28, 0xb9,
|
||||
0x1d, 0xb0, 0xd5, 0x5a, 0x17, 0x5e, 0x82, 0x85, 0x08, 0xcf, 0x89, 0xe7, 0x67, 0xfd, 0xd8, 0x4b,
|
||||
0x75, 0xab, 0x59, 0x72, 0xff, 0xd5, 0xcf, 0xbb, 0xe6, 0xf1, 0xb8, 0xbd, 0xc6, 0x8f, 0x1c, 0xd8,
|
||||
0x9d, 0x81, 0xfc, 0x73, 0xa5, 0x1e, 0xc2, 0xb2, 0x20, 0xb4, 0xef, 0xc9, 0x33, 0xce, 0x06, 0xc1,
|
||||
0x59, 0x5a, 0xeb, 0x2d, 0x6a, 0xa9, 0x28, 0xec, 0xd8, 0x50, 0xb3, 0x62, 0xcb, 0xff, 0x7e, 0x6c,
|
||||
0x9f, 0xa1, 0x9a, 0x70, 0x76, 0x39, 0x1c, 0x9b, 0x9a, 0x62, 0xb7, 0x6f, 0x30, 0xed, 0x2a, 0x28,
|
||||
0xf5, 0x5c, 0xd1, 0x0e, 0x99, 0xe5, 0xd4, 0x08, 0x35, 0xbe, 0xe5, 0xa0, 0x98, 0xe6, 0xf9, 0x0a,
|
||||
0x96, 0x42, 0xf3, 0xfd, 0xd8, 0x56, 0x3d, 0xdf, 0xac, 0x5c, 0x3d, 0x38, 0xe6, 0x7c, 0x5a, 0xee,
|
||||
0x88, 0x41, 0x6f, 0xa0, 0xc4, 0xd2, 0xaa, 0xec, 0x9c, 0xe6, 0x37, 0x26, 0xf9, 0x79, 0x35, 0xba,
|
||||
0x19, 0x85, 0x5a, 0x90, 0x8f, 0x58, 0x90, 0x46, 0xb7, 0x36, 0xa3, 0x83, 0x88, 0x05, 0x4e, 0x4a,
|
||||
0x29, 0x25, 0xda, 0x81, 0x3c, 0x4e, 0x12, 0xbb, 0xa0, 0x57, 0xbb, 0x6d, 0xf9, 0x0a, 0x41, 0x2f,
|
||||
0xa1, 0x9c, 0x25, 0x97, 0xc6, 0x7a, 0x77, 0x76, 0xac, 0xe9, 0x7a, 0x63, 0xf9, 0xf6, 0x16, 0x2c,
|
||||
0x9b, 0x9b, 0xef, 0x18, 0x8f, 0xb1, 0x54, 0xc7, 0x50, 0x57, 0x9d, 0xfb, 0x27, 0x83, 0xd3, 0xda,
|
||||
0x02, 0x2a, 0x41, 0xe1, 0x7d, 0xaf, 0xf3, 0xa9, 0x66, 0xed, 0xaf, 0x43, 0xd5, 0x67, 0xf1, 0x84,
|
||||
0xeb, 0x7e, 0xc5, 0x70, 0x5a, 0xfd, 0xa5, 0xa0, 0x6e, 0x9d, 0x14, 0xf5, 0x5f, 0xc6, 0xb3, 0x9f,
|
||||
0x01, 0x00, 0x00, 0xff, 0xff, 0x0d, 0xbe, 0x70, 0x63, 0x5d, 0x07, 0x00, 0x00,
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ option go_package = "core";
|
||||
option java_package = "com.v2ray.core";
|
||||
option java_outer_classname = "ConfigProto";
|
||||
|
||||
import "v2ray.com/core/common/loader/type.proto";
|
||||
import "v2ray.com/core/common/serial/typed_message.proto";
|
||||
import "v2ray.com/core/common/net/port.proto";
|
||||
import "v2ray.com/core/common/net/address.proto";
|
||||
import "v2ray.com/core/common/log/config.proto";
|
||||
@ -52,7 +52,7 @@ message AllocationStrategy {
|
||||
// Config for an inbound connection handler.
|
||||
message InboundConnectionConfig {
|
||||
// Protocol specific settings. Must be one of the supported protocols.
|
||||
v2ray.core.common.loader.TypedSettings settings = 1;
|
||||
v2ray.core.common.serial.TypedMessage settings = 1;
|
||||
|
||||
// Range of port number to run on. Both inclusive.
|
||||
v2ray.core.common.net.PortRange port_range = 2;
|
||||
@ -72,7 +72,7 @@ message InboundConnectionConfig {
|
||||
|
||||
// Config for an outbound connection handler.
|
||||
message OutboundConnectionConfig {
|
||||
v2ray.core.common.loader.TypedSettings settings = 1;
|
||||
v2ray.core.common.serial.TypedMessage settings = 1;
|
||||
|
||||
// IP address to send data through. 0.0.0.0 if unset.
|
||||
v2ray.core.common.net.IPOrDomain send_through = 2;
|
||||
@ -90,6 +90,6 @@ message Config {
|
||||
v2ray.core.common.log.Config log = 3;
|
||||
|
||||
// App configuration. Must be one in the app directory.
|
||||
repeated v2ray.core.common.loader.TypedSettings app = 4;
|
||||
repeated v2ray.core.common.serial.TypedMessage app = 4;
|
||||
v2ray.core.transport.Config transport = 5;
|
||||
}
|
@ -18,7 +18,7 @@ package blackhole
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
import v2ray_core_common_loader "v2ray.com/core/common/loader"
|
||||
import v2ray_core_common_serial "v2ray.com/core/common/serial"
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
@ -48,7 +48,7 @@ func (*HTTPResponse) ProtoMessage() {}
|
||||
func (*HTTPResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
|
||||
|
||||
type Config struct {
|
||||
Response *v2ray_core_common_loader.TypedSettings `protobuf:"bytes,1,opt,name=response" json:"response,omitempty"`
|
||||
Response *v2ray_core_common_serial.TypedMessage `protobuf:"bytes,1,opt,name=response" json:"response,omitempty"`
|
||||
}
|
||||
|
||||
func (m *Config) Reset() { *m = Config{} }
|
||||
@ -56,7 +56,7 @@ func (m *Config) String() string { return proto.CompactTextString(m)
|
||||
func (*Config) ProtoMessage() {}
|
||||
func (*Config) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }
|
||||
|
||||
func (m *Config) GetResponse() *v2ray_core_common_loader.TypedSettings {
|
||||
func (m *Config) GetResponse() *v2ray_core_common_serial.TypedMessage {
|
||||
if m != nil {
|
||||
return m.Response
|
||||
}
|
||||
@ -72,18 +72,18 @@ func init() {
|
||||
func init() { proto.RegisterFile("v2ray.com/core/proxy/blackhole/config.proto", fileDescriptor0) }
|
||||
|
||||
var fileDescriptor0 = []byte{
|
||||
// 203 bytes of a gzipped FileDescriptorProto
|
||||
// 205 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, 0x2f, 0x28, 0xca, 0xaf, 0xa8,
|
||||
0xd4, 0x4f, 0xca, 0x49, 0x4c, 0xce, 0xce, 0xc8, 0xcf, 0x49, 0xd5, 0x4f, 0xce, 0xcf, 0x4b, 0xcb,
|
||||
0x4c, 0xd7, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, 0x82, 0x29, 0x2e, 0x4a, 0xd5, 0x03, 0x2b,
|
||||
0xd4, 0x83, 0x2b, 0x94, 0x52, 0x47, 0x33, 0x28, 0x39, 0x3f, 0x37, 0x37, 0x3f, 0x4f, 0x3f, 0x27,
|
||||
0x3f, 0x31, 0x25, 0xb5, 0x48, 0xbf, 0xa4, 0xb2, 0x20, 0x15, 0x62, 0x88, 0x12, 0x1f, 0x17, 0x8f,
|
||||
0x5f, 0x7e, 0x5e, 0x6a, 0x50, 0x6a, 0x71, 0x41, 0x7e, 0x5e, 0x71, 0x2a, 0x88, 0xef, 0x11, 0x12,
|
||||
0x12, 0x00, 0xe7, 0xfb, 0x72, 0xb1, 0x39, 0x83, 0x2d, 0x15, 0x72, 0xe6, 0xe2, 0x28, 0x82, 0x8a,
|
||||
0x4a, 0x30, 0x2a, 0x30, 0x6a, 0x70, 0x1b, 0xa9, 0xeb, 0x21, 0xb9, 0x00, 0x62, 0x83, 0x1e, 0xc4,
|
||||
0x06, 0xbd, 0x90, 0xca, 0x82, 0xd4, 0x94, 0xe0, 0xd4, 0x92, 0x92, 0xcc, 0xbc, 0xf4, 0xe2, 0x20,
|
||||
0xb8, 0x46, 0x27, 0x0b, 0x2e, 0xb9, 0xe4, 0xfc, 0x5c, 0x3d, 0xdc, 0x2e, 0x77, 0xe2, 0x86, 0x58,
|
||||
0x17, 0x00, 0x72, 0x5d, 0x14, 0x27, 0x5c, 0x3c, 0x89, 0x0d, 0xec, 0x5e, 0x63, 0x40, 0x00, 0x00,
|
||||
0x00, 0xff, 0xff, 0x27, 0x0a, 0x95, 0x10, 0x23, 0x01, 0x00, 0x00,
|
||||
0xd4, 0x83, 0x2b, 0x94, 0x32, 0x40, 0x33, 0x28, 0x39, 0x3f, 0x37, 0x37, 0x3f, 0x4f, 0xbf, 0x38,
|
||||
0xb5, 0x28, 0x33, 0x31, 0x47, 0xbf, 0xa4, 0xb2, 0x20, 0x35, 0x25, 0x3e, 0x37, 0xb5, 0xb8, 0x38,
|
||||
0x31, 0x3d, 0x15, 0x62, 0x9a, 0x12, 0x1f, 0x17, 0x8f, 0x5f, 0x7e, 0x5e, 0x6a, 0x50, 0x6a, 0x71,
|
||||
0x41, 0x7e, 0x5e, 0x71, 0x2a, 0x88, 0xef, 0x11, 0x12, 0x12, 0x00, 0xe7, 0xfb, 0x70, 0xb1, 0x39,
|
||||
0x83, 0x6d, 0x17, 0x72, 0xe2, 0xe2, 0x28, 0x82, 0x8a, 0x4a, 0x30, 0x2a, 0x30, 0x6a, 0x70, 0x1b,
|
||||
0xa9, 0xe9, 0x21, 0x39, 0x05, 0x62, 0x95, 0x1e, 0xc4, 0x2a, 0xbd, 0x10, 0x90, 0x55, 0xbe, 0x10,
|
||||
0x9b, 0x82, 0xe0, 0xfa, 0x9c, 0x2c, 0xb8, 0xe4, 0x92, 0xf3, 0x73, 0xf5, 0x70, 0xfb, 0xc0, 0x89,
|
||||
0x1b, 0x62, 0x5b, 0x00, 0xc8, 0x71, 0x51, 0x9c, 0x70, 0xf1, 0x24, 0x36, 0xb0, 0x73, 0x8d, 0x01,
|
||||
0x01, 0x00, 0x00, 0xff, 0xff, 0x0b, 0x03, 0x0e, 0x8c, 0x2b, 0x01, 0x00, 0x00,
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ option go_package = "blackhole";
|
||||
option java_package = "com.v2ray.core.proxy.blackhole";
|
||||
option java_outer_classname = "ConfigProto";
|
||||
|
||||
import "v2ray.com/core/common/loader/type.proto";
|
||||
import "v2ray.com/core/common/serial/typed_message.proto";
|
||||
|
||||
message NoneResponse {
|
||||
}
|
||||
@ -14,5 +14,5 @@ message HTTPResponse {
|
||||
}
|
||||
|
||||
message Config {
|
||||
v2ray.core.common.loader.TypedSettings response = 1;
|
||||
v2ray.core.common.serial.TypedMessage response = 1;
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
package blackhole
|
||||
|
||||
import (
|
||||
"v2ray.com/core/common/loader"
|
||||
"v2ray.com/core/common/serial"
|
||||
"v2ray.com/core/proxy/registry"
|
||||
)
|
||||
|
||||
func init() {
|
||||
// Must listed after config.pb.go
|
||||
registry.MustRegisterOutboundHandlerCreator(loader.GetType(new(Config)), new(Factory))
|
||||
registry.MustRegisterOutboundHandlerCreator(serial.GetMessageType(new(Config)), new(Factory))
|
||||
}
|
||||
|
@ -7,9 +7,9 @@ import (
|
||||
"v2ray.com/core/app/dispatcher"
|
||||
"v2ray.com/core/common/buf"
|
||||
"v2ray.com/core/common/errors"
|
||||
"v2ray.com/core/common/loader"
|
||||
"v2ray.com/core/common/log"
|
||||
v2net "v2ray.com/core/common/net"
|
||||
"v2ray.com/core/common/serial"
|
||||
"v2ray.com/core/proxy"
|
||||
"v2ray.com/core/proxy/registry"
|
||||
"v2ray.com/core/transport/internet"
|
||||
@ -212,5 +212,5 @@ func (v *Factory) Create(space app.Space, rawConfig interface{}, meta *proxy.Inb
|
||||
}
|
||||
|
||||
func init() {
|
||||
registry.MustRegisterInboundHandlerCreator(loader.GetType(new(Config)), new(Factory))
|
||||
registry.MustRegisterInboundHandlerCreator(serial.GetMessageType(new(Config)), new(Factory))
|
||||
}
|
||||
|
@ -8,10 +8,10 @@ import (
|
||||
"v2ray.com/core/common/buf"
|
||||
"v2ray.com/core/common/dice"
|
||||
"v2ray.com/core/common/errors"
|
||||
"v2ray.com/core/common/loader"
|
||||
"v2ray.com/core/common/log"
|
||||
v2net "v2ray.com/core/common/net"
|
||||
"v2ray.com/core/common/retry"
|
||||
"v2ray.com/core/common/serial"
|
||||
"v2ray.com/core/proxy"
|
||||
"v2ray.com/core/proxy/registry"
|
||||
"v2ray.com/core/transport/internet"
|
||||
@ -142,5 +142,5 @@ func (v *FreedomFactory) Create(space app.Space, config interface{}, meta *proxy
|
||||
}
|
||||
|
||||
func init() {
|
||||
registry.MustRegisterOutboundHandlerCreator(loader.GetType(new(Config)), new(FreedomFactory))
|
||||
registry.MustRegisterOutboundHandlerCreator(serial.GetMessageType(new(Config)), new(FreedomFactory))
|
||||
}
|
||||
|
@ -14,9 +14,9 @@ import (
|
||||
"v2ray.com/core/common/buf"
|
||||
"v2ray.com/core/common/bufio"
|
||||
"v2ray.com/core/common/errors"
|
||||
"v2ray.com/core/common/loader"
|
||||
"v2ray.com/core/common/log"
|
||||
v2net "v2ray.com/core/common/net"
|
||||
"v2ray.com/core/common/serial"
|
||||
"v2ray.com/core/proxy"
|
||||
"v2ray.com/core/proxy/registry"
|
||||
"v2ray.com/core/transport/internet"
|
||||
@ -288,5 +288,5 @@ func (v *ServerFactory) Create(space app.Space, rawConfig interface{}, meta *pro
|
||||
}
|
||||
|
||||
func init() {
|
||||
registry.MustRegisterInboundHandlerCreator(loader.GetType(new(ServerConfig)), new(ServerFactory))
|
||||
registry.MustRegisterInboundHandlerCreator(serial.GetMessageType(new(ServerConfig)), new(ServerFactory))
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
package shadowsocks
|
||||
|
||||
import (
|
||||
"v2ray.com/core/common/loader"
|
||||
"v2ray.com/core/common/serial"
|
||||
"v2ray.com/core/proxy/registry"
|
||||
)
|
||||
|
||||
func init() {
|
||||
// Must happen after config is initialized
|
||||
registry.MustRegisterOutboundHandlerCreator(loader.GetType(new(ClientConfig)), new(ClientFactory))
|
||||
registry.MustRegisterInboundHandlerCreator(loader.GetType(new(ServerConfig)), new(ServerFactory))
|
||||
registry.MustRegisterOutboundHandlerCreator(serial.GetMessageType(new(ClientConfig)), new(ClientFactory))
|
||||
registry.MustRegisterInboundHandlerCreator(serial.GetMessageType(new(ServerConfig)), new(ServerFactory))
|
||||
}
|
||||
|
@ -4,7 +4,6 @@ import (
|
||||
"testing"
|
||||
|
||||
"v2ray.com/core/common/buf"
|
||||
"v2ray.com/core/common/loader"
|
||||
v2net "v2ray.com/core/common/net"
|
||||
"v2ray.com/core/common/protocol"
|
||||
"v2ray.com/core/common/serial"
|
||||
@ -22,7 +21,7 @@ func TestUDPEncoding(t *testing.T) {
|
||||
Port: 1234,
|
||||
User: &protocol.User{
|
||||
Email: "love@v2ray.com",
|
||||
Account: loader.NewTypedSettings(&Account{
|
||||
Account: serial.ToTypedMessage(&Account{
|
||||
Password: "shadowsocks-password",
|
||||
CipherType: CipherType_AES_128_CFB,
|
||||
Ota: Account_Disabled,
|
||||
@ -53,7 +52,7 @@ func TestTCPRequest(t *testing.T) {
|
||||
Port: 1234,
|
||||
User: &protocol.User{
|
||||
Email: "love@v2ray.com",
|
||||
Account: loader.NewTypedSettings(&Account{
|
||||
Account: serial.ToTypedMessage(&Account{
|
||||
Password: "tcp-password",
|
||||
CipherType: CipherType_CHACHA20,
|
||||
}),
|
||||
@ -83,7 +82,7 @@ func TestUDPReaderWriter(t *testing.T) {
|
||||
assert := assert.On(t)
|
||||
|
||||
user := &protocol.User{
|
||||
Account: loader.NewTypedSettings(&Account{
|
||||
Account: serial.ToTypedMessage(&Account{
|
||||
Password: "test-password",
|
||||
CipherType: CipherType_CHACHA20_IEFT,
|
||||
}),
|
||||
|
@ -11,9 +11,9 @@ import (
|
||||
"v2ray.com/core/common/bufio"
|
||||
"v2ray.com/core/common/crypto"
|
||||
"v2ray.com/core/common/errors"
|
||||
"v2ray.com/core/common/loader"
|
||||
"v2ray.com/core/common/log"
|
||||
v2net "v2ray.com/core/common/net"
|
||||
"v2ray.com/core/common/serial"
|
||||
"v2ray.com/core/proxy"
|
||||
"v2ray.com/core/proxy/registry"
|
||||
"v2ray.com/core/proxy/socks/protocol"
|
||||
@ -334,5 +334,5 @@ func (v *ServerFactory) Create(space app.Space, rawConfig interface{}, meta *pro
|
||||
}
|
||||
|
||||
func init() {
|
||||
registry.MustRegisterInboundHandlerCreator(loader.GetType(new(ServerConfig)), new(ServerFactory))
|
||||
registry.MustRegisterInboundHandlerCreator(serial.GetMessageType(new(ServerConfig)), new(ServerFactory))
|
||||
}
|
||||
|
@ -4,9 +4,9 @@ import (
|
||||
"testing"
|
||||
|
||||
"v2ray.com/core/common/buf"
|
||||
"v2ray.com/core/common/loader"
|
||||
v2net "v2ray.com/core/common/net"
|
||||
"v2ray.com/core/common/protocol"
|
||||
"v2ray.com/core/common/serial"
|
||||
"v2ray.com/core/common/uuid"
|
||||
"v2ray.com/core/proxy/vmess"
|
||||
. "v2ray.com/core/proxy/vmess/encoding"
|
||||
@ -24,7 +24,7 @@ func TestRequestSerialization(t *testing.T) {
|
||||
Id: uuid.New().String(),
|
||||
AlterId: 0,
|
||||
}
|
||||
user.Account = loader.NewTypedSettings(account)
|
||||
user.Account = serial.ToTypedMessage(account)
|
||||
|
||||
expectedRequest := &protocol.RequestHeader{
|
||||
Version: 1,
|
||||
|
@ -11,10 +11,10 @@ import (
|
||||
"v2ray.com/core/common/buf"
|
||||
"v2ray.com/core/common/bufio"
|
||||
"v2ray.com/core/common/errors"
|
||||
"v2ray.com/core/common/loader"
|
||||
"v2ray.com/core/common/log"
|
||||
v2net "v2ray.com/core/common/net"
|
||||
"v2ray.com/core/common/protocol"
|
||||
"v2ray.com/core/common/serial"
|
||||
"v2ray.com/core/common/uuid"
|
||||
"v2ray.com/core/proxy"
|
||||
"v2ray.com/core/proxy/registry"
|
||||
@ -59,7 +59,7 @@ func (v *userByEmail) Get(email string) (*protocol.User, bool) {
|
||||
user = &protocol.User{
|
||||
Level: v.defaultLevel,
|
||||
Email: email,
|
||||
Account: loader.NewTypedSettings(account),
|
||||
Account: serial.ToTypedMessage(account),
|
||||
}
|
||||
v.cache[email] = user
|
||||
}
|
||||
@ -272,5 +272,5 @@ func (v *Factory) Create(space app.Space, rawConfig interface{}, meta *proxy.Inb
|
||||
}
|
||||
|
||||
func init() {
|
||||
registry.MustRegisterInboundHandlerCreator(loader.GetType(new(Config)), new(Factory))
|
||||
registry.MustRegisterInboundHandlerCreator(serial.GetMessageType(new(Config)), new(Factory))
|
||||
}
|
||||
|
@ -3,9 +3,9 @@ package outbound
|
||||
import (
|
||||
"time"
|
||||
|
||||
"v2ray.com/core/common/loader"
|
||||
v2net "v2ray.com/core/common/net"
|
||||
"v2ray.com/core/common/protocol"
|
||||
"v2ray.com/core/common/serial"
|
||||
"v2ray.com/core/proxy/vmess"
|
||||
)
|
||||
|
||||
@ -18,7 +18,7 @@ func (v *VMessOutboundHandler) handleSwitchAccount(cmd *protocol.CommandSwitchAc
|
||||
user := &protocol.User{
|
||||
Email: "",
|
||||
Level: cmd.Level,
|
||||
Account: loader.NewTypedSettings(account),
|
||||
Account: serial.ToTypedMessage(account),
|
||||
}
|
||||
dest := v2net.TCPDestination(cmd.Host, cmd.Port)
|
||||
until := time.Now().Add(time.Duration(cmd.ValidMin) * time.Minute)
|
||||
|
@ -6,11 +6,11 @@ import (
|
||||
"v2ray.com/core/app"
|
||||
"v2ray.com/core/common/buf"
|
||||
"v2ray.com/core/common/bufio"
|
||||
"v2ray.com/core/common/loader"
|
||||
"v2ray.com/core/common/log"
|
||||
v2net "v2ray.com/core/common/net"
|
||||
"v2ray.com/core/common/protocol"
|
||||
"v2ray.com/core/common/retry"
|
||||
"v2ray.com/core/common/serial"
|
||||
"v2ray.com/core/proxy"
|
||||
"v2ray.com/core/proxy/registry"
|
||||
"v2ray.com/core/proxy/vmess"
|
||||
@ -176,5 +176,5 @@ func (v *Factory) Create(space app.Space, rawConfig interface{}, meta *proxy.Out
|
||||
}
|
||||
|
||||
func init() {
|
||||
registry.MustRegisterOutboundHandlerCreator(loader.GetType(new(Config)), new(Factory))
|
||||
registry.MustRegisterOutboundHandlerCreator(serial.GetMessageType(new(Config)), new(Factory))
|
||||
}
|
||||
|
@ -3,27 +3,27 @@ package conf
|
||||
import (
|
||||
"encoding/json"
|
||||
"v2ray.com/core/common/errors"
|
||||
"v2ray.com/core/common/loader"
|
||||
"v2ray.com/core/common/serial"
|
||||
"v2ray.com/core/proxy/blackhole"
|
||||
)
|
||||
|
||||
type NoneResponse struct{}
|
||||
|
||||
func (*NoneResponse) Build() (*loader.TypedSettings, error) {
|
||||
return loader.NewTypedSettings(new(blackhole.NoneResponse)), nil
|
||||
func (*NoneResponse) Build() (*serial.TypedMessage, error) {
|
||||
return serial.ToTypedMessage(new(blackhole.NoneResponse)), nil
|
||||
}
|
||||
|
||||
type HttpResponse struct{}
|
||||
|
||||
func (*HttpResponse) Build() (*loader.TypedSettings, error) {
|
||||
return loader.NewTypedSettings(new(blackhole.HTTPResponse)), nil
|
||||
func (*HttpResponse) Build() (*serial.TypedMessage, error) {
|
||||
return serial.ToTypedMessage(new(blackhole.HTTPResponse)), nil
|
||||
}
|
||||
|
||||
type BlackholeConfig struct {
|
||||
Response json.RawMessage `json:"response"`
|
||||
}
|
||||
|
||||
func (v *BlackholeConfig) Build() (*loader.TypedSettings, error) {
|
||||
func (v *BlackholeConfig) Build() (*serial.TypedMessage, error) {
|
||||
config := new(blackhole.Config)
|
||||
if v.Response != nil {
|
||||
response, _, err := configLoader.Load(v.Response)
|
||||
@ -37,7 +37,7 @@ func (v *BlackholeConfig) Build() (*loader.TypedSettings, error) {
|
||||
config.Response = responseSettings
|
||||
}
|
||||
|
||||
return loader.NewTypedSettings(config), nil
|
||||
return serial.ToTypedMessage(config), nil
|
||||
}
|
||||
|
||||
var (
|
||||
|
@ -1,9 +1,9 @@
|
||||
package conf
|
||||
|
||||
import (
|
||||
"v2ray.com/core/common/loader"
|
||||
"v2ray.com/core/common/serial"
|
||||
)
|
||||
|
||||
type Buildable interface {
|
||||
Build() (*loader.TypedSettings, error)
|
||||
Build() (*serial.TypedMessage, error)
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package conf
|
||||
|
||||
import (
|
||||
"v2ray.com/core/common/loader"
|
||||
"v2ray.com/core/common/serial"
|
||||
"v2ray.com/core/proxy/dokodemo"
|
||||
)
|
||||
|
||||
@ -13,7 +13,7 @@ type DokodemoConfig struct {
|
||||
Redirect bool `json:"followRedirect"`
|
||||
}
|
||||
|
||||
func (v *DokodemoConfig) Build() (*loader.TypedSettings, error) {
|
||||
func (v *DokodemoConfig) Build() (*serial.TypedMessage, error) {
|
||||
config := new(dokodemo.Config)
|
||||
if v.Host != nil {
|
||||
config.Address = v.Host.Build()
|
||||
@ -22,5 +22,5 @@ func (v *DokodemoConfig) Build() (*loader.TypedSettings, error) {
|
||||
config.NetworkList = v.NetworkList.Build()
|
||||
config.Timeout = v.TimeoutValue
|
||||
config.FollowRedirect = v.Redirect
|
||||
return loader.NewTypedSettings(config), nil
|
||||
return serial.ToTypedMessage(config), nil
|
||||
}
|
||||
|
6
6