Merge pull request #2730 from v2fly/master

merge fly
pull/2734/head
Kslr 2020-09-11 15:59:46 +08:00 committed by GitHub
commit 7a50794964
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 101 additions and 128 deletions

View File

@ -1,8 +1,8 @@
run:
modules-download-mode: vendor
skip-dirs:
- generated.*
- external
skip-files:
- generated.*
linters:
enable:
@ -44,3 +44,6 @@ linters:
- unused
- varcheck
- whitespace
issues:
new: true

View File

@ -13,7 +13,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.14
go-version: ^1.15
- name: Checkout codebase
uses: actions/checkout@v2

View File

@ -1,4 +1,4 @@
name: Lint
name: Linter
on:
push:
@ -14,7 +14,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.14
go-version: ^1.15
- name: Checkout codebase
uses: actions/checkout@v2
@ -26,17 +26,9 @@ jobs:
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-
- name: Lint *.go files
if: ${{ always() }}
run: |
go vet $(go list ./... | grep -v /external/)
if [[ $? != 0 ]]; then
exit 1
fi
- name: Lint other files
if: ${{ always() }}
uses: github/super-linter@v3.9.4
uses: github/super-linter@v3.10.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VALIDATE_ALL_CODEBASE: false
@ -48,12 +40,8 @@ jobs:
VALIDATE_MD: false
VALIDATE_PROTOBUF: false
- name: Show if need to format code
if: ${{ always() }}
run: |
filesNeedToFormat=$(go fmt ./...)
if [[ $filesNeedToFormat ]]; then
echo -e "\033[0;36m[Error] The following Go files need to be formatted:\033[0m"
echo -e "\033[0;31m$filesNeedToFormat\033[0m"
exit 1
fi
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
version: v1.31
args: --config=.github/linters/.golangci.yml

View File

@ -25,7 +25,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.14
go-version: ^1.15
- name: Checkout codebase
uses: actions/checkout@v2

View File

@ -4,7 +4,7 @@
# Project V
![](https://github.com/v2fly/v2ray-core/workflows/Test/badge.svg)
[![codecov.io][3]][4] [![GoDoc][5]][6] [![codebeat][7]][8] [![Downloads][9]][10]
[![codecov.io][3]][4] [![GoDoc][5]][6] [![codebeat][7]][8] [![Downloads][9]][10] [![Downloads][11]][12]
[3]: https://codecov.io/gh/v2fly/v2ray-core/branch/master/graph/badge.svg?branch=master "Coverage badge"
[4]: https://codecov.io/gh/v2fly/v2ray-core?branch=master "Codecov Status"
@ -14,12 +14,14 @@
[8]: https://codebeat.co/projects/github-com-v2ray-v2ray-core-master "Codebeat"
[9]: https://img.shields.io/github/downloads/v2ray/v2ray-core/total.svg "All releases badge"
[10]: https://github.com/v2ray/v2ray-core/releases/ "All releases number"
[11]: https://img.shields.io/github/downloads/v2fly/v2ray-core/total.svg "All releases badge"
[12]: https://github.com/v2fly/v2ray-core/releases/ "All releases number"
Project V is a set of network tools that help you to build your own computer network. It secures your network connections and thus protects your privacy. See [our website](https://www.v2fly.org/) for more information.
## License
[The MIT License (MIT)](https://raw.githubusercontent.com/v2ray/v2ray-core/master/LICENSE)
[The MIT License (MIT)](https://raw.githubusercontent.com/v2fly/v2ray-core/master/LICENSE)
## Credits

View File

@ -14,13 +14,13 @@ variables:
- name: GOPATH
value: '$(system.defaultWorkingDirectory)/gopath'
- name: BAZEL_VER
value: '0.23.0'
value: '3.5.0'
steps:
- checkout: self
- task: GoTool@0
inputs:
version: '1.15.1'
version: '1.15.2'
- script: |
mkdir triggersrc
ls -I "triggersrc" | xargs cp -rf -t triggersrc

View File

@ -19,7 +19,7 @@ import (
)
var (
version = "4.27.5"
version = "4.28.0"
build = "Custom"
codename = "V2Fly, a community-driven edition of V2Ray."
intro = "A unified platform for anti-censorship."

View File

@ -48,8 +48,8 @@ func (c *VLessInboundConfig) Build() (proto.Message, error) {
return nil, newError(`VLESS clients: invalid user`).Base(err)
}
if account.Schedulers != "" {
return nil, newError(`VLESS clients: "schedulers" is not available in this version`)
if account.Flow != "" {
return nil, newError(`VLESS clients: "flow" is not available in this version`)
}
if account.Encryption != "" {
return nil, newError(`VLESS clients: "encryption" should not in inbound settings`)
@ -161,8 +161,8 @@ func (c *VLessOutboundConfig) Build() (proto.Message, error) {
return nil, newError(`VLESS users: invalid user`).Base(err)
}
if account.Schedulers != "" {
return nil, newError(`VLESS users: "schedulers" is not available in this version`)
if account.Flow != "" {
return nil, newError(`VLESS users: "flow" is not available in this version`)
}
if account.Encryption != "none" {
return nil, newError(`VLESS users: please add/set "encryption":"none" for every user`)

View File

@ -14,10 +14,9 @@ import (
)
type VMessAccount struct {
ID string `json:"id"`
AlterIds uint16 `json:"alterId"`
Security string `json:"security"`
TestsEnabled string `json:"testsEnabled"`
ID string `json:"id"`
AlterIds uint16 `json:"alterId"`
Security string `json:"security"`
}
// Build implements Buildable
@ -41,7 +40,6 @@ func (a *VMessAccount) Build() *vmess.Account {
SecuritySettings: &protocol.SecurityConfig{
Type: st,
},
TestsEnabled: a.TestsEnabled,
}
}

View File

@ -15,7 +15,7 @@ func (a *Account) AsAccount() (protocol.Account, error) {
}
return &MemoryAccount{
ID: protocol.NewID(id),
Schedulers: a.Schedulers, // needs parser here?
Flow: a.Flow, // needs parser here?
Encryption: a.Encryption, // needs parser here?
}, nil
}
@ -24,8 +24,8 @@ func (a *Account) AsAccount() (protocol.Account, error) {
type MemoryAccount struct {
// ID of the account.
ID *protocol.ID
// Schedulers of the account.
Schedulers string
// Flow of the account. May be "xtls-rprx-origin".
Flow string
// Encryption of the account. Used for client connections, and only accepts "none" for now.
Encryption string
}

View File

@ -32,8 +32,8 @@ type Account struct {
// ID of the account, in the form of a UUID, e.g., "66ad4540-b58c-4ad2-9926-ea63445a9b57".
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
// Schedulers settings.
Schedulers string `protobuf:"bytes,2,opt,name=schedulers,proto3" json:"schedulers,omitempty"`
// Flow settings. May be "xtls-rprx-origin".
Flow string `protobuf:"bytes,2,opt,name=flow,proto3" json:"flow,omitempty"`
// Encryption settings. Only applies to client side, and only accepts "none" for now.
Encryption string `protobuf:"bytes,3,opt,name=encryption,proto3" json:"encryption,omitempty"`
}
@ -77,9 +77,9 @@ func (x *Account) GetId() string {
return ""
}
func (x *Account) GetSchedulers() string {
func (x *Account) GetFlow() string {
if x != nil {
return x.Schedulers
return x.Flow
}
return ""
}
@ -97,18 +97,17 @@ var file_proxy_vless_account_proto_rawDesc = []byte{
0x0a, 0x19, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x76, 0x6c, 0x65, 0x73, 0x73, 0x2f, 0x61, 0x63,
0x63, 0x6f, 0x75, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x16, 0x76, 0x32, 0x72,
0x61, 0x79, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x76, 0x6c,
0x65, 0x73, 0x73, 0x22, 0x59, 0x0a, 0x07, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x0e,
0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1e,
0x0a, 0x0a, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, 0x01,
0x28, 0x09, 0x52, 0x0a, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x73, 0x12, 0x1e,
0x0a, 0x0a, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01,
0x28, 0x09, 0x52, 0x0a, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x53,
0x0a, 0x1a, 0x63, 0x6f, 0x6d, 0x2e, 0x76, 0x32, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x72, 0x65,
0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x76, 0x6c, 0x65, 0x73, 0x73, 0x50, 0x01, 0x5a, 0x1a,
0x76, 0x32, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x70,
0x72, 0x6f, 0x78, 0x79, 0x2f, 0x76, 0x6c, 0x65, 0x73, 0x73, 0xaa, 0x02, 0x16, 0x56, 0x32, 0x52,
0x61, 0x79, 0x2e, 0x43, 0x6f, 0x72, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x56, 0x6c,
0x65, 0x73, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x65, 0x73, 0x73, 0x22, 0x4d, 0x0a, 0x07, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x0e,
0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12,
0x0a, 0x04, 0x66, 0x6c, 0x6f, 0x77, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x66, 0x6c,
0x6f, 0x77, 0x12, 0x1e, 0x0a, 0x0a, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, 0x6f, 0x6e,
0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69,
0x6f, 0x6e, 0x42, 0x53, 0x0a, 0x1a, 0x63, 0x6f, 0x6d, 0x2e, 0x76, 0x32, 0x72, 0x61, 0x79, 0x2e,
0x63, 0x6f, 0x72, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x76, 0x6c, 0x65, 0x73, 0x73,
0x50, 0x01, 0x5a, 0x1a, 0x76, 0x32, 0x72, 0x61, 0x79, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f,
0x72, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x76, 0x6c, 0x65, 0x73, 0x73, 0xaa, 0x02,
0x16, 0x56, 0x32, 0x52, 0x61, 0x79, 0x2e, 0x43, 0x6f, 0x72, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x78,
0x79, 0x2e, 0x56, 0x6c, 0x65, 0x73, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (

View File

@ -9,8 +9,8 @@ option java_multiple_files = true;
message Account {
// ID of the account, in the form of a UUID, e.g., "66ad4540-b58c-4ad2-9926-ea63445a9b57".
string id = 1;
// Schedulers settings.
string schedulers = 2;
// Flow settings. May be "xtls-rprx-origin".
string flow = 2;
// Encryption settings. Only applies to client side, and only accepts "none" for now.
string encryption = 3;
}

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)

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:

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;
}

View File

@ -166,7 +166,9 @@ func (h *Handler) Process(ctx context.Context, network net.Network, connection i
err = newError("fallback directly")
} else {
request, requestAddons, err, pre = encoding.DecodeRequestHeader(reader, h.validator)
if pre == nil {
if pre != nil {
defer pre.Release()
} else {
isfb = false
}
}
@ -286,6 +288,7 @@ func (h *Handler) Process(ctx context.Context, network net.Network, connection i
}
}
pro := buf.New()
defer pro.Release()
switch fb.Xver {
case 1:
if ipv4 {
@ -414,7 +417,7 @@ func (h *Handler) Process(ctx context.Context, network net.Network, connection i
defer timer.SetTimeout(sessionPolicy.Timeouts.UplinkOnly)
responseAddons := &encoding.Addons{
Scheduler: requestAddons.Scheduler,
Flow: requestAddons.Flow,
}
bufferWriter := buf.NewBufferedWriter(buf.NewWriter(connection))
@ -445,7 +448,7 @@ func (h *Handler) Process(ctx context.Context, network net.Network, connection i
}
// Indicates the end of response payload.
switch responseAddons.Scheduler {
switch responseAddons.Flow {
default:
}

View File

@ -105,7 +105,7 @@ func (v *Handler) Process(ctx context.Context, link *transport.Link, dialer inte
account := request.User.Account.(*vless.MemoryAccount)
requestAddons := &encoding.Addons{
Scheduler: account.Schedulers,
Flow: account.Flow,
}
sessionPolicy := v.policyManager.ForLevel(request.User.Level)
@ -140,7 +140,7 @@ func (v *Handler) Process(ctx context.Context, link *transport.Link, dialer inte
}
// Indicates the end of request payload.
switch requestAddons.Scheduler {
switch requestAddons.Flow {
default:
}

View File

@ -16,8 +16,6 @@ type MemoryAccount struct {
AlterIDs []*protocol.ID
// Security type of the account. Used for client connections.
Security protocol.SecurityType
TestsEnabled string
}
// AnyValidID returns an ID that is either the main ID or one of the alternative IDs if any.
@ -46,9 +44,8 @@ func (a *Account) AsAccount() (protocol.Account, error) {
}
protoID := protocol.NewID(id)
return &MemoryAccount{
ID: protoID,
AlterIDs: protocol.NewAlterIDs(protoID, uint16(a.AlterId)),
Security: a.SecuritySettings.GetSecurityType(),
TestsEnabled: a.TestsEnabled,
ID: protoID,
AlterIDs: protocol.NewAlterIDs(protoID, uint16(a.AlterId)),
Security: a.SecuritySettings.GetSecurityType(),
}, nil
}

View File

@ -9,12 +9,9 @@ import (
"crypto/rand"
"crypto/sha256"
"encoding/binary"
"fmt"
"hash"
"hash/fnv"
"io"
"os"
"strings"
vmessaead "v2ray.com/core/proxy/vmess/aead"
"golang.org/x/crypto/chacha20poly1305"
@ -59,26 +56,12 @@ func NewClientSession(idHash protocol.IDHash, ctx context.Context) *ClientSessio
session.isAEADRequest = false
if ctxValueTestsEnabled := ctx.Value(vmess.TestsEnabled); ctxValueTestsEnabled != nil {
testsEnabled := ctxValueTestsEnabled.(string)
if strings.Contains(testsEnabled, "VMessAEAD") {
if ctxValueAlterID := ctx.Value(vmess.AlterID); ctxValueAlterID != nil {
if ctxValueAlterID == 0 {
session.isAEADRequest = true
}
}
if vmessexp, vmessexp_found := os.LookupEnv("VMESSAEADEXPERIMENT"); vmessexp_found {
if vmessexp == "y" {
session.isAEADRequest = true
}
if vmessexp == "n" {
session.isAEADRequest = false
}
}
if session.isAEADRequest {
fmt.Println("=======VMESSAEADEXPERIMENT ENABLED========")
}
copy(session.requestBodyKey[:], randomBytes[:16])
copy(session.requestBodyIV[:], randomBytes[16:32])
session.responseHeader = randomBytes[32]

View File

@ -113,7 +113,7 @@ func (v *Handler) Process(ctx context.Context, link *transport.Link, dialer inte
input := link.Reader
output := link.Writer
ctx = context.WithValue(ctx, vmess.TestsEnabled, user.Account.(*vmess.MemoryAccount).TestsEnabled)
ctx = context.WithValue(ctx, vmess.AlterID, len(account.AlterIDs))
session := encoding.NewClientSession(protocol.DefaultIDHash, ctx)
sessionPolicy := v.policyManager.ForLevel(request.User.Level)

View File

@ -1,3 +1,3 @@
package vmess
const TestsEnabled = "VMessCtxInterface_TestsEnabled"
const AlterID = "VMessCtxInterface_AlterID"