Browse Source

refactor shell

pull/314/head
Darien Raymond 8 years ago
parent
commit
c1f91567ad
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169
  1. 2
      config.go
  2. 2
      config_json.go
  3. 4
      config_json_test.go
  4. 2
      inbound_detour.go
  5. 2
      inbound_detour_always.go
  6. 2
      inbound_detour_dynamic.go
  7. 7
      main/main.go
  8. 0
      main/main_test.go
  9. 2
      testing/scenarios/server_env.go
  10. 2
      tools/build/go.go
  11. 6
      v2ray.go

2
shell/point/config.go → config.go

@ -1,4 +1,4 @@
package point
package core
import (
"io"

2
shell/point/config_json.go → config_json.go

@ -1,6 +1,6 @@
// +build json
package point
package core
import (
"encoding/json"

4
shell/point/config_json_test.go → config_json_test.go

@ -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"
)

2
shell/point/inbound_detour.go → inbound_detour.go

@ -1,4 +1,4 @@
package point
package core
import (
"v2ray.com/core/proxy"

2
shell/point/inbound_detour_always.go → inbound_detour_always.go

@ -1,4 +1,4 @@
package point
package core
import (
"v2ray.com/core/app"

2
shell/point/inbound_detour_dynamic.go → inbound_detour_dynamic.go

@ -1,4 +1,4 @@
package point
package core
import (
"sync"

7
shell/point/main/main.go → main/main.go

@ -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

0
shell/point/main/main_test.go → main/main_test.go

2
testing/scenarios/server_env.go

@ -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 {

2
tools/build/go.go

@ -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()

6
shell/point/point.go → v2ray.go

@ -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…
Cancel
Save