forked from p4gefau1t/trojan-go
-
Notifications
You must be signed in to change notification settings - Fork 1
/
api_grpc.pb.go
356 lines (305 loc) · 12 KB
/
api_grpc.pb.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
package service
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
// TrojanClientServiceClient is the client API for TrojanClientService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type TrojanClientServiceClient interface {
GetTraffic(ctx context.Context, in *GetTrafficRequest, opts ...grpc.CallOption) (*GetTrafficResponse, error)
}
type trojanClientServiceClient struct {
cc grpc.ClientConnInterface
}
func NewTrojanClientServiceClient(cc grpc.ClientConnInterface) TrojanClientServiceClient {
return &trojanClientServiceClient{cc}
}
func (c *trojanClientServiceClient) GetTraffic(ctx context.Context, in *GetTrafficRequest, opts ...grpc.CallOption) (*GetTrafficResponse, error) {
out := new(GetTrafficResponse)
err := c.cc.Invoke(ctx, "/trojan.api.TrojanClientService/GetTraffic", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// TrojanClientServiceServer is the server API for TrojanClientService service.
// All implementations must embed UnimplementedTrojanClientServiceServer
// for forward compatibility
type TrojanClientServiceServer interface {
GetTraffic(context.Context, *GetTrafficRequest) (*GetTrafficResponse, error)
mustEmbedUnimplementedTrojanClientServiceServer()
}
// UnimplementedTrojanClientServiceServer must be embedded to have forward compatible implementations.
type UnimplementedTrojanClientServiceServer struct {
}
func (UnimplementedTrojanClientServiceServer) GetTraffic(context.Context, *GetTrafficRequest) (*GetTrafficResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetTraffic not implemented")
}
func (UnimplementedTrojanClientServiceServer) mustEmbedUnimplementedTrojanClientServiceServer() {}
// UnsafeTrojanClientServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to TrojanClientServiceServer will
// result in compilation errors.
type UnsafeTrojanClientServiceServer interface {
mustEmbedUnimplementedTrojanClientServiceServer()
}
func RegisterTrojanClientServiceServer(s grpc.ServiceRegistrar, srv TrojanClientServiceServer) {
s.RegisterService(&TrojanClientService_ServiceDesc, srv)
}
func _TrojanClientService_GetTraffic_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetTrafficRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(TrojanClientServiceServer).GetTraffic(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/trojan.api.TrojanClientService/GetTraffic",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(TrojanClientServiceServer).GetTraffic(ctx, req.(*GetTrafficRequest))
}
return interceptor(ctx, in, info, handler)
}
// TrojanClientService_ServiceDesc is the grpc.ServiceDesc for TrojanClientService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var TrojanClientService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "trojan.api.TrojanClientService",
HandlerType: (*TrojanClientServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "GetTraffic",
Handler: _TrojanClientService_GetTraffic_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "api.proto",
}
// TrojanServerServiceClient is the client API for TrojanServerService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type TrojanServerServiceClient interface {
// list all users
ListUsers(ctx context.Context, in *ListUsersRequest, opts ...grpc.CallOption) (TrojanServerService_ListUsersClient, error)
// obtain specified user's info
GetUsers(ctx context.Context, opts ...grpc.CallOption) (TrojanServerService_GetUsersClient, error)
// setup existing users' config
SetUsers(ctx context.Context, opts ...grpc.CallOption) (TrojanServerService_SetUsersClient, error)
}
type trojanServerServiceClient struct {
cc grpc.ClientConnInterface
}
func NewTrojanServerServiceClient(cc grpc.ClientConnInterface) TrojanServerServiceClient {
return &trojanServerServiceClient{cc}
}
func (c *trojanServerServiceClient) ListUsers(ctx context.Context, in *ListUsersRequest, opts ...grpc.CallOption) (TrojanServerService_ListUsersClient, error) {
stream, err := c.cc.NewStream(ctx, &TrojanServerService_ServiceDesc.Streams[0], "/trojan.api.TrojanServerService/ListUsers", opts...)
if err != nil {
return nil, err
}
x := &trojanServerServiceListUsersClient{stream}
if err := x.ClientStream.SendMsg(in); err != nil {
return nil, err
}
if err := x.ClientStream.CloseSend(); err != nil {
return nil, err
}
return x, nil
}
type TrojanServerService_ListUsersClient interface {
Recv() (*ListUsersResponse, error)
grpc.ClientStream
}
type trojanServerServiceListUsersClient struct {
grpc.ClientStream
}
func (x *trojanServerServiceListUsersClient) Recv() (*ListUsersResponse, error) {
m := new(ListUsersResponse)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
func (c *trojanServerServiceClient) GetUsers(ctx context.Context, opts ...grpc.CallOption) (TrojanServerService_GetUsersClient, error) {
stream, err := c.cc.NewStream(ctx, &TrojanServerService_ServiceDesc.Streams[1], "/trojan.api.TrojanServerService/GetUsers", opts...)
if err != nil {
return nil, err
}
x := &trojanServerServiceGetUsersClient{stream}
return x, nil
}
type TrojanServerService_GetUsersClient interface {
Send(*GetUsersRequest) error
Recv() (*GetUsersResponse, error)
grpc.ClientStream
}
type trojanServerServiceGetUsersClient struct {
grpc.ClientStream
}
func (x *trojanServerServiceGetUsersClient) Send(m *GetUsersRequest) error {
return x.ClientStream.SendMsg(m)
}
func (x *trojanServerServiceGetUsersClient) Recv() (*GetUsersResponse, error) {
m := new(GetUsersResponse)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
func (c *trojanServerServiceClient) SetUsers(ctx context.Context, opts ...grpc.CallOption) (TrojanServerService_SetUsersClient, error) {
stream, err := c.cc.NewStream(ctx, &TrojanServerService_ServiceDesc.Streams[2], "/trojan.api.TrojanServerService/SetUsers", opts...)
if err != nil {
return nil, err
}
x := &trojanServerServiceSetUsersClient{stream}
return x, nil
}
type TrojanServerService_SetUsersClient interface {
Send(*SetUsersRequest) error
Recv() (*SetUsersResponse, error)
grpc.ClientStream
}
type trojanServerServiceSetUsersClient struct {
grpc.ClientStream
}
func (x *trojanServerServiceSetUsersClient) Send(m *SetUsersRequest) error {
return x.ClientStream.SendMsg(m)
}
func (x *trojanServerServiceSetUsersClient) Recv() (*SetUsersResponse, error) {
m := new(SetUsersResponse)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
// TrojanServerServiceServer is the server API for TrojanServerService service.
// All implementations must embed UnimplementedTrojanServerServiceServer
// for forward compatibility
type TrojanServerServiceServer interface {
// list all users
ListUsers(*ListUsersRequest, TrojanServerService_ListUsersServer) error
// obtain specified user's info
GetUsers(TrojanServerService_GetUsersServer) error
// setup existing users' config
SetUsers(TrojanServerService_SetUsersServer) error
mustEmbedUnimplementedTrojanServerServiceServer()
}
// UnimplementedTrojanServerServiceServer must be embedded to have forward compatible implementations.
type UnimplementedTrojanServerServiceServer struct {
}
func (UnimplementedTrojanServerServiceServer) ListUsers(*ListUsersRequest, TrojanServerService_ListUsersServer) error {
return status.Errorf(codes.Unimplemented, "method ListUsers not implemented")
}
func (UnimplementedTrojanServerServiceServer) GetUsers(TrojanServerService_GetUsersServer) error {
return status.Errorf(codes.Unimplemented, "method GetUsers not implemented")
}
func (UnimplementedTrojanServerServiceServer) SetUsers(TrojanServerService_SetUsersServer) error {
return status.Errorf(codes.Unimplemented, "method SetUsers not implemented")
}
func (UnimplementedTrojanServerServiceServer) mustEmbedUnimplementedTrojanServerServiceServer() {}
// UnsafeTrojanServerServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to TrojanServerServiceServer will
// result in compilation errors.
type UnsafeTrojanServerServiceServer interface {
mustEmbedUnimplementedTrojanServerServiceServer()
}
func RegisterTrojanServerServiceServer(s grpc.ServiceRegistrar, srv TrojanServerServiceServer) {
s.RegisterService(&TrojanServerService_ServiceDesc, srv)
}
func _TrojanServerService_ListUsers_Handler(srv interface{}, stream grpc.ServerStream) error {
m := new(ListUsersRequest)
if err := stream.RecvMsg(m); err != nil {
return err
}
return srv.(TrojanServerServiceServer).ListUsers(m, &trojanServerServiceListUsersServer{stream})
}
type TrojanServerService_ListUsersServer interface {
Send(*ListUsersResponse) error
grpc.ServerStream
}
type trojanServerServiceListUsersServer struct {
grpc.ServerStream
}
func (x *trojanServerServiceListUsersServer) Send(m *ListUsersResponse) error {
return x.ServerStream.SendMsg(m)
}
func _TrojanServerService_GetUsers_Handler(srv interface{}, stream grpc.ServerStream) error {
return srv.(TrojanServerServiceServer).GetUsers(&trojanServerServiceGetUsersServer{stream})
}
type TrojanServerService_GetUsersServer interface {
Send(*GetUsersResponse) error
Recv() (*GetUsersRequest, error)
grpc.ServerStream
}
type trojanServerServiceGetUsersServer struct {
grpc.ServerStream
}
func (x *trojanServerServiceGetUsersServer) Send(m *GetUsersResponse) error {
return x.ServerStream.SendMsg(m)
}
func (x *trojanServerServiceGetUsersServer) Recv() (*GetUsersRequest, error) {
m := new(GetUsersRequest)
if err := x.ServerStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
func _TrojanServerService_SetUsers_Handler(srv interface{}, stream grpc.ServerStream) error {
return srv.(TrojanServerServiceServer).SetUsers(&trojanServerServiceSetUsersServer{stream})
}
type TrojanServerService_SetUsersServer interface {
Send(*SetUsersResponse) error
Recv() (*SetUsersRequest, error)
grpc.ServerStream
}
type trojanServerServiceSetUsersServer struct {
grpc.ServerStream
}
func (x *trojanServerServiceSetUsersServer) Send(m *SetUsersResponse) error {
return x.ServerStream.SendMsg(m)
}
func (x *trojanServerServiceSetUsersServer) Recv() (*SetUsersRequest, error) {
m := new(SetUsersRequest)
if err := x.ServerStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
// TrojanServerService_ServiceDesc is the grpc.ServiceDesc for TrojanServerService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var TrojanServerService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "trojan.api.TrojanServerService",
HandlerType: (*TrojanServerServiceServer)(nil),
Methods: []grpc.MethodDesc{},
Streams: []grpc.StreamDesc{
{
StreamName: "ListUsers",
Handler: _TrojanServerService_ListUsers_Handler,
ServerStreams: true,
},
{
StreamName: "GetUsers",
Handler: _TrojanServerService_GetUsers_Handler,
ServerStreams: true,
ClientStreams: true,
},
{
StreamName: "SetUsers",
Handler: _TrojanServerService_SetUsers_Handler,
ServerStreams: true,
ClientStreams: true,
},
},
Metadata: "api.proto",
}