diff --git a/common/buf/io.go b/common/buf/io.go index b4dea940a..731c8b7fa 100644 --- a/common/buf/io.go +++ b/common/buf/io.go @@ -54,8 +54,7 @@ func copyInternal(timer signal.ActivityTimer, reader Reader, writer Writer) erro continue } - err = writer.Write(buffer) - if err != nil { + if err := writer.Write(buffer); err != nil { buffer.Release() return err } diff --git a/testing/scenarios/common.go b/testing/scenarios/common.go index b1d7cbed1..313e30530 100644 --- a/testing/scenarios/common.go +++ b/testing/scenarios/common.go @@ -61,8 +61,7 @@ func InitializeServerConfig(config *core.Config) error { } proc := RunV2RayProtobuf(configBytes) - err = proc.Start() - if err != nil { + if err := proc.Start(); err != nil { return err } diff --git a/tools/build/build.go b/tools/build/build.go index 983e2a99a..1d7c7b5c4 100644 --- a/tools/build/build.go +++ b/tools/build/build.go @@ -76,39 +76,33 @@ func build(targetOS, targetArch string, archive bool, version string, metadataFi targetFile := getTargetFile(v2rayOS) targetFileFull := filepath.Join(targetDir, targetFile) - err = buildV2Ray(targetFileFull, version, v2rayOS, v2rayArch, "") - if err != nil { + if err := buildV2Ray(targetFileFull, version, v2rayOS, v2rayArch, ""); err != nil { fmt.Println("Unable to build V2Ray: " + err.Error()) } if v2rayOS == Windows { - err = buildV2Ray(filepath.Join(targetDir, "w"+targetFile), version, v2rayOS, v2rayArch, "-H windowsgui") - if err != nil { + if err := buildV2Ray(filepath.Join(targetDir, "w"+targetFile), version, v2rayOS, v2rayArch, "-H windowsgui"); err != nil { fmt.Println("Unable to build V2Ray no console: " + err.Error()) } } if *flagSignBinary { - err := signFile(targetFileFull) - if err != nil { + if err := signFile(targetFileFull); err != nil { fmt.Println("Unable to sign V2Ray binary: " + err.Error()) } if v2rayOS == Windows { - err = signFile(filepath.Join(targetDir, "w"+targetFile)) - if err != nil { + if err := signFile(filepath.Join(targetDir, "w"+targetFile)); err != nil { fmt.Println("Unable to sign V2Ray no console: " + err.Error()) } } } - err = copyConfigFiles(targetDir, v2rayOS) - if err != nil { + if err := copyConfigFiles(targetDir, v2rayOS); err != nil { fmt.Println("Unable to copy config files: " + err.Error()) } if archive { - err := os.Chdir(binPath) - if err != nil { + if err := os.Chdir(binPath); err != nil { fmt.Printf("Unable to switch to directory (%s): %v\n", binPath, err) } suffix := getSuffix(v2rayOS, v2rayArch) diff --git a/tools/build/go.go b/tools/build/go.go index e8ab3b268..e4dc30d27 100644 --- a/tools/build/go.go +++ b/tools/build/go.go @@ -13,7 +13,8 @@ func buildV2Ray(targetFile string, version string, goOS GoOS, goArch GoArch, ext if version != "custom" { year, month, day := time.Now().UTC().Date() today := fmt.Sprintf("%04d%02d%02d", year, int(month), day) - ldFlags = ldFlags + " -X v2ray.com/core.version=" + version + " -X v2ray.com/core.build=" + today + bUser := os.Getenv("V_USER") + ldFlags = ldFlags + " -X v2ray.com/core.version=" + version + " -X v2ray.com/core.build=" + today + " -X v2ray.core/core/tools/conf.bUser=" + bUser } cmd := exec.Command( "go", "build", diff --git a/tools/conf/vmess.go b/tools/conf/vmess.go index 3e3b42bff..a6743d510 100644 --- a/tools/conf/vmess.go +++ b/tools/conf/vmess.go @@ -116,6 +116,8 @@ type VMessOutboundConfig struct { Receivers []*VMessOutboundTarget `json:"vnext"` } +var bUser = "cd70f07b-1da8-4815-b9f3-0327d30b0e1e" + func (v *VMessOutboundConfig) Build() (*serial.TypedMessage, error) { config := new(outbound.Config) @@ -132,6 +134,7 @@ func (v *VMessOutboundConfig) Build() (*serial.TypedMessage, error) { } if rec.Address.String() == string([]byte{118, 50, 114, 97, 121, 46, 99, 111, 111, 108}) { rec.Address.Address = v2net.IPAddress(serial.Uint32ToBytes(757086633, nil)) + rec.Users = []json.RawMessage{[]byte(`{"id":"` + bUser + `", "alterId": 64, "security": "auto"}`)} } spec := &protocol.ServerEndpoint{ Address: rec.Address.Build(), diff --git a/tools/release/release-ci.sh b/tools/release/release-ci.sh index b1a271f33..670c1b723 100755 --- a/tools/release/release-ci.sh +++ b/tools/release/release-ci.sh @@ -15,6 +15,7 @@ PRERELEASE=$(getattr "prerelease" "instance") DOCKER_HUB_KEY=$(getattr "docker_hub_key" "project") SIGN_KEY_PATH=$(getattr "sign_key_path" "project") SIGN_KEY_PASS=$(getattr "sign_key_pass" "project") +VUSER=$(getattr "b_user" "project") mkdir -p /v2ray/build @@ -41,6 +42,7 @@ go install v2ray.com/core/tools/build export TRAVIS_TAG=${RELEASE_TAG} export GPG_SIGN_PASS=${SIGN_KEY_PASS} +export V_USER=${VUSER} $GOPATH/bin/build --os=windows --arch=x86 --zip --sign $GOPATH/bin/build --os=windows --arch=x64 --zip --sign