Skip to content

Commit

Permalink
refactor shell
Browse files Browse the repository at this point in the history
  • Loading branch information
DarienRaymond committed Oct 12, 2016
1 parent 22ef12a commit c1f9156
Show file tree
Hide file tree
Showing 11 changed files with 13 additions and 18 deletions.
2 changes: 1 addition & 1 deletion shell/point/config.go → config.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package point
package core

import (
"io"
Expand Down
2 changes: 1 addition & 1 deletion shell/point/config_json.go → config_json.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// +build json

package point
package core

import (
"encoding/json"
Expand Down
4 changes: 2 additions & 2 deletions shell/point/config_json_test.go → config_json_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// +build json

package point_test
package core_test

import (
"encoding/json"
Expand All @@ -9,7 +9,7 @@ import (
"path/filepath"
"testing"

. "v2ray.com/core/shell/point"
. "v2ray.com/core"

"v2ray.com/core/testing/assert"
)
Expand Down
2 changes: 1 addition & 1 deletion shell/point/inbound_detour.go → inbound_detour.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package point
package core

import (
"v2ray.com/core/proxy"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package point
package core

import (
"v2ray.com/core/app"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package point
package core

import (
"sync"
Expand Down
7 changes: 3 additions & 4 deletions shell/point/main/main.go → main/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion testing/scenarios/server_env.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion tools/build/go.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
6 changes: 1 addition & 5 deletions shell/point/point.go → v2ray.go
Original file line number Diff line number Diff line change
@@ -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"
Expand Down

0 comments on commit c1f9156

Please sign in to comment.