Skip to content

Commit

Permalink
new: add option to use xray core when possible
Browse files Browse the repository at this point in the history
  • Loading branch information
hiddify-com committed Aug 6, 2024
1 parent cfb3788 commit 3862808
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 30 deletions.
38 changes: 19 additions & 19 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,25 @@ jobs:
matrix:
job:
- { name: 'hiddify-core-android', os: 'ubuntu-latest', target: 'android' }
# - { name: 'hiddify-core-linux-amd64', os: 'ubuntu-20.04', target: 'linux-amd64' }
# - { name: "hiddify-core-windows-amd64", os: 'ubuntu-latest', target: 'windows-amd64', aarch: 'x64' }
# - { name: "hiddify-core-macos-universal", os: 'macos-12', target: 'macos-universal' }
# - { name: "hiddify-core-ios", os: "macos-12", target: "ios" }
# # linux custom
# - {name: hiddify-cli-linux-amd64, goos: linux, goarch: amd64, goamd64: v1, target: 'linux-custom', os: 'ubuntu-20.04'}
# - {name: hiddify-cli-linux-amd64-v3, goos: linux, goarch: amd64, goamd64: v3, target: 'linux-custom', os: 'ubuntu-20.04'}
# - {name: hiddify-cli-linux-386, goos: linux, goarch: 386, target: 'linux-custom', os: 'ubuntu-20.04'}
# - {name: hiddify-cli-linux-arm64, goos: linux, goarch: arm64, target: 'linux-custom', os: 'ubuntu-20.04'}
# - {name: hiddify-cli-linux-armv5, goos: linux, goarch: arm, goarm: 5, target: 'linux-custom', os: 'ubuntu-20.04'}
# - {name: hiddify-cli-linux-armv6, goos: linux, goarch: arm, goarm: 6, target: 'linux-custom', os: 'ubuntu-20.04'}
# - {name: hiddify-cli-linux-armv7, goos: linux, goarch: arm, goarm: 7, target: 'linux-custom', os: 'ubuntu-20.04'}
# - {name: hiddify-cli-linux-mips-softfloat, goos: linux, goarch: mips, gomips: softfloat, target: 'linux-custom', os: 'ubuntu-20.04'}
# - {name: hiddify-cli-linux-mips-hardfloat, goos: linux, goarch: mips, gomips: hardfloat, target: 'linux-custom', os: 'ubuntu-20.04'}
# - {name: hiddify-cli-linux-mipsel-softfloat, goos: linux, goarch: mipsle, gomips: softfloat, target: 'linux-custom', os: 'ubuntu-20.04'}
# - {name: hiddify-cli-linux-mipsel-hardfloat, goos: linux, goarch: mipsle, gomips: hardfloat, target: 'linux-custom', os: 'ubuntu-20.04'}
# - {name: hiddify-cli-linux-mips64, goos: linux, goarch: mips64, target: 'linux-custom', os: 'ubuntu-20.04'}
# - {name: hiddify-cli-linux-mips64el, goos: linux, goarch: mips64le, target: 'linux-custom', os: 'ubuntu-20.04'}
# - {name: hiddify-cli-linux-s390x, goos: linux, goarch: s390x, target: 'linux-custom', os: 'ubuntu-20.04'}
- { name: 'hiddify-core-linux-amd64', os: 'ubuntu-20.04', target: 'linux-amd64' }
- { name: "hiddify-core-windows-amd64", os: 'ubuntu-latest', target: 'windows-amd64', aarch: 'x64' }
- { name: "hiddify-core-macos-universal", os: 'macos-12', target: 'macos-universal' }
- { name: "hiddify-core-ios", os: "macos-12", target: "ios" }
# linux custom
- {name: hiddify-cli-linux-amd64, goos: linux, goarch: amd64, goamd64: v1, target: 'linux-custom', os: 'ubuntu-20.04'}
- {name: hiddify-cli-linux-amd64-v3, goos: linux, goarch: amd64, goamd64: v3, target: 'linux-custom', os: 'ubuntu-20.04'}
- {name: hiddify-cli-linux-386, goos: linux, goarch: 386, target: 'linux-custom', os: 'ubuntu-20.04'}
- {name: hiddify-cli-linux-arm64, goos: linux, goarch: arm64, target: 'linux-custom', os: 'ubuntu-20.04'}
- {name: hiddify-cli-linux-armv5, goos: linux, goarch: arm, goarm: 5, target: 'linux-custom', os: 'ubuntu-20.04'}
- {name: hiddify-cli-linux-armv6, goos: linux, goarch: arm, goarm: 6, target: 'linux-custom', os: 'ubuntu-20.04'}
- {name: hiddify-cli-linux-armv7, goos: linux, goarch: arm, goarm: 7, target: 'linux-custom', os: 'ubuntu-20.04'}
- {name: hiddify-cli-linux-mips-softfloat, goos: linux, goarch: mips, gomips: softfloat, target: 'linux-custom', os: 'ubuntu-20.04'}
- {name: hiddify-cli-linux-mips-hardfloat, goos: linux, goarch: mips, gomips: hardfloat, target: 'linux-custom', os: 'ubuntu-20.04'}
- {name: hiddify-cli-linux-mipsel-softfloat, goos: linux, goarch: mipsle, gomips: softfloat, target: 'linux-custom', os: 'ubuntu-20.04'}
- {name: hiddify-cli-linux-mipsel-hardfloat, goos: linux, goarch: mipsle, gomips: hardfloat, target: 'linux-custom', os: 'ubuntu-20.04'}
- {name: hiddify-cli-linux-mips64, goos: linux, goarch: mips64, target: 'linux-custom', os: 'ubuntu-20.04'}
- {name: hiddify-cli-linux-mips64el, goos: linux, goarch: mips64le, target: 'linux-custom', os: 'ubuntu-20.04'}
- {name: hiddify-cli-linux-s390x, goos: linux, goarch: s390x, target: 'linux-custom', os: 'ubuntu-20.04'}

runs-on: ${{ matrix.job.os }}
env:
Expand Down
15 changes: 8 additions & 7 deletions config/option.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ import (
)

type ConfigOptions struct {
EnableFullConfig bool `json:"enable-full-config"`
LogLevel string `json:"log-level"`
EnableClashApi bool `json:"enable-clash-api"`
ClashApiPort uint16 `json:"clash-api-port"`
ClashApiSecret string `json:"web-secret"`
Region string `json:"region"`
BlockAds bool `json:"block-ads"`
EnableFullConfig bool `json:"enable-full-config"`
LogLevel string `json:"log-level"`
EnableClashApi bool `json:"enable-clash-api"`
ClashApiPort uint16 `json:"clash-api-port"`
ClashApiSecret string `json:"web-secret"`
Region string `json:"region"`
BlockAds bool `json:"block-ads"`
UseXrayCoreWhenPossible bool `json:"use-xray-core-when-possible"`
// GeoIPPath string `json:"geoip-path"`
// GeoSitePath string `json:"geosite-path"`
Rules []Rule `json:"rules"`
Expand Down
2 changes: 1 addition & 1 deletion config/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func ParseConfigContent(contentstr string, debug bool, configOpt *ConfigOptions,
return patchConfig(newContent, "SingboxParser", configOpt)
}

v2rayStr, err := ray2sing.Ray2Singbox(string(content))
v2rayStr, err := ray2sing.Ray2Singbox(string(content), configOpt.UseXrayCoreWhenPossible)
if err == nil {
return patchConfig([]byte(v2rayStr), "V2rayParser", configOpt)
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,4 @@ replace github.com/sagernet/wireguard-go => github.com/hiddify/wireguard-go v0.0

replace github.com/bepass-org/warp-plus => github.com/hiddify/warp-plus v0.0.0-20240717223357-4f3122e0d11d

// replace github.com/hiddify/ray2sing => github.com/hiddify/ray2sing v0.0.0-20240802071553-e5ba91dc16e6
replace github.com/hiddify/ray2sing => github.com/hiddify/ray2sing v0.0.0-20240806191321-60866735d9ec
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE
github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ=
github.com/hiddify/hiddify-sing-box v1.8.9-0.20240806124804-ee348999b0bd h1:k27QSXPpQbBxfQ4NWdOB3ckTX8p9L4sg4zvmcGB+nVY=
github.com/hiddify/hiddify-sing-box v1.8.9-0.20240806124804-ee348999b0bd/go.mod h1:2wBDpGJbCEPXFy8jHkFbD2TAwxxUjKoMLXF2HTzhHfU=
github.com/hiddify/ray2sing v0.0.0-20240804185422-f340989b59a0 h1:O/BeurchSCEmZxRbnQNcv7+8dwNxkfMU6hGVNwzDo0A=
github.com/hiddify/ray2sing v0.0.0-20240804185422-f340989b59a0/go.mod h1:Qp3mFdKsJZ5TwBYLREgWp8n2O6dgmNt3aAoX+xpvnsM=
github.com/hiddify/ray2sing v0.0.0-20240806191321-60866735d9ec h1:pcmZoNGZBwsWEhPmstTunTSahm2O6yVj4cdOmorBkLk=
github.com/hiddify/ray2sing v0.0.0-20240806191321-60866735d9ec/go.mod h1:Qp3mFdKsJZ5TwBYLREgWp8n2O6dgmNt3aAoX+xpvnsM=
github.com/hiddify/warp-plus v0.0.0-20240717223357-4f3122e0d11d h1:vRGKh9ou+/vQGfVYa8MczhbIVjHxlP52OWwrDWO77RA=
github.com/hiddify/warp-plus v0.0.0-20240717223357-4f3122e0d11d/go.mod h1:uSRUbr1CcvFrEV69FTvuJFwpzEmwO8N4knb6+Zq3Ys4=
github.com/hiddify/wireguard-go v0.0.0-20240727191222-383c1da14ff1 h1:xdbHlZtzs+jijAxy85qal835GglwmjohA/srHT8gm9s=
Expand Down

0 comments on commit 3862808

Please sign in to comment.