Schedulers -> Flow

This commit is contained in:
RPRX
2020-09-11 03:37:23 +00:00
committed by GitHub
parent 72d8d2abdf
commit ee1e18df24
9 changed files with 65 additions and 66 deletions
+4 -4
View File
@@ -13,7 +13,7 @@ import (
func EncodeHeaderAddons(buffer *buf.Buffer, addons *Addons) error {
switch addons.Scheduler {
switch addons.Flow {
default:
if err := buffer.WriteByte(0); err != nil {
@@ -47,7 +47,7 @@ func DecodeHeaderAddons(buffer *buf.Buffer, reader io.Reader) (*Addons, error) {
}
// Verification.
switch addons.Scheduler {
switch addons.Flow {
default:
}
@@ -61,7 +61,7 @@ func DecodeHeaderAddons(buffer *buf.Buffer, reader io.Reader) (*Addons, error) {
// EncodeBodyAddons returns a Writer that auto-encrypt content written by caller.
func EncodeBodyAddons(writer io.Writer, request *protocol.RequestHeader, addons *Addons) buf.Writer {
switch addons.Scheduler {
switch addons.Flow {
default:
return buf.NewWriter(writer)
@@ -73,7 +73,7 @@ func EncodeBodyAddons(writer io.Writer, request *protocol.RequestHeader, addons
// DecodeBodyAddons returns a Reader from which caller can fetch decrypted body.
func DecodeBodyAddons(reader io.Reader, request *protocol.RequestHeader, addons *Addons) buf.Reader {
switch addons.Scheduler {
switch addons.Flow {
default:
return buf.NewReader(reader)
+31 -31
View File
@@ -23,8 +23,8 @@ var _ = math.Inf
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
type Addons struct {
Scheduler string `protobuf:"bytes,1,opt,name=Scheduler,proto3" json:"Scheduler,omitempty"`
SchedulerV []byte `protobuf:"bytes,2,opt,name=SchedulerV,proto3" json:"SchedulerV,omitempty"`
Flow string `protobuf:"bytes,1,opt,name=Flow,proto3" json:"Flow,omitempty"`
Seed []byte `protobuf:"bytes,2,opt,name=Seed,proto3" json:"Seed,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@@ -63,16 +63,16 @@ func (m *Addons) XXX_DiscardUnknown() {
var xxx_messageInfo_Addons proto.InternalMessageInfo
func (m *Addons) GetScheduler() string {
func (m *Addons) GetFlow() string {
if m != nil {
return m.Scheduler
return m.Flow
}
return ""
}
func (m *Addons) GetSchedulerV() []byte {
func (m *Addons) GetSeed() []byte {
if m != nil {
return m.SchedulerV
return m.Seed
}
return nil
}
@@ -84,19 +84,19 @@ func init() {
func init() { proto.RegisterFile("proxy/vless/encoding/addons.proto", fileDescriptor_75ab671b0ca8b1cc) }
var fileDescriptor_75ab671b0ca8b1cc = []byte{
// 192 bytes of a gzipped FileDescriptorProto
// 186 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x2c, 0x28, 0xca, 0xaf,
0xa8, 0xd4, 0x2f, 0xcb, 0x49, 0x2d, 0x2e, 0xd6, 0x4f, 0xcd, 0x4b, 0xce, 0x4f, 0xc9, 0xcc, 0x4b,
0xd7, 0x4f, 0x4c, 0x49, 0xc9, 0xcf, 0x2b, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, 0x2f,
0x33, 0x2a, 0x4a, 0xac, 0xd4, 0x4b, 0xce, 0x2f, 0x4a, 0xd5, 0x03, 0xab, 0xd6, 0x03, 0xab, 0xd6,
0x83, 0xa9, 0x56, 0x72, 0xe3, 0x62, 0x73, 0x04, 0x6b, 0x10, 0x92, 0xe1, 0xe2, 0x0c, 0x4e, 0xce,
0x48, 0x4d, 0x29, 0xcd, 0x49, 0x2d, 0x92, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x0c, 0x42, 0x08, 0x08,
0xc9, 0x71, 0x71, 0xc1, 0x39, 0x61, 0x12, 0x4c, 0x0a, 0x8c, 0x1a, 0x3c, 0x41, 0x48, 0x22, 0x4e,
0x75, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x8c, 0xc7,
0x72, 0x0c, 0x5c, 0xca, 0xc9, 0xf9, 0xb9, 0x7a, 0x04, 0xac, 0x0f, 0x60, 0x8c, 0x52, 0x86, 0x29,
0xc9, 0xd5, 0x07, 0x29, 0xd3, 0xc7, 0xe6, 0xa7, 0x55, 0x4c, 0xf2, 0x61, 0x46, 0x41, 0x89, 0x95,
0x7a, 0xce, 0x20, 0x83, 0x02, 0xc0, 0x06, 0x85, 0x81, 0x0d, 0x72, 0x85, 0xaa, 0x48, 0x62, 0x03,
0xfb, 0xd7, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0x21, 0xe4, 0x67, 0xb0, 0x14, 0x01, 0x00, 0x00,
0x83, 0xa9, 0x56, 0x32, 0xe0, 0x62, 0x73, 0x04, 0x6b, 0x10, 0x12, 0xe2, 0x62, 0x71, 0xcb, 0xc9,
0x2f, 0x97, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x0c, 0x02, 0xb3, 0x41, 0x62, 0xc1, 0xa9, 0xa9, 0x29,
0x12, 0x4c, 0x0a, 0x8c, 0x1a, 0x3c, 0x41, 0x60, 0xb6, 0x53, 0xdd, 0x89, 0x47, 0x72, 0x8c, 0x17,
0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, 0xe3, 0xb1, 0x1c, 0x03, 0x97, 0x72, 0x72, 0x7e,
0xae, 0x1e, 0x01, 0x8b, 0x02, 0x18, 0xa3, 0x94, 0x61, 0x4a, 0x72, 0xf5, 0x41, 0xca, 0xf4, 0xb1,
0xb9, 0x7e, 0x15, 0x93, 0x7c, 0x98, 0x51, 0x50, 0x62, 0xa5, 0x9e, 0x33, 0xc8, 0xa0, 0x00, 0xb0,
0x41, 0x61, 0x60, 0x83, 0x5c, 0xa1, 0x2a, 0x92, 0xd8, 0xc0, 0x3e, 0x33, 0x06, 0x04, 0x00, 0x00,
0xff, 0xff, 0x36, 0x32, 0x14, 0x7c, 0xfe, 0x00, 0x00, 0x00,
}
func (m *Addons) Marshal() (dAtA []byte, err error) {
@@ -123,17 +123,17 @@ func (m *Addons) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i -= len(m.XXX_unrecognized)
copy(dAtA[i:], m.XXX_unrecognized)
}
if len(m.SchedulerV) > 0 {
i -= len(m.SchedulerV)
copy(dAtA[i:], m.SchedulerV)
i = encodeVarintAddons(dAtA, i, uint64(len(m.SchedulerV)))
if len(m.Seed) > 0 {
i -= len(m.Seed)
copy(dAtA[i:], m.Seed)
i = encodeVarintAddons(dAtA, i, uint64(len(m.Seed)))
i--
dAtA[i] = 0x12
}
if len(m.Scheduler) > 0 {
i -= len(m.Scheduler)
copy(dAtA[i:], m.Scheduler)
i = encodeVarintAddons(dAtA, i, uint64(len(m.Scheduler)))
if len(m.Flow) > 0 {
i -= len(m.Flow)
copy(dAtA[i:], m.Flow)
i = encodeVarintAddons(dAtA, i, uint64(len(m.Flow)))
i--
dAtA[i] = 0xa
}
@@ -157,11 +157,11 @@ func (m *Addons) Size() (n int) {
}
var l int
_ = l
l = len(m.Scheduler)
l = len(m.Flow)
if l > 0 {
n += 1 + l + sovAddons(uint64(l))
}
l = len(m.SchedulerV)
l = len(m.Seed)
if l > 0 {
n += 1 + l + sovAddons(uint64(l))
}
@@ -208,7 +208,7 @@ func (m *Addons) Unmarshal(dAtA []byte) error {
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Scheduler", wireType)
return fmt.Errorf("proto: wrong wireType = %d for field Flow", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
@@ -236,11 +236,11 @@ func (m *Addons) Unmarshal(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Scheduler = string(dAtA[iNdEx:postIndex])
m.Flow = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field SchedulerV", wireType)
return fmt.Errorf("proto: wrong wireType = %d for field Seed", wireType)
}
var byteLen int
for shift := uint(0); ; shift += 7 {
@@ -267,9 +267,9 @@ func (m *Addons) Unmarshal(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.SchedulerV = append(m.SchedulerV[:0], dAtA[iNdEx:postIndex]...)
if m.SchedulerV == nil {
m.SchedulerV = []byte{}
m.Seed = append(m.Seed[:0], dAtA[iNdEx:postIndex]...)
if m.Seed == nil {
m.Seed = []byte{}
}
iNdEx = postIndex
default:
+2 -2
View File
@@ -7,6 +7,6 @@ option java_package = "com.v2ray.core.proxy.vless.encoding";
option java_multiple_files = true;
message Addons {
string Scheduler = 1;
bytes SchedulerV = 2;
string Flow = 1;
bytes Seed = 2;
}