Browse Source

update: v2fly-core version `5.1.0`

v1.x.x
dnomd343 2 years ago
parent
commit
a8f2be82bc
  1. 2
      Dockerfile
  2. 2
      cmd/common/file.go
  3. 2
      cmd/config/decode.go
  4. 2
      cmd/controller.go
  5. 5
      cmd/proxy/main.go
  6. 2
      cmd/xproxy.go

2
Dockerfile

@ -18,7 +18,7 @@ COPY --from=upx /upx/ /usr/
RUN upx -9 /tmp/xray RUN upx -9 /tmp/xray
FROM golang:1.18-alpine3.16 AS v2ray FROM golang:1.18-alpine3.16 AS v2ray
ENV V2FLY_VERSION="4.45.2" ENV V2FLY_VERSION="5.1.0"
RUN wget https://github.com/v2fly/v2ray-core/archive/refs/tags/v${V2FLY_VERSION}.tar.gz && tar xf v${V2FLY_VERSION}.tar.gz RUN wget https://github.com/v2fly/v2ray-core/archive/refs/tags/v${V2FLY_VERSION}.tar.gz && tar xf v${V2FLY_VERSION}.tar.gz
WORKDIR ./v2ray-core-${V2FLY_VERSION}/ WORKDIR ./v2ray-core-${V2FLY_VERSION}/
RUN go mod download -x RUN go mod download -x

2
cmd/common/file.go

@ -57,7 +57,7 @@ func ListFiles(folderPath string, suffix string) []string {
func CopyFile(source string, target string) { func CopyFile(source string, target string) {
log.Infof("Copy file `%s` => `%s`", source, target) log.Infof("Copy file `%s` => `%s`", source, target)
if IsFileExist(target) { if IsFileExist(target) {
log.Debugf("File `%s` will be overrided", target) log.Debugf("File `%s` will be overridden", target)
} }
srcFile, err := os.Open(source) srcFile, err := os.Open(source)
defer srcFile.Close() defer srcFile.Close()

2
cmd/config/decode.go

@ -146,7 +146,7 @@ func decodeProxy(rawConfig *RawConfig, config *Config) {
log.Debugf("Add-on inbounds -> %v", config.Proxy.AddOn) log.Debugf("Add-on inbounds -> %v", config.Proxy.AddOn)
log.Debugf("Connection sniff -> %t", config.Proxy.Sniff.Enable) log.Debugf("Connection sniff -> %t", config.Proxy.Sniff.Enable)
log.Debugf("Connection redirect -> %t", config.Proxy.Sniff.Redirect) log.Debugf("Connection redirect -> %t", config.Proxy.Sniff.Redirect)
log.Debugf("Connection sniff exlcude -> %v", config.Proxy.Sniff.Exclude) log.Debugf("Connection sniff exclude -> %v", config.Proxy.Sniff.Exclude)
} }
func decodeRadvd(rawConfig *RawConfig, config *Config) { func decodeRadvd(rawConfig *RawConfig, config *Config) {

2
cmd/controller.go

@ -74,7 +74,7 @@ func runProxy(settings *config.Config) {
if settings.Proxy.Core == "xray" { // xray-core if settings.Proxy.Core == "xray" { // xray-core
runProcess([]string{"XRAY_LOCATION_ASSET=" + assetDir}, "xray", "-confdir", configDir) runProcess([]string{"XRAY_LOCATION_ASSET=" + assetDir}, "xray", "-confdir", configDir)
} else if settings.Proxy.Core == "v2ray" { // v2fly-core } else if settings.Proxy.Core == "v2ray" { // v2fly-core
runProcess([]string{"V2RAY_LOCATION_ASSET=" + assetDir}, "v2ray", "-confdir", configDir) runProcess([]string{"V2RAY_LOCATION_ASSET=" + assetDir}, "v2ray", "run", "-d", configDir)
} else if settings.Proxy.Core == "sagray" { // sager-core } else if settings.Proxy.Core == "sagray" { // sager-core
runProcess([]string{"V2RAY_LOCATION_ASSET=" + assetDir}, "sagray", "run", "-confdir", configDir) runProcess([]string{"V2RAY_LOCATION_ASSET=" + assetDir}, "sagray", "run", "-confdir", configDir)
} else { } else {

5
cmd/proxy/main.go

@ -33,9 +33,6 @@ func loadInbounds(config *Config) string {
DestOverride: []string{"http", "tls", "quic"}, DestOverride: []string{"http", "tls", "quic"},
DomainsExcluded: config.Sniff.Exclude, DomainsExcluded: config.Sniff.Exclude,
} }
if config.Core == "v2ray" { // PATCH: v2fly-core v4 not support quic sniff
sniff.DestOverride = sniff.DestOverride[:len(sniff.DestOverride)-1]
}
var inbounds []interface{} var inbounds []interface{}
inbounds = append(inbounds, loadTProxyConfig("tproxy4", config.V4TProxyPort, sniff)) inbounds = append(inbounds, loadTProxyConfig("tproxy4", config.V4TProxyPort, sniff))
inbounds = append(inbounds, loadTProxyConfig("tproxy6", config.V6TProxyPort, sniff)) inbounds = append(inbounds, loadTProxyConfig("tproxy6", config.V6TProxyPort, sniff))
@ -62,7 +59,7 @@ func Load(configDir string, exposeDir string, config *Config) {
saveConfig(configDir, "log", loadLogConfig(config.Log, path.Join(exposeDir, "log")), true) saveConfig(configDir, "log", loadLogConfig(config.Log, path.Join(exposeDir, "log")), true)
for _, configFile := range common.ListFiles(path.Join(exposeDir, "config"), ".json") { for _, configFile := range common.ListFiles(path.Join(exposeDir, "config"), ".json") {
if configFile == "log.json" || configFile == "inbounds" { if configFile == "log.json" || configFile == "inbounds" {
log.Warningf("Config file %s will be override", configFile) log.Warningf("Config file %s will be overridden", configFile)
} }
common.CopyFile(path.Join(exposeDir, "config", configFile), path.Join(configDir, configFile)) common.CopyFile(path.Join(exposeDir, "config", configFile), path.Join(configDir, configFile))
} }

2
cmd/xproxy.go

@ -13,7 +13,7 @@ import (
"strconv" "strconv"
) )
var version = "1.0.0" var version = "1.0.1"
var v4RouteTable = 104 var v4RouteTable = 104
var v6RouteTable = 106 var v6RouteTable = 106
var v4TProxyPort = 7288 var v4TProxyPort = 7288

Loading…
Cancel
Save