Skip to content

Commit

Permalink
Fix: Code generator & API (XTLS#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
JimhHan committed Dec 10, 2020
1 parent f1eb5e3 commit 9c0f0a0
Show file tree
Hide file tree
Showing 12 changed files with 71 additions and 106 deletions.
8 changes: 6 additions & 2 deletions app/log/command/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,13 @@ type service struct {
}

func (s *service) Register(server *grpc.Server) {
RegisterLoggerServiceServer(server, &LoggerServer{
ls := &LoggerServer{
V: s.v,
})
}
RegisterLoggerServiceServer(server, ls)
vCoreDesc := _LoggerService_serviceDesc
vCoreDesc.ServiceName = "v2ray.core.app.log.command.LoggerService"
server.RegisterService(&vCoreDesc, ls)
}

func init() {
Expand Down
14 changes: 0 additions & 14 deletions app/log/command/config_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions app/proxyman/command/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ func (s *service) Register(server *grpc.Server) {
hs.ohm = om
}))
RegisterHandlerServiceServer(server, hs)
vCoreDesc := _HandlerService_serviceDesc
vCoreDesc.ServiceName = "v2ray.core.app.proxyman.command.HandlerService"
server.RegisterService(&vCoreDesc, hs)
}

func init() {
Expand Down
34 changes: 0 additions & 34 deletions app/proxyman/command/command_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion app/router/command/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,11 @@ type service struct {

func (s *service) Register(server *grpc.Server) {
common.Must(s.v.RequireFeatures(func(router routing.Router, stats stats.Manager) {
RegisterRoutingServiceServer(server, NewRoutingServer(router, nil))
rs := NewRoutingServer(router, nil)
RegisterRoutingServiceServer(server, rs)
vCoreDesc := _RoutingService_serviceDesc
vCoreDesc.ServiceName = "v2ray.core.app.router.command.RoutingService"
server.RegisterService(&vCoreDesc, rs)
}))
}

Expand Down
20 changes: 0 additions & 20 deletions app/router/command/command_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion app/stats/command/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,11 @@ type service struct {
}

func (s *service) Register(server *grpc.Server) {
RegisterStatsServiceServer(server, NewStatsServer(s.statsManager))
ss := NewStatsServer(s.statsManager)
RegisterStatsServiceServer(server, ss)
vCoreDesc := _StatsService_serviceDesc
vCoreDesc.ServiceName = "v2ray.core.app.stats.command.StatsService"
server.RegisterService(&vCoreDesc, ss)
}

func init() {
Expand Down
22 changes: 0 additions & 22 deletions app/stats/command/command_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions core/mocks.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package core

//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/xtls/xray-core/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/xtls/xray-core/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/xtls/xray-core/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/xtls/xray-core/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/xtls/xray-core/proxy Inbound,Outbound
//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/xtls/xray-core/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/xtls/xray-core/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/xtls/xray-core/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/xtls/xray-core/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/xtls/xray-core/proxy Inbound,Outbound
3 changes: 2 additions & 1 deletion core/proto.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import "path/filepath"

//go:generate go install -v google.golang.org/protobuf/cmd/protoc-gen-go
//go:generate go install -v google.golang.org/grpc/cmd/protoc-gen-go-grpc
//go:generate go get -v -u github.com/gogo/protobuf/protoc-gen-gofast
//go:generate go install -v github.com/gogo/protobuf/protoc-gen-gofast
//go:generate go run ../infra/vprotogen/main.go
//go:generate go run ../infra/vprotogen/main.go -pwd ./..

// ProtoFilesUsingProtocGenGoFast is the map of Proto files
// that use `protoc-gen-gofast` to generate pb.go files
Expand Down
Loading

0 comments on commit 9c0f0a0

Please sign in to comment.