mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-01-17 14:57:44 -05:00
refactor shell
This commit is contained in:
parent
22ef12a456
commit
c1f91567ad
@ -1,4 +1,4 @@
|
|||||||
package point
|
package core
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io"
|
"io"
|
@ -1,6 +1,6 @@
|
|||||||
// +build json
|
// +build json
|
||||||
|
|
||||||
package point
|
package core
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
@ -1,6 +1,6 @@
|
|||||||
// +build json
|
// +build json
|
||||||
|
|
||||||
package point_test
|
package core_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
@ -9,7 +9,7 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
. "v2ray.com/core/shell/point"
|
. "v2ray.com/core"
|
||||||
|
|
||||||
"v2ray.com/core/testing/assert"
|
"v2ray.com/core/testing/assert"
|
||||||
)
|
)
|
@ -1,4 +1,4 @@
|
|||||||
package point
|
package core
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"v2ray.com/core/proxy"
|
"v2ray.com/core/proxy"
|
@ -1,4 +1,4 @@
|
|||||||
package point
|
package core
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"v2ray.com/core/app"
|
"v2ray.com/core/app"
|
@ -1,4 +1,4 @@
|
|||||||
package point
|
package core
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"sync"
|
"sync"
|
@ -11,7 +11,6 @@ import (
|
|||||||
|
|
||||||
"v2ray.com/core"
|
"v2ray.com/core"
|
||||||
"v2ray.com/core/common/log"
|
"v2ray.com/core/common/log"
|
||||||
"v2ray.com/core/shell/point"
|
|
||||||
|
|
||||||
// The following are necessary as they register handlers in their init functions.
|
// The following are necessary as they register handlers in their init functions.
|
||||||
_ "v2ray.com/core/proxy/blackhole"
|
_ "v2ray.com/core/proxy/blackhole"
|
||||||
@ -49,7 +48,7 @@ func init() {
|
|||||||
flag.StringVar(&configFile, "config", defaultConfigFile, "Config file for this Point server.")
|
flag.StringVar(&configFile, "config", defaultConfigFile, "Config file for this Point server.")
|
||||||
}
|
}
|
||||||
|
|
||||||
func startV2Ray() *point.Point {
|
func startV2Ray() *core.Point {
|
||||||
if len(configFile) == 0 {
|
if len(configFile) == 0 {
|
||||||
log.Error("Config file is not set.")
|
log.Error("Config file is not set.")
|
||||||
return nil
|
return nil
|
||||||
@ -67,13 +66,13 @@ func startV2Ray() *point.Point {
|
|||||||
defer file.Close()
|
defer file.Close()
|
||||||
configInput = file
|
configInput = file
|
||||||
}
|
}
|
||||||
config, err := point.LoadConfig(configInput)
|
config, err := core.LoadConfig(configInput)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Failed to read config file (", configFile, "): ", configFile, err)
|
log.Error("Failed to read config file (", configFile, "): ", configFile, err)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
vPoint, err := point.NewPoint(config)
|
vPoint, err := core.NewPoint(config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Failed to create Point server: ", err)
|
log.Error("Failed to create Point server: ", err)
|
||||||
return nil
|
return nil
|
@ -33,7 +33,7 @@ func GetTestBinaryPath() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func GetSourcePath() string {
|
func GetSourcePath() string {
|
||||||
return filepath.Join("v2ray.com", "core", "shell", "point", "main")
|
return filepath.Join("v2ray.com", "core", "main")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestFile(filename string) string {
|
func TestFile(filename string) string {
|
||||||
|
@ -14,7 +14,7 @@ func buildV2Ray(targetFile string, version string, goOS GoOS, goArch GoArch) err
|
|||||||
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
|
ldFlags = ldFlags + " -X v2ray.com/core.version=" + version + " -X v2ray.com/core.build=" + today
|
||||||
}
|
}
|
||||||
cmd := exec.Command("go", "build", "-tags", "json", "-o", targetFile, "-compiler", "gc", "-ldflags", ldFlags, "v2ray.com/core/shell/point/main")
|
cmd := exec.Command("go", "build", "-tags", "json", "-o", targetFile, "-compiler", "gc", "-ldflags", ldFlags, "v2ray.com/core/main")
|
||||||
cmd.Env = append(cmd.Env, "GOOS="+string(goOS), "GOARCH="+string(goArch))
|
cmd.Env = append(cmd.Env, "GOOS="+string(goOS), "GOARCH="+string(goArch))
|
||||||
cmd.Env = append(cmd.Env, os.Environ()...)
|
cmd.Env = append(cmd.Env, os.Environ()...)
|
||||||
output, err := cmd.CombinedOutput()
|
output, err := cmd.CombinedOutput()
|
||||||
|
@ -1,8 +1,4 @@
|
|||||||
// Package point is a shell of V2Ray to run on various of systems.
|
package core
|
||||||
// Point server is a full functionality proxying system. It consists of an inbound and an outbound
|
|
||||||
// connection, as well as any number of inbound and outbound detours. It provides a way internally
|
|
||||||
// to route network packets.
|
|
||||||
package point
|
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"v2ray.com/core/app"
|
"v2ray.com/core/app"
|
Loading…
Reference in New Issue
Block a user