From 7c1ab062064c515e8c14669edb7c75173c0e8d2c Mon Sep 17 00:00:00 2001 From: Jebbs Date: Fri, 4 Dec 2020 22:32:55 +0800 Subject: [PATCH] v5: Remove v2ctl & wv2ray (#488) * remove v2ctl, wv2ray * remove v2ctl, wv2ray build scripts * remove infra/control/main * remove !confonly flag * remove ctlcmd package * remove Confgi.Override func * move commands package into main --- .github/workflows/release.yml | 10 --- app/commander/commander.go | 2 - app/commander/outbound.go | 2 - app/commander/service.go | 2 - app/dispatcher/default.go | 2 - app/dispatcher/dispatcher.go | 2 - app/dispatcher/sniffer.go | 2 - app/dispatcher/stats.go | 2 - app/dns/dnscommon.go | 2 - app/dns/dnscommon_test.go | 2 - app/dns/dohdns.go | 2 - app/dns/hosts.go | 2 - app/dns/nameserver.go | 2 - app/dns/server.go | 2 - app/dns/udpns.go | 2 - app/log/command/command.go | 2 - app/log/log.go | 2 - app/log/log_creator.go | 2 - app/proxyman/command/command.go | 2 - app/reverse/bridge.go | 2 - app/reverse/config.go | 2 - app/reverse/portal.go | 2 - app/reverse/reverse.go | 2 - app/router/balancing.go | 2 - app/router/command/command.go | 2 - app/router/condition.go | 2 - app/router/condition_geoip.go | 2 - app/router/config.go | 2 - app/router/router.go | 2 - app/stats/channel.go | 2 - app/stats/command/command.go | 2 - app/stats/counter.go | 2 - app/stats/stats.go | 2 - common/net/connection.go | 2 - common/platform/ctlcmd/attr_other.go | 9 -- common/platform/ctlcmd/attr_windows.go | 11 --- common/platform/ctlcmd/ctlcmd.go | 50 ----------- common/platform/ctlcmd/errors.generated.go | 9 -- config.go | 2 - context.go | 2 - functions.go | 2 - infra/conf/v2ray.go | 84 ------------------- infra/conf/v2ray_test.go | 78 ----------------- infra/control/main/main.go | 11 --- {commands => main/commands}/all/api/api.go | 2 +- .../commands}/all/api/inbounds_add.go | 2 +- .../commands}/all/api/inbounds_remove.go | 2 +- .../commands}/all/api/logger_restart.go | 2 +- .../commands}/all/api/outbounds_add.go | 2 +- .../commands}/all/api/outbounds_remove.go | 2 +- {commands => main/commands}/all/api/shared.go | 2 +- .../commands}/all/api/stats_get.go | 2 +- .../commands}/all/api/stats_query.go | 2 +- .../commands}/all/api/stats_sys.go | 2 +- {commands => main/commands}/all/commands.go | 6 +- {commands => main/commands}/all/convert.go | 2 +- .../commands}/all/convert_confs.go | 2 +- .../commands}/all/errors.generated.go | 0 {commands => main/commands}/all/format_doc.go | 2 +- {commands => main/commands}/all/love.go | 2 +- {commands => main/commands}/all/merge_doc.go | 2 +- {commands => main/commands}/all/tls/cert.go | 2 +- {commands => main/commands}/all/tls/ping.go | 2 +- {commands => main/commands}/all/tls/tls.go | 2 +- {commands => main/commands}/all/uuid.go | 2 +- {commands => main/commands}/all/verify.go | 2 +- {commands => main/commands}/base/command.go | 0 {commands => main/commands}/base/env.go | 0 {commands => main/commands}/base/execute.go | 0 {commands => main/commands}/base/help.go | 0 {commands => main/commands}/base/root.go | 0 main/commands/run.go | 2 +- main/commands/test.go | 2 +- main/commands/version.go | 2 +- main/distro/all/all.go | 2 +- main/main.go | 2 +- proxy/blackhole/blackhole.go | 2 - proxy/dns/dns.go | 2 - proxy/dokodemo/dokodemo.go | 2 - proxy/freedom/freedom.go | 2 - proxy/http/client.go | 2 - proxy/http/server.go | 2 - proxy/shadowsocks/client.go | 2 - proxy/shadowsocks/protocol.go | 2 - proxy/shadowsocks/server.go | 2 - proxy/socks/client.go | 2 - proxy/socks/config.go | 2 - proxy/socks/protocol.go | 2 - proxy/socks/server.go | 2 - proxy/trojan/client.go | 2 - proxy/trojan/server.go | 2 - proxy/trojan/validator.go | 2 - proxy/vless/account.go | 2 - proxy/vless/encoding/addons.go | 2 - proxy/vless/encoding/encoding.go | 2 - proxy/vless/inbound/config.go | 2 - proxy/vless/inbound/inbound.go | 2 - proxy/vless/outbound/config.go | 2 - proxy/vless/outbound/outbound.go | 2 - proxy/vless/validator.go | 2 - proxy/vmess/account.go | 2 - proxy/vmess/inbound/config.go | 2 - proxy/vmess/inbound/inbound.go | 2 - proxy/vmess/outbound/command.go | 2 - proxy/vmess/outbound/outbound.go | 2 - proxy/vmess/validator.go | 2 - release/debian/rules | 2 - release/user-package.sh | 6 -- transport/internet/domainsocket/config.go | 2 - transport/internet/domainsocket/dial.go | 1 - transport/internet/domainsocket/listener.go | 1 - transport/internet/http/config.go | 2 - transport/internet/http/dialer.go | 2 - transport/internet/http/hub.go | 2 - transport/internet/kcp/config.go | 2 - transport/internet/kcp/connection.go | 2 - transport/internet/kcp/crypt.go | 2 - transport/internet/kcp/dialer.go | 2 - transport/internet/kcp/io.go | 2 - transport/internet/kcp/listener.go | 2 - transport/internet/kcp/output.go | 2 - transport/internet/kcp/receiving.go | 2 - transport/internet/kcp/segment.go | 2 - transport/internet/kcp/sending.go | 2 - transport/internet/quic/config.go | 2 - transport/internet/quic/conn.go | 2 - transport/internet/quic/dialer.go | 2 - transport/internet/quic/hub.go | 2 - transport/internet/quic/pool.go | 2 - transport/internet/quic/quic.go | 2 - transport/internet/tcp/config.go | 2 - transport/internet/tcp/dialer.go | 2 - transport/internet/tcp/hub.go | 2 - transport/internet/tcp/sockopt_freebsd.go | 1 - transport/internet/tcp/sockopt_linux.go | 1 - transport/internet/tcp/sockopt_other.go | 1 - transport/internet/tls/config.go | 2 - transport/internet/tls/config_other.go | 1 - transport/internet/tls/config_windows.go | 1 - transport/internet/tls/tls.go | 2 - transport/internet/websocket/config.go | 2 - transport/internet/websocket/connection.go | 2 - transport/internet/websocket/dialer.go | 2 - transport/internet/websocket/hub.go | 2 - v2ray.go | 2 - 145 files changed, 28 insertions(+), 497 deletions(-) delete mode 100644 common/platform/ctlcmd/attr_other.go delete mode 100644 common/platform/ctlcmd/attr_windows.go delete mode 100644 common/platform/ctlcmd/ctlcmd.go delete mode 100644 common/platform/ctlcmd/errors.generated.go delete mode 100644 infra/control/main/main.go rename {commands => main/commands}/all/api/api.go (91%) rename {commands => main/commands}/all/api/inbounds_add.go (97%) rename {commands => main/commands}/all/api/inbounds_remove.go (97%) rename {commands => main/commands}/all/api/logger_restart.go (95%) rename {commands => main/commands}/all/api/outbounds_add.go (97%) rename {commands => main/commands}/all/api/outbounds_remove.go (97%) rename {commands => main/commands}/all/api/shared.go (96%) rename {commands => main/commands}/all/api/stats_get.go (96%) rename {commands => main/commands}/all/api/stats_query.go (96%) rename {commands => main/commands}/all/api/stats_sys.go (95%) rename {commands => main/commands}/all/commands.go (71%) rename {commands => main/commands}/all/convert.go (98%) rename {commands => main/commands}/all/convert_confs.go (98%) rename {commands => main/commands}/all/errors.generated.go (100%) rename {commands => main/commands}/all/format_doc.go (97%) rename {commands => main/commands}/all/love.go (97%) rename {commands => main/commands}/all/merge_doc.go (97%) rename {commands => main/commands}/all/tls/cert.go (98%) rename {commands => main/commands}/all/tls/ping.go (98%) rename {commands => main/commands}/all/tls/tls.go (87%) rename {commands => main/commands}/all/uuid.go (89%) rename {commands => main/commands}/all/verify.go (96%) rename {commands => main/commands}/base/command.go (100%) rename {commands => main/commands}/base/env.go (100%) rename {commands => main/commands}/base/execute.go (100%) rename {commands => main/commands}/base/help.go (100%) rename {commands => main/commands}/base/root.go (100%) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f83857c82..38bb8bb36 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -102,16 +102,6 @@ jobs: run: | mkdir -p build_assets go build -v -o build_assets/v2ray -trimpath -ldflags "-s -w -buildid=" ./main - go build -v -o build_assets/v2ctl -trimpath -ldflags "-s -w -buildid=" -tags confonly ./infra/control/main - - - name: Build Windows wv2ray - if: matrix.goos == 'windows' - run: | - echo "::warning ::wv2ray.exe will be removed in v5" - go build -v -o build_assets/wv2ray.exe -trimpath -ldflags "-s -w -H windowsgui -buildid=" ./main - cd ./build_assets || exit 1 - mv v2ray v2ray.exe - mv v2ctl v2ctl.exe - name: Prepare package run: cp -v ./release/config/*.* ./build_assets diff --git a/app/commander/commander.go b/app/commander/commander.go index e0196af66..f1816065e 100644 --- a/app/commander/commander.go +++ b/app/commander/commander.go @@ -1,5 +1,3 @@ -// +build !confonly - package commander //go:generate go run v2ray.com/core/common/errors/errorgen diff --git a/app/commander/outbound.go b/app/commander/outbound.go index 0a849ddd1..bfe6e84c1 100644 --- a/app/commander/outbound.go +++ b/app/commander/outbound.go @@ -1,5 +1,3 @@ -// +build !confonly - package commander import ( diff --git a/app/commander/service.go b/app/commander/service.go index cf4e6a804..c120a6e30 100644 --- a/app/commander/service.go +++ b/app/commander/service.go @@ -1,5 +1,3 @@ -// +build !confonly - package commander import ( diff --git a/app/dispatcher/default.go b/app/dispatcher/default.go index 6823884ec..4a303535c 100644 --- a/app/dispatcher/default.go +++ b/app/dispatcher/default.go @@ -1,5 +1,3 @@ -// +build !confonly - package dispatcher //go:generate go run v2ray.com/core/common/errors/errorgen diff --git a/app/dispatcher/dispatcher.go b/app/dispatcher/dispatcher.go index 70c609321..6bfe15f29 100644 --- a/app/dispatcher/dispatcher.go +++ b/app/dispatcher/dispatcher.go @@ -1,5 +1,3 @@ -// +build !confonly - package dispatcher //go:generate go run v2ray.com/core/common/errors/errorgen diff --git a/app/dispatcher/sniffer.go b/app/dispatcher/sniffer.go index 34851ab8b..665a413c8 100644 --- a/app/dispatcher/sniffer.go +++ b/app/dispatcher/sniffer.go @@ -1,5 +1,3 @@ -// +build !confonly - package dispatcher import ( diff --git a/app/dispatcher/stats.go b/app/dispatcher/stats.go index 9b1c3a063..b897c8e6a 100644 --- a/app/dispatcher/stats.go +++ b/app/dispatcher/stats.go @@ -1,5 +1,3 @@ -// +build !confonly - package dispatcher import ( diff --git a/app/dns/dnscommon.go b/app/dns/dnscommon.go index 955962bcb..fe0a9854b 100644 --- a/app/dns/dnscommon.go +++ b/app/dns/dnscommon.go @@ -1,5 +1,3 @@ -// +build !confonly - package dns import ( diff --git a/app/dns/dnscommon_test.go b/app/dns/dnscommon_test.go index 24cc69270..1ac15bcc4 100644 --- a/app/dns/dnscommon_test.go +++ b/app/dns/dnscommon_test.go @@ -1,5 +1,3 @@ -// +build !confonly - package dns import ( diff --git a/app/dns/dohdns.go b/app/dns/dohdns.go index 1bb61dee5..9504b9fd7 100644 --- a/app/dns/dohdns.go +++ b/app/dns/dohdns.go @@ -1,5 +1,3 @@ -// +build !confonly - package dns import ( diff --git a/app/dns/hosts.go b/app/dns/hosts.go index 21dc30ba8..765d45a76 100644 --- a/app/dns/hosts.go +++ b/app/dns/hosts.go @@ -1,5 +1,3 @@ -// +build !confonly - package dns import ( diff --git a/app/dns/nameserver.go b/app/dns/nameserver.go index c55f901cf..9efc7843d 100644 --- a/app/dns/nameserver.go +++ b/app/dns/nameserver.go @@ -1,5 +1,3 @@ -// +build !confonly - package dns import ( diff --git a/app/dns/server.go b/app/dns/server.go index ecf4d2153..0f86d81dc 100644 --- a/app/dns/server.go +++ b/app/dns/server.go @@ -1,5 +1,3 @@ -// +build !confonly - package dns //go:generate go run v2ray.com/core/common/errors/errorgen diff --git a/app/dns/udpns.go b/app/dns/udpns.go index 267f15e96..e006ad592 100644 --- a/app/dns/udpns.go +++ b/app/dns/udpns.go @@ -1,5 +1,3 @@ -// +build !confonly - package dns import ( diff --git a/app/log/command/command.go b/app/log/command/command.go index a6b6b5c21..a35ef34e2 100644 --- a/app/log/command/command.go +++ b/app/log/command/command.go @@ -1,5 +1,3 @@ -// +build !confonly - package command //go:generate go run v2ray.com/core/common/errors/errorgen diff --git a/app/log/log.go b/app/log/log.go index ae78be3b3..0954c5904 100644 --- a/app/log/log.go +++ b/app/log/log.go @@ -1,5 +1,3 @@ -// +build !confonly - package log //go:generate go run v2ray.com/core/common/errors/errorgen diff --git a/app/log/log_creator.go b/app/log/log_creator.go index c7ea5a805..ade60b533 100644 --- a/app/log/log_creator.go +++ b/app/log/log_creator.go @@ -1,5 +1,3 @@ -// +build !confonly - package log import ( diff --git a/app/proxyman/command/command.go b/app/proxyman/command/command.go index 6586bf0c1..c4577bb9f 100644 --- a/app/proxyman/command/command.go +++ b/app/proxyman/command/command.go @@ -1,5 +1,3 @@ -// +build !confonly - package command import ( diff --git a/app/reverse/bridge.go b/app/reverse/bridge.go index 502745485..8be7cdef1 100644 --- a/app/reverse/bridge.go +++ b/app/reverse/bridge.go @@ -1,5 +1,3 @@ -// +build !confonly - package reverse import ( diff --git a/app/reverse/config.go b/app/reverse/config.go index 04259baee..b80802374 100644 --- a/app/reverse/config.go +++ b/app/reverse/config.go @@ -1,5 +1,3 @@ -// +build !confonly - package reverse import ( diff --git a/app/reverse/portal.go b/app/reverse/portal.go index ed846fe0c..37f9a30f3 100644 --- a/app/reverse/portal.go +++ b/app/reverse/portal.go @@ -1,5 +1,3 @@ -// +build !confonly - package reverse import ( diff --git a/app/reverse/reverse.go b/app/reverse/reverse.go index a1d262863..67fbde736 100644 --- a/app/reverse/reverse.go +++ b/app/reverse/reverse.go @@ -1,5 +1,3 @@ -// +build !confonly - package reverse //go:generate go run v2ray.com/core/common/errors/errorgen diff --git a/app/router/balancing.go b/app/router/balancing.go index 0cede3922..3d9f06014 100644 --- a/app/router/balancing.go +++ b/app/router/balancing.go @@ -1,5 +1,3 @@ -// +build !confonly - package router import ( diff --git a/app/router/command/command.go b/app/router/command/command.go index 6d777829d..ec8c73d33 100644 --- a/app/router/command/command.go +++ b/app/router/command/command.go @@ -1,5 +1,3 @@ -// +build !confonly - package command //go:generate go run v2ray.com/core/common/errors/errorgen diff --git a/app/router/condition.go b/app/router/condition.go index ac6984feb..12dea98e2 100644 --- a/app/router/condition.go +++ b/app/router/condition.go @@ -1,5 +1,3 @@ -// +build !confonly - package router import ( diff --git a/app/router/condition_geoip.go b/app/router/condition_geoip.go index 2688bc38b..0d508dfd4 100644 --- a/app/router/condition_geoip.go +++ b/app/router/condition_geoip.go @@ -1,5 +1,3 @@ -// +build !confonly - package router import ( diff --git a/app/router/config.go b/app/router/config.go index 8eb9d5aa1..68a28c05e 100644 --- a/app/router/config.go +++ b/app/router/config.go @@ -1,5 +1,3 @@ -// +build !confonly - package router import ( diff --git a/app/router/router.go b/app/router/router.go index 30cfe6592..cca8c1f98 100644 --- a/app/router/router.go +++ b/app/router/router.go @@ -1,5 +1,3 @@ -// +build !confonly - package router //go:generate go run v2ray.com/core/common/errors/errorgen diff --git a/app/stats/channel.go b/app/stats/channel.go index 2fd54468c..f9aa8b36e 100644 --- a/app/stats/channel.go +++ b/app/stats/channel.go @@ -1,5 +1,3 @@ -// +build !confonly - package stats import ( diff --git a/app/stats/command/command.go b/app/stats/command/command.go index 434af86b3..19369a750 100644 --- a/app/stats/command/command.go +++ b/app/stats/command/command.go @@ -1,5 +1,3 @@ -// +build !confonly - package command //go:generate go run v2ray.com/core/common/errors/errorgen diff --git a/app/stats/counter.go b/app/stats/counter.go index c4e120133..f8373ee78 100644 --- a/app/stats/counter.go +++ b/app/stats/counter.go @@ -1,5 +1,3 @@ -// +build !confonly - package stats import "sync/atomic" diff --git a/app/stats/stats.go b/app/stats/stats.go index 3b881c331..8aab57337 100644 --- a/app/stats/stats.go +++ b/app/stats/stats.go @@ -1,5 +1,3 @@ -// +build !confonly - package stats //go:generate go run v2ray.com/core/common/errors/errorgen diff --git a/common/net/connection.go b/common/net/connection.go index f271beef9..c9046d3eb 100644 --- a/common/net/connection.go +++ b/common/net/connection.go @@ -1,5 +1,3 @@ -// +build !confonly - package net import ( diff --git a/common/platform/ctlcmd/attr_other.go b/common/platform/ctlcmd/attr_other.go deleted file mode 100644 index 8dfe963dc..000000000 --- a/common/platform/ctlcmd/attr_other.go +++ /dev/null @@ -1,9 +0,0 @@ -// +build !windows - -package ctlcmd - -import "syscall" - -func getSysProcAttr() *syscall.SysProcAttr { - return nil -} diff --git a/common/platform/ctlcmd/attr_windows.go b/common/platform/ctlcmd/attr_windows.go deleted file mode 100644 index b4c1c5f8b..000000000 --- a/common/platform/ctlcmd/attr_windows.go +++ /dev/null @@ -1,11 +0,0 @@ -// +build windows - -package ctlcmd - -import "syscall" - -func getSysProcAttr() *syscall.SysProcAttr { - return &syscall.SysProcAttr{ - HideWindow: true, - } -} diff --git a/common/platform/ctlcmd/ctlcmd.go b/common/platform/ctlcmd/ctlcmd.go deleted file mode 100644 index 3ee617bde..000000000 --- a/common/platform/ctlcmd/ctlcmd.go +++ /dev/null @@ -1,50 +0,0 @@ -package ctlcmd - -import ( - "io" - "os" - "os/exec" - "strings" - - "v2ray.com/core/common/buf" - "v2ray.com/core/common/platform" -) - -//go:generate go run v2ray.com/core/common/errors/errorgen - -func Run(args []string, input io.Reader) (buf.MultiBuffer, error) { - v2ctl := platform.GetToolLocation("v2ctl") - if _, err := os.Stat(v2ctl); err != nil { - return nil, newError("v2ctl doesn't exist").Base(err) - } - - var errBuffer buf.MultiBufferContainer - var outBuffer buf.MultiBufferContainer - - cmd := exec.Command(v2ctl, args...) - cmd.Stderr = &errBuffer - cmd.Stdout = &outBuffer - cmd.SysProcAttr = getSysProcAttr() - if input != nil { - cmd.Stdin = input - } - - if err := cmd.Start(); err != nil { - return nil, newError("failed to start v2ctl").Base(err) - } - - if err := cmd.Wait(); err != nil { - msg := "failed to execute v2ctl" - if errBuffer.Len() > 0 { - msg += ": \n" + strings.TrimSpace(errBuffer.MultiBuffer.String()) - } - return nil, newError(msg).Base(err) - } - - // log stderr, info message - if !errBuffer.IsEmpty() { - newError(" \n", strings.TrimSpace(errBuffer.MultiBuffer.String())).AtInfo().WriteToLog() - } - - return outBuffer.MultiBuffer, nil -} diff --git a/common/platform/ctlcmd/errors.generated.go b/common/platform/ctlcmd/errors.generated.go deleted file mode 100644 index 91233667c..000000000 --- a/common/platform/ctlcmd/errors.generated.go +++ /dev/null @@ -1,9 +0,0 @@ -package ctlcmd - -import "v2ray.com/core/common/errors" - -type errPathObjHolder struct{} - -func newError(values ...interface{}) *errors.Error { - return errors.New(values...).WithPathObj(errPathObjHolder{}) -} diff --git a/config.go b/config.go index 4c1089a55..c1eea0933 100644 --- a/config.go +++ b/config.go @@ -1,5 +1,3 @@ -// +build !confonly - package core import ( diff --git a/context.go b/context.go index 84cd2396b..51edfb42a 100644 --- a/context.go +++ b/context.go @@ -1,5 +1,3 @@ -// +build !confonly - package core import ( diff --git a/functions.go b/functions.go index a2fc42f06..5d13acf73 100644 --- a/functions.go +++ b/functions.go @@ -1,5 +1,3 @@ -// +build !confonly - package core import ( diff --git a/infra/conf/v2ray.go b/infra/conf/v2ray.go index 4da244bd7..941ac630b 100644 --- a/infra/conf/v2ray.go +++ b/infra/conf/v2ray.go @@ -2,8 +2,6 @@ package conf import ( "encoding/json" - "log" - "os" "strings" "v2ray.com/core" @@ -35,8 +33,6 @@ var ( "trojan": func() interface{} { return new(TrojanClientConfig) }, "dns": func() interface{} { return new(DNSOutboundConfig) }, }, "protocol", "settings") - - ctllog = log.New(os.Stderr, "v2ctl> ", 0) ) func toProtocolList(s []string) ([]proxyman.KnownProtocols, error) { @@ -368,86 +364,6 @@ func (c *Config) findOutboundTag(tag string) int { return found } -// Override method accepts another Config overrides the current attribute -func (c *Config) Override(o *Config, fn string) { - // only process the non-deprecated members - - if o.LogConfig != nil { - c.LogConfig = o.LogConfig - } - if o.RouterConfig != nil { - c.RouterConfig = o.RouterConfig - } - if o.DNSConfig != nil { - c.DNSConfig = o.DNSConfig - } - if o.Transport != nil { - c.Transport = o.Transport - } - if o.Policy != nil { - c.Policy = o.Policy - } - if o.API != nil { - c.API = o.API - } - if o.Stats != nil { - c.Stats = o.Stats - } - if o.Reverse != nil { - c.Reverse = o.Reverse - } - - // deprecated attrs... keep them for now - if o.InboundConfig != nil { - c.InboundConfig = o.InboundConfig - } - if o.OutboundConfig != nil { - c.OutboundConfig = o.OutboundConfig - } - if o.InboundDetours != nil { - c.InboundDetours = o.InboundDetours - } - if o.OutboundDetours != nil { - c.OutboundDetours = o.OutboundDetours - } - // deprecated attrs - - // update the Inbound in slice if the only one in overide config has same tag - if len(o.InboundConfigs) > 0 { - if len(c.InboundConfigs) > 0 && len(o.InboundConfigs) == 1 { - if idx := c.findInboundTag(o.InboundConfigs[0].Tag); idx > -1 { - c.InboundConfigs[idx] = o.InboundConfigs[0] - ctllog.Println("[", fn, "] updated inbound with tag: ", o.InboundConfigs[0].Tag) - } else { - c.InboundConfigs = append(c.InboundConfigs, o.InboundConfigs[0]) - ctllog.Println("[", fn, "] appended inbound with tag: ", o.InboundConfigs[0].Tag) - } - } else { - c.InboundConfigs = o.InboundConfigs - } - } - - // update the Outbound in slice if the only one in overide config has same tag - if len(o.OutboundConfigs) > 0 { - if len(c.OutboundConfigs) > 0 && len(o.OutboundConfigs) == 1 { - if idx := c.findOutboundTag(o.OutboundConfigs[0].Tag); idx > -1 { - c.OutboundConfigs[idx] = o.OutboundConfigs[0] - ctllog.Println("[", fn, "] updated outbound with tag: ", o.OutboundConfigs[0].Tag) - } else { - if strings.Contains(strings.ToLower(fn), "tail") { - c.OutboundConfigs = append(c.OutboundConfigs, o.OutboundConfigs[0]) - ctllog.Println("[", fn, "] appended outbound with tag: ", o.OutboundConfigs[0].Tag) - } else { - c.OutboundConfigs = append(o.OutboundConfigs, c.OutboundConfigs...) - ctllog.Println("[", fn, "] prepended outbound with tag: ", o.OutboundConfigs[0].Tag) - } - } - } else { - c.OutboundConfigs = o.OutboundConfigs - } - } -} - func applyTransportConfig(s *StreamConfig, t *TransportConfig) { if s.TCPSettings == nil { s.TCPSettings = t.TCPConfig diff --git a/infra/conf/v2ray_test.go b/infra/conf/v2ray_test.go index a26af25ee..d324d3ea6 100644 --- a/infra/conf/v2ray_test.go +++ b/infra/conf/v2ray_test.go @@ -6,7 +6,6 @@ import ( "testing" "github.com/golang/protobuf/proto" - "github.com/google/go-cmp/cmp" "v2ray.com/core" "v2ray.com/core/app/dispatcher" "v2ray.com/core/app/log" @@ -370,80 +369,3 @@ func TestMuxConfig_Build(t *testing.T) { }) } } - -func TestConfig_Override(t *testing.T) { - tests := []struct { - name string - orig *Config - over *Config - fn string - want *Config - }{ - {"combine/empty", - &Config{}, - &Config{ - LogConfig: &LogConfig{}, - RouterConfig: &RouterConfig{}, - DNSConfig: &DNSConfig{}, - Transport: &TransportConfig{}, - Policy: &PolicyConfig{}, - API: &APIConfig{}, - Stats: &StatsConfig{}, - Reverse: &ReverseConfig{}, - }, - "", - &Config{ - LogConfig: &LogConfig{}, - RouterConfig: &RouterConfig{}, - DNSConfig: &DNSConfig{}, - Transport: &TransportConfig{}, - Policy: &PolicyConfig{}, - API: &APIConfig{}, - Stats: &StatsConfig{}, - Reverse: &ReverseConfig{}, - }, - }, - {"combine/newattr", - &Config{InboundConfigs: []InboundDetourConfig{{Tag: "old"}}}, - &Config{LogConfig: &LogConfig{}}, "", - &Config{LogConfig: &LogConfig{}, InboundConfigs: []InboundDetourConfig{{Tag: "old"}}}}, - {"replace/inbounds", - &Config{InboundConfigs: []InboundDetourConfig{{Tag: "pos0"}, {Protocol: "vmess", Tag: "pos1"}}}, - &Config{InboundConfigs: []InboundDetourConfig{{Tag: "pos1", Protocol: "kcp"}}}, - "", - &Config{InboundConfigs: []InboundDetourConfig{{Tag: "pos0"}, {Tag: "pos1", Protocol: "kcp"}}}}, - {"replace/inbounds-replaceall", - &Config{InboundConfigs: []InboundDetourConfig{{Tag: "pos0"}, {Protocol: "vmess", Tag: "pos1"}}}, - &Config{InboundConfigs: []InboundDetourConfig{{Tag: "pos1", Protocol: "kcp"}, {Tag: "pos2", Protocol: "kcp"}}}, - "", - &Config{InboundConfigs: []InboundDetourConfig{{Tag: "pos1", Protocol: "kcp"}, {Tag: "pos2", Protocol: "kcp"}}}}, - {"replace/notag-append", - &Config{InboundConfigs: []InboundDetourConfig{{}, {Protocol: "vmess"}}}, - &Config{InboundConfigs: []InboundDetourConfig{{Tag: "pos1", Protocol: "kcp"}}}, - "", - &Config{InboundConfigs: []InboundDetourConfig{{}, {Protocol: "vmess"}, {Tag: "pos1", Protocol: "kcp"}}}}, - {"replace/outbounds", - &Config{OutboundConfigs: []OutboundDetourConfig{{Tag: "pos0"}, {Protocol: "vmess", Tag: "pos1"}}}, - &Config{OutboundConfigs: []OutboundDetourConfig{{Tag: "pos1", Protocol: "kcp"}}}, - "", - &Config{OutboundConfigs: []OutboundDetourConfig{{Tag: "pos0"}, {Tag: "pos1", Protocol: "kcp"}}}}, - {"replace/outbounds-prepend", - &Config{OutboundConfigs: []OutboundDetourConfig{{Tag: "pos0"}, {Protocol: "vmess", Tag: "pos1"}}}, - &Config{OutboundConfigs: []OutboundDetourConfig{{Tag: "pos1", Protocol: "kcp"}, {Tag: "pos2", Protocol: "kcp"}}}, - "config.json", - &Config{OutboundConfigs: []OutboundDetourConfig{{Tag: "pos1", Protocol: "kcp"}, {Tag: "pos2", Protocol: "kcp"}}}}, - {"replace/outbounds-append", - &Config{OutboundConfigs: []OutboundDetourConfig{{Tag: "pos0"}, {Protocol: "vmess", Tag: "pos1"}}}, - &Config{OutboundConfigs: []OutboundDetourConfig{{Tag: "pos2", Protocol: "kcp"}}}, - "config_tail.json", - &Config{OutboundConfigs: []OutboundDetourConfig{{Tag: "pos0"}, {Protocol: "vmess", Tag: "pos1"}, {Tag: "pos2", Protocol: "kcp"}}}}, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - tt.orig.Override(tt.over, tt.fn) - if r := cmp.Diff(tt.orig, tt.want); r != "" { - t.Error(r) - } - }) - } -} diff --git a/infra/control/main/main.go b/infra/control/main/main.go deleted file mode 100644 index 4ca389f02..000000000 --- a/infra/control/main/main.go +++ /dev/null @@ -1,11 +0,0 @@ -package main - -import ( - _ "v2ray.com/core/commands/all" - "v2ray.com/core/commands/base" -) - -func main() { - base.RootCommand.Long = "A tool set for V2Ray." - base.Execute() -} diff --git a/commands/all/api/api.go b/main/commands/all/api/api.go similarity index 91% rename from commands/all/api/api.go rename to main/commands/all/api/api.go index d76b89e94..439a92852 100644 --- a/commands/all/api/api.go +++ b/main/commands/all/api/api.go @@ -1,7 +1,7 @@ package api import ( - "v2ray.com/core/commands/base" + "v2ray.com/core/main/commands/base" ) // CmdAPI calls an API in an V2Ray process diff --git a/commands/all/api/inbounds_add.go b/main/commands/all/api/inbounds_add.go similarity index 97% rename from commands/all/api/inbounds_add.go rename to main/commands/all/api/inbounds_add.go index 54ad3e7f1..9643bf105 100644 --- a/commands/all/api/inbounds_add.go +++ b/main/commands/all/api/inbounds_add.go @@ -4,10 +4,10 @@ import ( "fmt" handlerService "v2ray.com/core/app/proxyman/command" - "v2ray.com/core/commands/base" "v2ray.com/core/common/cmdarg" "v2ray.com/core/infra/conf" "v2ray.com/core/infra/conf/serial" + "v2ray.com/core/main/commands/base" ) var cmdAddInbounds = &base.Command{ diff --git a/commands/all/api/inbounds_remove.go b/main/commands/all/api/inbounds_remove.go similarity index 97% rename from commands/all/api/inbounds_remove.go rename to main/commands/all/api/inbounds_remove.go index a7ad82f9e..fa92eb21d 100644 --- a/commands/all/api/inbounds_remove.go +++ b/main/commands/all/api/inbounds_remove.go @@ -4,9 +4,9 @@ import ( "fmt" handlerService "v2ray.com/core/app/proxyman/command" - "v2ray.com/core/commands/base" "v2ray.com/core/common/cmdarg" "v2ray.com/core/infra/conf/serial" + "v2ray.com/core/main/commands/base" ) var cmdRemoveInbounds = &base.Command{ diff --git a/commands/all/api/logger_restart.go b/main/commands/all/api/logger_restart.go similarity index 95% rename from commands/all/api/logger_restart.go rename to main/commands/all/api/logger_restart.go index e6de4f74a..cc595688e 100644 --- a/commands/all/api/logger_restart.go +++ b/main/commands/all/api/logger_restart.go @@ -2,7 +2,7 @@ package api import ( logService "v2ray.com/core/app/log/command" - "v2ray.com/core/commands/base" + "v2ray.com/core/main/commands/base" ) var cmdRestartLogger = &base.Command{ diff --git a/commands/all/api/outbounds_add.go b/main/commands/all/api/outbounds_add.go similarity index 97% rename from commands/all/api/outbounds_add.go rename to main/commands/all/api/outbounds_add.go index a840c8b61..03896d266 100644 --- a/commands/all/api/outbounds_add.go +++ b/main/commands/all/api/outbounds_add.go @@ -4,10 +4,10 @@ import ( "fmt" handlerService "v2ray.com/core/app/proxyman/command" - "v2ray.com/core/commands/base" "v2ray.com/core/common/cmdarg" "v2ray.com/core/infra/conf" "v2ray.com/core/infra/conf/serial" + "v2ray.com/core/main/commands/base" ) var cmdAddOutbounds = &base.Command{ diff --git a/commands/all/api/outbounds_remove.go b/main/commands/all/api/outbounds_remove.go similarity index 97% rename from commands/all/api/outbounds_remove.go rename to main/commands/all/api/outbounds_remove.go index ddd139f94..245dae49f 100644 --- a/commands/all/api/outbounds_remove.go +++ b/main/commands/all/api/outbounds_remove.go @@ -4,9 +4,9 @@ import ( "fmt" handlerService "v2ray.com/core/app/proxyman/command" - "v2ray.com/core/commands/base" "v2ray.com/core/common/cmdarg" "v2ray.com/core/infra/conf/serial" + "v2ray.com/core/main/commands/base" ) var cmdRemoveOutbounds = &base.Command{ diff --git a/commands/all/api/shared.go b/main/commands/all/api/shared.go similarity index 96% rename from commands/all/api/shared.go rename to main/commands/all/api/shared.go index 2256b7dd1..6217d55e8 100644 --- a/commands/all/api/shared.go +++ b/main/commands/all/api/shared.go @@ -8,7 +8,7 @@ import ( "google.golang.org/grpc" "google.golang.org/protobuf/proto" - "v2ray.com/core/commands/base" + "v2ray.com/core/main/commands/base" ) type serviceHandler func(ctx context.Context, conn *grpc.ClientConn, cmd *base.Command, args []string) string diff --git a/commands/all/api/stats_get.go b/main/commands/all/api/stats_get.go similarity index 96% rename from commands/all/api/stats_get.go rename to main/commands/all/api/stats_get.go index 7e9b69ed0..c6999d425 100644 --- a/commands/all/api/stats_get.go +++ b/main/commands/all/api/stats_get.go @@ -2,7 +2,7 @@ package api import ( statsService "v2ray.com/core/app/stats/command" - "v2ray.com/core/commands/base" + "v2ray.com/core/main/commands/base" ) var cmdGetStats = &base.Command{ diff --git a/commands/all/api/stats_query.go b/main/commands/all/api/stats_query.go similarity index 96% rename from commands/all/api/stats_query.go rename to main/commands/all/api/stats_query.go index 65670d399..14407c082 100644 --- a/commands/all/api/stats_query.go +++ b/main/commands/all/api/stats_query.go @@ -2,7 +2,7 @@ package api import ( statsService "v2ray.com/core/app/stats/command" - "v2ray.com/core/commands/base" + "v2ray.com/core/main/commands/base" ) var cmdQueryStats = &base.Command{ diff --git a/commands/all/api/stats_sys.go b/main/commands/all/api/stats_sys.go similarity index 95% rename from commands/all/api/stats_sys.go rename to main/commands/all/api/stats_sys.go index 257372d39..20302b979 100644 --- a/commands/all/api/stats_sys.go +++ b/main/commands/all/api/stats_sys.go @@ -2,7 +2,7 @@ package api import ( statsService "v2ray.com/core/app/stats/command" - "v2ray.com/core/commands/base" + "v2ray.com/core/main/commands/base" ) var cmdSysStats = &base.Command{ diff --git a/commands/all/commands.go b/main/commands/all/commands.go similarity index 71% rename from commands/all/commands.go rename to main/commands/all/commands.go index 58dc3158e..91bd851b8 100644 --- a/commands/all/commands.go +++ b/main/commands/all/commands.go @@ -1,9 +1,9 @@ package all import ( - "v2ray.com/core/commands/all/api" - "v2ray.com/core/commands/all/tls" - "v2ray.com/core/commands/base" + "v2ray.com/core/main/commands/all/api" + "v2ray.com/core/main/commands/all/tls" + "v2ray.com/core/main/commands/base" ) // go:generate go run v2ray.com/core/common/errors/errorgen diff --git a/commands/all/convert.go b/main/commands/all/convert.go similarity index 98% rename from commands/all/convert.go rename to main/commands/all/convert.go index f612523ed..7d416ef1b 100644 --- a/commands/all/convert.go +++ b/main/commands/all/convert.go @@ -8,8 +8,8 @@ import ( "google.golang.org/protobuf/proto" "gopkg.in/yaml.v2" - "v2ray.com/core/commands/base" "v2ray.com/core/infra/conf/serial" + "v2ray.com/core/main/commands/base" ) var cmdConvert = &base.Command{ diff --git a/commands/all/convert_confs.go b/main/commands/all/convert_confs.go similarity index 98% rename from commands/all/convert_confs.go rename to main/commands/all/convert_confs.go index 72bebd9f9..6ed2f5365 100644 --- a/commands/all/convert_confs.go +++ b/main/commands/all/convert_confs.go @@ -6,10 +6,10 @@ import ( "path/filepath" "strings" - "v2ray.com/core/commands/base" "v2ray.com/core/common/cmdarg" "v2ray.com/core/infra/conf/json" "v2ray.com/core/infra/conf/merge" + "v2ray.com/core/main/commands/base" ) func mergeConvertToMap(files []string, format string) map[string]interface{} { diff --git a/commands/all/errors.generated.go b/main/commands/all/errors.generated.go similarity index 100% rename from commands/all/errors.generated.go rename to main/commands/all/errors.generated.go diff --git a/commands/all/format_doc.go b/main/commands/all/format_doc.go similarity index 97% rename from commands/all/format_doc.go rename to main/commands/all/format_doc.go index ca1024533..f94fb6392 100644 --- a/commands/all/format_doc.go +++ b/main/commands/all/format_doc.go @@ -1,7 +1,7 @@ package all import ( - "v2ray.com/core/commands/base" + "v2ray.com/core/main/commands/base" ) var docFormat = &base.Command{ diff --git a/commands/all/love.go b/main/commands/all/love.go similarity index 97% rename from commands/all/love.go rename to main/commands/all/love.go index 41b67ed46..be9c7b760 100644 --- a/commands/all/love.go +++ b/main/commands/all/love.go @@ -7,9 +7,9 @@ import ( "encoding/base64" "fmt" - "v2ray.com/core/commands/base" "v2ray.com/core/common" "v2ray.com/core/common/platform" + "v2ray.com/core/main/commands/base" ) var cmdLove = &base.Command{ diff --git a/commands/all/merge_doc.go b/main/commands/all/merge_doc.go similarity index 97% rename from commands/all/merge_doc.go rename to main/commands/all/merge_doc.go index a601c74e8..fc8dbb1ed 100644 --- a/commands/all/merge_doc.go +++ b/main/commands/all/merge_doc.go @@ -1,7 +1,7 @@ package all import ( - "v2ray.com/core/commands/base" + "v2ray.com/core/main/commands/base" ) var docMerge = &base.Command{ diff --git a/commands/all/tls/cert.go b/main/commands/all/tls/cert.go similarity index 98% rename from commands/all/tls/cert.go rename to main/commands/all/tls/cert.go index a8d63602e..6a05f6708 100644 --- a/commands/all/tls/cert.go +++ b/main/commands/all/tls/cert.go @@ -8,10 +8,10 @@ import ( "strings" "time" - "v2ray.com/core/commands/base" "v2ray.com/core/common" "v2ray.com/core/common/protocol/tls/cert" "v2ray.com/core/common/task" + "v2ray.com/core/main/commands/base" ) // cmdCert is the tls cert command diff --git a/commands/all/tls/ping.go b/main/commands/all/tls/ping.go similarity index 98% rename from commands/all/tls/ping.go rename to main/commands/all/tls/ping.go index fa395137b..fcf3404f4 100644 --- a/commands/all/tls/ping.go +++ b/main/commands/all/tls/ping.go @@ -6,7 +6,7 @@ import ( "fmt" "net" - "v2ray.com/core/commands/base" + "v2ray.com/core/main/commands/base" ) // cmdPing is the tls ping command diff --git a/commands/all/tls/tls.go b/main/commands/all/tls/tls.go similarity index 87% rename from commands/all/tls/tls.go rename to main/commands/all/tls/tls.go index a9dec0c34..f1a6ec988 100644 --- a/commands/all/tls/tls.go +++ b/main/commands/all/tls/tls.go @@ -1,7 +1,7 @@ package tls import ( - "v2ray.com/core/commands/base" + "v2ray.com/core/main/commands/base" ) // CmdTLS holds all tls sub commands diff --git a/commands/all/uuid.go b/main/commands/all/uuid.go similarity index 89% rename from commands/all/uuid.go rename to main/commands/all/uuid.go index d0efa7e09..9a26ec4fa 100644 --- a/commands/all/uuid.go +++ b/main/commands/all/uuid.go @@ -3,8 +3,8 @@ package all import ( "fmt" - "v2ray.com/core/commands/base" "v2ray.com/core/common/uuid" + "v2ray.com/core/main/commands/base" ) var cmdUUID = &base.Command{ diff --git a/commands/all/verify.go b/main/commands/all/verify.go similarity index 96% rename from commands/all/verify.go rename to main/commands/all/verify.go index 6eecaff37..860421c3d 100644 --- a/commands/all/verify.go +++ b/main/commands/all/verify.go @@ -4,7 +4,7 @@ import ( "os" "github.com/v2fly/VSign/signerVerify" - "v2ray.com/core/commands/base" + "v2ray.com/core/main/commands/base" ) var cmdVerify = &base.Command{ diff --git a/commands/base/command.go b/main/commands/base/command.go similarity index 100% rename from commands/base/command.go rename to main/commands/base/command.go diff --git a/commands/base/env.go b/main/commands/base/env.go similarity index 100% rename from commands/base/env.go rename to main/commands/base/env.go diff --git a/commands/base/execute.go b/main/commands/base/execute.go similarity index 100% rename from commands/base/execute.go rename to main/commands/base/execute.go diff --git a/commands/base/help.go b/main/commands/base/help.go similarity index 100% rename from commands/base/help.go rename to main/commands/base/help.go diff --git a/commands/base/root.go b/main/commands/base/root.go similarity index 100% rename from commands/base/root.go rename to main/commands/base/root.go diff --git a/main/commands/run.go b/main/commands/run.go index 6ce56f693..3d20cb7e2 100644 --- a/main/commands/run.go +++ b/main/commands/run.go @@ -11,9 +11,9 @@ import ( "syscall" "v2ray.com/core" - "v2ray.com/core/commands/base" "v2ray.com/core/common/cmdarg" "v2ray.com/core/common/platform" + "v2ray.com/core/main/commands/base" ) // CmdRun runs V2Ray with config diff --git a/main/commands/test.go b/main/commands/test.go index 95a712fe5..e6ad06797 100644 --- a/main/commands/test.go +++ b/main/commands/test.go @@ -5,7 +5,7 @@ import ( "log" "v2ray.com/core" - "v2ray.com/core/commands/base" + "v2ray.com/core/main/commands/base" ) // CmdTest tests config files diff --git a/main/commands/version.go b/main/commands/version.go index 23549afd2..ce7d370c7 100644 --- a/main/commands/version.go +++ b/main/commands/version.go @@ -4,7 +4,7 @@ import ( "fmt" "v2ray.com/core" - "v2ray.com/core/commands/base" + "v2ray.com/core/main/commands/base" ) // CmdVersion prints V2Ray Versions diff --git a/main/distro/all/all.go b/main/distro/all/all.go index 6cd06dddb..e3fe37fde 100644 --- a/main/distro/all/all.go +++ b/main/distro/all/all.go @@ -62,5 +62,5 @@ import ( _ "v2ray.com/core/main/yaml" // commands - _ "v2ray.com/core/commands/all" + _ "v2ray.com/core/main/commands/all" ) diff --git a/main/main.go b/main/main.go index 680074895..635142809 100644 --- a/main/main.go +++ b/main/main.go @@ -1,8 +1,8 @@ package main import ( - "v2ray.com/core/commands/base" "v2ray.com/core/main/commands" + "v2ray.com/core/main/commands/base" _ "v2ray.com/core/main/distro/all" ) diff --git a/proxy/blackhole/blackhole.go b/proxy/blackhole/blackhole.go index 00b12a222..840dba6d2 100644 --- a/proxy/blackhole/blackhole.go +++ b/proxy/blackhole/blackhole.go @@ -1,5 +1,3 @@ -// +build !confonly - // Package blackhole is an outbound handler that blocks all connections. package blackhole diff --git a/proxy/dns/dns.go b/proxy/dns/dns.go index 4117c0c36..953cb95de 100644 --- a/proxy/dns/dns.go +++ b/proxy/dns/dns.go @@ -1,5 +1,3 @@ -// +build !confonly - package dns import ( diff --git a/proxy/dokodemo/dokodemo.go b/proxy/dokodemo/dokodemo.go index a124924e4..2b0709695 100644 --- a/proxy/dokodemo/dokodemo.go +++ b/proxy/dokodemo/dokodemo.go @@ -1,5 +1,3 @@ -// +build !confonly - package dokodemo //go:generate go run v2ray.com/core/common/errors/errorgen diff --git a/proxy/freedom/freedom.go b/proxy/freedom/freedom.go index 9a55a71b2..0f92fe01b 100644 --- a/proxy/freedom/freedom.go +++ b/proxy/freedom/freedom.go @@ -1,5 +1,3 @@ -// +build !confonly - package freedom //go:generate go run v2ray.com/core/common/errors/errorgen diff --git a/proxy/http/client.go b/proxy/http/client.go index 51a2b6de4..7fa1470d8 100644 --- a/proxy/http/client.go +++ b/proxy/http/client.go @@ -1,5 +1,3 @@ -// +build !confonly - package http import ( diff --git a/proxy/http/server.go b/proxy/http/server.go index 5cf5c5ed4..3e5689895 100644 --- a/proxy/http/server.go +++ b/proxy/http/server.go @@ -1,5 +1,3 @@ -// +build !confonly - package http import ( diff --git a/proxy/shadowsocks/client.go b/proxy/shadowsocks/client.go index 04b7c723d..7bfbaeda6 100644 --- a/proxy/shadowsocks/client.go +++ b/proxy/shadowsocks/client.go @@ -1,5 +1,3 @@ -// +build !confonly - package shadowsocks import ( diff --git a/proxy/shadowsocks/protocol.go b/proxy/shadowsocks/protocol.go index 63f807605..3ed9f08bd 100644 --- a/proxy/shadowsocks/protocol.go +++ b/proxy/shadowsocks/protocol.go @@ -1,5 +1,3 @@ -// +build !confonly - package shadowsocks import ( diff --git a/proxy/shadowsocks/server.go b/proxy/shadowsocks/server.go index fdfa1d9fa..1412578a2 100644 --- a/proxy/shadowsocks/server.go +++ b/proxy/shadowsocks/server.go @@ -1,5 +1,3 @@ -// +build !confonly - package shadowsocks import ( diff --git a/proxy/socks/client.go b/proxy/socks/client.go index 836caf205..26d36e357 100644 --- a/proxy/socks/client.go +++ b/proxy/socks/client.go @@ -1,5 +1,3 @@ -// +build !confonly - package socks import ( diff --git a/proxy/socks/config.go b/proxy/socks/config.go index f9c617de8..0d380bd2c 100644 --- a/proxy/socks/config.go +++ b/proxy/socks/config.go @@ -1,5 +1,3 @@ -// +build !confonly - package socks import "v2ray.com/core/common/protocol" diff --git a/proxy/socks/protocol.go b/proxy/socks/protocol.go index 47ad3f30f..701baf751 100644 --- a/proxy/socks/protocol.go +++ b/proxy/socks/protocol.go @@ -1,5 +1,3 @@ -// +build !confonly - package socks import ( diff --git a/proxy/socks/server.go b/proxy/socks/server.go index 3f421bb78..7bdabe806 100644 --- a/proxy/socks/server.go +++ b/proxy/socks/server.go @@ -1,5 +1,3 @@ -// +build !confonly - package socks import ( diff --git a/proxy/trojan/client.go b/proxy/trojan/client.go index b97461761..43a7ae198 100644 --- a/proxy/trojan/client.go +++ b/proxy/trojan/client.go @@ -1,5 +1,3 @@ -// +build !confonly - package trojan import ( diff --git a/proxy/trojan/server.go b/proxy/trojan/server.go index 6e51829f9..6127f1e87 100644 --- a/proxy/trojan/server.go +++ b/proxy/trojan/server.go @@ -1,5 +1,3 @@ -// +build !confonly - package trojan import ( diff --git a/proxy/trojan/validator.go b/proxy/trojan/validator.go index f26f081e9..483f6cad8 100644 --- a/proxy/trojan/validator.go +++ b/proxy/trojan/validator.go @@ -1,5 +1,3 @@ -// +build !confonly - package trojan import ( diff --git a/proxy/vless/account.go b/proxy/vless/account.go index 54e7622e1..f4c379505 100644 --- a/proxy/vless/account.go +++ b/proxy/vless/account.go @@ -1,5 +1,3 @@ -// +build !confonly - package vless import ( diff --git a/proxy/vless/encoding/addons.go b/proxy/vless/encoding/addons.go index 6eb9cbbaa..7c77eb5d0 100644 --- a/proxy/vless/encoding/addons.go +++ b/proxy/vless/encoding/addons.go @@ -1,5 +1,3 @@ -// +build !confonly - package encoding import ( diff --git a/proxy/vless/encoding/encoding.go b/proxy/vless/encoding/encoding.go index 81a8d512a..b87581dbb 100644 --- a/proxy/vless/encoding/encoding.go +++ b/proxy/vless/encoding/encoding.go @@ -1,5 +1,3 @@ -// +build !confonly - package encoding //go:generate go run v2ray.com/core/common/errors/errorgen diff --git a/proxy/vless/inbound/config.go b/proxy/vless/inbound/config.go index 039be4337..71c65bf69 100644 --- a/proxy/vless/inbound/config.go +++ b/proxy/vless/inbound/config.go @@ -1,3 +1 @@ -// +build !confonly - package inbound diff --git a/proxy/vless/inbound/inbound.go b/proxy/vless/inbound/inbound.go index d293c5ce3..80b2a7b64 100644 --- a/proxy/vless/inbound/inbound.go +++ b/proxy/vless/inbound/inbound.go @@ -1,5 +1,3 @@ -// +build !confonly - package inbound //go:generate go run v2ray.com/core/common/errors/errorgen diff --git a/proxy/vless/outbound/config.go b/proxy/vless/outbound/config.go index 35bf561b6..a1e73e066 100644 --- a/proxy/vless/outbound/config.go +++ b/proxy/vless/outbound/config.go @@ -1,3 +1 @@ -// +build !confonly - package outbound diff --git a/proxy/vless/outbound/outbound.go b/proxy/vless/outbound/outbound.go index aee8f1c28..c14fecbf4 100644 --- a/proxy/vless/outbound/outbound.go +++ b/proxy/vless/outbound/outbound.go @@ -1,5 +1,3 @@ -// +build !confonly - package outbound //go:generate go run v2ray.com/core/common/errors/errorgen diff --git a/proxy/vless/validator.go b/proxy/vless/validator.go index ac3dc4f15..52e99cd8d 100644 --- a/proxy/vless/validator.go +++ b/proxy/vless/validator.go @@ -1,5 +1,3 @@ -// +build !confonly - package vless import ( diff --git a/proxy/vmess/account.go b/proxy/vmess/account.go index eff55debb..47eb267c1 100644 --- a/proxy/vmess/account.go +++ b/proxy/vmess/account.go @@ -1,5 +1,3 @@ -// +build !confonly - package vmess import ( diff --git a/proxy/vmess/inbound/config.go b/proxy/vmess/inbound/config.go index 25badc456..e4c5fbb3c 100644 --- a/proxy/vmess/inbound/config.go +++ b/proxy/vmess/inbound/config.go @@ -1,5 +1,3 @@ -// +build !confonly - package inbound // GetDefaultValue returns default settings of DefaultConfig. diff --git a/proxy/vmess/inbound/inbound.go b/proxy/vmess/inbound/inbound.go index 12386b5fc..a25e2e2c7 100644 --- a/proxy/vmess/inbound/inbound.go +++ b/proxy/vmess/inbound/inbound.go @@ -1,5 +1,3 @@ -// +build !confonly - package inbound //go:generate go run v2ray.com/core/common/errors/errorgen diff --git a/proxy/vmess/outbound/command.go b/proxy/vmess/outbound/command.go index f46983a41..94fc1bc17 100644 --- a/proxy/vmess/outbound/command.go +++ b/proxy/vmess/outbound/command.go @@ -1,5 +1,3 @@ -// +build !confonly - package outbound import ( diff --git a/proxy/vmess/outbound/outbound.go b/proxy/vmess/outbound/outbound.go index bb31ad758..7fb649fd8 100644 --- a/proxy/vmess/outbound/outbound.go +++ b/proxy/vmess/outbound/outbound.go @@ -1,5 +1,3 @@ -// +build !confonly - package outbound //go:generate go run v2ray.com/core/common/errors/errorgen diff --git a/proxy/vmess/validator.go b/proxy/vmess/validator.go index 9f21f5974..e9fcdb7d2 100644 --- a/proxy/vmess/validator.go +++ b/proxy/vmess/validator.go @@ -1,5 +1,3 @@ -// +build !confonly - package vmess import ( diff --git a/release/debian/rules b/release/debian/rules index 2392cdd96..f111e551d 100755 --- a/release/debian/rules +++ b/release/debian/rules @@ -18,8 +18,6 @@ override_dh_auto_clean: override_dh_auto_build: DH_GOPKG="v2ray.com/core/main" dh_auto_build -- -ldflags "-s -w" -tags $(DEB_VERSION_UPSTREAM) cd $(BUILDDIR); mv bin/main bin/v2ray - DH_GOPKG="v2ray.com/core/infra/control/main" dh_auto_build -- -ldflags "-s -w" -tags $(DEB_VERSION_UPSTREAM) - cd $(BUILDDIR); mv bin/main bin/v2ctl override_dh_auto_install: dh_auto_install -- --no-source diff --git a/release/user-package.sh b/release/user-package.sh index a21f1419d..942aba475 100755 --- a/release/user-package.sh +++ b/release/user-package.sh @@ -37,12 +37,6 @@ build_v2() { echo ">>> Compile v2ray ..." env CGO_ENABLED=0 go build -o "$TMP"/v2ray"${EXESUFFIX}" -ldflags "$LDFLAGS" ./main - if [[ $GOOS == "windows" ]]; then - env CGO_ENABLED=0 go build -o "$TMP"/wv2ray"${EXESUFFIX}" -ldflags "-H windowsgui $LDFLAGS" ./main - fi - - echo ">>> Compile v2ctl ..." - env CGO_ENABLED=0 go build -o "$TMP"/v2ctl"${EXESUFFIX}" -tags confonly -ldflags "$LDFLAGS" ./infra/control/main } build_dat() { diff --git a/transport/internet/domainsocket/config.go b/transport/internet/domainsocket/config.go index f51879476..b51c0a1a5 100644 --- a/transport/internet/domainsocket/config.go +++ b/transport/internet/domainsocket/config.go @@ -1,5 +1,3 @@ -// +build !confonly - package domainsocket import ( diff --git a/transport/internet/domainsocket/dial.go b/transport/internet/domainsocket/dial.go index bd6591de3..e069c7e51 100644 --- a/transport/internet/domainsocket/dial.go +++ b/transport/internet/domainsocket/dial.go @@ -1,6 +1,5 @@ // +build !windows // +build !wasm -// +build !confonly package domainsocket diff --git a/transport/internet/domainsocket/listener.go b/transport/internet/domainsocket/listener.go index aba951d0a..1e893b6af 100644 --- a/transport/internet/domainsocket/listener.go +++ b/transport/internet/domainsocket/listener.go @@ -1,6 +1,5 @@ // +build !windows // +build !wasm -// +build !confonly package domainsocket diff --git a/transport/internet/http/config.go b/transport/internet/http/config.go index b433e331c..1e2c38b34 100644 --- a/transport/internet/http/config.go +++ b/transport/internet/http/config.go @@ -1,5 +1,3 @@ -// +build !confonly - package http import ( diff --git a/transport/internet/http/dialer.go b/transport/internet/http/dialer.go index 48269fcdd..819f5be45 100644 --- a/transport/internet/http/dialer.go +++ b/transport/internet/http/dialer.go @@ -1,5 +1,3 @@ -// +build !confonly - package http import ( diff --git a/transport/internet/http/hub.go b/transport/internet/http/hub.go index 645b9101b..6adfd3a4d 100644 --- a/transport/internet/http/hub.go +++ b/transport/internet/http/hub.go @@ -1,5 +1,3 @@ -// +build !confonly - package http import ( diff --git a/transport/internet/kcp/config.go b/transport/internet/kcp/config.go index 3179e9c7e..750c447c0 100644 --- a/transport/internet/kcp/config.go +++ b/transport/internet/kcp/config.go @@ -1,5 +1,3 @@ -// +build !confonly - package kcp import ( diff --git a/transport/internet/kcp/connection.go b/transport/internet/kcp/connection.go index b89e1da69..e6f5d2db6 100644 --- a/transport/internet/kcp/connection.go +++ b/transport/internet/kcp/connection.go @@ -1,5 +1,3 @@ -// +build !confonly - package kcp import ( diff --git a/transport/internet/kcp/crypt.go b/transport/internet/kcp/crypt.go index 35bf55eac..66b7c1e36 100644 --- a/transport/internet/kcp/crypt.go +++ b/transport/internet/kcp/crypt.go @@ -1,5 +1,3 @@ -// +build !confonly - package kcp import ( diff --git a/transport/internet/kcp/dialer.go b/transport/internet/kcp/dialer.go index 4a6d9b4ff..8f80da0f3 100644 --- a/transport/internet/kcp/dialer.go +++ b/transport/internet/kcp/dialer.go @@ -1,5 +1,3 @@ -// +build !confonly - package kcp import ( diff --git a/transport/internet/kcp/io.go b/transport/internet/kcp/io.go index 58f657ca0..e85bf3364 100644 --- a/transport/internet/kcp/io.go +++ b/transport/internet/kcp/io.go @@ -1,5 +1,3 @@ -// +build !confonly - package kcp import ( diff --git a/transport/internet/kcp/listener.go b/transport/internet/kcp/listener.go index e0411aa20..94c5ecf9d 100644 --- a/transport/internet/kcp/listener.go +++ b/transport/internet/kcp/listener.go @@ -1,5 +1,3 @@ -// +build !confonly - package kcp import ( diff --git a/transport/internet/kcp/output.go b/transport/internet/kcp/output.go index 5f4a1dc2a..470b8e456 100644 --- a/transport/internet/kcp/output.go +++ b/transport/internet/kcp/output.go @@ -1,5 +1,3 @@ -// +build !confonly - package kcp import ( diff --git a/transport/internet/kcp/receiving.go b/transport/internet/kcp/receiving.go index abdedb9ec..0e07ea6e2 100644 --- a/transport/internet/kcp/receiving.go +++ b/transport/internet/kcp/receiving.go @@ -1,5 +1,3 @@ -// +build !confonly - package kcp import ( diff --git a/transport/internet/kcp/segment.go b/transport/internet/kcp/segment.go index 1f3f31db7..2d5b1d26a 100644 --- a/transport/internet/kcp/segment.go +++ b/transport/internet/kcp/segment.go @@ -1,5 +1,3 @@ -// +build !confonly - package kcp import ( diff --git a/transport/internet/kcp/sending.go b/transport/internet/kcp/sending.go index 4d9931733..593707134 100644 --- a/transport/internet/kcp/sending.go +++ b/transport/internet/kcp/sending.go @@ -1,5 +1,3 @@ -// +build !confonly - package kcp import ( diff --git a/transport/internet/quic/config.go b/transport/internet/quic/config.go index d9dcff3a4..0aab65eea 100644 --- a/transport/internet/quic/config.go +++ b/transport/internet/quic/config.go @@ -1,5 +1,3 @@ -// +build !confonly - package quic import ( diff --git a/transport/internet/quic/conn.go b/transport/internet/quic/conn.go index c59b2a7b6..f14d01d9d 100644 --- a/transport/internet/quic/conn.go +++ b/transport/internet/quic/conn.go @@ -1,5 +1,3 @@ -// +build !confonly - package quic import ( diff --git a/transport/internet/quic/dialer.go b/transport/internet/quic/dialer.go index daec007f5..b467341ca 100644 --- a/transport/internet/quic/dialer.go +++ b/transport/internet/quic/dialer.go @@ -1,5 +1,3 @@ -// +build !confonly - package quic import ( diff --git a/transport/internet/quic/hub.go b/transport/internet/quic/hub.go index 9e4947595..68a3a8686 100644 --- a/transport/internet/quic/hub.go +++ b/transport/internet/quic/hub.go @@ -1,5 +1,3 @@ -// +build !confonly - package quic import ( diff --git a/transport/internet/quic/pool.go b/transport/internet/quic/pool.go index 935a45068..ec2583201 100644 --- a/transport/internet/quic/pool.go +++ b/transport/internet/quic/pool.go @@ -1,5 +1,3 @@ -// +build !confonly - package quic import ( diff --git a/transport/internet/quic/quic.go b/transport/internet/quic/quic.go index 16bb0ab7b..d17cb51fd 100644 --- a/transport/internet/quic/quic.go +++ b/transport/internet/quic/quic.go @@ -1,5 +1,3 @@ -// +build !confonly - package quic import ( diff --git a/transport/internet/tcp/config.go b/transport/internet/tcp/config.go index f1bbcebb3..f98ad3a0a 100644 --- a/transport/internet/tcp/config.go +++ b/transport/internet/tcp/config.go @@ -1,5 +1,3 @@ -// +build !confonly - package tcp import ( diff --git a/transport/internet/tcp/dialer.go b/transport/internet/tcp/dialer.go index e6f414e0b..738b59c14 100644 --- a/transport/internet/tcp/dialer.go +++ b/transport/internet/tcp/dialer.go @@ -1,5 +1,3 @@ -// +build !confonly - package tcp import ( diff --git a/transport/internet/tcp/hub.go b/transport/internet/tcp/hub.go index eff9bf4b2..2715a6269 100644 --- a/transport/internet/tcp/hub.go +++ b/transport/internet/tcp/hub.go @@ -1,5 +1,3 @@ -// +build !confonly - package tcp import ( diff --git a/transport/internet/tcp/sockopt_freebsd.go b/transport/internet/tcp/sockopt_freebsd.go index 58f3dcd0d..592d26c0f 100644 --- a/transport/internet/tcp/sockopt_freebsd.go +++ b/transport/internet/tcp/sockopt_freebsd.go @@ -1,5 +1,4 @@ // +build freebsd -// +build !confonly package tcp diff --git a/transport/internet/tcp/sockopt_linux.go b/transport/internet/tcp/sockopt_linux.go index a5ebca737..d4fbc8de4 100644 --- a/transport/internet/tcp/sockopt_linux.go +++ b/transport/internet/tcp/sockopt_linux.go @@ -1,5 +1,4 @@ // +build linux -// +build !confonly package tcp diff --git a/transport/internet/tcp/sockopt_other.go b/transport/internet/tcp/sockopt_other.go index 2d4d4708e..2c5abf163 100644 --- a/transport/internet/tcp/sockopt_other.go +++ b/transport/internet/tcp/sockopt_other.go @@ -1,5 +1,4 @@ // +build !linux,!freebsd -// +build !confonly package tcp diff --git a/transport/internet/tls/config.go b/transport/internet/tls/config.go index f210f673d..27c4b2c5d 100644 --- a/transport/internet/tls/config.go +++ b/transport/internet/tls/config.go @@ -1,5 +1,3 @@ -// +build !confonly - package tls import ( diff --git a/transport/internet/tls/config_other.go b/transport/internet/tls/config_other.go index abc32ed47..3a46792b6 100644 --- a/transport/internet/tls/config_other.go +++ b/transport/internet/tls/config_other.go @@ -1,5 +1,4 @@ // +build !windows -// +build !confonly package tls diff --git a/transport/internet/tls/config_windows.go b/transport/internet/tls/config_windows.go index f02f6d26d..94b247629 100644 --- a/transport/internet/tls/config_windows.go +++ b/transport/internet/tls/config_windows.go @@ -1,5 +1,4 @@ // +build windows -// +build !confonly package tls diff --git a/transport/internet/tls/tls.go b/transport/internet/tls/tls.go index a102e1f08..a2969e393 100644 --- a/transport/internet/tls/tls.go +++ b/transport/internet/tls/tls.go @@ -1,5 +1,3 @@ -// +build !confonly - package tls import ( diff --git a/transport/internet/websocket/config.go b/transport/internet/websocket/config.go index 982cf7309..3df56b25f 100644 --- a/transport/internet/websocket/config.go +++ b/transport/internet/websocket/config.go @@ -1,5 +1,3 @@ -// +build !confonly - package websocket import ( diff --git a/transport/internet/websocket/connection.go b/transport/internet/websocket/connection.go index c63d6b57b..cff07bfc5 100644 --- a/transport/internet/websocket/connection.go +++ b/transport/internet/websocket/connection.go @@ -1,5 +1,3 @@ -// +build !confonly - package websocket import ( diff --git a/transport/internet/websocket/dialer.go b/transport/internet/websocket/dialer.go index 7545f8537..ef7289ee5 100644 --- a/transport/internet/websocket/dialer.go +++ b/transport/internet/websocket/dialer.go @@ -1,5 +1,3 @@ -// +build !confonly - package websocket import ( diff --git a/transport/internet/websocket/hub.go b/transport/internet/websocket/hub.go index 0439a05d7..19fe9e195 100644 --- a/transport/internet/websocket/hub.go +++ b/transport/internet/websocket/hub.go @@ -1,5 +1,3 @@ -// +build !confonly - package websocket import ( diff --git a/v2ray.go b/v2ray.go index 0dfd8b5a5..c8ffc2fcb 100644 --- a/v2ray.go +++ b/v2ray.go @@ -1,5 +1,3 @@ -// +build !confonly - package core import (