diff --git a/.dockerignore b/.dockerignore index 31012b5f..ba6683c6 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,6 +1,9 @@ -**/v2rayA_* +/v2raya +/v2raya_core +/v2raya.exe +/v2raya_core.exe **/.idea **/.vscode -**/*.test.go +**/*_test.go **/.tr **/node_modules/** diff --git a/.github/workflows/dispatch_docs.yml b/.github/workflows/dispatch_docs.yml deleted file mode 100644 index 00baeefc..00000000 --- a/.github/workflows/dispatch_docs.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: dispatch_docs - -on: - release: - types: - - released # a release or draft of a release is published, or a pre-release is changed to a release - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Invoke workflow in docs repo - uses: benc-uk/workflow-dispatch@v1 - with: - workflow: Pages CI - repo: v2rayA/v2raya.github.io - ref: main - token: ${{ secrets.DISPATCH_BUILD_TOKEN }} diff --git a/.gitignore b/.gitignore index 1b91b5ca..8ee0c15b 100644 --- a/.gitignore +++ b/.gitignore @@ -55,7 +55,6 @@ plans .omo/ # Built web assets (generated by the gui build) -/service/web/ # Release artifacts and PR materials /release/ diff --git a/gui/src/assets/font/Inter-Regular.woff2 b/gui/src/assets/font/Inter-Regular.woff2 deleted file mode 100644 index 73de43c2..00000000 Binary files a/gui/src/assets/font/Inter-Regular.woff2 and /dev/null differ diff --git a/gui/src/assets/img/switch-menu.svg b/gui/src/assets/img/switch-menu.svg deleted file mode 100644 index e4131a39..00000000 --- a/gui/src/assets/img/switch-menu.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/install/docker/docker_helper.sh b/install/docker/docker_helper.sh index dfe1b247..33203163 100644 --- a/install/docker/docker_helper.sh +++ b/install/docker/docker_helper.sh @@ -3,19 +3,15 @@ set -x current_dir=$(pwd) case "$(arch)" in x86_64) - v2ray_arch="64" v2raya_arch="x64" ;; armv7l) - v2ray_arch="arm32-v7a" v2raya_arch="armv7" ;; aarch64) - v2ray_arch="arm64-v8a" v2raya_arch="arm64" ;; riscv64) - v2ray_arch="riscv64" v2raya_arch="riscv64" ;; *) diff --git a/service/common/netTools/ports/ss.go b/service/common/netTools/ports/ss.go deleted file mode 100644 index 6c0a6eab..00000000 --- a/service/common/netTools/ports/ss.go +++ /dev/null @@ -1,7 +0,0 @@ -package ports - -/* socketstat */ -//deprecated -func ss() { - -} diff --git a/service/common/tools_test.go b/service/common/tools_test.go index 87e9e424..76844dd7 100644 --- a/service/common/tools_test.go +++ b/service/common/tools_test.go @@ -31,16 +31,16 @@ func TestFillEmpty(t *testing.T) { if err := common.FillEmpty(setting, configure.NewSetting()); err != nil { t.Fatal(err) } + if setting.Transparent != "10" || setting.Mux != 9 { + t.Fatalf("FillEmpty overwrote set fields: %+v", setting) + } emptySetting := &configure.Setting{} if err := common.FillEmpty(emptySetting, configure.NewSetting()); err != nil { t.Fatal(err) } - // FillEmpty deliberately leaves bool fields alone (see the note in - // db/configure/migrate_dns.go), so an empty Setting never equals - // NewSetting(); this test never compiled before the import cycle in - // this file was removed and its expectation predates that behaviour. - t.Skip("FillEmpty skips bool fields; expectation predates that behaviour") - if *emptySetting != *configure.NewSetting() { - t.Fatal() + // bool fields are left alone on purpose (see db/configure/migrate_dns.go) + defaults := configure.NewSetting() + if emptySetting.Transparent != defaults.Transparent || emptySetting.Mux != defaults.Mux || emptySetting.MuxOn != defaults.MuxOn { + t.Fatalf("FillEmpty left defaults unset: %+v", emptySetting) } } diff --git a/service/kernel/v2ray/template_dns.go b/service/kernel/v2ray/template_dns.go index 768bc351..7323762a 100644 --- a/service/kernel/v2ray/template_dns.go +++ b/service/kernel/v2ray/template_dns.go @@ -7,7 +7,6 @@ import ( "net/url" "os" "runtime" - "strconv" "strings" jsoniter "github.com/json-iterator/go" @@ -24,54 +23,6 @@ type Addr struct { udp bool } -func parseDnsAddr(addr string) Addr { - // 223.5.5.5 - if net.ParseIP(addr) != nil { - return Addr{ - host: addr, - port: "53", - udp: true, - } - } - // dns.google:53 - if host, port, err := net.SplitHostPort(addr); err == nil { - if _, err = strconv.Atoi(port); err == nil { - return Addr{ - host: host, - port: port, - udp: true, - } - } - } - // tcp://8.8.8.8:53, https://dns.google/dns-query, quic://dns.nextdns.io - if strings.Contains(addr, "://") { - if u, err := url.Parse(addr); err == nil { - udp := false - if u.Scheme == "quic" { - udp = true - } - return Addr{ - host: u.Hostname(), - port: u.Port(), - udp: udp, - } - } - } - // dns.google, dns.pub, etc. - return Addr{ - host: addr, - port: "53", - udp: true, - } -} - -type DnsRouting struct { - DirectDomains []Addr - ProxyDomains []Addr - DirectIPs []Addr - ProxyIPs []Addr -} - // setDNS 生成新 DNS 模块的配置,嵌入 xray JSON 供 v2raya-core 读取。 // v2raya-core 启动时解析此配置并启动独立 DNS 监听器,v2rayA 不参与 DNS 查询处理。 func (t *Template) setDNS(serverInfos []serverInfo) error { diff --git a/service/pkg/util/copyfile/main.go b/service/pkg/util/copyfile/main.go deleted file mode 100644 index 3e8330a3..00000000 --- a/service/pkg/util/copyfile/main.go +++ /dev/null @@ -1,98 +0,0 @@ -package copyfile - -// https://stackoverflow.com/questions/21060945/simple-way-to-copy-a-file-in-golang - -import ( - "fmt" - "io" - "os" -) - -// CopyFile copies a file from src to dst. If src and dst files exist, and are -// the same, then return success. Otherise, attempt to create a hard link -// between the two files. If that fail, copy the file contents from src to dst. -func CopyFile(src, dst string) (err error) { - sfi, err := os.Stat(src) - if err != nil { - return - } - if !sfi.Mode().IsRegular() { - // cannot copy non-regular files (e.g., directories, - // symlinks, devices, etc.) - return fmt.Errorf("CopyFile: non-regular source file %s (%q)", sfi.Name(), sfi.Mode().String()) - } - dfi, err := os.Stat(dst) - if err != nil { - if !os.IsNotExist(err) { - return - } - } else { - if !(dfi.Mode().IsRegular()) { - return fmt.Errorf("CopyFile: non-regular destination file %s (%q)", dfi.Name(), dfi.Mode().String()) - } - if os.SameFile(sfi, dfi) { - return - } - } - if err = os.Link(src, dst); err == nil { - return - } - err = copyFileContents(src, dst) - return -} - -// CopyFile copies a file from src to dst. If src and dst files exist, and are -// the same, then return success. Otherise, copy the file contents from src to dst. -func CopyFileContent(src, dst string) (err error) { - sfi, err := os.Stat(src) - if err != nil { - return - } - if !sfi.Mode().IsRegular() { - // cannot copy non-regular files (e.g., directories, - // symlinks, devices, etc.) - return fmt.Errorf("CopyFile: non-regular source file %s (%q)", sfi.Name(), sfi.Mode().String()) - } - dfi, err := os.Stat(dst) - if err != nil { - if !os.IsNotExist(err) { - return - } - } else { - if !(dfi.Mode().IsRegular()) { - return fmt.Errorf("CopyFile: non-regular destination file %s (%q)", dfi.Name(), dfi.Mode().String()) - } - if os.SameFile(sfi, dfi) { - return - } - } - err = copyFileContents(src, dst) - return -} - -// copyFileContents copies the contents of the file named src to the file named -// by dst. The file will be created if it does not already exist. If the -// destination file exists, all it's contents will be replaced by the contents -// of the source file. -func copyFileContents(src, dst string) (err error) { - in, err := os.Open(src) - if err != nil { - return - } - defer in.Close() - out, err := os.Create(dst) - if err != nil { - return - } - defer func() { - cerr := out.Close() - if err == nil { - err = cerr - } - }() - if _, err = io.Copy(out, in); err != nil { - return - } - err = out.Sync() - return -}