From 6aba40ff65282913333e37f9adc15f623400d9c2 Mon Sep 17 00:00:00 2001 From: Kaien Date: Wed, 15 Apr 2026 23:40:05 +0300 Subject: [PATCH] feat: add Xray gRPC RPCs (GetXrayStatus, GetXrayPublicKey, AddXrayUser, RemoveXrayUser) --- proto/agent.pb.go | 466 ++++++++++++++++++++++++++++++++++++++++- proto/agent.proto | 40 ++++ proto/agent_grpc.pb.go | 154 ++++++++++++++ 3 files changed, 649 insertions(+), 11 deletions(-) diff --git a/proto/agent.pb.go b/proto/agent.pb.go index 6b08706..f7e84d8 100644 --- a/proto/agent.pb.go +++ b/proto/agent.pb.go @@ -701,6 +701,406 @@ func (x *PingHostsResponse) GetResults() []*PingResult { return nil } +type GetXrayStatusRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetXrayStatusRequest) Reset() { + *x = GetXrayStatusRequest{} + mi := &file_proto_agent_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetXrayStatusRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetXrayStatusRequest) ProtoMessage() {} + +func (x *GetXrayStatusRequest) ProtoReflect() protoreflect.Message { + mi := &file_proto_agent_proto_msgTypes[12] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetXrayStatusRequest.ProtoReflect.Descriptor instead. +func (*GetXrayStatusRequest) Descriptor() ([]byte, []int) { + return file_proto_agent_proto_rawDescGZIP(), []int{12} +} + +type GetXrayStatusResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Running bool `protobuf:"varint,1,opt,name=running,proto3" json:"running,omitempty"` + Port int32 `protobuf:"varint,2,opt,name=port,proto3" json:"port,omitempty"` + Error string `protobuf:"bytes,3,opt,name=error,proto3" json:"error,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetXrayStatusResponse) Reset() { + *x = GetXrayStatusResponse{} + mi := &file_proto_agent_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetXrayStatusResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetXrayStatusResponse) ProtoMessage() {} + +func (x *GetXrayStatusResponse) ProtoReflect() protoreflect.Message { + mi := &file_proto_agent_proto_msgTypes[13] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetXrayStatusResponse.ProtoReflect.Descriptor instead. +func (*GetXrayStatusResponse) Descriptor() ([]byte, []int) { + return file_proto_agent_proto_rawDescGZIP(), []int{13} +} + +func (x *GetXrayStatusResponse) GetRunning() bool { + if x != nil { + return x.Running + } + return false +} + +func (x *GetXrayStatusResponse) GetPort() int32 { + if x != nil { + return x.Port + } + return 0 +} + +func (x *GetXrayStatusResponse) GetError() string { + if x != nil { + return x.Error + } + return "" +} + +type GetXrayPublicKeyRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetXrayPublicKeyRequest) Reset() { + *x = GetXrayPublicKeyRequest{} + mi := &file_proto_agent_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetXrayPublicKeyRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetXrayPublicKeyRequest) ProtoMessage() {} + +func (x *GetXrayPublicKeyRequest) ProtoReflect() protoreflect.Message { + mi := &file_proto_agent_proto_msgTypes[14] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetXrayPublicKeyRequest.ProtoReflect.Descriptor instead. +func (*GetXrayPublicKeyRequest) Descriptor() ([]byte, []int) { + return file_proto_agent_proto_rawDescGZIP(), []int{14} +} + +type GetXrayPublicKeyResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + PublicKey string `protobuf:"bytes,1,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"` + ShortId string `protobuf:"bytes,2,opt,name=short_id,json=shortId,proto3" json:"short_id,omitempty"` + ServerName string `protobuf:"bytes,3,opt,name=server_name,json=serverName,proto3" json:"server_name,omitempty"` + Port int32 `protobuf:"varint,4,opt,name=port,proto3" json:"port,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetXrayPublicKeyResponse) Reset() { + *x = GetXrayPublicKeyResponse{} + mi := &file_proto_agent_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetXrayPublicKeyResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetXrayPublicKeyResponse) ProtoMessage() {} + +func (x *GetXrayPublicKeyResponse) ProtoReflect() protoreflect.Message { + mi := &file_proto_agent_proto_msgTypes[15] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetXrayPublicKeyResponse.ProtoReflect.Descriptor instead. +func (*GetXrayPublicKeyResponse) Descriptor() ([]byte, []int) { + return file_proto_agent_proto_rawDescGZIP(), []int{15} +} + +func (x *GetXrayPublicKeyResponse) GetPublicKey() string { + if x != nil { + return x.PublicKey + } + return "" +} + +func (x *GetXrayPublicKeyResponse) GetShortId() string { + if x != nil { + return x.ShortId + } + return "" +} + +func (x *GetXrayPublicKeyResponse) GetServerName() string { + if x != nil { + return x.ServerName + } + return "" +} + +func (x *GetXrayPublicKeyResponse) GetPort() int32 { + if x != nil { + return x.Port + } + return 0 +} + +type AddXrayUserRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Uuid string `protobuf:"bytes,1,opt,name=uuid,proto3" json:"uuid,omitempty"` + Email string `protobuf:"bytes,2,opt,name=email,proto3" json:"email,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AddXrayUserRequest) Reset() { + *x = AddXrayUserRequest{} + mi := &file_proto_agent_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AddXrayUserRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddXrayUserRequest) ProtoMessage() {} + +func (x *AddXrayUserRequest) ProtoReflect() protoreflect.Message { + mi := &file_proto_agent_proto_msgTypes[16] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AddXrayUserRequest.ProtoReflect.Descriptor instead. +func (*AddXrayUserRequest) Descriptor() ([]byte, []int) { + return file_proto_agent_proto_rawDescGZIP(), []int{16} +} + +func (x *AddXrayUserRequest) GetUuid() string { + if x != nil { + return x.Uuid + } + return "" +} + +func (x *AddXrayUserRequest) GetEmail() string { + if x != nil { + return x.Email + } + return "" +} + +type AddXrayUserResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + Error string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *AddXrayUserResponse) Reset() { + *x = AddXrayUserResponse{} + mi := &file_proto_agent_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *AddXrayUserResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AddXrayUserResponse) ProtoMessage() {} + +func (x *AddXrayUserResponse) ProtoReflect() protoreflect.Message { + mi := &file_proto_agent_proto_msgTypes[17] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AddXrayUserResponse.ProtoReflect.Descriptor instead. +func (*AddXrayUserResponse) Descriptor() ([]byte, []int) { + return file_proto_agent_proto_rawDescGZIP(), []int{17} +} + +func (x *AddXrayUserResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *AddXrayUserResponse) GetError() string { + if x != nil { + return x.Error + } + return "" +} + +type RemoveXrayUserRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Uuid string `protobuf:"bytes,1,opt,name=uuid,proto3" json:"uuid,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RemoveXrayUserRequest) Reset() { + *x = RemoveXrayUserRequest{} + mi := &file_proto_agent_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RemoveXrayUserRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RemoveXrayUserRequest) ProtoMessage() {} + +func (x *RemoveXrayUserRequest) ProtoReflect() protoreflect.Message { + mi := &file_proto_agent_proto_msgTypes[18] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RemoveXrayUserRequest.ProtoReflect.Descriptor instead. +func (*RemoveXrayUserRequest) Descriptor() ([]byte, []int) { + return file_proto_agent_proto_rawDescGZIP(), []int{18} +} + +func (x *RemoveXrayUserRequest) GetUuid() string { + if x != nil { + return x.Uuid + } + return "" +} + +type RemoveXrayUserResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + Error string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RemoveXrayUserResponse) Reset() { + *x = RemoveXrayUserResponse{} + mi := &file_proto_agent_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RemoveXrayUserResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RemoveXrayUserResponse) ProtoMessage() {} + +func (x *RemoveXrayUserResponse) ProtoReflect() protoreflect.Message { + mi := &file_proto_agent_proto_msgTypes[19] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RemoveXrayUserResponse.ProtoReflect.Descriptor instead. +func (*RemoveXrayUserResponse) Descriptor() ([]byte, []int) { + return file_proto_agent_proto_rawDescGZIP(), []int{19} +} + +func (x *RemoveXrayUserResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +func (x *RemoveXrayUserResponse) GetError() string { + if x != nil { + return x.Error + } + return "" +} + var File_proto_agent_proto protoreflect.FileDescriptor const file_proto_agent_proto_rawDesc = "" + @@ -758,13 +1158,41 @@ const file_proto_agent_proto_rawDesc = "" + "\x11PingHostsResponse\x12\x18\n" + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x14\n" + "\x05error\x18\x02 \x01(\tR\x05error\x12+\n" + - "\aresults\x18\x03 \x03(\v2\x11.agent.PingResultR\aresults2\x9b\x03\n" + + "\aresults\x18\x03 \x03(\v2\x11.agent.PingResultR\aresults\"\x16\n" + + "\x14GetXrayStatusRequest\"[\n" + + "\x15GetXrayStatusResponse\x12\x18\n" + + "\arunning\x18\x01 \x01(\bR\arunning\x12\x12\n" + + "\x04port\x18\x02 \x01(\x05R\x04port\x12\x14\n" + + "\x05error\x18\x03 \x01(\tR\x05error\"\x19\n" + + "\x17GetXrayPublicKeyRequest\"\x89\x01\n" + + "\x18GetXrayPublicKeyResponse\x12\x1d\n" + + "\n" + + "public_key\x18\x01 \x01(\tR\tpublicKey\x12\x19\n" + + "\bshort_id\x18\x02 \x01(\tR\ashortId\x12\x1f\n" + + "\vserver_name\x18\x03 \x01(\tR\n" + + "serverName\x12\x12\n" + + "\x04port\x18\x04 \x01(\x05R\x04port\">\n" + + "\x12AddXrayUserRequest\x12\x12\n" + + "\x04uuid\x18\x01 \x01(\tR\x04uuid\x12\x14\n" + + "\x05email\x18\x02 \x01(\tR\x05email\"E\n" + + "\x13AddXrayUserResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x14\n" + + "\x05error\x18\x02 \x01(\tR\x05error\"+\n" + + "\x15RemoveXrayUserRequest\x12\x12\n" + + "\x04uuid\x18\x01 \x01(\tR\x04uuid\"H\n" + + "\x16RemoveXrayUserResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\x12\x14\n" + + "\x05error\x18\x02 \x01(\tR\x05error2\xd1\x05\n" + "\x0eWireGuardAgent\x12S\n" + "\x10GetClientConfigs\x12\x1e.agent.GetClientConfigsRequest\x1a\x1f.agent.GetClientConfigsResponse\x12M\n" + "\x0eRegisterClient\x12\x1c.agent.RegisterClientRequest\x1a\x1d.agent.RegisterClientResponse\x12S\n" + "\x10UnregisterClient\x12\x1e.agent.UnregisterClientRequest\x1a\x1f.agent.UnregisterClientResponse\x12P\n" + "\x0fGetServerStatus\x12\x1d.agent.GetServerStatusRequest\x1a\x1e.agent.GetServerStatusResponse\x12>\n" + - "\tPingHosts\x12\x17.agent.PingHostsRequest\x1a\x18.agent.PingHostsResponseB\x13Z\x11l_vpn_proto/protob\x06proto3" + "\tPingHosts\x12\x17.agent.PingHostsRequest\x1a\x18.agent.PingHostsResponse\x12J\n" + + "\rGetXrayStatus\x12\x1b.agent.GetXrayStatusRequest\x1a\x1c.agent.GetXrayStatusResponse\x12S\n" + + "\x10GetXrayPublicKey\x12\x1e.agent.GetXrayPublicKeyRequest\x1a\x1f.agent.GetXrayPublicKeyResponse\x12D\n" + + "\vAddXrayUser\x12\x19.agent.AddXrayUserRequest\x1a\x1a.agent.AddXrayUserResponse\x12M\n" + + "\x0eRemoveXrayUser\x12\x1c.agent.RemoveXrayUserRequest\x1a\x1d.agent.RemoveXrayUserResponseB\x13Z\x11l_vpn_proto/protob\x06proto3" var ( file_proto_agent_proto_rawDescOnce sync.Once @@ -778,7 +1206,7 @@ func file_proto_agent_proto_rawDescGZIP() []byte { return file_proto_agent_proto_rawDescData } -var file_proto_agent_proto_msgTypes = make([]protoimpl.MessageInfo, 12) +var file_proto_agent_proto_msgTypes = make([]protoimpl.MessageInfo, 20) var file_proto_agent_proto_goTypes = []any{ (*GetClientConfigsRequest)(nil), // 0: agent.GetClientConfigsRequest (*ClientConfig)(nil), // 1: agent.ClientConfig @@ -792,6 +1220,14 @@ var file_proto_agent_proto_goTypes = []any{ (*PingHostsRequest)(nil), // 9: agent.PingHostsRequest (*PingResult)(nil), // 10: agent.PingResult (*PingHostsResponse)(nil), // 11: agent.PingHostsResponse + (*GetXrayStatusRequest)(nil), // 12: agent.GetXrayStatusRequest + (*GetXrayStatusResponse)(nil), // 13: agent.GetXrayStatusResponse + (*GetXrayPublicKeyRequest)(nil), // 14: agent.GetXrayPublicKeyRequest + (*GetXrayPublicKeyResponse)(nil), // 15: agent.GetXrayPublicKeyResponse + (*AddXrayUserRequest)(nil), // 16: agent.AddXrayUserRequest + (*AddXrayUserResponse)(nil), // 17: agent.AddXrayUserResponse + (*RemoveXrayUserRequest)(nil), // 18: agent.RemoveXrayUserRequest + (*RemoveXrayUserResponse)(nil), // 19: agent.RemoveXrayUserResponse } var file_proto_agent_proto_depIdxs = []int32{ 1, // 0: agent.GetClientConfigsResponse.clients:type_name -> agent.ClientConfig @@ -802,13 +1238,21 @@ var file_proto_agent_proto_depIdxs = []int32{ 5, // 5: agent.WireGuardAgent.UnregisterClient:input_type -> agent.UnregisterClientRequest 7, // 6: agent.WireGuardAgent.GetServerStatus:input_type -> agent.GetServerStatusRequest 9, // 7: agent.WireGuardAgent.PingHosts:input_type -> agent.PingHostsRequest - 2, // 8: agent.WireGuardAgent.GetClientConfigs:output_type -> agent.GetClientConfigsResponse - 4, // 9: agent.WireGuardAgent.RegisterClient:output_type -> agent.RegisterClientResponse - 6, // 10: agent.WireGuardAgent.UnregisterClient:output_type -> agent.UnregisterClientResponse - 8, // 11: agent.WireGuardAgent.GetServerStatus:output_type -> agent.GetServerStatusResponse - 11, // 12: agent.WireGuardAgent.PingHosts:output_type -> agent.PingHostsResponse - 8, // [8:13] is the sub-list for method output_type - 3, // [3:8] is the sub-list for method input_type + 12, // 8: agent.WireGuardAgent.GetXrayStatus:input_type -> agent.GetXrayStatusRequest + 14, // 9: agent.WireGuardAgent.GetXrayPublicKey:input_type -> agent.GetXrayPublicKeyRequest + 16, // 10: agent.WireGuardAgent.AddXrayUser:input_type -> agent.AddXrayUserRequest + 18, // 11: agent.WireGuardAgent.RemoveXrayUser:input_type -> agent.RemoveXrayUserRequest + 2, // 12: agent.WireGuardAgent.GetClientConfigs:output_type -> agent.GetClientConfigsResponse + 4, // 13: agent.WireGuardAgent.RegisterClient:output_type -> agent.RegisterClientResponse + 6, // 14: agent.WireGuardAgent.UnregisterClient:output_type -> agent.UnregisterClientResponse + 8, // 15: agent.WireGuardAgent.GetServerStatus:output_type -> agent.GetServerStatusResponse + 11, // 16: agent.WireGuardAgent.PingHosts:output_type -> agent.PingHostsResponse + 13, // 17: agent.WireGuardAgent.GetXrayStatus:output_type -> agent.GetXrayStatusResponse + 15, // 18: agent.WireGuardAgent.GetXrayPublicKey:output_type -> agent.GetXrayPublicKeyResponse + 17, // 19: agent.WireGuardAgent.AddXrayUser:output_type -> agent.AddXrayUserResponse + 19, // 20: agent.WireGuardAgent.RemoveXrayUser:output_type -> agent.RemoveXrayUserResponse + 12, // [12:21] is the sub-list for method output_type + 3, // [3:12] is the sub-list for method input_type 3, // [3:3] is the sub-list for extension type_name 3, // [3:3] is the sub-list for extension extendee 0, // [0:3] is the sub-list for field type_name @@ -825,7 +1269,7 @@ func file_proto_agent_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_proto_agent_proto_rawDesc), len(file_proto_agent_proto_rawDesc)), NumEnums: 0, - NumMessages: 12, + NumMessages: 20, NumExtensions: 0, NumServices: 1, }, diff --git a/proto/agent.proto b/proto/agent.proto index b720403..cbcf058 100644 --- a/proto/agent.proto +++ b/proto/agent.proto @@ -10,6 +10,12 @@ service WireGuardAgent { rpc UnregisterClient(UnregisterClientRequest) returns (UnregisterClientResponse); rpc GetServerStatus(GetServerStatusRequest) returns (GetServerStatusResponse); rpc PingHosts(PingHostsRequest) returns (PingHostsResponse); + + // Xray / VLESS+Reality management + rpc GetXrayStatus(GetXrayStatusRequest) returns (GetXrayStatusResponse); + rpc GetXrayPublicKey(GetXrayPublicKeyRequest) returns (GetXrayPublicKeyResponse); + rpc AddXrayUser(AddXrayUserRequest) returns (AddXrayUserResponse); + rpc RemoveXrayUser(RemoveXrayUserRequest) returns (RemoveXrayUserResponse); } message GetClientConfigsRequest {} @@ -76,3 +82,37 @@ message PingHostsResponse { string error = 2; repeated PingResult results = 3; } + +// ── Xray messages ───────────────────────────────────────────────────────────── + +message GetXrayStatusRequest {} +message GetXrayStatusResponse { + bool running = 1; + int32 port = 2; + string error = 3; +} + +message GetXrayPublicKeyRequest {} +message GetXrayPublicKeyResponse { + string public_key = 1; + string short_id = 2; + string server_name = 3; + int32 port = 4; +} + +message AddXrayUserRequest { + string uuid = 1; + string email = 2; +} +message AddXrayUserResponse { + bool success = 1; + string error = 2; +} + +message RemoveXrayUserRequest { + string uuid = 1; +} +message RemoveXrayUserResponse { + bool success = 1; + string error = 2; +} diff --git a/proto/agent_grpc.pb.go b/proto/agent_grpc.pb.go index c348b85..62aed18 100644 --- a/proto/agent_grpc.pb.go +++ b/proto/agent_grpc.pb.go @@ -24,6 +24,10 @@ const ( WireGuardAgent_UnregisterClient_FullMethodName = "/agent.WireGuardAgent/UnregisterClient" WireGuardAgent_GetServerStatus_FullMethodName = "/agent.WireGuardAgent/GetServerStatus" WireGuardAgent_PingHosts_FullMethodName = "/agent.WireGuardAgent/PingHosts" + WireGuardAgent_GetXrayStatus_FullMethodName = "/agent.WireGuardAgent/GetXrayStatus" + WireGuardAgent_GetXrayPublicKey_FullMethodName = "/agent.WireGuardAgent/GetXrayPublicKey" + WireGuardAgent_AddXrayUser_FullMethodName = "/agent.WireGuardAgent/AddXrayUser" + WireGuardAgent_RemoveXrayUser_FullMethodName = "/agent.WireGuardAgent/RemoveXrayUser" ) // WireGuardAgentClient is the client API for WireGuardAgent service. @@ -35,6 +39,11 @@ type WireGuardAgentClient interface { UnregisterClient(ctx context.Context, in *UnregisterClientRequest, opts ...grpc.CallOption) (*UnregisterClientResponse, error) GetServerStatus(ctx context.Context, in *GetServerStatusRequest, opts ...grpc.CallOption) (*GetServerStatusResponse, error) PingHosts(ctx context.Context, in *PingHostsRequest, opts ...grpc.CallOption) (*PingHostsResponse, error) + // Xray / VLESS+Reality management + GetXrayStatus(ctx context.Context, in *GetXrayStatusRequest, opts ...grpc.CallOption) (*GetXrayStatusResponse, error) + GetXrayPublicKey(ctx context.Context, in *GetXrayPublicKeyRequest, opts ...grpc.CallOption) (*GetXrayPublicKeyResponse, error) + AddXrayUser(ctx context.Context, in *AddXrayUserRequest, opts ...grpc.CallOption) (*AddXrayUserResponse, error) + RemoveXrayUser(ctx context.Context, in *RemoveXrayUserRequest, opts ...grpc.CallOption) (*RemoveXrayUserResponse, error) } type wireGuardAgentClient struct { @@ -95,6 +104,46 @@ func (c *wireGuardAgentClient) PingHosts(ctx context.Context, in *PingHostsReque return out, nil } +func (c *wireGuardAgentClient) GetXrayStatus(ctx context.Context, in *GetXrayStatusRequest, opts ...grpc.CallOption) (*GetXrayStatusResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetXrayStatusResponse) + err := c.cc.Invoke(ctx, WireGuardAgent_GetXrayStatus_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *wireGuardAgentClient) GetXrayPublicKey(ctx context.Context, in *GetXrayPublicKeyRequest, opts ...grpc.CallOption) (*GetXrayPublicKeyResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetXrayPublicKeyResponse) + err := c.cc.Invoke(ctx, WireGuardAgent_GetXrayPublicKey_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *wireGuardAgentClient) AddXrayUser(ctx context.Context, in *AddXrayUserRequest, opts ...grpc.CallOption) (*AddXrayUserResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(AddXrayUserResponse) + err := c.cc.Invoke(ctx, WireGuardAgent_AddXrayUser_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *wireGuardAgentClient) RemoveXrayUser(ctx context.Context, in *RemoveXrayUserRequest, opts ...grpc.CallOption) (*RemoveXrayUserResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(RemoveXrayUserResponse) + err := c.cc.Invoke(ctx, WireGuardAgent_RemoveXrayUser_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + // WireGuardAgentServer is the server API for WireGuardAgent service. // All implementations must embed UnimplementedWireGuardAgentServer // for forward compatibility. @@ -104,6 +153,11 @@ type WireGuardAgentServer interface { UnregisterClient(context.Context, *UnregisterClientRequest) (*UnregisterClientResponse, error) GetServerStatus(context.Context, *GetServerStatusRequest) (*GetServerStatusResponse, error) PingHosts(context.Context, *PingHostsRequest) (*PingHostsResponse, error) + // Xray / VLESS+Reality management + GetXrayStatus(context.Context, *GetXrayStatusRequest) (*GetXrayStatusResponse, error) + GetXrayPublicKey(context.Context, *GetXrayPublicKeyRequest) (*GetXrayPublicKeyResponse, error) + AddXrayUser(context.Context, *AddXrayUserRequest) (*AddXrayUserResponse, error) + RemoveXrayUser(context.Context, *RemoveXrayUserRequest) (*RemoveXrayUserResponse, error) mustEmbedUnimplementedWireGuardAgentServer() } @@ -129,6 +183,18 @@ func (UnimplementedWireGuardAgentServer) GetServerStatus(context.Context, *GetSe func (UnimplementedWireGuardAgentServer) PingHosts(context.Context, *PingHostsRequest) (*PingHostsResponse, error) { return nil, status.Error(codes.Unimplemented, "method PingHosts not implemented") } +func (UnimplementedWireGuardAgentServer) GetXrayStatus(context.Context, *GetXrayStatusRequest) (*GetXrayStatusResponse, error) { + return nil, status.Error(codes.Unimplemented, "method GetXrayStatus not implemented") +} +func (UnimplementedWireGuardAgentServer) GetXrayPublicKey(context.Context, *GetXrayPublicKeyRequest) (*GetXrayPublicKeyResponse, error) { + return nil, status.Error(codes.Unimplemented, "method GetXrayPublicKey not implemented") +} +func (UnimplementedWireGuardAgentServer) AddXrayUser(context.Context, *AddXrayUserRequest) (*AddXrayUserResponse, error) { + return nil, status.Error(codes.Unimplemented, "method AddXrayUser not implemented") +} +func (UnimplementedWireGuardAgentServer) RemoveXrayUser(context.Context, *RemoveXrayUserRequest) (*RemoveXrayUserResponse, error) { + return nil, status.Error(codes.Unimplemented, "method RemoveXrayUser not implemented") +} func (UnimplementedWireGuardAgentServer) mustEmbedUnimplementedWireGuardAgentServer() {} func (UnimplementedWireGuardAgentServer) testEmbeddedByValue() {} @@ -240,6 +306,78 @@ func _WireGuardAgent_PingHosts_Handler(srv interface{}, ctx context.Context, dec return interceptor(ctx, in, info, handler) } +func _WireGuardAgent_GetXrayStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetXrayStatusRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WireGuardAgentServer).GetXrayStatus(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WireGuardAgent_GetXrayStatus_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WireGuardAgentServer).GetXrayStatus(ctx, req.(*GetXrayStatusRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WireGuardAgent_GetXrayPublicKey_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetXrayPublicKeyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WireGuardAgentServer).GetXrayPublicKey(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WireGuardAgent_GetXrayPublicKey_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WireGuardAgentServer).GetXrayPublicKey(ctx, req.(*GetXrayPublicKeyRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WireGuardAgent_AddXrayUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AddXrayUserRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WireGuardAgentServer).AddXrayUser(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WireGuardAgent_AddXrayUser_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WireGuardAgentServer).AddXrayUser(ctx, req.(*AddXrayUserRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _WireGuardAgent_RemoveXrayUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RemoveXrayUserRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(WireGuardAgentServer).RemoveXrayUser(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: WireGuardAgent_RemoveXrayUser_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(WireGuardAgentServer).RemoveXrayUser(ctx, req.(*RemoveXrayUserRequest)) + } + return interceptor(ctx, in, info, handler) +} + // WireGuardAgent_ServiceDesc is the grpc.ServiceDesc for WireGuardAgent service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -267,6 +405,22 @@ var WireGuardAgent_ServiceDesc = grpc.ServiceDesc{ MethodName: "PingHosts", Handler: _WireGuardAgent_PingHosts_Handler, }, + { + MethodName: "GetXrayStatus", + Handler: _WireGuardAgent_GetXrayStatus_Handler, + }, + { + MethodName: "GetXrayPublicKey", + Handler: _WireGuardAgent_GetXrayPublicKey_Handler, + }, + { + MethodName: "AddXrayUser", + Handler: _WireGuardAgent_AddXrayUser_Handler, + }, + { + MethodName: "RemoveXrayUser", + Handler: _WireGuardAgent_RemoveXrayUser_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "proto/agent.proto",