Skip to content

Commit

Permalink
Merge pull request v2ray#2730 from v2fly/master
Browse files Browse the repository at this point in the history
merge fly
  • Loading branch information
kslr authored Sep 11, 2020
2 parents 1d759b4 + 8661477 commit 7a50794
Show file tree
Hide file tree
Showing 21 changed files with 101 additions and 128 deletions.
7 changes: 5 additions & 2 deletions .github/linters/.golangci.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
run:
modules-download-mode: vendor
skip-dirs:
- generated.*
- external
skip-files:
- generated.*

linters:
enable:
Expand Down Expand Up @@ -44,3 +44,6 @@ linters:
- unused
- varcheck
- whitespace

issues:
new: true
2 changes: 1 addition & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
28 changes: 8 additions & 20 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Lint
name: Linter

on:
push:
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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

Expand Down
4 changes: 2 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion core.go
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down
8 changes: 4 additions & 4 deletions infra/conf/vless.go
Original file line number Diff line number Diff line change
Expand Up @@ -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`)
Expand Down Expand Up @@ -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`)
Expand Down
8 changes: 3 additions & 5 deletions infra/conf/vmess.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -41,7 +40,6 @@ func (a *VMessAccount) Build() *vmess.Account {
SecuritySettings: &protocol.SecurityConfig{
Type: st,
},
TestsEnabled: a.TestsEnabled,
}
}

Expand Down
6 changes: 3 additions & 3 deletions proxy/vless/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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
}
Expand Down
31 changes: 15 additions & 16 deletions proxy/vless/account.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions proxy/vless/account.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
8 changes: 4 additions & 4 deletions proxy/vless/encoding/addons.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -47,7 +47,7 @@ func DecodeHeaderAddons(buffer *buf.Buffer, reader io.Reader) (*Addons, error) {
}

// Verification.
switch addons.Scheduler {
switch addons.Flow {
default:

}
Expand All @@ -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)
Expand All @@ -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)
Expand Down
Loading

0 comments on commit 7a50794

Please sign in to comment.