mirror of
https://github.com/v2rayA/v2rayA.git
synced 2026-11-20 23:02:25 +03:00
chore: remove what nothing uses any more
copyfile, the empty ports/ss.go stub, parseDnsAddr and DnsRouting (the DNS config is generated for the core's module now), the Inter font and the switch-menu icon of the old GUI, the docs-site dispatch workflow (the site is retired; the docs are in the app), the unused v2ray_arch in the docker helper, the root .gitignore rule for a web directory that moved, and the .dockerignore patterns for binary and test names that no longer exist. The skipped TestFillEmpty asserts what FillEmpty does instead of what it once did.
This commit is contained in:
10 files changed
+12
-187
No files matched your search
+5
-2
@@ -1,6 +1,9 @@
|
||||
**/v2rayA_*
|
||||
/v2raya
|
||||
/v2raya_core
|
||||
/v2raya.exe
|
||||
/v2raya_core.exe
|
||||
**/.idea
|
||||
**/.vscode
|
||||
**/*.test.go
|
||||
**/*_test.go
|
||||
**/.tr
|
||||
**/node_modules/**
|
||||
@@ -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 }}
|
||||
@@ -55,7 +55,6 @@ plans
|
||||
.omo/
|
||||
|
||||
# Built web assets (generated by the gui build)
|
||||
/service/web/
|
||||
|
||||
# Release artifacts and PR materials
|
||||
/release/
|
||||
|
||||
Binary file not shown.
@@ -1 +0,0 @@
|
||||
<svg t="1628253142116" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="984" width="200" height="200"><path d="M512 835.38c-78.7 0-154.49-28.67-213.41-80.74-58.39-51.6-96.11-122.37-106.21-199.26-1.79-13.6 7.79-26.07 21.38-27.85 13.59-1.79 26.07 7.79 27.85 21.38 8.54 65.01 40.45 124.86 89.86 168.52 49.83 44.04 113.94 68.29 180.52 68.29 66.58 0 130.69-24.25 180.52-68.29 49.41-43.66 81.32-103.51 89.86-168.52 1.79-13.6 14.26-23.17 27.85-21.38 13.6 1.79 23.17 14.26 21.38 27.85-10.1 76.9-47.82 147.66-106.21 199.26-58.9 52.07-134.69 80.74-213.39 80.74zM217.3 496.69c-1.13 0-2.28-0.08-3.43-0.24-13.58-1.88-23.07-14.41-21.19-28 10.57-76.4 48.46-146.64 106.7-197.78 58.79-51.62 134.3-80.05 212.62-80.05s153.83 28.43 212.62 80.05c58.24 51.14 96.13 121.38 106.7 197.78 1.88 13.58-7.61 26.12-21.19 28-13.59 1.88-26.12-7.61-28-21.19-8.94-64.59-41-124-90.28-167.27-49.73-43.66-113.6-67.71-179.86-67.71s-130.13 24.05-179.86 67.71c-49.28 43.27-81.34 102.68-90.28 167.27-1.7 12.43-12.35 21.43-24.55 21.43z" fill="#333333" p-id="985"></path><path d="M278.98 607.83c-3.79 0-7.63-0.87-11.23-2.7l-60.96-31c-12.22-6.22-17.09-21.16-10.88-33.39 6.22-12.22 21.16-17.09 33.39-10.88l60.96 31c12.22 6.22 17.09 21.16 10.88 33.39-4.39 8.62-13.11 13.58-22.16 13.58zM805.68 496.83c-3.02 0-6.09-0.55-9.07-1.72l-63.69-25c-12.76-5.01-19.05-19.42-14.04-32.18 5.01-12.76 19.42-19.05 32.18-14.04l63.69 25c12.76 5.01 19.05 19.42 14.04 32.18-3.83 9.79-13.2 15.76-23.11 15.76z" fill="#333333" p-id="986"></path><path d="M373.5 392m-24.83 0a24.83 24.83 0 1 0 49.66 0 24.83 24.83 0 1 0-49.66 0Z" fill="#333333" p-id="987"></path><path d="M654 416.83H452c-13.71 0-24.83-11.12-24.83-24.83s11.12-24.83 24.83-24.83h202c13.71 0 24.83 11.12 24.83 24.83s-11.12 24.83-24.83 24.83z" fill="#333333" p-id="988"></path><path d="M373.5 520.5m-24.83 0a24.83 24.83 0 1 0 49.66 0 24.83 24.83 0 1 0-49.66 0Z" fill="#448AFF" p-id="989"></path><path d="M654 545.33H452c-13.71 0-24.83-11.12-24.83-24.83 0-13.71 11.12-24.83 24.83-24.83h202c13.71 0 24.83 11.12 24.83 24.83 0 13.71-11.12 24.83-24.83 24.83z" fill="#448AFF" p-id="990"></path><path d="M373.5 649m-24.83 0a24.83 24.83 0 1 0 49.66 0 24.83 24.83 0 1 0-49.66 0Z" fill="#333333" p-id="991"></path><path d="M654 673.83H452c-13.71 0-24.83-11.12-24.83-24.83s11.12-24.83 24.83-24.83h202c13.71 0 24.83 11.12 24.83 24.83s-11.12 24.83-24.83 24.83z" fill="#333333" p-id="992"></path></svg>
|
||||
|
Before Width: | Height: | Size: 2.4 KiB |
@@ -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"
|
||||
;;
|
||||
*)
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
package ports
|
||||
|
||||
/* socketstat */
|
||||
//deprecated
|
||||
func ss() {
|
||||
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
}
|
||||
Reference in new issue
Block a user