diff --git a/app/commander/commander.go b/app/commander/commander.go index 2a8ae501..e0196af6 100644 --- a/app/commander/commander.go +++ b/app/commander/commander.go @@ -2,7 +2,7 @@ package commander -//go:generate errorgen +//go:generate go run v2ray.com/core/common/errors/errorgen import ( "context" diff --git a/app/dispatcher/default.go b/app/dispatcher/default.go index d74f243e..6823884e 100644 --- a/app/dispatcher/default.go +++ b/app/dispatcher/default.go @@ -2,7 +2,7 @@ package dispatcher -//go:generate errorgen +//go:generate go run v2ray.com/core/common/errors/errorgen import ( "context" diff --git a/app/dispatcher/dispatcher.go b/app/dispatcher/dispatcher.go index ba516bd8..70c60932 100644 --- a/app/dispatcher/dispatcher.go +++ b/app/dispatcher/dispatcher.go @@ -2,4 +2,4 @@ package dispatcher -//go:generate errorgen +//go:generate go run v2ray.com/core/common/errors/errorgen diff --git a/app/dns/dns.go b/app/dns/dns.go index 28024235..ac724387 100644 --- a/app/dns/dns.go +++ b/app/dns/dns.go @@ -1,4 +1,4 @@ // Package dns is an implementation of core.DNS feature. package dns -//go:generate errorgen +//go:generate go run v2ray.com/core/common/errors/errorgen diff --git a/app/dns/server.go b/app/dns/server.go index aaf8c240..da9f6cc0 100644 --- a/app/dns/server.go +++ b/app/dns/server.go @@ -2,7 +2,7 @@ package dns -//go:generate errorgen +//go:generate go run v2ray.com/core/common/errors/errorgen import ( "context" diff --git a/app/log/command/command.go b/app/log/command/command.go index f1711988..a6b6b5c2 100644 --- a/app/log/command/command.go +++ b/app/log/command/command.go @@ -2,7 +2,7 @@ package command -//go:generate errorgen +//go:generate go run v2ray.com/core/common/errors/errorgen import ( "context" diff --git a/app/log/log.go b/app/log/log.go index 1b47cb56..bf95a4ce 100644 --- a/app/log/log.go +++ b/app/log/log.go @@ -2,7 +2,7 @@ package log -//go:generate errorgen +//go:generate go run v2ray.com/core/common/errors/errorgen import ( "context" diff --git a/app/policy/policy.go b/app/policy/policy.go index bb3ac3b3..4ae0b028 100644 --- a/app/policy/policy.go +++ b/app/policy/policy.go @@ -1,4 +1,4 @@ // Package policy is an implementation of policy.Manager feature. package policy -//go:generate errorgen +//go:generate go run v2ray.com/core/common/errors/errorgen diff --git a/app/proxyman/command/doc.go b/app/proxyman/command/doc.go index a9d2624e..d09e0a9a 100644 --- a/app/proxyman/command/doc.go +++ b/app/proxyman/command/doc.go @@ -1,3 +1,3 @@ package command -//go:generate errorgen +//go:generate go run v2ray.com/core/common/errors/errorgen diff --git a/app/proxyman/inbound/inbound.go b/app/proxyman/inbound/inbound.go index fa8ffb78..947205e8 100644 --- a/app/proxyman/inbound/inbound.go +++ b/app/proxyman/inbound/inbound.go @@ -1,6 +1,6 @@ package inbound -//go:generate errorgen +//go:generate go run v2ray.com/core/common/errors/errorgen import ( "context" diff --git a/app/proxyman/outbound/outbound.go b/app/proxyman/outbound/outbound.go index af286116..e01c7bb0 100644 --- a/app/proxyman/outbound/outbound.go +++ b/app/proxyman/outbound/outbound.go @@ -1,6 +1,6 @@ package outbound -//go:generate errorgen +//go:generate go run v2ray.com/core/common/errors/errorgen import ( "context" diff --git a/app/reverse/reverse.go b/app/reverse/reverse.go index 898a1850..a1d26286 100644 --- a/app/reverse/reverse.go +++ b/app/reverse/reverse.go @@ -2,7 +2,7 @@ package reverse -//go:generate errorgen +//go:generate go run v2ray.com/core/common/errors/errorgen import ( "context" diff --git a/app/router/command/command.go b/app/router/command/command.go index 2a6867fe..f1720f87 100644 --- a/app/router/command/command.go +++ b/app/router/command/command.go @@ -2,7 +2,7 @@ package command -//go:generate errorgen +//go:generate go run v2ray.com/core/common/errors/errorgen import ( "context" diff --git a/app/router/router.go b/app/router/router.go index de8321ba..30cfe659 100644 --- a/app/router/router.go +++ b/app/router/router.go @@ -2,7 +2,7 @@ package router -//go:generate errorgen +//go:generate go run v2ray.com/core/common/errors/errorgen import ( "context" diff --git a/app/stats/command/command.go b/app/stats/command/command.go index 21c85446..434af86b 100644 --- a/app/stats/command/command.go +++ b/app/stats/command/command.go @@ -2,7 +2,7 @@ package command -//go:generate errorgen +//go:generate go run v2ray.com/core/common/errors/errorgen import ( "context" diff --git a/app/stats/stats.go b/app/stats/stats.go index 0e14faf2..3b881c33 100644 --- a/app/stats/stats.go +++ b/app/stats/stats.go @@ -2,7 +2,7 @@ package stats -//go:generate errorgen +//go:generate go run v2ray.com/core/common/errors/errorgen import ( "context" diff --git a/common/buf/buf.go b/common/buf/buf.go index 39335479..8579694c 100644 --- a/common/buf/buf.go +++ b/common/buf/buf.go @@ -1,4 +1,4 @@ // Package buf provides a light-weight memory allocation mechanism. package buf // import "v2ray.com/core/common/buf" -//go:generate errorgen +//go:generate go run v2ray.com/core/common/errors/errorgen diff --git a/common/common.go b/common/common.go index 4156a7b1..2d0a929b 100644 --- a/common/common.go +++ b/common/common.go @@ -13,7 +13,7 @@ import ( "v2ray.com/core/common/errors" ) -//go:generate errorgen +//go:generate go run v2ray.com/core/common/errors/errorgen var ( // ErrNoClue is for the situation that existing information is not enough to make a decision. For example, Router may return this error when there is no suitable route. @@ -126,25 +126,33 @@ func GetGOPATH() string { // GetModuleName returns the value of module in `go.mod` file. func GetModuleName(pathToProjectRoot string) (string, error) { - gomodPath := filepath.Join(pathToProjectRoot, "go.mod") - gomodBytes, err := ioutil.ReadFile(gomodPath) - if err != nil { - return "", err - } - gomodContent := string(gomodBytes) - moduleIdx := strings.Index(gomodContent, "module ") - newLineIdx := strings.Index(gomodContent, "\n") - var moduleName string - if moduleIdx >= 0 { - if newLineIdx >= 0 { - moduleName = strings.TrimSpace(gomodContent[moduleIdx+6 : newLineIdx]) - moduleName = strings.TrimSuffix(moduleName, "\r") - } else { - moduleName = strings.TrimSpace(gomodContent[moduleIdx+6:]) + loopPath := pathToProjectRoot + for { + if idx := strings.LastIndex(loopPath, string(filepath.Separator)); idx >= 0 { + gomodPath := filepath.Join(loopPath, "go.mod") + gomodBytes, err := ioutil.ReadFile(gomodPath) + if err != nil { + loopPath = loopPath[:idx] + continue + } + + gomodContent := string(gomodBytes) + moduleIdx := strings.Index(gomodContent, "module ") + newLineIdx := strings.Index(gomodContent, "\n") + + if moduleIdx >= 0 { + if newLineIdx >= 0 { + moduleName = strings.TrimSpace(gomodContent[moduleIdx+6 : newLineIdx]) + moduleName = strings.TrimSuffix(moduleName, "\r") + } else { + moduleName = strings.TrimSpace(gomodContent[moduleIdx+6:]) + } + return moduleName, nil + } + return "", fmt.Errorf("can not get module path in `%s`", gomodPath) } - } else { - return "", fmt.Errorf("can not get module path in `%s`", gomodPath) + break } - return moduleName, nil + return moduleName, fmt.Errorf("no `go.mod` file in every parent directory of `%s`", pathToProjectRoot) } diff --git a/common/crypto/crypto.go b/common/crypto/crypto.go index d98e8dfe..0adb1a2a 100644 --- a/common/crypto/crypto.go +++ b/common/crypto/crypto.go @@ -1,4 +1,4 @@ // Package crypto provides common crypto libraries for V2Ray. package crypto // import "v2ray.com/core/common/crypto" -//go:generate errorgen +//go:generate go run v2ray.com/core/common/errors/errorgen diff --git a/common/errors/errorgen/main.go b/common/errors/errorgen/main.go index 85dfeb61..f7bbefe4 100644 --- a/common/errors/errorgen/main.go +++ b/common/errors/errorgen/main.go @@ -5,35 +5,41 @@ import ( "log" "os" "path/filepath" + + "v2ray.com/core/common" ) -func getCurrentPkg() (string, error) { - path, err := os.Getwd() - if err != nil { - return "", err - } - return filepath.Base(path), nil -} - func main() { - pkg, err := getCurrentPkg() + pwd, err := os.Getwd() if err != nil { - log.Fatal("Failed to get current package: ", err.Error()) - return + fmt.Println("can not get current working directory") + os.Exit(1) + } + pkg := filepath.Base(pwd) + if pkg == "v2ray-core" { + pkg = "core" + } + + moduleName, gmnErr := common.GetModuleName(pwd) + if gmnErr != nil { + fmt.Println("can not get module path", gmnErr) + os.Exit(1) } file, err := os.OpenFile("errors.generated.go", os.O_WRONLY|os.O_TRUNC|os.O_CREATE, 0644) if err != nil { log.Fatalf("Failed to generate errors.generated.go: %v", err) - return + os.Exit(1) } + defer file.Close() fmt.Fprintln(file, "package", pkg) fmt.Fprintln(file, "") - fmt.Fprintln(file, "import \"v2ray.com/core/common/errors\"") + fmt.Fprintln(file, "import \""+moduleName+"/common/errors\"") fmt.Fprintln(file, "") - fmt.Fprintln(file, "type errPathObjHolder struct {}") - fmt.Fprintln(file, "func newError(values ...interface{}) *errors.Error { return errors.New(values...).WithPathObj(errPathObjHolder{}) }") - - file.Close() + fmt.Fprintln(file, "type errPathObjHolder struct{}") + fmt.Fprintln(file, "") + fmt.Fprintln(file, "func newError(values ...interface{}) *errors.Error {") + fmt.Fprintln(file, " return errors.New(values...).WithPathObj(errPathObjHolder{})") + fmt.Fprintln(file, "}") } diff --git a/common/mux/mux.go b/common/mux/mux.go index 30682771..35b05a76 100644 --- a/common/mux/mux.go +++ b/common/mux/mux.go @@ -1,3 +1,3 @@ package mux -//go:generate errorgen +//go:generate go run v2ray.com/core/common/errors/errorgen diff --git a/common/net/net.go b/common/net/net.go index da929836..172e516d 100644 --- a/common/net/net.go +++ b/common/net/net.go @@ -1,4 +1,4 @@ // Package net is a drop-in replacement to Golang's net package, with some more functionalities. package net // import "v2ray.com/core/common/net" -//go:generate errorgen +//go:generate go run v2ray.com/core/common/errors/errorgen diff --git a/common/platform/ctlcmd/ctlcmd.go b/common/platform/ctlcmd/ctlcmd.go index 1fad1e74..3ee617bd 100644 --- a/common/platform/ctlcmd/ctlcmd.go +++ b/common/platform/ctlcmd/ctlcmd.go @@ -10,7 +10,7 @@ import ( "v2ray.com/core/common/platform" ) -//go:generate errorgen +//go:generate go run v2ray.com/core/common/errors/errorgen func Run(args []string, input io.Reader) (buf.MultiBuffer, error) { v2ctl := platform.GetToolLocation("v2ctl") diff --git a/common/protocol/protocol.go b/common/protocol/protocol.go index 8a7851b2..41d99d0a 100644 --- a/common/protocol/protocol.go +++ b/common/protocol/protocol.go @@ -1,3 +1,3 @@ package protocol // import "v2ray.com/core/common/protocol" -//go:generate errorgen +//go:generate go run v2ray.com/core/common/errors/errorgen diff --git a/common/protocol/tls/cert/cert.go b/common/protocol/tls/cert/cert.go index 6c2b8bc3..8f96db00 100644 --- a/common/protocol/tls/cert/cert.go +++ b/common/protocol/tls/cert/cert.go @@ -15,7 +15,7 @@ import ( "v2ray.com/core/common" ) -//go:generate errorgen +//go:generate go run v2ray.com/core/common/errors/errorgen type Certificate struct { // Cerificate in ASN.1 DER format diff --git a/common/retry/retry.go b/common/retry/retry.go index c719e267..30aed1f1 100644 --- a/common/retry/retry.go +++ b/common/retry/retry.go @@ -1,6 +1,6 @@ package retry // import "v2ray.com/core/common/retry" -//go:generate errorgen +//go:generate go run v2ray.com/core/common/errors/errorgen import ( "time" diff --git a/core.go b/core.go index 29fa268e..1399502a 100644 --- a/core.go +++ b/core.go @@ -9,8 +9,7 @@ // connections. package core -//go:generate go install "v2ray.com/core/common/errors/errorgen" -//go:generate errorgen +//go:generate go run v2ray.com/core/common/errors/errorgen import ( "runtime" diff --git a/features/feature.go b/features/feature.go index ac7b77a7..5cd0adbd 100644 --- a/features/feature.go +++ b/features/feature.go @@ -2,7 +2,7 @@ package features import "v2ray.com/core/common" -//go:generate errorgen +//go:generate go run v2ray.com/core/common/errors/errorgen // Feature is the interface for V2Ray features. All features must implement this interface. // All existing features have an implementation in app directory. These features can be replaced by third-party ones. diff --git a/features/routing/dns/context.go b/features/routing/dns/context.go index fca58701..e36fa157 100644 --- a/features/routing/dns/context.go +++ b/features/routing/dns/context.go @@ -1,6 +1,6 @@ package dns -//go:generate errorgen +//go:generate go run v2ray.com/core/common/errors/errorgen import ( "v2ray.com/core/common/net" diff --git a/features/stats/stats.go b/features/stats/stats.go index f92c75d0..d0a188ad 100644 --- a/features/stats/stats.go +++ b/features/stats/stats.go @@ -1,6 +1,6 @@ package stats -//go:generate errorgen +//go:generate go run v2ray.com/core/common/errors/errorgen import ( "context" diff --git a/infra/conf/command/command.go b/infra/conf/command/command.go index 9f8c12d5..b7d7829c 100644 --- a/infra/conf/command/command.go +++ b/infra/conf/command/command.go @@ -1,6 +1,6 @@ package command -//go:generate errorgen +//go:generate go run v2ray.com/core/common/errors/errorgen import ( "os" diff --git a/infra/conf/conf.go b/infra/conf/conf.go index 63b7313f..4a099384 100644 --- a/infra/conf/conf.go +++ b/infra/conf/conf.go @@ -1,3 +1,3 @@ package conf -//go:generate errorgen +//go:generate go run v2ray.com/core/common/errors/errorgen diff --git a/infra/conf/serial/serial.go b/infra/conf/serial/serial.go index 8314cb01..8c0604ac 100644 --- a/infra/conf/serial/serial.go +++ b/infra/conf/serial/serial.go @@ -1,3 +1,3 @@ package serial -//go:generate errorgen +//go:generate go run v2ray.com/core/common/errors/errorgen diff --git a/infra/control/control.go b/infra/control/control.go index adac14d8..7c05ea27 100644 --- a/infra/control/control.go +++ b/infra/control/control.go @@ -1,3 +1,3 @@ package control -//go:generate errorgen +//go:generate go run v2ray.com/core/common/errors/errorgen diff --git a/main/confloader/external/external.go b/main/confloader/external/external.go index a16f0c7a..f6bcf7d5 100644 --- a/main/confloader/external/external.go +++ b/main/confloader/external/external.go @@ -1,6 +1,6 @@ package external -//go:generate errorgen +//go:generate go run v2ray.com/core/common/errors/errorgen import ( "bytes" diff --git a/main/json/config_json.go b/main/json/config_json.go index 59bcc63d..650aceb5 100644 --- a/main/json/config_json.go +++ b/main/json/config_json.go @@ -1,6 +1,6 @@ package json -//go:generate errorgen +//go:generate go run v2ray.com/core/common/errors/errorgen import ( "io" diff --git a/main/main.go b/main/main.go index 4fe18844..8390af3e 100644 --- a/main/main.go +++ b/main/main.go @@ -1,6 +1,6 @@ package main -//go:generate errorgen +//go:generate go run v2ray.com/core/common/errors/errorgen import ( "flag" diff --git a/proxy/blackhole/blackhole.go b/proxy/blackhole/blackhole.go index 8bcc5f5e..d2213390 100644 --- a/proxy/blackhole/blackhole.go +++ b/proxy/blackhole/blackhole.go @@ -4,7 +4,7 @@ package blackhole -//go:generate errorgen +//go:generate go run v2ray.com/core/common/errors/errorgen import ( "context" diff --git a/proxy/dokodemo/dokodemo.go b/proxy/dokodemo/dokodemo.go index 24ebe098..0333eb28 100644 --- a/proxy/dokodemo/dokodemo.go +++ b/proxy/dokodemo/dokodemo.go @@ -2,7 +2,7 @@ package dokodemo -//go:generate errorgen +//go:generate go run v2ray.com/core/common/errors/errorgen import ( "context" diff --git a/proxy/freedom/freedom.go b/proxy/freedom/freedom.go index d26ffe61..0ac95466 100644 --- a/proxy/freedom/freedom.go +++ b/proxy/freedom/freedom.go @@ -2,7 +2,7 @@ package freedom -//go:generate errorgen +//go:generate go run v2ray.com/core/common/errors/errorgen import ( "context" diff --git a/proxy/http/http.go b/proxy/http/http.go index cb8ad4e9..f2305b87 100644 --- a/proxy/http/http.go +++ b/proxy/http/http.go @@ -1,3 +1,3 @@ package http -//go:generate errorgen +//go:generate go run v2ray.com/core/common/errors/errorgen diff --git a/proxy/mtproto/mtproto.go b/proxy/mtproto/mtproto.go index 75629fe7..c89a224a 100644 --- a/proxy/mtproto/mtproto.go +++ b/proxy/mtproto/mtproto.go @@ -1,3 +1,3 @@ package mtproto -//go:generate errorgen +//go:generate go run v2ray.com/core/common/errors/errorgen diff --git a/proxy/shadowsocks/shadowsocks.go b/proxy/shadowsocks/shadowsocks.go index d7f6980e..a401063b 100644 --- a/proxy/shadowsocks/shadowsocks.go +++ b/proxy/shadowsocks/shadowsocks.go @@ -5,4 +5,4 @@ // R.I.P Shadowsocks package shadowsocks -//go:generate errorgen +//go:generate go run v2ray.com/core/common/errors/errorgen diff --git a/proxy/socks/socks.go b/proxy/socks/socks.go index ac2da5a4..d3be1059 100644 --- a/proxy/socks/socks.go +++ b/proxy/socks/socks.go @@ -1,4 +1,4 @@ // Package socks provides implements of Socks protocol 4, 4a and 5. package socks -//go:generate errorgen +//go:generate go run v2ray.com/core/common/errors/errorgen diff --git a/proxy/vless/encoding/encoding.go b/proxy/vless/encoding/encoding.go index 99e466ae..ec6ecff6 100644 --- a/proxy/vless/encoding/encoding.go +++ b/proxy/vless/encoding/encoding.go @@ -2,7 +2,7 @@ package encoding -//go:generate errorgen +//go:generate go run v2ray.com/core/common/errors/errorgen import ( "io" diff --git a/proxy/vless/inbound/inbound.go b/proxy/vless/inbound/inbound.go index cb0439cb..fa8124e1 100644 --- a/proxy/vless/inbound/inbound.go +++ b/proxy/vless/inbound/inbound.go @@ -2,7 +2,7 @@ package inbound -//go:generate errorgen +//go:generate go run v2ray.com/core/common/errors/errorgen import ( "context" diff --git a/proxy/vless/outbound/outbound.go b/proxy/vless/outbound/outbound.go index 825464c9..95e8be5e 100644 --- a/proxy/vless/outbound/outbound.go +++ b/proxy/vless/outbound/outbound.go @@ -2,7 +2,7 @@ package outbound -//go:generate errorgen +//go:generate go run v2ray.com/core/common/errors/errorgen import ( "context" diff --git a/proxy/vless/vless.go b/proxy/vless/vless.go index ea51e563..6628a5be 100644 --- a/proxy/vless/vless.go +++ b/proxy/vless/vless.go @@ -5,7 +5,7 @@ // clients with 'socks' for proxying. package vless -//go:generate errorgen +//go:generate go run v2ray.com/core/common/errors/errorgen const ( XRO = "xtls-rprx-origin" diff --git a/proxy/vmess/encoding/encoding.go b/proxy/vmess/encoding/encoding.go index f6d04947..bd601e3a 100644 --- a/proxy/vmess/encoding/encoding.go +++ b/proxy/vmess/encoding/encoding.go @@ -5,7 +5,7 @@ import ( "v2ray.com/core/common/protocol" ) -//go:generate errorgen +//go:generate go run v2ray.com/core/common/errors/errorgen const ( Version = byte(1) diff --git a/proxy/vmess/inbound/inbound.go b/proxy/vmess/inbound/inbound.go index cf86c874..9f385be9 100644 --- a/proxy/vmess/inbound/inbound.go +++ b/proxy/vmess/inbound/inbound.go @@ -2,7 +2,7 @@ package inbound -//go:generate errorgen +//go:generate go run v2ray.com/core/common/errors/errorgen import ( "context" diff --git a/proxy/vmess/outbound/outbound.go b/proxy/vmess/outbound/outbound.go index b1592766..85255239 100644 --- a/proxy/vmess/outbound/outbound.go +++ b/proxy/vmess/outbound/outbound.go @@ -2,7 +2,7 @@ package outbound -//go:generate errorgen +//go:generate go run v2ray.com/core/common/errors/errorgen import ( "context" diff --git a/proxy/vmess/vmess.go b/proxy/vmess/vmess.go index 9e22db61..6ffb6d46 100644 --- a/proxy/vmess/vmess.go +++ b/proxy/vmess/vmess.go @@ -5,4 +5,4 @@ // clients with 'socks' for proxying. package vmess -//go:generate errorgen +//go:generate go run v2ray.com/core/common/errors/errorgen diff --git a/transport/internet/domainsocket/errgen.go b/transport/internet/domainsocket/errgen.go index d4501e83..124b932b 100644 --- a/transport/internet/domainsocket/errgen.go +++ b/transport/internet/domainsocket/errgen.go @@ -1,3 +1,3 @@ package domainsocket -//go:generate errorgen +//go:generate go run v2ray.com/core/common/errors/errorgen diff --git a/transport/internet/headers/http/http.go b/transport/internet/headers/http/http.go index 5b940cb8..c12d5b03 100644 --- a/transport/internet/headers/http/http.go +++ b/transport/internet/headers/http/http.go @@ -1,6 +1,6 @@ package http -//go:generate errorgen +//go:generate go run v2ray.com/core/common/errors/errorgen import ( "bufio" diff --git a/transport/internet/http/http.go b/transport/internet/http/http.go index cb8ad4e9..f2305b87 100644 --- a/transport/internet/http/http.go +++ b/transport/internet/http/http.go @@ -1,3 +1,3 @@ package http -//go:generate errorgen +//go:generate go run v2ray.com/core/common/errors/errorgen diff --git a/transport/internet/internet.go b/transport/internet/internet.go index 77027eaa..a2283fcf 100644 --- a/transport/internet/internet.go +++ b/transport/internet/internet.go @@ -1,3 +1,3 @@ package internet -//go:generate errorgen +//go:generate go run v2ray.com/core/common/errors/errorgen diff --git a/transport/internet/kcp/kcp.go b/transport/internet/kcp/kcp.go index 177b6517..5bef0b89 100644 --- a/transport/internet/kcp/kcp.go +++ b/transport/internet/kcp/kcp.go @@ -5,4 +5,4 @@ // xtaci@github for translating to Golang package kcp -//go:generate errorgen +//go:generate go run v2ray.com/core/common/errors/errorgen diff --git a/transport/internet/quic/quic.go b/transport/internet/quic/quic.go index 1ec3b3cf..16bb0ab7 100644 --- a/transport/internet/quic/quic.go +++ b/transport/internet/quic/quic.go @@ -7,7 +7,7 @@ import ( "v2ray.com/core/transport/internet" ) -//go:generate errorgen +//go:generate go run v2ray.com/core/common/errors/errorgen // Here is some modification needs to be done before update quic vendor. // * use bytespool in buffer_pool.go diff --git a/transport/internet/tcp/tcp.go b/transport/internet/tcp/tcp.go index 05307a11..052d4eb7 100644 --- a/transport/internet/tcp/tcp.go +++ b/transport/internet/tcp/tcp.go @@ -1,3 +1,3 @@ package tcp -//go:generate errorgen +//go:generate go run v2ray.com/core/common/errors/errorgen diff --git a/transport/internet/tls/tls.go b/transport/internet/tls/tls.go index 6319a61d..a102e1f0 100644 --- a/transport/internet/tls/tls.go +++ b/transport/internet/tls/tls.go @@ -9,7 +9,7 @@ import ( "v2ray.com/core/common/net" ) -//go:generate errorgen +//go:generate go run v2ray.com/core/common/errors/errorgen var ( _ buf.Writer = (*Conn)(nil) diff --git a/transport/internet/udp/udp.go b/transport/internet/udp/udp.go index cbcebe44..444da1cd 100644 --- a/transport/internet/udp/udp.go +++ b/transport/internet/udp/udp.go @@ -1,5 +1,5 @@ package udp -//go:generate errorgen +//go:generate go run v2ray.com/core/common/errors/errorgen const protocolName = "udp" diff --git a/transport/internet/websocket/ws.go b/transport/internet/websocket/ws.go index 7edd1344..157f436a 100644 --- a/transport/internet/websocket/ws.go +++ b/transport/internet/websocket/ws.go @@ -4,4 +4,4 @@ Websocket transport implements an HTTP(S) compliable, surveillance proof transpo */ package websocket -//go:generate errorgen +//go:generate go run v2ray.com/core/common/errors/errorgen diff --git a/transport/internet/xtls/xtls.go b/transport/internet/xtls/xtls.go index e34408bf..8a1be33f 100644 --- a/transport/internet/xtls/xtls.go +++ b/transport/internet/xtls/xtls.go @@ -9,7 +9,7 @@ import ( "v2ray.com/core/common/net" ) -//go:generate errorgen +//go:generate go run v2ray.com/core/common/errors/errorgen var ( _ buf.Writer = (*Conn)(nil)