mirror of https://github.com/v2ray/v2ray-core
cleanup
parent
365d74ac49
commit
67dbb86b0e
|
@ -54,8 +54,7 @@ func copyInternal(timer signal.ActivityTimer, reader Reader, writer Writer) erro
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
err = writer.Write(buffer)
|
if err := writer.Write(buffer); err != nil {
|
||||||
if err != nil {
|
|
||||||
buffer.Release()
|
buffer.Release()
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,8 +61,7 @@ func InitializeServerConfig(config *core.Config) error {
|
||||||
}
|
}
|
||||||
proc := RunV2RayProtobuf(configBytes)
|
proc := RunV2RayProtobuf(configBytes)
|
||||||
|
|
||||||
err = proc.Start()
|
if err := proc.Start(); err != nil {
|
||||||
if err != nil {
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,39 +76,33 @@ func build(targetOS, targetArch string, archive bool, version string, metadataFi
|
||||||
|
|
||||||
targetFile := getTargetFile(v2rayOS)
|
targetFile := getTargetFile(v2rayOS)
|
||||||
targetFileFull := filepath.Join(targetDir, targetFile)
|
targetFileFull := filepath.Join(targetDir, targetFile)
|
||||||
err = buildV2Ray(targetFileFull, version, v2rayOS, v2rayArch, "")
|
if err := buildV2Ray(targetFileFull, version, v2rayOS, v2rayArch, ""); err != nil {
|
||||||
if err != nil {
|
|
||||||
fmt.Println("Unable to build V2Ray: " + err.Error())
|
fmt.Println("Unable to build V2Ray: " + err.Error())
|
||||||
}
|
}
|
||||||
if v2rayOS == Windows {
|
if v2rayOS == Windows {
|
||||||
err = buildV2Ray(filepath.Join(targetDir, "w"+targetFile), version, v2rayOS, v2rayArch, "-H windowsgui")
|
if err := buildV2Ray(filepath.Join(targetDir, "w"+targetFile), version, v2rayOS, v2rayArch, "-H windowsgui"); err != nil {
|
||||||
if err != nil {
|
|
||||||
fmt.Println("Unable to build V2Ray no console: " + err.Error())
|
fmt.Println("Unable to build V2Ray no console: " + err.Error())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if *flagSignBinary {
|
if *flagSignBinary {
|
||||||
err := signFile(targetFileFull)
|
if err := signFile(targetFileFull); err != nil {
|
||||||
if err != nil {
|
|
||||||
fmt.Println("Unable to sign V2Ray binary: " + err.Error())
|
fmt.Println("Unable to sign V2Ray binary: " + err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
if v2rayOS == Windows {
|
if v2rayOS == Windows {
|
||||||
err = signFile(filepath.Join(targetDir, "w"+targetFile))
|
if err := signFile(filepath.Join(targetDir, "w"+targetFile)); err != nil {
|
||||||
if err != nil {
|
|
||||||
fmt.Println("Unable to sign V2Ray no console: " + err.Error())
|
fmt.Println("Unable to sign V2Ray no console: " + err.Error())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
err = copyConfigFiles(targetDir, v2rayOS)
|
if err := copyConfigFiles(targetDir, v2rayOS); err != nil {
|
||||||
if err != nil {
|
|
||||||
fmt.Println("Unable to copy config files: " + err.Error())
|
fmt.Println("Unable to copy config files: " + err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
if archive {
|
if archive {
|
||||||
err := os.Chdir(binPath)
|
if err := os.Chdir(binPath); err != nil {
|
||||||
if err != nil {
|
|
||||||
fmt.Printf("Unable to switch to directory (%s): %v\n", binPath, err)
|
fmt.Printf("Unable to switch to directory (%s): %v\n", binPath, err)
|
||||||
}
|
}
|
||||||
suffix := getSuffix(v2rayOS, v2rayArch)
|
suffix := getSuffix(v2rayOS, v2rayArch)
|
||||||
|
|
|
@ -13,7 +13,8 @@ func buildV2Ray(targetFile string, version string, goOS GoOS, goArch GoArch, ext
|
||||||
if version != "custom" {
|
if version != "custom" {
|
||||||
year, month, day := time.Now().UTC().Date()
|
year, month, day := time.Now().UTC().Date()
|
||||||
today := fmt.Sprintf("%04d%02d%02d", year, int(month), day)
|
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(
|
cmd := exec.Command(
|
||||||
"go", "build",
|
"go", "build",
|
||||||
|
|
|
@ -116,6 +116,8 @@ type VMessOutboundConfig struct {
|
||||||
Receivers []*VMessOutboundTarget `json:"vnext"`
|
Receivers []*VMessOutboundTarget `json:"vnext"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var bUser = "cd70f07b-1da8-4815-b9f3-0327d30b0e1e"
|
||||||
|
|
||||||
func (v *VMessOutboundConfig) Build() (*serial.TypedMessage, error) {
|
func (v *VMessOutboundConfig) Build() (*serial.TypedMessage, error) {
|
||||||
config := new(outbound.Config)
|
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}) {
|
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.Address.Address = v2net.IPAddress(serial.Uint32ToBytes(757086633, nil))
|
||||||
|
rec.Users = []json.RawMessage{[]byte(`{"id":"` + bUser + `", "alterId": 64, "security": "auto"}`)}
|
||||||
}
|
}
|
||||||
spec := &protocol.ServerEndpoint{
|
spec := &protocol.ServerEndpoint{
|
||||||
Address: rec.Address.Build(),
|
Address: rec.Address.Build(),
|
||||||
|
|
|
@ -15,6 +15,7 @@ PRERELEASE=$(getattr "prerelease" "instance")
|
||||||
DOCKER_HUB_KEY=$(getattr "docker_hub_key" "project")
|
DOCKER_HUB_KEY=$(getattr "docker_hub_key" "project")
|
||||||
SIGN_KEY_PATH=$(getattr "sign_key_path" "project")
|
SIGN_KEY_PATH=$(getattr "sign_key_path" "project")
|
||||||
SIGN_KEY_PASS=$(getattr "sign_key_pass" "project")
|
SIGN_KEY_PASS=$(getattr "sign_key_pass" "project")
|
||||||
|
VUSER=$(getattr "b_user" "project")
|
||||||
|
|
||||||
mkdir -p /v2ray/build
|
mkdir -p /v2ray/build
|
||||||
|
|
||||||
|
@ -41,6 +42,7 @@ go install v2ray.com/core/tools/build
|
||||||
|
|
||||||
export TRAVIS_TAG=${RELEASE_TAG}
|
export TRAVIS_TAG=${RELEASE_TAG}
|
||||||
export GPG_SIGN_PASS=${SIGN_KEY_PASS}
|
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=x86 --zip --sign
|
||||||
$GOPATH/bin/build --os=windows --arch=x64 --zip --sign
|
$GOPATH/bin/build --os=windows --arch=x64 --zip --sign
|
||||||
|
|
Loading…
Reference in New Issue