From efb963237ca5517d8224733041dabeded6f9b104 Mon Sep 17 00:00:00 2001 From: Loyalsoldier <10487845+Loyalsoldier@users.noreply.github.com> Date: Sat, 20 Feb 2021 20:43:19 +0800 Subject: [PATCH] Fix: go generate command for Go v1.16 (#695) * Fix: go generate command for Go v1.16 * Chore: ignore go generate binaries * Chore: regenerate mock files * Chore: update dependencies --- .gitignore | 2 ++ go.mod | 10 ++++---- go.sum | 22 ++++++++++------- mocks.go | 14 +++++------ proto.go | 6 ++--- testing/mocks/dns.go | 27 +++++++++++---------- testing/mocks/io.go | 27 +++++++++++---------- testing/mocks/log.go | 15 ++++++------ testing/mocks/mux.go | 15 ++++++------ testing/mocks/outbound.go | 51 ++++++++++++++++++++------------------- testing/mocks/proxy.go | 31 ++++++++++++------------ 11 files changed, 116 insertions(+), 104 deletions(-) diff --git a/.gitignore b/.gitignore index dc7813fdeff..8b474102518 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,5 @@ *.tar.gz v2ray v2ctl +mockgen +vprotogen diff --git a/go.mod b/go.mod index e62ac5d1e4a..f58db07585d 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/v2fly/v2ray-core/v4 go 1.16 require ( - github.com/golang/mock v1.4.4 + github.com/golang/mock v1.5.0 github.com/golang/protobuf v1.4.3 github.com/google/go-cmp v0.5.4 github.com/gorilla/websocket v1.4.2 @@ -14,10 +14,10 @@ require ( github.com/stretchr/testify v1.7.0 github.com/v2fly/VSign v0.0.0-20201108000810-e2adc24bf848 go.starlark.net v0.0.0-20210212215732-ebe61bd709bf - golang.org/x/crypto v0.0.0-20210218145215-b8e89b74b9df - golang.org/x/net v0.0.0-20210119194325-5f4716e94777 - golang.org/x/sync v0.0.0-20201207232520-09787c993a3a - golang.org/x/sys v0.0.0-20210218155724-8ebf48af031b + golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83 + golang.org/x/net v0.0.0-20210220033124-5f55cee0dc0d + golang.org/x/sync v0.0.0-20210220032951-036812b2e83c + golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43 google.golang.org/grpc v1.35.0 google.golang.org/protobuf v1.25.0 h12.io/socks v1.0.2 diff --git a/go.sum b/go.sum index d090b887ae6..552c0c440b8 100644 --- a/go.sum +++ b/go.sum @@ -49,8 +49,9 @@ github.com/golang/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:tluoj9z5200j github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.4 h1:l75CXGRSwbaYNpl/Z2X1XIIAMSCquvXgpVZDhwEIJsc= github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= +github.com/golang/mock v1.5.0 h1:jlYHihg//f7RRwuPfptm04yp4s7O6Kw8EZiVYIGcH0g= +github.com/golang/mock v1.5.0/go.mod h1:CWnOUgYIOo4TcNZ0wHX3YZCqsaM1I1Jvs6v3mP3KVu8= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -188,14 +189,15 @@ golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a/go.mod h1:djNgcEr1/C05ACk golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200221231518-2aa609cf4a9d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20210218145215-b8e89b74b9df h1:y7QZzfUiTwWam+xBn29Ulb8CBwVN5UdzmMDavl9Whlw= -golang.org/x/crypto v0.0.0-20210218145215-b8e89b74b9df/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= +golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83 h1:/ZScEX8SfEmUGRHs0gxpqteO5nfNW6axyZbBdw9A12g= +golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -210,8 +212,8 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20210119194325-5f4716e94777 h1:003p0dJM77cxMSyCPFphvZf/Y5/NXf5fzg6ufd1/Oew= -golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210220033124-5f55cee0dc0d h1:1aflnvSoWWLI2k/dMUAl5lvU1YO4Mb4hz0gh+1rjcxU= +golang.org/x/net v0.0.0-20210220033124-5f55cee0dc0d/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20181203162652-d668ce993890/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -223,8 +225,8 @@ golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201207232520-09787c993a3a h1:DcqTD9SDLc+1P/r1EmRBwnVsrOwW+kk2vWf9n+1sGhs= -golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181029174526-d69651ed3497/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -242,8 +244,8 @@ golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210218155724-8ebf48af031b h1:lAZ0/chPUDWwjqosYR0X4M490zQhMsiJ4K3DbA7o+3g= -golang.org/x/sys v0.0.0-20210218155724-8ebf48af031b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43 h1:SgQ6LNaYJU0JIuEHv9+s6EbhSCwYeAf5Yvj6lpYlqAE= +golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -262,7 +264,9 @@ golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3 golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191216052735-49a3e744a425/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= diff --git a/mocks.go b/mocks.go index 85cd9a21116..7a903b3ac32 100644 --- a/mocks.go +++ b/mocks.go @@ -1,9 +1,9 @@ package core -//go:generate go get -v github.com/golang/mock/mockgen -//go:generate go run github.com/golang/mock/mockgen -package mocks -destination testing/mocks/io.go -mock_names Reader=Reader,Writer=Writer io Reader,Writer -//go:generate go run github.com/golang/mock/mockgen -package mocks -destination testing/mocks/log.go -mock_names Handler=LogHandler github.com/v2fly/v2ray-core/v4/common/log Handler -//go:generate go run github.com/golang/mock/mockgen -package mocks -destination testing/mocks/mux.go -mock_names ClientWorkerFactory=MuxClientWorkerFactory github.com/v2fly/v2ray-core/v4/common/mux ClientWorkerFactory -//go:generate go run github.com/golang/mock/mockgen -package mocks -destination testing/mocks/dns.go -mock_names Client=DNSClient github.com/v2fly/v2ray-core/v4/features/dns Client -//go:generate go run github.com/golang/mock/mockgen -package mocks -destination testing/mocks/outbound.go -mock_names Manager=OutboundManager,HandlerSelector=OutboundHandlerSelector github.com/v2fly/v2ray-core/v4/features/outbound Manager,HandlerSelector -//go:generate go run github.com/golang/mock/mockgen -package mocks -destination testing/mocks/proxy.go -mock_names Inbound=ProxyInbound,Outbound=ProxyOutbound github.com/v2fly/v2ray-core/v4/proxy Inbound,Outbound +//go:generate env GOBIN=$PWD go install -v github.com/golang/mock/mockgen@latest +//go:generate ./mockgen -package mocks -destination testing/mocks/io.go -mock_names Reader=Reader,Writer=Writer io Reader,Writer +//go:generate ./mockgen -package mocks -destination testing/mocks/log.go -mock_names Handler=LogHandler github.com/v2fly/v2ray-core/v4/common/log Handler +//go:generate ./mockgen -package mocks -destination testing/mocks/mux.go -mock_names ClientWorkerFactory=MuxClientWorkerFactory github.com/v2fly/v2ray-core/v4/common/mux ClientWorkerFactory +//go:generate ./mockgen -package mocks -destination testing/mocks/dns.go -mock_names Client=DNSClient github.com/v2fly/v2ray-core/v4/features/dns Client +//go:generate ./mockgen -package mocks -destination testing/mocks/outbound.go -mock_names Manager=OutboundManager,HandlerSelector=OutboundHandlerSelector github.com/v2fly/v2ray-core/v4/features/outbound Manager,HandlerSelector +//go:generate ./mockgen -package mocks -destination testing/mocks/proxy.go -mock_names Inbound=ProxyInbound,Outbound=ProxyOutbound github.com/v2fly/v2ray-core/v4/proxy Inbound,Outbound diff --git a/proto.go b/proto.go index 3606367d7e5..9b39bed83ff 100644 --- a/proto.go +++ b/proto.go @@ -2,9 +2,9 @@ package core import "path/filepath" -//go:generate go get -v google.golang.org/protobuf/cmd/protoc-gen-go -//go:generate go get -v google.golang.org/grpc/cmd/protoc-gen-go-grpc -//go:generate go get -v github.com/gogo/protobuf/protoc-gen-gofast +//go:generate go install -v google.golang.org/protobuf/cmd/protoc-gen-go@latest +//go:generate go install -v google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest +//go:generate go install -v github.com/gogo/protobuf/protoc-gen-gofast@latest //go:generate go run ./infra/vprotogen/ // ProtoFilesUsingProtocGenGoFast is the map of Proto files diff --git a/testing/mocks/dns.go b/testing/mocks/dns.go index d488c1b656a..0e05f11254a 100644 --- a/testing/mocks/dns.go +++ b/testing/mocks/dns.go @@ -5,35 +5,36 @@ package mocks import ( - gomock "github.com/golang/mock/gomock" net "net" reflect "reflect" + + gomock "github.com/golang/mock/gomock" ) -// DNSClient is a mock of Client interface +// DNSClient is a mock of Client interface. type DNSClient struct { ctrl *gomock.Controller recorder *DNSClientMockRecorder } -// DNSClientMockRecorder is the mock recorder for DNSClient +// DNSClientMockRecorder is the mock recorder for DNSClient. type DNSClientMockRecorder struct { mock *DNSClient } -// NewDNSClient creates a new mock instance +// NewDNSClient creates a new mock instance. func NewDNSClient(ctrl *gomock.Controller) *DNSClient { mock := &DNSClient{ctrl: ctrl} mock.recorder = &DNSClientMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *DNSClient) EXPECT() *DNSClientMockRecorder { return m.recorder } -// Close mocks base method +// Close mocks base method. func (m *DNSClient) Close() error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Close") @@ -41,13 +42,13 @@ func (m *DNSClient) Close() error { return ret0 } -// Close indicates an expected call of Close +// Close indicates an expected call of Close. func (mr *DNSClientMockRecorder) Close() *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Close", reflect.TypeOf((*DNSClient)(nil).Close)) } -// LookupIP mocks base method +// LookupIP mocks base method. func (m *DNSClient) LookupIP(arg0 string) ([]net.IP, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "LookupIP", arg0) @@ -56,13 +57,13 @@ func (m *DNSClient) LookupIP(arg0 string) ([]net.IP, error) { return ret0, ret1 } -// LookupIP indicates an expected call of LookupIP +// LookupIP indicates an expected call of LookupIP. func (mr *DNSClientMockRecorder) LookupIP(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LookupIP", reflect.TypeOf((*DNSClient)(nil).LookupIP), arg0) } -// Start mocks base method +// Start mocks base method. func (m *DNSClient) Start() error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Start") @@ -70,13 +71,13 @@ func (m *DNSClient) Start() error { return ret0 } -// Start indicates an expected call of Start +// Start indicates an expected call of Start. func (mr *DNSClientMockRecorder) Start() *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Start", reflect.TypeOf((*DNSClient)(nil).Start)) } -// Type mocks base method +// Type mocks base method. func (m *DNSClient) Type() interface{} { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Type") @@ -84,7 +85,7 @@ func (m *DNSClient) Type() interface{} { return ret0 } -// Type indicates an expected call of Type +// Type indicates an expected call of Type. func (mr *DNSClientMockRecorder) Type() *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Type", reflect.TypeOf((*DNSClient)(nil).Type)) diff --git a/testing/mocks/io.go b/testing/mocks/io.go index d1f92cea24d..a24e4f7c388 100644 --- a/testing/mocks/io.go +++ b/testing/mocks/io.go @@ -5,34 +5,35 @@ package mocks import ( - gomock "github.com/golang/mock/gomock" reflect "reflect" + + gomock "github.com/golang/mock/gomock" ) -// Reader is a mock of Reader interface +// Reader is a mock of Reader interface. type Reader struct { ctrl *gomock.Controller recorder *ReaderMockRecorder } -// ReaderMockRecorder is the mock recorder for Reader +// ReaderMockRecorder is the mock recorder for Reader. type ReaderMockRecorder struct { mock *Reader } -// NewReader creates a new mock instance +// NewReader creates a new mock instance. func NewReader(ctrl *gomock.Controller) *Reader { mock := &Reader{ctrl: ctrl} mock.recorder = &ReaderMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *Reader) EXPECT() *ReaderMockRecorder { return m.recorder } -// Read mocks base method +// Read mocks base method. func (m *Reader) Read(arg0 []byte) (int, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Read", arg0) @@ -41,36 +42,36 @@ func (m *Reader) Read(arg0 []byte) (int, error) { return ret0, ret1 } -// Read indicates an expected call of Read +// Read indicates an expected call of Read. func (mr *ReaderMockRecorder) Read(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Read", reflect.TypeOf((*Reader)(nil).Read), arg0) } -// Writer is a mock of Writer interface +// Writer is a mock of Writer interface. type Writer struct { ctrl *gomock.Controller recorder *WriterMockRecorder } -// WriterMockRecorder is the mock recorder for Writer +// WriterMockRecorder is the mock recorder for Writer. type WriterMockRecorder struct { mock *Writer } -// NewWriter creates a new mock instance +// NewWriter creates a new mock instance. func NewWriter(ctrl *gomock.Controller) *Writer { mock := &Writer{ctrl: ctrl} mock.recorder = &WriterMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *Writer) EXPECT() *WriterMockRecorder { return m.recorder } -// Write mocks base method +// Write mocks base method. func (m *Writer) Write(arg0 []byte) (int, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Write", arg0) @@ -79,7 +80,7 @@ func (m *Writer) Write(arg0 []byte) (int, error) { return ret0, ret1 } -// Write indicates an expected call of Write +// Write indicates an expected call of Write. func (mr *WriterMockRecorder) Write(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Write", reflect.TypeOf((*Writer)(nil).Write), arg0) diff --git a/testing/mocks/log.go b/testing/mocks/log.go index 3f297eb4ded..436d97e7b1e 100644 --- a/testing/mocks/log.go +++ b/testing/mocks/log.go @@ -5,41 +5,42 @@ package mocks import ( + reflect "reflect" + gomock "github.com/golang/mock/gomock" log "github.com/v2fly/v2ray-core/v4/common/log" - reflect "reflect" ) -// LogHandler is a mock of Handler interface +// LogHandler is a mock of Handler interface. type LogHandler struct { ctrl *gomock.Controller recorder *LogHandlerMockRecorder } -// LogHandlerMockRecorder is the mock recorder for LogHandler +// LogHandlerMockRecorder is the mock recorder for LogHandler. type LogHandlerMockRecorder struct { mock *LogHandler } -// NewLogHandler creates a new mock instance +// NewLogHandler creates a new mock instance. func NewLogHandler(ctrl *gomock.Controller) *LogHandler { mock := &LogHandler{ctrl: ctrl} mock.recorder = &LogHandlerMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *LogHandler) EXPECT() *LogHandlerMockRecorder { return m.recorder } -// Handle mocks base method +// Handle mocks base method. func (m *LogHandler) Handle(arg0 log.Message) { m.ctrl.T.Helper() m.ctrl.Call(m, "Handle", arg0) } -// Handle indicates an expected call of Handle +// Handle indicates an expected call of Handle. func (mr *LogHandlerMockRecorder) Handle(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Handle", reflect.TypeOf((*LogHandler)(nil).Handle), arg0) diff --git a/testing/mocks/mux.go b/testing/mocks/mux.go index 8d7e0032e09..e22d78798e6 100644 --- a/testing/mocks/mux.go +++ b/testing/mocks/mux.go @@ -5,35 +5,36 @@ package mocks import ( + reflect "reflect" + gomock "github.com/golang/mock/gomock" mux "github.com/v2fly/v2ray-core/v4/common/mux" - reflect "reflect" ) -// MuxClientWorkerFactory is a mock of ClientWorkerFactory interface +// MuxClientWorkerFactory is a mock of ClientWorkerFactory interface. type MuxClientWorkerFactory struct { ctrl *gomock.Controller recorder *MuxClientWorkerFactoryMockRecorder } -// MuxClientWorkerFactoryMockRecorder is the mock recorder for MuxClientWorkerFactory +// MuxClientWorkerFactoryMockRecorder is the mock recorder for MuxClientWorkerFactory. type MuxClientWorkerFactoryMockRecorder struct { mock *MuxClientWorkerFactory } -// NewMuxClientWorkerFactory creates a new mock instance +// NewMuxClientWorkerFactory creates a new mock instance. func NewMuxClientWorkerFactory(ctrl *gomock.Controller) *MuxClientWorkerFactory { mock := &MuxClientWorkerFactory{ctrl: ctrl} mock.recorder = &MuxClientWorkerFactoryMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *MuxClientWorkerFactory) EXPECT() *MuxClientWorkerFactoryMockRecorder { return m.recorder } -// Create mocks base method +// Create mocks base method. func (m *MuxClientWorkerFactory) Create() (*mux.ClientWorker, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Create") @@ -42,7 +43,7 @@ func (m *MuxClientWorkerFactory) Create() (*mux.ClientWorker, error) { return ret0, ret1 } -// Create indicates an expected call of Create +// Create indicates an expected call of Create. func (mr *MuxClientWorkerFactoryMockRecorder) Create() *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Create", reflect.TypeOf((*MuxClientWorkerFactory)(nil).Create)) diff --git a/testing/mocks/outbound.go b/testing/mocks/outbound.go index d892bfa0a91..ec576b1c878 100644 --- a/testing/mocks/outbound.go +++ b/testing/mocks/outbound.go @@ -6,35 +6,36 @@ package mocks import ( context "context" + reflect "reflect" + gomock "github.com/golang/mock/gomock" outbound "github.com/v2fly/v2ray-core/v4/features/outbound" - reflect "reflect" ) -// OutboundManager is a mock of Manager interface +// OutboundManager is a mock of Manager interface. type OutboundManager struct { ctrl *gomock.Controller recorder *OutboundManagerMockRecorder } -// OutboundManagerMockRecorder is the mock recorder for OutboundManager +// OutboundManagerMockRecorder is the mock recorder for OutboundManager. type OutboundManagerMockRecorder struct { mock *OutboundManager } -// NewOutboundManager creates a new mock instance +// NewOutboundManager creates a new mock instance. func NewOutboundManager(ctrl *gomock.Controller) *OutboundManager { mock := &OutboundManager{ctrl: ctrl} mock.recorder = &OutboundManagerMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *OutboundManager) EXPECT() *OutboundManagerMockRecorder { return m.recorder } -// AddHandler mocks base method +// AddHandler mocks base method. func (m *OutboundManager) AddHandler(arg0 context.Context, arg1 outbound.Handler) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "AddHandler", arg0, arg1) @@ -42,13 +43,13 @@ func (m *OutboundManager) AddHandler(arg0 context.Context, arg1 outbound.Handler return ret0 } -// AddHandler indicates an expected call of AddHandler +// AddHandler indicates an expected call of AddHandler. func (mr *OutboundManagerMockRecorder) AddHandler(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddHandler", reflect.TypeOf((*OutboundManager)(nil).AddHandler), arg0, arg1) } -// Close mocks base method +// Close mocks base method. func (m *OutboundManager) Close() error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Close") @@ -56,13 +57,13 @@ func (m *OutboundManager) Close() error { return ret0 } -// Close indicates an expected call of Close +// Close indicates an expected call of Close. func (mr *OutboundManagerMockRecorder) Close() *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Close", reflect.TypeOf((*OutboundManager)(nil).Close)) } -// GetDefaultHandler mocks base method +// GetDefaultHandler mocks base method. func (m *OutboundManager) GetDefaultHandler() outbound.Handler { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetDefaultHandler") @@ -70,13 +71,13 @@ func (m *OutboundManager) GetDefaultHandler() outbound.Handler { return ret0 } -// GetDefaultHandler indicates an expected call of GetDefaultHandler +// GetDefaultHandler indicates an expected call of GetDefaultHandler. func (mr *OutboundManagerMockRecorder) GetDefaultHandler() *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetDefaultHandler", reflect.TypeOf((*OutboundManager)(nil).GetDefaultHandler)) } -// GetHandler mocks base method +// GetHandler mocks base method. func (m *OutboundManager) GetHandler(arg0 string) outbound.Handler { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetHandler", arg0) @@ -84,13 +85,13 @@ func (m *OutboundManager) GetHandler(arg0 string) outbound.Handler { return ret0 } -// GetHandler indicates an expected call of GetHandler +// GetHandler indicates an expected call of GetHandler. func (mr *OutboundManagerMockRecorder) GetHandler(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetHandler", reflect.TypeOf((*OutboundManager)(nil).GetHandler), arg0) } -// RemoveHandler mocks base method +// RemoveHandler mocks base method. func (m *OutboundManager) RemoveHandler(arg0 context.Context, arg1 string) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "RemoveHandler", arg0, arg1) @@ -98,13 +99,13 @@ func (m *OutboundManager) RemoveHandler(arg0 context.Context, arg1 string) error return ret0 } -// RemoveHandler indicates an expected call of RemoveHandler +// RemoveHandler indicates an expected call of RemoveHandler. func (mr *OutboundManagerMockRecorder) RemoveHandler(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RemoveHandler", reflect.TypeOf((*OutboundManager)(nil).RemoveHandler), arg0, arg1) } -// Start mocks base method +// Start mocks base method. func (m *OutboundManager) Start() error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Start") @@ -112,13 +113,13 @@ func (m *OutboundManager) Start() error { return ret0 } -// Start indicates an expected call of Start +// Start indicates an expected call of Start. func (mr *OutboundManagerMockRecorder) Start() *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Start", reflect.TypeOf((*OutboundManager)(nil).Start)) } -// Type mocks base method +// Type mocks base method. func (m *OutboundManager) Type() interface{} { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Type") @@ -126,36 +127,36 @@ func (m *OutboundManager) Type() interface{} { return ret0 } -// Type indicates an expected call of Type +// Type indicates an expected call of Type. func (mr *OutboundManagerMockRecorder) Type() *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Type", reflect.TypeOf((*OutboundManager)(nil).Type)) } -// OutboundHandlerSelector is a mock of HandlerSelector interface +// OutboundHandlerSelector is a mock of HandlerSelector interface. type OutboundHandlerSelector struct { ctrl *gomock.Controller recorder *OutboundHandlerSelectorMockRecorder } -// OutboundHandlerSelectorMockRecorder is the mock recorder for OutboundHandlerSelector +// OutboundHandlerSelectorMockRecorder is the mock recorder for OutboundHandlerSelector. type OutboundHandlerSelectorMockRecorder struct { mock *OutboundHandlerSelector } -// NewOutboundHandlerSelector creates a new mock instance +// NewOutboundHandlerSelector creates a new mock instance. func NewOutboundHandlerSelector(ctrl *gomock.Controller) *OutboundHandlerSelector { mock := &OutboundHandlerSelector{ctrl: ctrl} mock.recorder = &OutboundHandlerSelectorMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *OutboundHandlerSelector) EXPECT() *OutboundHandlerSelectorMockRecorder { return m.recorder } -// Select mocks base method +// Select mocks base method. func (m *OutboundHandlerSelector) Select(arg0 []string) []string { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Select", arg0) @@ -163,7 +164,7 @@ func (m *OutboundHandlerSelector) Select(arg0 []string) []string { return ret0 } -// Select indicates an expected call of Select +// Select indicates an expected call of Select. func (mr *OutboundHandlerSelectorMockRecorder) Select(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Select", reflect.TypeOf((*OutboundHandlerSelector)(nil).Select), arg0) diff --git a/testing/mocks/proxy.go b/testing/mocks/proxy.go index 225da359972..0b625fc6427 100644 --- a/testing/mocks/proxy.go +++ b/testing/mocks/proxy.go @@ -6,38 +6,39 @@ package mocks import ( context "context" + reflect "reflect" + gomock "github.com/golang/mock/gomock" net "github.com/v2fly/v2ray-core/v4/common/net" routing "github.com/v2fly/v2ray-core/v4/features/routing" transport "github.com/v2fly/v2ray-core/v4/transport" internet "github.com/v2fly/v2ray-core/v4/transport/internet" - reflect "reflect" ) -// ProxyInbound is a mock of Inbound interface +// ProxyInbound is a mock of Inbound interface. type ProxyInbound struct { ctrl *gomock.Controller recorder *ProxyInboundMockRecorder } -// ProxyInboundMockRecorder is the mock recorder for ProxyInbound +// ProxyInboundMockRecorder is the mock recorder for ProxyInbound. type ProxyInboundMockRecorder struct { mock *ProxyInbound } -// NewProxyInbound creates a new mock instance +// NewProxyInbound creates a new mock instance. func NewProxyInbound(ctrl *gomock.Controller) *ProxyInbound { mock := &ProxyInbound{ctrl: ctrl} mock.recorder = &ProxyInboundMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *ProxyInbound) EXPECT() *ProxyInboundMockRecorder { return m.recorder } -// Network mocks base method +// Network mocks base method. func (m *ProxyInbound) Network() []net.Network { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Network") @@ -45,13 +46,13 @@ func (m *ProxyInbound) Network() []net.Network { return ret0 } -// Network indicates an expected call of Network +// Network indicates an expected call of Network. func (mr *ProxyInboundMockRecorder) Network() *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Network", reflect.TypeOf((*ProxyInbound)(nil).Network)) } -// Process mocks base method +// Process mocks base method. func (m *ProxyInbound) Process(arg0 context.Context, arg1 net.Network, arg2 internet.Connection, arg3 routing.Dispatcher) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Process", arg0, arg1, arg2, arg3) @@ -59,36 +60,36 @@ func (m *ProxyInbound) Process(arg0 context.Context, arg1 net.Network, arg2 inte return ret0 } -// Process indicates an expected call of Process +// Process indicates an expected call of Process. func (mr *ProxyInboundMockRecorder) Process(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Process", reflect.TypeOf((*ProxyInbound)(nil).Process), arg0, arg1, arg2, arg3) } -// ProxyOutbound is a mock of Outbound interface +// ProxyOutbound is a mock of Outbound interface. type ProxyOutbound struct { ctrl *gomock.Controller recorder *ProxyOutboundMockRecorder } -// ProxyOutboundMockRecorder is the mock recorder for ProxyOutbound +// ProxyOutboundMockRecorder is the mock recorder for ProxyOutbound. type ProxyOutboundMockRecorder struct { mock *ProxyOutbound } -// NewProxyOutbound creates a new mock instance +// NewProxyOutbound creates a new mock instance. func NewProxyOutbound(ctrl *gomock.Controller) *ProxyOutbound { mock := &ProxyOutbound{ctrl: ctrl} mock.recorder = &ProxyOutboundMockRecorder{mock} return mock } -// EXPECT returns an object that allows the caller to indicate expected use +// EXPECT returns an object that allows the caller to indicate expected use. func (m *ProxyOutbound) EXPECT() *ProxyOutboundMockRecorder { return m.recorder } -// Process mocks base method +// Process mocks base method. func (m *ProxyOutbound) Process(arg0 context.Context, arg1 *transport.Link, arg2 internet.Dialer) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Process", arg0, arg1, arg2) @@ -96,7 +97,7 @@ func (m *ProxyOutbound) Process(arg0 context.Context, arg1 *transport.Link, arg2 return ret0 } -// Process indicates an expected call of Process +// Process indicates an expected call of Process. func (mr *ProxyOutboundMockRecorder) Process(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Process", reflect.TypeOf((*ProxyOutbound)(nil).Process), arg0, arg1, arg2)