mirror of https://github.com/v2ray/v2ray-core
				
				
				
			refactor shell
							parent
							
								
									22ef12a456
								
							
						
					
					
						commit
						c1f91567ad
					
				| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
package point
 | 
			
		||||
package core
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"io"
 | 
			
		||||
| 
						 | 
				
			
			@ -1,6 +1,6 @@
 | 
			
		|||
// +build json
 | 
			
		||||
 | 
			
		||||
package point
 | 
			
		||||
package core
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"encoding/json"
 | 
			
		||||
| 
						 | 
				
			
			@ -1,6 +1,6 @@
 | 
			
		|||
// +build json
 | 
			
		||||
 | 
			
		||||
package point_test
 | 
			
		||||
package core_test
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"encoding/json"
 | 
			
		||||
| 
						 | 
				
			
			@ -9,7 +9,7 @@ import (
 | 
			
		|||
	"path/filepath"
 | 
			
		||||
	"testing"
 | 
			
		||||
 | 
			
		||||
	. "v2ray.com/core/shell/point"
 | 
			
		||||
	. "v2ray.com/core"
 | 
			
		||||
 | 
			
		||||
	"v2ray.com/core/testing/assert"
 | 
			
		||||
)
 | 
			
		||||
| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
package point
 | 
			
		||||
package core
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"v2ray.com/core/proxy"
 | 
			
		||||
| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
package point
 | 
			
		||||
package core
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"v2ray.com/core/app"
 | 
			
		||||
| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
package point
 | 
			
		||||
package core
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"sync"
 | 
			
		||||
| 
						 | 
				
			
			@ -11,7 +11,6 @@ import (
 | 
			
		|||
 | 
			
		||||
	"v2ray.com/core"
 | 
			
		||||
	"v2ray.com/core/common/log"
 | 
			
		||||
	"v2ray.com/core/shell/point"
 | 
			
		||||
 | 
			
		||||
	// The following are necessary as they register handlers in their init functions.
 | 
			
		||||
	_ "v2ray.com/core/proxy/blackhole"
 | 
			
		||||
| 
						 | 
				
			
			@ -49,7 +48,7 @@ func init() {
 | 
			
		|||
	flag.StringVar(&configFile, "config", defaultConfigFile, "Config file for this Point server.")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func startV2Ray() *point.Point {
 | 
			
		||||
func startV2Ray() *core.Point {
 | 
			
		||||
	if len(configFile) == 0 {
 | 
			
		||||
		log.Error("Config file is not set.")
 | 
			
		||||
		return nil
 | 
			
		||||
| 
						 | 
				
			
			@ -67,13 +66,13 @@ func startV2Ray() *point.Point {
 | 
			
		|||
		defer file.Close()
 | 
			
		||||
		configInput = file
 | 
			
		||||
	}
 | 
			
		||||
	config, err := point.LoadConfig(configInput)
 | 
			
		||||
	config, err := core.LoadConfig(configInput)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		log.Error("Failed to read config file (", configFile, "): ", configFile, err)
 | 
			
		||||
		return nil
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	vPoint, err := point.NewPoint(config)
 | 
			
		||||
	vPoint, err := core.NewPoint(config)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		log.Error("Failed to create Point server: ", err)
 | 
			
		||||
		return nil
 | 
			
		||||
| 
						 | 
				
			
			@ -33,7 +33,7 @@ func GetTestBinaryPath() 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 {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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)
 | 
			
		||||
		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, os.Environ()...)
 | 
			
		||||
	output, err := cmd.CombinedOutput()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,8 +1,4 @@
 | 
			
		|||
// Package point is a shell of V2Ray to run on various of systems.
 | 
			
		||||
// 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
 | 
			
		||||
package core
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"v2ray.com/core/app"
 | 
			
		||||
		Loading…
	
		Reference in New Issue