mirror of
https://github.com/v2ray/v2ray-core.git
synced 2026-10-25 23:59:25 +00:00
Version 1.0 alpha
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"auth": "noauth"
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"clients": [
|
||||
{"id": "ad937d9d-6e23-4a5a-ba23-bce5092a7c51"}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"vnext": [
|
||||
{
|
||||
"address": "127.0.0.1",
|
||||
"port": 27183,
|
||||
"users": [
|
||||
{"id": "ad937d9d-6e23-4a5a-ba23-bce5092a7c51"}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"port": 1080,
|
||||
"inbound": {
|
||||
"protocol": "socks",
|
||||
"file": "in_socks.json"
|
||||
},
|
||||
"outbound": {
|
||||
"protocol": "vmess",
|
||||
"file": "out_vmess.json"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"port": 27183,
|
||||
"inbound": {
|
||||
"protocol": "vmess",
|
||||
"file": "in_vmess.json"
|
||||
},
|
||||
"outbound": {
|
||||
"protocol": "freedom",
|
||||
"file": ""
|
||||
}
|
||||
}
|
||||
+53
-1
@@ -1,5 +1,57 @@
|
||||
package main
|
||||
|
||||
func main() {
|
||||
import (
|
||||
"flag"
|
||||
"io/ioutil"
|
||||
"path"
|
||||
|
||||
"github.com/v2ray/v2ray-core"
|
||||
"github.com/v2ray/v2ray-core/log"
|
||||
|
||||
_ "github.com/v2ray/v2ray-core/net/freedom"
|
||||
_ "github.com/v2ray/v2ray-core/net/socks"
|
||||
_ "github.com/v2ray/v2ray-core/net/vmess"
|
||||
)
|
||||
|
||||
var (
|
||||
configFile = flag.String("config", "", "Config file for this VPoint server.")
|
||||
)
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
|
||||
log.SetLogLevel(log.DebugLevel)
|
||||
|
||||
if configFile == nil || len(*configFile) == 0 {
|
||||
panic(log.Error("Config file is not set."))
|
||||
}
|
||||
rawVConfig, err := ioutil.ReadFile(*configFile)
|
||||
if err != nil {
|
||||
panic(log.Error("Failed to read config file (%s): %v", *configFile, err))
|
||||
}
|
||||
vconfig, err := core.LoadVConfig(rawVConfig)
|
||||
if err != nil {
|
||||
panic(log.Error("Failed to parse VConfig: %v", err))
|
||||
}
|
||||
|
||||
if !path.IsAbs(vconfig.InboundConfig.File) && len(vconfig.InboundConfig.File) > 0 {
|
||||
vconfig.InboundConfig.File = path.Join(path.Dir(*configFile), vconfig.InboundConfig.File)
|
||||
}
|
||||
|
||||
if !path.IsAbs(vconfig.OutboundConfig.File) && len(vconfig.OutboundConfig.File) > 0 {
|
||||
vconfig.OutboundConfig.File = path.Join(path.Dir(*configFile), vconfig.OutboundConfig.File)
|
||||
}
|
||||
|
||||
vPoint, err := core.NewVPoint(vconfig)
|
||||
if err != nil {
|
||||
panic(log.Error("Failed to create VPoint server: %v", err))
|
||||
}
|
||||
|
||||
err = vPoint.Start()
|
||||
if err != nil {
|
||||
log.Error("Error starting VPoint server.")
|
||||
}
|
||||
|
||||
finish := make(chan bool)
|
||||
<-finish
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user