From 068e98e245a7ba919449763ec7415295d7c53ab1 Mon Sep 17 00:00:00 2001 From: Anthony Date: Tue, 3 Aug 2021 15:17:15 -0500 Subject: [PATCH] Initial generated libs/docs/config --- config.yml | 56 ++ docs/custom_markdown.tmpl | 127 ++++ docs/federate.md | 132 ++++ docs/lightning.md | 167 +++++ docs/messaging.md | 99 +++ docs/signing.md | 133 ++++ docs/socket.md | 154 ++++ docs/vpn.md | 170 +++++ docs/websocket.md | 98 +++ go/proto/imp/api/federate/federate.pb.go | 510 +++++++++++++ go/proto/imp/api/federate/federate.pb.gw.go | 248 ++++++ go/proto/imp/api/lightning/lightning.pb.go | 688 +++++++++++++++++ go/proto/imp/api/lightning/lightning.pb.gw.go | 329 ++++++++ go/proto/imp/api/messaging/messaging.pb.go | 335 +++++++++ go/proto/imp/api/messaging/messaging.pb.gw.go | 167 +++++ go/proto/imp/api/signing/signing.pb.go | 506 +++++++++++++ go/proto/imp/api/signing/signing.pb.gw.go | 248 ++++++ go/proto/imp/api/socket/socket.pb.go | 669 +++++++++++++++++ go/proto/imp/api/socket/socket.pb.gw.go | 329 ++++++++ go/proto/imp/api/vpn/vpn.pb.go | 709 ++++++++++++++++++ go/proto/imp/api/vpn/vpn.pb.gw.go | 329 ++++++++ go/proto/imp/api/websocket/websocket.pb.go | 390 ++++++++++ go/proto/imp/api/websocket/websocket.pb.gw.go | 134 ++++ js/acceptcontractrequest.js | 230 ++++++ js/acceptcontractresponse.js | 170 +++++ js/checkinvoicerequest.js | 168 +++++ js/checkinvoiceresponse.js | 168 +++++ js/federaterequest.js | 168 +++++ js/federateresponse.js | 168 +++++ js/generateinvoicerequest.js | 198 +++++ js/generateinvoiceresponse.js | 168 +++++ js/leavefederationrequest.js | 170 +++++ js/leavefederationresponse.js | 170 +++++ js/messagerequest.js | 198 +++++ js/messageresponse.js | 168 +++++ js/payinvoicerequest.js | 168 +++++ js/payinvoiceresponse.js | 168 +++++ js/refreshcontractrequest.js | 230 ++++++ js/refreshcontractresponse.js | 170 +++++ js/requestfederaterequest.js | 170 +++++ js/requestfederateresponse.js | 170 +++++ js/requestquoterequest.js | 170 +++++ js/requestquoteresponse.js | 170 +++++ js/sendmessagerequest.js | 200 +++++ js/sendmessageresponse.js | 170 +++++ js/sendsocketrequest.js | 170 +++++ js/sendsocketresponse.js | 170 +++++ js/signrequest.js | 170 +++++ js/signresponse.js | 170 +++++ js/socketrequest.js | 141 ++++ js/socketresponse.js | 170 +++++ js/startsocketrequest.js | 141 ++++ js/startsocketresponse.js | 260 +++++++ js/stopsocketrequest.js | 141 ++++ js/stopsocketresponse.js | 141 ++++ js/subscriberequest.js | 141 ++++ js/subscriberesponse.js | 320 ++++++++ js/verifyrequest.js | 200 +++++ js/verifyresponse.js | 170 +++++ js/vpnrequest.js | 228 ++++++ js/vpnresponse.js | 168 +++++ openapiv2/proto/imp/api/federate/federate.go | 171 +++++ .../imp/api/federate/federate.swagger.json | 167 +++++ .../proto/imp/api/lightning/lightning.go | 223 ++++++ .../imp/api/lightning/lightning.swagger.json | 219 ++++++ .../proto/imp/api/messaging/messaging.go | 122 +++ .../imp/api/messaging/messaging.swagger.json | 118 +++ openapiv2/proto/imp/api/signing/signing.go | 172 +++++ .../imp/api/signing/signing.swagger.json | 168 +++++ openapiv2/proto/imp/api/socket/socket.go | 213 ++++++ .../proto/imp/api/socket/socket.swagger.json | 209 ++++++ openapiv2/proto/imp/api/vpn/vpn.go | 231 ++++++ openapiv2/proto/imp/api/vpn/vpn.swagger.json | 227 ++++++ .../proto/imp/api/websocket/websocket.go | 125 +++ .../imp/api/websocket/websocket.swagger.json | 121 +++ proto/federate.proto | 80 ++ proto/lightning.proto | 95 +++ proto/messaging.proto | 53 ++ proto/signing.proto | 74 ++ proto/socket.proto | 94 +++ proto/vpn.proto | 98 +++ proto/websocket.proto | 56 ++ 82 files changed, 16594 insertions(+) create mode 100644 config.yml create mode 100644 docs/custom_markdown.tmpl create mode 100644 docs/federate.md create mode 100644 docs/lightning.md create mode 100644 docs/messaging.md create mode 100644 docs/signing.md create mode 100644 docs/socket.md create mode 100644 docs/vpn.md create mode 100644 docs/websocket.md create mode 100644 go/proto/imp/api/federate/federate.pb.go create mode 100644 go/proto/imp/api/federate/federate.pb.gw.go create mode 100644 go/proto/imp/api/lightning/lightning.pb.go create mode 100644 go/proto/imp/api/lightning/lightning.pb.gw.go create mode 100644 go/proto/imp/api/messaging/messaging.pb.go create mode 100644 go/proto/imp/api/messaging/messaging.pb.gw.go create mode 100644 go/proto/imp/api/signing/signing.pb.go create mode 100644 go/proto/imp/api/signing/signing.pb.gw.go create mode 100644 go/proto/imp/api/socket/socket.pb.go create mode 100644 go/proto/imp/api/socket/socket.pb.gw.go create mode 100644 go/proto/imp/api/vpn/vpn.pb.go create mode 100644 go/proto/imp/api/vpn/vpn.pb.gw.go create mode 100644 go/proto/imp/api/websocket/websocket.pb.go create mode 100644 go/proto/imp/api/websocket/websocket.pb.gw.go create mode 100644 js/acceptcontractrequest.js create mode 100644 js/acceptcontractresponse.js create mode 100644 js/checkinvoicerequest.js create mode 100644 js/checkinvoiceresponse.js create mode 100644 js/federaterequest.js create mode 100644 js/federateresponse.js create mode 100644 js/generateinvoicerequest.js create mode 100644 js/generateinvoiceresponse.js create mode 100644 js/leavefederationrequest.js create mode 100644 js/leavefederationresponse.js create mode 100644 js/messagerequest.js create mode 100644 js/messageresponse.js create mode 100644 js/payinvoicerequest.js create mode 100644 js/payinvoiceresponse.js create mode 100644 js/refreshcontractrequest.js create mode 100644 js/refreshcontractresponse.js create mode 100644 js/requestfederaterequest.js create mode 100644 js/requestfederateresponse.js create mode 100644 js/requestquoterequest.js create mode 100644 js/requestquoteresponse.js create mode 100644 js/sendmessagerequest.js create mode 100644 js/sendmessageresponse.js create mode 100644 js/sendsocketrequest.js create mode 100644 js/sendsocketresponse.js create mode 100644 js/signrequest.js create mode 100644 js/signresponse.js create mode 100644 js/socketrequest.js create mode 100644 js/socketresponse.js create mode 100644 js/startsocketrequest.js create mode 100644 js/startsocketresponse.js create mode 100644 js/stopsocketrequest.js create mode 100644 js/stopsocketresponse.js create mode 100644 js/subscriberequest.js create mode 100644 js/subscriberesponse.js create mode 100644 js/verifyrequest.js create mode 100644 js/verifyresponse.js create mode 100644 js/vpnrequest.js create mode 100644 js/vpnresponse.js create mode 100644 openapiv2/proto/imp/api/federate/federate.go create mode 100644 openapiv2/proto/imp/api/federate/federate.swagger.json create mode 100644 openapiv2/proto/imp/api/lightning/lightning.go create mode 100644 openapiv2/proto/imp/api/lightning/lightning.swagger.json create mode 100644 openapiv2/proto/imp/api/messaging/messaging.go create mode 100644 openapiv2/proto/imp/api/messaging/messaging.swagger.json create mode 100644 openapiv2/proto/imp/api/signing/signing.go create mode 100644 openapiv2/proto/imp/api/signing/signing.swagger.json create mode 100644 openapiv2/proto/imp/api/socket/socket.go create mode 100644 openapiv2/proto/imp/api/socket/socket.swagger.json create mode 100644 openapiv2/proto/imp/api/vpn/vpn.go create mode 100644 openapiv2/proto/imp/api/vpn/vpn.swagger.json create mode 100644 openapiv2/proto/imp/api/websocket/websocket.go create mode 100644 openapiv2/proto/imp/api/websocket/websocket.swagger.json create mode 100644 proto/federate.proto create mode 100644 proto/lightning.proto create mode 100644 proto/messaging.proto create mode 100644 proto/signing.proto create mode 100644 proto/socket.proto create mode 100644 proto/vpn.proto create mode 100644 proto/websocket.proto diff --git a/config.yml b/config.yml new file mode 100644 index 0000000..32eb77f --- /dev/null +++ b/config.yml @@ -0,0 +1,56 @@ +# Server configurations +server: + enabled: true # enable the GRPC/HTTP/websocket server + grpc_addr: 127.0.0.1:8881 #IP:port for GRPC + http_addr: 127.0.0.1:8882 #IP:port for HTTP/websocket +# Redis DB configurations +sqlite3: + username: admin + password: supersecretpassword # this will get moved to environment variable or generated dynamically +###### DO NOT EDIT THE BELOW SECTION##### +# Services +service_list: + - service_type: federate + active: true + custom_record_number: 100000 + additional_service_data: + - service_type: vpn + active: true + custom_record_number: 200000 + additional_service_data: + - service_type: message + active: true + custom_record_number: 400000 + additional_service_data: + - service_type: socket + active: true + custom_record_number: 500000 + additional_service_data: + - service_type: sign + active: true + custom_record_number: 800000 + additional_service_data: +###### DO NOT EDIT THE ABOVE SECTION##### + +# Lightning +lightning: + lnd_node: + ip: 127.0.0.1 #IP of your LND node + port: 10001 #GRPC port of your LND node + pub_key: asdfasdfasdf #get your LND pubkey with "lncli getinfo" + tls_cert: /path/to/tls.cert + admin_macaroon: /path/to/admin.macaroon +federate: + ttl: 31560000 #Federation auto delete in seconds + imp_id: YOUR_IMP_ID #plain text string of your IMP node name +vpn: + price: 100 #per hour + server_ip: 127.0.0.1 #public IP of your VPN server + server_port: 51820 #port you want to listen on + subnet: 10.0.0.0/24 #subnet you want to give to your clients. .1 == your server IP. + server_pub_key: asdfasdfasdf #get this from your WG public key file + allowed_ips: 0.0.0.0/0 #what subnets clients can reach. Default is entire world. + binary_path: /usr/bin/wg #where your installed the "wg" command. + dns: 8.8.8.8 #set your preferred DNS server here. +socket: + server_ip: 1.1.1.1 #public IP of your socket server diff --git a/docs/custom_markdown.tmpl b/docs/custom_markdown.tmpl new file mode 100644 index 0000000..fc9fb9f --- /dev/null +++ b/docs/custom_markdown.tmpl @@ -0,0 +1,127 @@ +# Protocol Documentation + + + + +## {{.Name}} +{{.Description}} + + +{{range .Services}}{{ $service := . }} + + +### {{.Name}} +{{.Description}} + +| Method Name | Request Type | Response Type | Description | +| ----------- | ------------ | ------------- | ------------| +{{range .Methods -}} + | {{.Name}} | {{.RequestLongType}}{{if .RequestStreaming}} stream{{end}} | {{.ResponseLongType}}{{if .ResponseStreaming}} stream{{end}} | {{nobr .Description}} | +{{end}} + + +{{- if $service.MethodsWithOption "google.api.http" }} + +#### HTTP bindings + +| Method Name | Method | Pattern | +| ----------- | ------ | ------- | +{{- range $service.MethodsWithOption "google.api.http" }}{{ $method := . }} +{{- range (.Option "google.api.http").Rules }} +| `{{ $method.Name }}` | `{{ .Method }}` | `{{ .Pattern }}` +{{- end -}} +{{- end -}} +{{ end -}} + + + +{{end}} + + +{{range .Messages}} + + +### {{.LongName}} +{{.Description}} + +{{if .HasFields}} +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +{{range .Fields -}} + | {{.Name}} | {{.LongType}} | {{.Label}} | {{if (index .Options "deprecated"|default false)}}**Deprecated.** {{end}}{{nobr .Description}}{{if .DefaultValue}} Default: {{.DefaultValue}}{{end}} | +{{end}} +{{end}} + +{{if .HasExtensions}} +| Extension | Type | Base | Number | Description | +| --------- | ---- | ---- | ------ | ----------- | +{{range .Extensions -}} + | {{.Name}} | {{.LongType}} | {{.ContainingLongType}} | {{.Number}} | {{nobr .Description}}{{if .DefaultValue}} Default: {{.DefaultValue}}{{end}} | +{{end}} +{{end}} + +{{end}} + +{{range .Enums}} + + +### {{.LongName}} +{{.Description}} + +| Name | Number | Description | +| ---- | ------ | ----------- | +{{range .Values -}} + | {{.Name}} | {{.Number}} | {{nobr .Description}} | +{{end}} + +{{end}} + +{{if .HasExtensions}} + + +### File-level Extensions +| Extension | Type | Base | Number | Description | +| --------- | ---- | ---- | ------ | ----------- | +{{range .Extensions -}} + | {{.Name}} | {{.LongType}} | {{.ContainingLongType}} | {{.Number}} | {{nobr .Description}}{{if .DefaultValue}} Default: `{{.DefaultValue}}`{{end}} | +{{end}} +{{end}} + +{{ end -}} + + +## Scalar Value Types + +| .proto Type | Notes | C++ | Java | Python | Go | C# | PHP | Ruby | +| ----------- | ----- | --- | ---- | ------ | -- | -- | --- | ---- | +{{range .Scalars -}} + | {{.ProtoType}} | {{.Notes}} | {{.CppType}} | {{.JavaType}} | {{.PythonType}} | {{.GoType}} | {{.CSharp}} | {{.PhpType}} | {{.RubyType}} | +{{end}} diff --git a/docs/federate.md b/docs/federate.md new file mode 100644 index 0000000..272b7f4 --- /dev/null +++ b/docs/federate.md @@ -0,0 +1,132 @@ +# Protocol Documentation + + + + +## proto/imp/api/federate/federate.proto +Allows for p2p federation between Impervious nodes + + + + + +### Federate + + +| Method Name | Request Type | Response Type | Description | +| ----------- | ------------ | ------------- | ------------| +| RequestFederate | RequestFederateRequest | RequestFederateResponse | RequestFederation performs the federation request to a specific peer. | +| LeaveFederation | LeaveFederationRequest | LeaveFederationResponse | LeaveFederation performs the removal of a federated peer (upon message receipt). | + + +#### HTTP bindings + +| Method Name | Method | Pattern | +| ----------- | ------ | ------- | +| `RequestFederate` | `POST` | `/v1/federate/request` +| `LeaveFederation` | `POST` | `/v1/federate/leave` + + + + + +### LeaveFederationRequest +Represents a request to leave a federation from a far end node + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| pubkey | string | | The public key of the far end LND node running IMP | + + + + + + + + +### LeaveFederationResponse +Represents a response back from a Leave Federation Request + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| id | string | | returned message ID | + + + + + + + + +### RequestFederateRequest +Represents a request to federate with a far end node + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| pubkey | string | | The public key of the far end LND node running IMP | + + + + + + + + +### RequestFederateResponse +Represents a response back from a Federation Request + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| id | string | | returned message ID | + + + + + + + + + + + +## Scalar Value Types + +| .proto Type | Notes | C++ | Java | Python | Go | C# | PHP | Ruby | +| ----------- | ----- | --- | ---- | ------ | -- | -- | --- | ---- | +| double | | double | double | float | float64 | double | float | Float | +| float | | float | float | float | float32 | float | float | Float | +| int32 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) | +| int64 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. | int64 | long | int/long | int64 | long | integer/string | Bignum | +| uint32 | Uses variable-length encoding. | uint32 | int | int/long | uint32 | uint | integer | Bignum or Fixnum (as required) | +| uint64 | Uses variable-length encoding. | uint64 | long | int/long | uint64 | ulong | integer/string | Bignum or Fixnum (as required) | +| sint32 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) | +| sint64 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. | int64 | long | int/long | int64 | long | integer/string | Bignum | +| fixed32 | Always four bytes. More efficient than uint32 if values are often greater than 2^28. | uint32 | int | int | uint32 | uint | integer | Bignum or Fixnum (as required) | +| fixed64 | Always eight bytes. More efficient than uint64 if values are often greater than 2^56. | uint64 | long | int/long | uint64 | ulong | integer/string | Bignum | +| sfixed32 | Always four bytes. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) | +| sfixed64 | Always eight bytes. | int64 | long | int/long | int64 | long | integer/string | Bignum | +| bool | | bool | boolean | boolean | bool | bool | boolean | TrueClass/FalseClass | +| string | A string must always contain UTF-8 encoded or 7-bit ASCII text. | string | String | str/unicode | string | string | string | String (UTF-8) | +| bytes | May contain any arbitrary sequence of bytes. | string | ByteString | str | []byte | ByteString | string | String (ASCII-8BIT) | diff --git a/docs/lightning.md b/docs/lightning.md new file mode 100644 index 0000000..a367ea7 --- /dev/null +++ b/docs/lightning.md @@ -0,0 +1,167 @@ +# Protocol Documentation + + + + +## proto/imp/api/lightning/lightning.proto +Allows for p2p messaging between Impervious nodes + + + + + +### Lightning + + +| Method Name | Request Type | Response Type | Description | +| ----------- | ------------ | ------------- | ------------| +| GenerateInvoice | GenerateInvoiceRequest | GenerateInvoiceResponse | | +| PayInvoice | PayInvoiceRequest | PayInvoiceResponse | | +| CheckInvoice | CheckInvoiceRequest | CheckInvoiceResponse | | + + +#### HTTP bindings + +| Method Name | Method | Pattern | +| ----------- | ------ | ------- | +| `GenerateInvoice` | `POST` | `/v1/lightning/generateinvoice` +| `PayInvoice` | `POST` | `/v1/lightning/payinvoice` +| `CheckInvoice` | `POST` | `/v1/lightning/checkinvoice` + + + + + +### CheckInvoiceRequest +Represents an request to check an invoice. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| invoice | string | | The invoice to check | + + + + + + + + +### CheckInvoiceResponse +Represents a response back from the invoice check. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| paid | bool | | The boolean result representing whether or not the invoice was paid | + + + + + + + + +### GenerateInvoiceRequest +Represents an invoice creation request from your lightning node. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| amount | int64 | | The amount of satoshis you want to receive | +| memo | string | | The human readable memo you want the sender to see | + + + + + + + + +### GenerateInvoiceResponse +Represents a response back from an invoice generation request. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| invoice | string | | The invoice from your lightning node | + + + + + + + + +### PayInvoiceRequest +Represents an invoice that will be paid by your lightning node. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| invoice | string | | The invoice to pay | + + + + + + + + +### PayInvoiceResponse +Represents a response back from the payment result. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| preimage | string | | The preimage from the payment result, if successful | + + + + + + + + + + + +## Scalar Value Types + +| .proto Type | Notes | C++ | Java | Python | Go | C# | PHP | Ruby | +| ----------- | ----- | --- | ---- | ------ | -- | -- | --- | ---- | +| double | | double | double | float | float64 | double | float | Float | +| float | | float | float | float | float32 | float | float | Float | +| int32 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) | +| int64 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. | int64 | long | int/long | int64 | long | integer/string | Bignum | +| uint32 | Uses variable-length encoding. | uint32 | int | int/long | uint32 | uint | integer | Bignum or Fixnum (as required) | +| uint64 | Uses variable-length encoding. | uint64 | long | int/long | uint64 | ulong | integer/string | Bignum or Fixnum (as required) | +| sint32 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) | +| sint64 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. | int64 | long | int/long | int64 | long | integer/string | Bignum | +| fixed32 | Always four bytes. More efficient than uint32 if values are often greater than 2^28. | uint32 | int | int | uint32 | uint | integer | Bignum or Fixnum (as required) | +| fixed64 | Always eight bytes. More efficient than uint64 if values are often greater than 2^56. | uint64 | long | int/long | uint64 | ulong | integer/string | Bignum | +| sfixed32 | Always four bytes. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) | +| sfixed64 | Always eight bytes. | int64 | long | int/long | int64 | long | integer/string | Bignum | +| bool | | bool | boolean | boolean | bool | bool | boolean | TrueClass/FalseClass | +| string | A string must always contain UTF-8 encoded or 7-bit ASCII text. | string | String | str/unicode | string | string | string | String (UTF-8) | +| bytes | May contain any arbitrary sequence of bytes. | string | ByteString | str | []byte | ByteString | string | String (ASCII-8BIT) | diff --git a/docs/messaging.md b/docs/messaging.md new file mode 100644 index 0000000..c258212 --- /dev/null +++ b/docs/messaging.md @@ -0,0 +1,99 @@ +# Protocol Documentation + + + + +## proto/imp/api/messaging/messaging.proto +Allows for p2p messaging between Impervious nodes + + + + + +### Messaging + + +| Method Name | Request Type | Response Type | Description | +| ----------- | ------------ | ------------- | ------------| +| SendMessage | SendMessageRequest | SendMessageResponse | | + + +#### HTTP bindings + +| Method Name | Method | Pattern | +| ----------- | ------ | ------- | +| `SendMessage` | `POST` | `/v1/message/send` + + + + + +### SendMessageRequest +Represents a message send to a far end node + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| msg | string | | the raw message itself to be sent to the far end node | +| pubkey | string | | The public key of the far end LND node running IMP | + + + + + + + + +### SendMessageResponse +Represents a response back from a sent message + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| id | string | | returned message ID | + + + + + + + + + + + +## Scalar Value Types + +| .proto Type | Notes | C++ | Java | Python | Go | C# | PHP | Ruby | +| ----------- | ----- | --- | ---- | ------ | -- | -- | --- | ---- | +| double | | double | double | float | float64 | double | float | Float | +| float | | float | float | float | float32 | float | float | Float | +| int32 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) | +| int64 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. | int64 | long | int/long | int64 | long | integer/string | Bignum | +| uint32 | Uses variable-length encoding. | uint32 | int | int/long | uint32 | uint | integer | Bignum or Fixnum (as required) | +| uint64 | Uses variable-length encoding. | uint64 | long | int/long | uint64 | ulong | integer/string | Bignum or Fixnum (as required) | +| sint32 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) | +| sint64 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. | int64 | long | int/long | int64 | long | integer/string | Bignum | +| fixed32 | Always four bytes. More efficient than uint32 if values are often greater than 2^28. | uint32 | int | int | uint32 | uint | integer | Bignum or Fixnum (as required) | +| fixed64 | Always eight bytes. More efficient than uint64 if values are often greater than 2^56. | uint64 | long | int/long | uint64 | ulong | integer/string | Bignum | +| sfixed32 | Always four bytes. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) | +| sfixed64 | Always eight bytes. | int64 | long | int/long | int64 | long | integer/string | Bignum | +| bool | | bool | boolean | boolean | bool | bool | boolean | TrueClass/FalseClass | +| string | A string must always contain UTF-8 encoded or 7-bit ASCII text. | string | String | str/unicode | string | string | string | String (UTF-8) | +| bytes | May contain any arbitrary sequence of bytes. | string | ByteString | str | []byte | ByteString | string | String (ASCII-8BIT) | diff --git a/docs/signing.md b/docs/signing.md new file mode 100644 index 0000000..4bedc01 --- /dev/null +++ b/docs/signing.md @@ -0,0 +1,133 @@ +# Protocol Documentation + + + + +## proto/imp/api/signing/signing.proto +Allows an Imp node to sign and verify messaging with the connected LND + + + + + +### Signing + + +| Method Name | Request Type | Response Type | Description | +| ----------- | ------------ | ------------- | ------------| +| SignMessage | SignRequest | SignResponse | | +| VerifySignature | VerifyRequest | VerifyResponse | | + + +#### HTTP bindings + +| Method Name | Method | Pattern | +| ----------- | ------ | ------- | +| `SignMessage` | `POST` | `/v1/sign` +| `VerifySignature` | `POST` | `/v1/verify` + + + + + +### SignRequest +Represents a request to sign a message + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| msg | string | | message to be signed | + + + + + + + + +### SignResponse +Represents a response from a signature request + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| signature | string | | signature of signed message returned from LND | + + + + + + + + +### VerifyRequest +Represents a request to verify a signature and message + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| msg | string | | message to be verified | +| signature | string | | signature of message | + + + + + + + + +### VerifyResponse +Represents a response back from a verification request + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| result | bool | | result of signature verification | + + + + + + + + + + + +## Scalar Value Types + +| .proto Type | Notes | C++ | Java | Python | Go | C# | PHP | Ruby | +| ----------- | ----- | --- | ---- | ------ | -- | -- | --- | ---- | +| double | | double | double | float | float64 | double | float | Float | +| float | | float | float | float | float32 | float | float | Float | +| int32 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) | +| int64 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. | int64 | long | int/long | int64 | long | integer/string | Bignum | +| uint32 | Uses variable-length encoding. | uint32 | int | int/long | uint32 | uint | integer | Bignum or Fixnum (as required) | +| uint64 | Uses variable-length encoding. | uint64 | long | int/long | uint64 | ulong | integer/string | Bignum or Fixnum (as required) | +| sint32 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) | +| sint64 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. | int64 | long | int/long | int64 | long | integer/string | Bignum | +| fixed32 | Always four bytes. More efficient than uint32 if values are often greater than 2^28. | uint32 | int | int | uint32 | uint | integer | Bignum or Fixnum (as required) | +| fixed64 | Always eight bytes. More efficient than uint64 if values are often greater than 2^56. | uint64 | long | int/long | uint64 | ulong | integer/string | Bignum | +| sfixed32 | Always four bytes. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) | +| sfixed64 | Always eight bytes. | int64 | long | int/long | int64 | long | integer/string | Bignum | +| bool | | bool | boolean | boolean | bool | bool | boolean | TrueClass/FalseClass | +| string | A string must always contain UTF-8 encoded or 7-bit ASCII text. | string | String | str/unicode | string | string | string | String (UTF-8) | +| bytes | May contain any arbitrary sequence of bytes. | string | ByteString | str | []byte | ByteString | string | String (ASCII-8BIT) | diff --git a/docs/socket.md b/docs/socket.md new file mode 100644 index 0000000..dd0828d --- /dev/null +++ b/docs/socket.md @@ -0,0 +1,154 @@ +# Protocol Documentation + + + + +## proto/imp/api/socket/socket.proto +Allows for p2p sockets to be established between Impervious nodes + + + + + +### Socket + + +| Method Name | Request Type | Response Type | Description | +| ----------- | ------------ | ------------- | ------------| +| SendSocket | SendSocketRequest | SendSocketResponse | | +| StartSocket | StartSocketRequest | StartSocketResponse | | +| StopSocket | StopSocketRequest | StopSocketResponse | | + + +#### HTTP bindings + +| Method Name | Method | Pattern | +| ----------- | ------ | ------- | +| `SendSocket` | `POST` | `/v1/socket/sendRequest` +| `StartSocket` | `POST` | `/v1/socket/start` +| `StopSocket` | `POST` | `/v1/socket/stop` + + + + + +### SendSocketRequest +Represents a request to send socket connection information to a far end node + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| pubkey | string | | The public key of the far end LND node running IMP | + + + + + + + + +### SendSocketResponse +Represents a response back from the request to establish a socket + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| id | string | | returned message ID | + + + + + + + + +### StartSocketRequest +Represents a request to start a socket on an owned IMP node + + + + + + + + +### StartSocketResponse +Represents a response containing socket information from a started socket + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| protocol | string | | the protocol of the socket connection | +| ip | string | | the ip of the IMP node to connect to | +| port1 | string | | the first port of the socket connection | +| port2 | string | | the second port of the socket connection | + + + + + + + + +### StopSocketRequest +Represents a request to stop a socket on an owned IMP node + + + + + + + + +### StopSocketResponse +Represents a response back from a stopped socket + + + + + + + + + + + +## Scalar Value Types + +| .proto Type | Notes | C++ | Java | Python | Go | C# | PHP | Ruby | +| ----------- | ----- | --- | ---- | ------ | -- | -- | --- | ---- | +| double | | double | double | float | float64 | double | float | Float | +| float | | float | float | float | float32 | float | float | Float | +| int32 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) | +| int64 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. | int64 | long | int/long | int64 | long | integer/string | Bignum | +| uint32 | Uses variable-length encoding. | uint32 | int | int/long | uint32 | uint | integer | Bignum or Fixnum (as required) | +| uint64 | Uses variable-length encoding. | uint64 | long | int/long | uint64 | ulong | integer/string | Bignum or Fixnum (as required) | +| sint32 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) | +| sint64 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. | int64 | long | int/long | int64 | long | integer/string | Bignum | +| fixed32 | Always four bytes. More efficient than uint32 if values are often greater than 2^28. | uint32 | int | int | uint32 | uint | integer | Bignum or Fixnum (as required) | +| fixed64 | Always eight bytes. More efficient than uint64 if values are often greater than 2^56. | uint64 | long | int/long | uint64 | ulong | integer/string | Bignum | +| sfixed32 | Always four bytes. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) | +| sfixed64 | Always eight bytes. | int64 | long | int/long | int64 | long | integer/string | Bignum | +| bool | | bool | boolean | boolean | bool | bool | boolean | TrueClass/FalseClass | +| string | A string must always contain UTF-8 encoded or 7-bit ASCII text. | string | String | str/unicode | string | string | string | String (UTF-8) | +| bytes | May contain any arbitrary sequence of bytes. | string | ByteString | str | []byte | ByteString | string | String (ASCII-8BIT) | diff --git a/docs/vpn.md b/docs/vpn.md new file mode 100644 index 0000000..ee92b9c --- /dev/null +++ b/docs/vpn.md @@ -0,0 +1,170 @@ +# Protocol Documentation + + + + +## proto/imp/api/vpn/vpn.proto +Allows for an Encrypted Wireguard VPN between Impervious nodes + + + + + +### VPN + + +| Method Name | Request Type | Response Type | Description | +| ----------- | ------------ | ------------- | ------------| +| RequestQuote | RequestQuoteRequest | RequestQuoteResponse | | +| AcceptContract | AcceptContractRequest | AcceptContractResponse | | +| RefreshContract | RefreshContractRequest | RefreshContractResponse | | + + +#### HTTP bindings + +| Method Name | Method | Pattern | +| ----------- | ------ | ------- | +| `RequestQuote` | `POST` | `/v1/vpn/quote` +| `AcceptContract` | `POST` | `/v1/vpn/contract` +| `RefreshContract` | `POST` | `/v1/vpn/refresh` + + + + + +### AcceptContractRequest +Represents a request to Accept (Pay For) a VPN Quote + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| pubkey | string | | The public key of the far end LND node running IMP | +| nonce | string | | the identifier from a requested VPN quote | +| price | string | | the agreed upon price from the VPN quote | + + + + + + + + +### AcceptContractResponse +Represents a response back from an accepted VPN Quote + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| id | string | | returned message ID | + + + + + + + + +### RefreshContractRequest +Represents a request to extend/refresh an expiring VPN Connection (i.e. purchase more time) + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| pubkey | string | | The public key of the far end LND node running IMP | +| nonce | string | | the identifier of the VPN connection | +| price | string | | the agreed upon price from the VPN quote | + + + + + + + + +### RefreshContractResponse +Represents a reponse back from a refreshed VPN connection + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| id | string | | returned message ID | + + + + + + + + +### RequestQuoteRequest +Represents a request to receive a VPN quote from a far end node + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| pubkey | string | | The public key of the far end LND node running IMP | + + + + + + + + +### RequestQuoteResponse +Represents a response back from a VPN Quote Reqeust + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| id | string | | returned message ID | + + + + + + + + + + + +## Scalar Value Types + +| .proto Type | Notes | C++ | Java | Python | Go | C# | PHP | Ruby | +| ----------- | ----- | --- | ---- | ------ | -- | -- | --- | ---- | +| double | | double | double | float | float64 | double | float | Float | +| float | | float | float | float | float32 | float | float | Float | +| int32 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) | +| int64 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. | int64 | long | int/long | int64 | long | integer/string | Bignum | +| uint32 | Uses variable-length encoding. | uint32 | int | int/long | uint32 | uint | integer | Bignum or Fixnum (as required) | +| uint64 | Uses variable-length encoding. | uint64 | long | int/long | uint64 | ulong | integer/string | Bignum or Fixnum (as required) | +| sint32 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) | +| sint64 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. | int64 | long | int/long | int64 | long | integer/string | Bignum | +| fixed32 | Always four bytes. More efficient than uint32 if values are often greater than 2^28. | uint32 | int | int | uint32 | uint | integer | Bignum or Fixnum (as required) | +| fixed64 | Always eight bytes. More efficient than uint64 if values are often greater than 2^56. | uint64 | long | int/long | uint64 | ulong | integer/string | Bignum | +| sfixed32 | Always four bytes. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) | +| sfixed64 | Always eight bytes. | int64 | long | int/long | int64 | long | integer/string | Bignum | +| bool | | bool | boolean | boolean | bool | bool | boolean | TrueClass/FalseClass | +| string | A string must always contain UTF-8 encoded or 7-bit ASCII text. | string | String | str/unicode | string | string | string | String (UTF-8) | +| bytes | May contain any arbitrary sequence of bytes. | string | ByteString | str | []byte | ByteString | string | String (ASCII-8BIT) | diff --git a/docs/websocket.md b/docs/websocket.md new file mode 100644 index 0000000..44c2d65 --- /dev/null +++ b/docs/websocket.md @@ -0,0 +1,98 @@ +# Protocol Documentation + + + + +## proto/imp/api/websocket/websocket.proto +Allows for receiving messages from your IMP node + + + + + +### Websocket + + +| Method Name | Request Type | Response Type | Description | +| ----------- | ------------ | ------------- | ------------| +| Subscribe | SubscribeRequest | SubscribeResponse stream | | + + +#### HTTP bindings + +| Method Name | Method | Pattern | +| ----------- | ------ | ------- | +| `Subscribe` | `GET` | `/v1/subscribe` + + + + + +### SubscribeRequest +Represents a request to subscribe to the event websocket + + + + + + + + +### SubscribeResponse +Represents a response back from the websocket containing event information + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| id | string | | | +| reply_to_id | string | | | +| from_pubkey | string | | | +| data | string | | | +| service_type | string | | | +| amount | int64 | | | + + + + + + + + + + + +## Scalar Value Types + +| .proto Type | Notes | C++ | Java | Python | Go | C# | PHP | Ruby | +| ----------- | ----- | --- | ---- | ------ | -- | -- | --- | ---- | +| double | | double | double | float | float64 | double | float | Float | +| float | | float | float | float | float32 | float | float | Float | +| int32 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) | +| int64 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. | int64 | long | int/long | int64 | long | integer/string | Bignum | +| uint32 | Uses variable-length encoding. | uint32 | int | int/long | uint32 | uint | integer | Bignum or Fixnum (as required) | +| uint64 | Uses variable-length encoding. | uint64 | long | int/long | uint64 | ulong | integer/string | Bignum or Fixnum (as required) | +| sint32 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) | +| sint64 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. | int64 | long | int/long | int64 | long | integer/string | Bignum | +| fixed32 | Always four bytes. More efficient than uint32 if values are often greater than 2^28. | uint32 | int | int | uint32 | uint | integer | Bignum or Fixnum (as required) | +| fixed64 | Always eight bytes. More efficient than uint64 if values are often greater than 2^56. | uint64 | long | int/long | uint64 | ulong | integer/string | Bignum | +| sfixed32 | Always four bytes. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) | +| sfixed64 | Always eight bytes. | int64 | long | int/long | int64 | long | integer/string | Bignum | +| bool | | bool | boolean | boolean | bool | bool | boolean | TrueClass/FalseClass | +| string | A string must always contain UTF-8 encoded or 7-bit ASCII text. | string | String | str/unicode | string | string | string | String (UTF-8) | +| bytes | May contain any arbitrary sequence of bytes. | string | ByteString | str | []byte | ByteString | string | String (ASCII-8BIT) | diff --git a/go/proto/imp/api/federate/federate.pb.go b/go/proto/imp/api/federate/federate.pb.go new file mode 100644 index 0000000..46b7456 --- /dev/null +++ b/go/proto/imp/api/federate/federate.pb.go @@ -0,0 +1,510 @@ +/// Allows for p2p federation between Impervious nodes + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.1 +// protoc v3.17.3 +// source: proto/imp/api/federate/federate.proto + +package gen + +import ( + context "context" + _ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options" + _ "google.golang.org/genproto/googleapis/api/annotations" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +//* +// Represents a request to federate with a far end node +type RequestFederateRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Pubkey string `protobuf:"bytes,1,opt,name=pubkey,proto3" json:"pubkey,omitempty"` // The public key of the far end LND node running IMP +} + +func (x *RequestFederateRequest) Reset() { + *x = RequestFederateRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_imp_api_federate_federate_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RequestFederateRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RequestFederateRequest) ProtoMessage() {} + +func (x *RequestFederateRequest) ProtoReflect() protoreflect.Message { + mi := &file_proto_imp_api_federate_federate_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RequestFederateRequest.ProtoReflect.Descriptor instead. +func (*RequestFederateRequest) Descriptor() ([]byte, []int) { + return file_proto_imp_api_federate_federate_proto_rawDescGZIP(), []int{0} +} + +func (x *RequestFederateRequest) GetPubkey() string { + if x != nil { + return x.Pubkey + } + return "" +} + +//* +// Represents a response back from a Federation Request +type RequestFederateResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // returned message ID +} + +func (x *RequestFederateResponse) Reset() { + *x = RequestFederateResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_imp_api_federate_federate_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RequestFederateResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RequestFederateResponse) ProtoMessage() {} + +func (x *RequestFederateResponse) ProtoReflect() protoreflect.Message { + mi := &file_proto_imp_api_federate_federate_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RequestFederateResponse.ProtoReflect.Descriptor instead. +func (*RequestFederateResponse) Descriptor() ([]byte, []int) { + return file_proto_imp_api_federate_federate_proto_rawDescGZIP(), []int{1} +} + +func (x *RequestFederateResponse) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +//* +// Represents a request to leave a federation from a far end node +type LeaveFederationRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Pubkey string `protobuf:"bytes,1,opt,name=pubkey,proto3" json:"pubkey,omitempty"` // The public key of the far end LND node running IMP +} + +func (x *LeaveFederationRequest) Reset() { + *x = LeaveFederationRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_imp_api_federate_federate_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LeaveFederationRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LeaveFederationRequest) ProtoMessage() {} + +func (x *LeaveFederationRequest) ProtoReflect() protoreflect.Message { + mi := &file_proto_imp_api_federate_federate_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LeaveFederationRequest.ProtoReflect.Descriptor instead. +func (*LeaveFederationRequest) Descriptor() ([]byte, []int) { + return file_proto_imp_api_federate_federate_proto_rawDescGZIP(), []int{2} +} + +func (x *LeaveFederationRequest) GetPubkey() string { + if x != nil { + return x.Pubkey + } + return "" +} + +//* +// Represents a response back from a Leave Federation Request +type LeaveFederationResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // returned message ID +} + +func (x *LeaveFederationResponse) Reset() { + *x = LeaveFederationResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_imp_api_federate_federate_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LeaveFederationResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LeaveFederationResponse) ProtoMessage() {} + +func (x *LeaveFederationResponse) ProtoReflect() protoreflect.Message { + mi := &file_proto_imp_api_federate_federate_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LeaveFederationResponse.ProtoReflect.Descriptor instead. +func (*LeaveFederationResponse) Descriptor() ([]byte, []int) { + return file_proto_imp_api_federate_federate_proto_rawDescGZIP(), []int{3} +} + +func (x *LeaveFederationResponse) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +var File_proto_imp_api_federate_federate_proto protoreflect.FileDescriptor + +var file_proto_imp_api_federate_federate_proto_rawDesc = []byte{ + 0x0a, 0x25, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x69, 0x6d, 0x70, 0x2f, 0x61, 0x70, 0x69, 0x2f, + 0x66, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x65, 0x2f, 0x66, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x08, 0x66, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, + 0x65, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, + 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x6f, 0x70, 0x65, 0x6e, + 0x61, 0x70, 0x69, 0x76, 0x32, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x61, 0x6e, + 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, + 0x30, 0x0a, 0x16, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x46, 0x65, 0x64, 0x65, 0x72, 0x61, + 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x75, 0x62, + 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x75, 0x62, 0x6b, 0x65, + 0x79, 0x22, 0x29, 0x0a, 0x17, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x46, 0x65, 0x64, 0x65, + 0x72, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x30, 0x0a, 0x16, + 0x4c, 0x65, 0x61, 0x76, 0x65, 0x46, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x75, 0x62, 0x6b, 0x65, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x75, 0x62, 0x6b, 0x65, 0x79, 0x22, 0x29, + 0x0a, 0x17, 0x4c, 0x65, 0x61, 0x76, 0x65, 0x46, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x32, 0xfa, 0x01, 0x0a, 0x08, 0x46, 0x65, + 0x64, 0x65, 0x72, 0x61, 0x74, 0x65, 0x12, 0x77, 0x0a, 0x0f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x46, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x65, 0x12, 0x20, 0x2e, 0x66, 0x65, 0x64, 0x65, + 0x72, 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x46, 0x65, 0x64, 0x65, + 0x72, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x66, 0x65, + 0x64, 0x65, 0x72, 0x61, 0x74, 0x65, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x46, 0x65, + 0x64, 0x65, 0x72, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1f, + 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x19, 0x22, 0x14, 0x2f, 0x76, 0x31, 0x2f, 0x66, 0x65, 0x64, 0x65, + 0x72, 0x61, 0x74, 0x65, 0x2f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x3a, 0x01, 0x2a, 0x12, + 0x75, 0x0a, 0x0f, 0x4c, 0x65, 0x61, 0x76, 0x65, 0x46, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x12, 0x20, 0x2e, 0x66, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x65, 0x2e, 0x4c, 0x65, + 0x61, 0x76, 0x65, 0x46, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x66, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x65, 0x2e, + 0x4c, 0x65, 0x61, 0x76, 0x65, 0x46, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x17, 0x22, + 0x12, 0x2f, 0x76, 0x31, 0x2f, 0x66, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x65, 0x2f, 0x6c, 0x65, + 0x61, 0x76, 0x65, 0x3a, 0x01, 0x2a, 0x42, 0xda, 0x01, 0x5a, 0x23, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x6d, 0x70, 0x65, 0x72, 0x76, 0x69, 0x6f, 0x75, 0x73, + 0x61, 0x69, 0x2f, 0x66, 0x72, 0x65, 0x65, 0x69, 0x6d, 0x70, 0x2f, 0x67, 0x65, 0x6e, 0x92, 0x41, + 0xb1, 0x01, 0x12, 0x40, 0x0a, 0x11, 0x46, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x65, 0x20, 0x53, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x22, 0x26, 0x0a, 0x0d, 0x49, 0x6d, 0x70, 0x65, 0x72, + 0x76, 0x69, 0x6f, 0x75, 0x73, 0x20, 0x41, 0x49, 0x12, 0x15, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, + 0x2f, 0x2f, 0x69, 0x6d, 0x70, 0x65, 0x72, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x2e, 0x61, 0x69, 0x32, + 0x03, 0x31, 0x2e, 0x30, 0x2a, 0x03, 0x01, 0x02, 0x04, 0x32, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, + 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x73, 0x6f, 0x6e, 0x3a, 0x10, 0x61, 0x70, 0x70, + 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x73, 0x6f, 0x6e, 0x72, 0x44, 0x0a, + 0x14, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6f, + 0x6e, 0x20, 0x49, 0x4d, 0x50, 0x12, 0x2c, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x67, + 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x6d, 0x70, 0x65, 0x72, 0x76, + 0x69, 0x6f, 0x75, 0x73, 0x61, 0x69, 0x2f, 0x69, 0x6d, 0x70, 0x2d, 0x72, 0x65, 0x6c, 0x65, 0x61, + 0x73, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_proto_imp_api_federate_federate_proto_rawDescOnce sync.Once + file_proto_imp_api_federate_federate_proto_rawDescData = file_proto_imp_api_federate_federate_proto_rawDesc +) + +func file_proto_imp_api_federate_federate_proto_rawDescGZIP() []byte { + file_proto_imp_api_federate_federate_proto_rawDescOnce.Do(func() { + file_proto_imp_api_federate_federate_proto_rawDescData = protoimpl.X.CompressGZIP(file_proto_imp_api_federate_federate_proto_rawDescData) + }) + return file_proto_imp_api_federate_federate_proto_rawDescData +} + +var file_proto_imp_api_federate_federate_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_proto_imp_api_federate_federate_proto_goTypes = []interface{}{ + (*RequestFederateRequest)(nil), // 0: federate.RequestFederateRequest + (*RequestFederateResponse)(nil), // 1: federate.RequestFederateResponse + (*LeaveFederationRequest)(nil), // 2: federate.LeaveFederationRequest + (*LeaveFederationResponse)(nil), // 3: federate.LeaveFederationResponse +} +var file_proto_imp_api_federate_federate_proto_depIdxs = []int32{ + 0, // 0: federate.Federate.RequestFederate:input_type -> federate.RequestFederateRequest + 2, // 1: federate.Federate.LeaveFederation:input_type -> federate.LeaveFederationRequest + 1, // 2: federate.Federate.RequestFederate:output_type -> federate.RequestFederateResponse + 3, // 3: federate.Federate.LeaveFederation:output_type -> federate.LeaveFederationResponse + 2, // [2:4] is the sub-list for method output_type + 0, // [0:2] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_proto_imp_api_federate_federate_proto_init() } +func file_proto_imp_api_federate_federate_proto_init() { + if File_proto_imp_api_federate_federate_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_proto_imp_api_federate_federate_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RequestFederateRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_imp_api_federate_federate_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RequestFederateResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_imp_api_federate_federate_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LeaveFederationRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_imp_api_federate_federate_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LeaveFederationResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_proto_imp_api_federate_federate_proto_rawDesc, + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_proto_imp_api_federate_federate_proto_goTypes, + DependencyIndexes: file_proto_imp_api_federate_federate_proto_depIdxs, + MessageInfos: file_proto_imp_api_federate_federate_proto_msgTypes, + }.Build() + File_proto_imp_api_federate_federate_proto = out.File + file_proto_imp_api_federate_federate_proto_rawDesc = nil + file_proto_imp_api_federate_federate_proto_goTypes = nil + file_proto_imp_api_federate_federate_proto_depIdxs = nil +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConnInterface + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion6 + +// FederateClient is the client API for Federate service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type FederateClient interface { + //* + // RequestFederation performs the federation request to a specific peer. + RequestFederate(ctx context.Context, in *RequestFederateRequest, opts ...grpc.CallOption) (*RequestFederateResponse, error) + //* + // LeaveFederation performs the removal of a federated peer (upon message receipt). + LeaveFederation(ctx context.Context, in *LeaveFederationRequest, opts ...grpc.CallOption) (*LeaveFederationResponse, error) +} + +type federateClient struct { + cc grpc.ClientConnInterface +} + +func NewFederateClient(cc grpc.ClientConnInterface) FederateClient { + return &federateClient{cc} +} + +func (c *federateClient) RequestFederate(ctx context.Context, in *RequestFederateRequest, opts ...grpc.CallOption) (*RequestFederateResponse, error) { + out := new(RequestFederateResponse) + err := c.cc.Invoke(ctx, "/federate.Federate/RequestFederate", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *federateClient) LeaveFederation(ctx context.Context, in *LeaveFederationRequest, opts ...grpc.CallOption) (*LeaveFederationResponse, error) { + out := new(LeaveFederationResponse) + err := c.cc.Invoke(ctx, "/federate.Federate/LeaveFederation", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// FederateServer is the server API for Federate service. +type FederateServer interface { + //* + // RequestFederation performs the federation request to a specific peer. + RequestFederate(context.Context, *RequestFederateRequest) (*RequestFederateResponse, error) + //* + // LeaveFederation performs the removal of a federated peer (upon message receipt). + LeaveFederation(context.Context, *LeaveFederationRequest) (*LeaveFederationResponse, error) +} + +// UnimplementedFederateServer can be embedded to have forward compatible implementations. +type UnimplementedFederateServer struct { +} + +func (*UnimplementedFederateServer) RequestFederate(context.Context, *RequestFederateRequest) (*RequestFederateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RequestFederate not implemented") +} +func (*UnimplementedFederateServer) LeaveFederation(context.Context, *LeaveFederationRequest) (*LeaveFederationResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method LeaveFederation not implemented") +} + +func RegisterFederateServer(s *grpc.Server, srv FederateServer) { + s.RegisterService(&_Federate_serviceDesc, srv) +} + +func _Federate_RequestFederate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RequestFederateRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(FederateServer).RequestFederate(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/federate.Federate/RequestFederate", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FederateServer).RequestFederate(ctx, req.(*RequestFederateRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Federate_LeaveFederation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(LeaveFederationRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(FederateServer).LeaveFederation(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/federate.Federate/LeaveFederation", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FederateServer).LeaveFederation(ctx, req.(*LeaveFederationRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Federate_serviceDesc = grpc.ServiceDesc{ + ServiceName: "federate.Federate", + HandlerType: (*FederateServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "RequestFederate", + Handler: _Federate_RequestFederate_Handler, + }, + { + MethodName: "LeaveFederation", + Handler: _Federate_LeaveFederation_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "proto/imp/api/federate/federate.proto", +} diff --git a/go/proto/imp/api/federate/federate.pb.gw.go b/go/proto/imp/api/federate/federate.pb.gw.go new file mode 100644 index 0000000..3b64984 --- /dev/null +++ b/go/proto/imp/api/federate/federate.pb.gw.go @@ -0,0 +1,248 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: proto/imp/api/federate/federate.proto + +/* +Package gen is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package gen + +import ( + "context" + "io" + "net/http" + + "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" + "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = metadata.Join + +func request_Federate_RequestFederate_0(ctx context.Context, marshaler runtime.Marshaler, client FederateClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq RequestFederateRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.RequestFederate(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Federate_RequestFederate_0(ctx context.Context, marshaler runtime.Marshaler, server FederateServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq RequestFederateRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.RequestFederate(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Federate_LeaveFederation_0(ctx context.Context, marshaler runtime.Marshaler, client FederateClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq LeaveFederationRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.LeaveFederation(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Federate_LeaveFederation_0(ctx context.Context, marshaler runtime.Marshaler, server FederateServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq LeaveFederationRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.LeaveFederation(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterFederateHandlerServer registers the http handlers for service Federate to "mux". +// UnaryRPC :call FederateServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterFederateHandlerFromEndpoint instead. +func RegisterFederateHandlerServer(ctx context.Context, mux *runtime.ServeMux, server FederateServer) error { + + mux.Handle("POST", pattern_Federate_RequestFederate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/federate.Federate/RequestFederate", runtime.WithHTTPPathPattern("/v1/federate/request")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Federate_RequestFederate_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Federate_RequestFederate_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Federate_LeaveFederation_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/federate.Federate/LeaveFederation", runtime.WithHTTPPathPattern("/v1/federate/leave")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Federate_LeaveFederation_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Federate_LeaveFederation_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterFederateHandlerFromEndpoint is same as RegisterFederateHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterFederateHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterFederateHandler(ctx, mux, conn) +} + +// RegisterFederateHandler registers the http handlers for service Federate to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterFederateHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterFederateHandlerClient(ctx, mux, NewFederateClient(conn)) +} + +// RegisterFederateHandlerClient registers the http handlers for service Federate +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "FederateClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "FederateClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "FederateClient" to call the correct interceptors. +func RegisterFederateHandlerClient(ctx context.Context, mux *runtime.ServeMux, client FederateClient) error { + + mux.Handle("POST", pattern_Federate_RequestFederate_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req, "/federate.Federate/RequestFederate", runtime.WithHTTPPathPattern("/v1/federate/request")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Federate_RequestFederate_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Federate_RequestFederate_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Federate_LeaveFederation_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req, "/federate.Federate/LeaveFederation", runtime.WithHTTPPathPattern("/v1/federate/leave")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Federate_LeaveFederation_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Federate_LeaveFederation_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Federate_RequestFederate_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "federate", "request"}, "")) + + pattern_Federate_LeaveFederation_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "federate", "leave"}, "")) +) + +var ( + forward_Federate_RequestFederate_0 = runtime.ForwardResponseMessage + + forward_Federate_LeaveFederation_0 = runtime.ForwardResponseMessage +) diff --git a/go/proto/imp/api/lightning/lightning.pb.go b/go/proto/imp/api/lightning/lightning.pb.go new file mode 100644 index 0000000..813c964 --- /dev/null +++ b/go/proto/imp/api/lightning/lightning.pb.go @@ -0,0 +1,688 @@ +/// Allows for p2p messaging between Impervious nodes + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.1 +// protoc v3.17.3 +// source: proto/imp/api/lightning/lightning.proto + +package gen + +import ( + context "context" + _ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options" + _ "google.golang.org/genproto/googleapis/api/annotations" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +//* +// Represents an invoice creation request from your lightning node. +type GenerateInvoiceRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Amount int64 `protobuf:"varint,1,opt,name=amount,proto3" json:"amount,omitempty"` // The amount of satoshis you want to receive + Memo string `protobuf:"bytes,2,opt,name=memo,proto3" json:"memo,omitempty"` // The human readable memo you want the sender to see +} + +func (x *GenerateInvoiceRequest) Reset() { + *x = GenerateInvoiceRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_imp_api_lightning_lightning_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GenerateInvoiceRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GenerateInvoiceRequest) ProtoMessage() {} + +func (x *GenerateInvoiceRequest) ProtoReflect() protoreflect.Message { + mi := &file_proto_imp_api_lightning_lightning_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GenerateInvoiceRequest.ProtoReflect.Descriptor instead. +func (*GenerateInvoiceRequest) Descriptor() ([]byte, []int) { + return file_proto_imp_api_lightning_lightning_proto_rawDescGZIP(), []int{0} +} + +func (x *GenerateInvoiceRequest) GetAmount() int64 { + if x != nil { + return x.Amount + } + return 0 +} + +func (x *GenerateInvoiceRequest) GetMemo() string { + if x != nil { + return x.Memo + } + return "" +} + +//* +// Represents a response back from an invoice generation request. +type GenerateInvoiceResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Invoice string `protobuf:"bytes,1,opt,name=invoice,proto3" json:"invoice,omitempty"` // The invoice from your lightning node +} + +func (x *GenerateInvoiceResponse) Reset() { + *x = GenerateInvoiceResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_imp_api_lightning_lightning_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GenerateInvoiceResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GenerateInvoiceResponse) ProtoMessage() {} + +func (x *GenerateInvoiceResponse) ProtoReflect() protoreflect.Message { + mi := &file_proto_imp_api_lightning_lightning_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GenerateInvoiceResponse.ProtoReflect.Descriptor instead. +func (*GenerateInvoiceResponse) Descriptor() ([]byte, []int) { + return file_proto_imp_api_lightning_lightning_proto_rawDescGZIP(), []int{1} +} + +func (x *GenerateInvoiceResponse) GetInvoice() string { + if x != nil { + return x.Invoice + } + return "" +} + +//* +// Represents an invoice that will be paid by your lightning node. +type PayInvoiceRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Invoice string `protobuf:"bytes,1,opt,name=invoice,proto3" json:"invoice,omitempty"` // The invoice to pay +} + +func (x *PayInvoiceRequest) Reset() { + *x = PayInvoiceRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_imp_api_lightning_lightning_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PayInvoiceRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PayInvoiceRequest) ProtoMessage() {} + +func (x *PayInvoiceRequest) ProtoReflect() protoreflect.Message { + mi := &file_proto_imp_api_lightning_lightning_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PayInvoiceRequest.ProtoReflect.Descriptor instead. +func (*PayInvoiceRequest) Descriptor() ([]byte, []int) { + return file_proto_imp_api_lightning_lightning_proto_rawDescGZIP(), []int{2} +} + +func (x *PayInvoiceRequest) GetInvoice() string { + if x != nil { + return x.Invoice + } + return "" +} + +//* +// Represents a response back from the payment result. +type PayInvoiceResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Preimage string `protobuf:"bytes,1,opt,name=preimage,proto3" json:"preimage,omitempty"` // The preimage from the payment result, if successful +} + +func (x *PayInvoiceResponse) Reset() { + *x = PayInvoiceResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_imp_api_lightning_lightning_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PayInvoiceResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PayInvoiceResponse) ProtoMessage() {} + +func (x *PayInvoiceResponse) ProtoReflect() protoreflect.Message { + mi := &file_proto_imp_api_lightning_lightning_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use PayInvoiceResponse.ProtoReflect.Descriptor instead. +func (*PayInvoiceResponse) Descriptor() ([]byte, []int) { + return file_proto_imp_api_lightning_lightning_proto_rawDescGZIP(), []int{3} +} + +func (x *PayInvoiceResponse) GetPreimage() string { + if x != nil { + return x.Preimage + } + return "" +} + +//* +// Represents an request to check an invoice. +type CheckInvoiceRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Invoice string `protobuf:"bytes,1,opt,name=invoice,proto3" json:"invoice,omitempty"` // The invoice to check +} + +func (x *CheckInvoiceRequest) Reset() { + *x = CheckInvoiceRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_imp_api_lightning_lightning_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CheckInvoiceRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CheckInvoiceRequest) ProtoMessage() {} + +func (x *CheckInvoiceRequest) ProtoReflect() protoreflect.Message { + mi := &file_proto_imp_api_lightning_lightning_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CheckInvoiceRequest.ProtoReflect.Descriptor instead. +func (*CheckInvoiceRequest) Descriptor() ([]byte, []int) { + return file_proto_imp_api_lightning_lightning_proto_rawDescGZIP(), []int{4} +} + +func (x *CheckInvoiceRequest) GetInvoice() string { + if x != nil { + return x.Invoice + } + return "" +} + +//* +// Represents a response back from the invoice check. +type CheckInvoiceResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Paid bool `protobuf:"varint,1,opt,name=paid,proto3" json:"paid,omitempty"` // The boolean result representing whether or not the invoice was paid +} + +func (x *CheckInvoiceResponse) Reset() { + *x = CheckInvoiceResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_imp_api_lightning_lightning_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CheckInvoiceResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CheckInvoiceResponse) ProtoMessage() {} + +func (x *CheckInvoiceResponse) ProtoReflect() protoreflect.Message { + mi := &file_proto_imp_api_lightning_lightning_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CheckInvoiceResponse.ProtoReflect.Descriptor instead. +func (*CheckInvoiceResponse) Descriptor() ([]byte, []int) { + return file_proto_imp_api_lightning_lightning_proto_rawDescGZIP(), []int{5} +} + +func (x *CheckInvoiceResponse) GetPaid() bool { + if x != nil { + return x.Paid + } + return false +} + +var File_proto_imp_api_lightning_lightning_proto protoreflect.FileDescriptor + +var file_proto_imp_api_lightning_lightning_proto_rawDesc = []byte{ + 0x0a, 0x27, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x69, 0x6d, 0x70, 0x2f, 0x61, 0x70, 0x69, 0x2f, + 0x6c, 0x69, 0x67, 0x68, 0x74, 0x6e, 0x69, 0x6e, 0x67, 0x2f, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x6e, + 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x09, 0x6c, 0x69, 0x67, 0x68, 0x74, + 0x6e, 0x69, 0x6e, 0x67, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, + 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x6f, + 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x22, 0x44, 0x0a, 0x16, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x49, 0x6e, + 0x76, 0x6f, 0x69, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, + 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x61, 0x6d, + 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6d, 0x65, 0x6d, 0x6f, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x04, 0x6d, 0x65, 0x6d, 0x6f, 0x22, 0x33, 0x0a, 0x17, 0x47, 0x65, 0x6e, 0x65, + 0x72, 0x61, 0x74, 0x65, 0x49, 0x6e, 0x76, 0x6f, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x69, 0x6e, 0x76, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x69, 0x6e, 0x76, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x2d, 0x0a, + 0x11, 0x50, 0x61, 0x79, 0x49, 0x6e, 0x76, 0x6f, 0x69, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x69, 0x6e, 0x76, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x07, 0x69, 0x6e, 0x76, 0x6f, 0x69, 0x63, 0x65, 0x22, 0x30, 0x0a, 0x12, + 0x50, 0x61, 0x79, 0x49, 0x6e, 0x76, 0x6f, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x65, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x72, 0x65, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x22, 0x2f, + 0x0a, 0x13, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x49, 0x6e, 0x76, 0x6f, 0x69, 0x63, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x69, 0x6e, 0x76, 0x6f, 0x69, 0x63, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x69, 0x6e, 0x76, 0x6f, 0x69, 0x63, 0x65, 0x22, + 0x2a, 0x0a, 0x14, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x49, 0x6e, 0x76, 0x6f, 0x69, 0x63, 0x65, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x70, 0x61, 0x69, 0x64, 0x32, 0xf8, 0x02, 0x0a, 0x09, + 0x4c, 0x69, 0x67, 0x68, 0x74, 0x6e, 0x69, 0x6e, 0x67, 0x12, 0x82, 0x01, 0x0a, 0x0f, 0x47, 0x65, + 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x49, 0x6e, 0x76, 0x6f, 0x69, 0x63, 0x65, 0x12, 0x21, 0x2e, + 0x6c, 0x69, 0x67, 0x68, 0x74, 0x6e, 0x69, 0x6e, 0x67, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, + 0x74, 0x65, 0x49, 0x6e, 0x76, 0x6f, 0x69, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x22, 0x2e, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x6e, 0x69, 0x6e, 0x67, 0x2e, 0x47, 0x65, 0x6e, + 0x65, 0x72, 0x61, 0x74, 0x65, 0x49, 0x6e, 0x76, 0x6f, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x28, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x22, 0x22, 0x1d, 0x2f, 0x76, + 0x31, 0x2f, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x6e, 0x69, 0x6e, 0x67, 0x2f, 0x67, 0x65, 0x6e, 0x65, + 0x72, 0x61, 0x74, 0x65, 0x69, 0x6e, 0x76, 0x6f, 0x69, 0x63, 0x65, 0x3a, 0x01, 0x2a, 0x12, 0x6e, + 0x0a, 0x0a, 0x50, 0x61, 0x79, 0x49, 0x6e, 0x76, 0x6f, 0x69, 0x63, 0x65, 0x12, 0x1c, 0x2e, 0x6c, + 0x69, 0x67, 0x68, 0x74, 0x6e, 0x69, 0x6e, 0x67, 0x2e, 0x50, 0x61, 0x79, 0x49, 0x6e, 0x76, 0x6f, + 0x69, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x6c, 0x69, 0x67, + 0x68, 0x74, 0x6e, 0x69, 0x6e, 0x67, 0x2e, 0x50, 0x61, 0x79, 0x49, 0x6e, 0x76, 0x6f, 0x69, 0x63, + 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x23, 0x82, 0xd3, 0xe4, 0x93, 0x02, + 0x1d, 0x22, 0x18, 0x2f, 0x76, 0x31, 0x2f, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x6e, 0x69, 0x6e, 0x67, + 0x2f, 0x70, 0x61, 0x79, 0x69, 0x6e, 0x76, 0x6f, 0x69, 0x63, 0x65, 0x3a, 0x01, 0x2a, 0x12, 0x76, + 0x0a, 0x0c, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x49, 0x6e, 0x76, 0x6f, 0x69, 0x63, 0x65, 0x12, 0x1e, + 0x2e, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x6e, 0x69, 0x6e, 0x67, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, + 0x49, 0x6e, 0x76, 0x6f, 0x69, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, + 0x2e, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x6e, 0x69, 0x6e, 0x67, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, + 0x49, 0x6e, 0x76, 0x6f, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x25, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1f, 0x22, 0x1a, 0x2f, 0x76, 0x31, 0x2f, 0x6c, 0x69, 0x67, + 0x68, 0x74, 0x6e, 0x69, 0x6e, 0x67, 0x2f, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x69, 0x6e, 0x76, 0x6f, + 0x69, 0x63, 0x65, 0x3a, 0x01, 0x2a, 0x42, 0xdb, 0x01, 0x5a, 0x23, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x6d, 0x70, 0x65, 0x72, 0x76, 0x69, 0x6f, 0x75, 0x73, + 0x61, 0x69, 0x2f, 0x66, 0x72, 0x65, 0x65, 0x69, 0x6d, 0x70, 0x2f, 0x67, 0x65, 0x6e, 0x92, 0x41, + 0xb2, 0x01, 0x12, 0x41, 0x0a, 0x12, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x6e, 0x69, 0x6e, 0x67, 0x20, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x22, 0x26, 0x0a, 0x0d, 0x49, 0x6d, 0x70, 0x65, + 0x72, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x20, 0x41, 0x49, 0x12, 0x15, 0x68, 0x74, 0x74, 0x70, 0x73, + 0x3a, 0x2f, 0x2f, 0x69, 0x6d, 0x70, 0x65, 0x72, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x2e, 0x61, 0x69, + 0x32, 0x03, 0x31, 0x2e, 0x30, 0x2a, 0x03, 0x01, 0x02, 0x04, 0x32, 0x10, 0x61, 0x70, 0x70, 0x6c, + 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x73, 0x6f, 0x6e, 0x3a, 0x10, 0x61, 0x70, + 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x73, 0x6f, 0x6e, 0x72, 0x44, + 0x0a, 0x14, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, + 0x6f, 0x6e, 0x20, 0x49, 0x4d, 0x50, 0x12, 0x2c, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, + 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x6d, 0x70, 0x65, 0x72, + 0x76, 0x69, 0x6f, 0x75, 0x73, 0x61, 0x69, 0x2f, 0x69, 0x6d, 0x70, 0x2d, 0x72, 0x65, 0x6c, 0x65, + 0x61, 0x73, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_proto_imp_api_lightning_lightning_proto_rawDescOnce sync.Once + file_proto_imp_api_lightning_lightning_proto_rawDescData = file_proto_imp_api_lightning_lightning_proto_rawDesc +) + +func file_proto_imp_api_lightning_lightning_proto_rawDescGZIP() []byte { + file_proto_imp_api_lightning_lightning_proto_rawDescOnce.Do(func() { + file_proto_imp_api_lightning_lightning_proto_rawDescData = protoimpl.X.CompressGZIP(file_proto_imp_api_lightning_lightning_proto_rawDescData) + }) + return file_proto_imp_api_lightning_lightning_proto_rawDescData +} + +var file_proto_imp_api_lightning_lightning_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_proto_imp_api_lightning_lightning_proto_goTypes = []interface{}{ + (*GenerateInvoiceRequest)(nil), // 0: lightning.GenerateInvoiceRequest + (*GenerateInvoiceResponse)(nil), // 1: lightning.GenerateInvoiceResponse + (*PayInvoiceRequest)(nil), // 2: lightning.PayInvoiceRequest + (*PayInvoiceResponse)(nil), // 3: lightning.PayInvoiceResponse + (*CheckInvoiceRequest)(nil), // 4: lightning.CheckInvoiceRequest + (*CheckInvoiceResponse)(nil), // 5: lightning.CheckInvoiceResponse +} +var file_proto_imp_api_lightning_lightning_proto_depIdxs = []int32{ + 0, // 0: lightning.Lightning.GenerateInvoice:input_type -> lightning.GenerateInvoiceRequest + 2, // 1: lightning.Lightning.PayInvoice:input_type -> lightning.PayInvoiceRequest + 4, // 2: lightning.Lightning.CheckInvoice:input_type -> lightning.CheckInvoiceRequest + 1, // 3: lightning.Lightning.GenerateInvoice:output_type -> lightning.GenerateInvoiceResponse + 3, // 4: lightning.Lightning.PayInvoice:output_type -> lightning.PayInvoiceResponse + 5, // 5: lightning.Lightning.CheckInvoice:output_type -> lightning.CheckInvoiceResponse + 3, // [3:6] is the sub-list for method output_type + 0, // [0:3] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_proto_imp_api_lightning_lightning_proto_init() } +func file_proto_imp_api_lightning_lightning_proto_init() { + if File_proto_imp_api_lightning_lightning_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_proto_imp_api_lightning_lightning_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GenerateInvoiceRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_imp_api_lightning_lightning_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GenerateInvoiceResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_imp_api_lightning_lightning_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PayInvoiceRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_imp_api_lightning_lightning_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PayInvoiceResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_imp_api_lightning_lightning_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CheckInvoiceRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_imp_api_lightning_lightning_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CheckInvoiceResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_proto_imp_api_lightning_lightning_proto_rawDesc, + NumEnums: 0, + NumMessages: 6, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_proto_imp_api_lightning_lightning_proto_goTypes, + DependencyIndexes: file_proto_imp_api_lightning_lightning_proto_depIdxs, + MessageInfos: file_proto_imp_api_lightning_lightning_proto_msgTypes, + }.Build() + File_proto_imp_api_lightning_lightning_proto = out.File + file_proto_imp_api_lightning_lightning_proto_rawDesc = nil + file_proto_imp_api_lightning_lightning_proto_goTypes = nil + file_proto_imp_api_lightning_lightning_proto_depIdxs = nil +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConnInterface + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion6 + +// LightningClient is the client API for Lightning service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type LightningClient interface { + GenerateInvoice(ctx context.Context, in *GenerateInvoiceRequest, opts ...grpc.CallOption) (*GenerateInvoiceResponse, error) + PayInvoice(ctx context.Context, in *PayInvoiceRequest, opts ...grpc.CallOption) (*PayInvoiceResponse, error) + CheckInvoice(ctx context.Context, in *CheckInvoiceRequest, opts ...grpc.CallOption) (*CheckInvoiceResponse, error) +} + +type lightningClient struct { + cc grpc.ClientConnInterface +} + +func NewLightningClient(cc grpc.ClientConnInterface) LightningClient { + return &lightningClient{cc} +} + +func (c *lightningClient) GenerateInvoice(ctx context.Context, in *GenerateInvoiceRequest, opts ...grpc.CallOption) (*GenerateInvoiceResponse, error) { + out := new(GenerateInvoiceResponse) + err := c.cc.Invoke(ctx, "/lightning.Lightning/GenerateInvoice", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *lightningClient) PayInvoice(ctx context.Context, in *PayInvoiceRequest, opts ...grpc.CallOption) (*PayInvoiceResponse, error) { + out := new(PayInvoiceResponse) + err := c.cc.Invoke(ctx, "/lightning.Lightning/PayInvoice", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *lightningClient) CheckInvoice(ctx context.Context, in *CheckInvoiceRequest, opts ...grpc.CallOption) (*CheckInvoiceResponse, error) { + out := new(CheckInvoiceResponse) + err := c.cc.Invoke(ctx, "/lightning.Lightning/CheckInvoice", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// LightningServer is the server API for Lightning service. +type LightningServer interface { + GenerateInvoice(context.Context, *GenerateInvoiceRequest) (*GenerateInvoiceResponse, error) + PayInvoice(context.Context, *PayInvoiceRequest) (*PayInvoiceResponse, error) + CheckInvoice(context.Context, *CheckInvoiceRequest) (*CheckInvoiceResponse, error) +} + +// UnimplementedLightningServer can be embedded to have forward compatible implementations. +type UnimplementedLightningServer struct { +} + +func (*UnimplementedLightningServer) GenerateInvoice(context.Context, *GenerateInvoiceRequest) (*GenerateInvoiceResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GenerateInvoice not implemented") +} +func (*UnimplementedLightningServer) PayInvoice(context.Context, *PayInvoiceRequest) (*PayInvoiceResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method PayInvoice not implemented") +} +func (*UnimplementedLightningServer) CheckInvoice(context.Context, *CheckInvoiceRequest) (*CheckInvoiceResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CheckInvoice not implemented") +} + +func RegisterLightningServer(s *grpc.Server, srv LightningServer) { + s.RegisterService(&_Lightning_serviceDesc, srv) +} + +func _Lightning_GenerateInvoice_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GenerateInvoiceRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LightningServer).GenerateInvoice(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/lightning.Lightning/GenerateInvoice", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LightningServer).GenerateInvoice(ctx, req.(*GenerateInvoiceRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Lightning_PayInvoice_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PayInvoiceRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LightningServer).PayInvoice(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/lightning.Lightning/PayInvoice", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LightningServer).PayInvoice(ctx, req.(*PayInvoiceRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Lightning_CheckInvoice_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CheckInvoiceRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(LightningServer).CheckInvoice(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/lightning.Lightning/CheckInvoice", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(LightningServer).CheckInvoice(ctx, req.(*CheckInvoiceRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Lightning_serviceDesc = grpc.ServiceDesc{ + ServiceName: "lightning.Lightning", + HandlerType: (*LightningServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GenerateInvoice", + Handler: _Lightning_GenerateInvoice_Handler, + }, + { + MethodName: "PayInvoice", + Handler: _Lightning_PayInvoice_Handler, + }, + { + MethodName: "CheckInvoice", + Handler: _Lightning_CheckInvoice_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "proto/imp/api/lightning/lightning.proto", +} diff --git a/go/proto/imp/api/lightning/lightning.pb.gw.go b/go/proto/imp/api/lightning/lightning.pb.gw.go new file mode 100644 index 0000000..be63a6d --- /dev/null +++ b/go/proto/imp/api/lightning/lightning.pb.gw.go @@ -0,0 +1,329 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: proto/imp/api/lightning/lightning.proto + +/* +Package gen is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package gen + +import ( + "context" + "io" + "net/http" + + "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" + "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = metadata.Join + +func request_Lightning_GenerateInvoice_0(ctx context.Context, marshaler runtime.Marshaler, client LightningClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GenerateInvoiceRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.GenerateInvoice(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Lightning_GenerateInvoice_0(ctx context.Context, marshaler runtime.Marshaler, server LightningServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GenerateInvoiceRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.GenerateInvoice(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Lightning_PayInvoice_0(ctx context.Context, marshaler runtime.Marshaler, client LightningClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq PayInvoiceRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.PayInvoice(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Lightning_PayInvoice_0(ctx context.Context, marshaler runtime.Marshaler, server LightningServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq PayInvoiceRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.PayInvoice(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Lightning_CheckInvoice_0(ctx context.Context, marshaler runtime.Marshaler, client LightningClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq CheckInvoiceRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.CheckInvoice(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Lightning_CheckInvoice_0(ctx context.Context, marshaler runtime.Marshaler, server LightningServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq CheckInvoiceRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.CheckInvoice(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterLightningHandlerServer registers the http handlers for service Lightning to "mux". +// UnaryRPC :call LightningServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterLightningHandlerFromEndpoint instead. +func RegisterLightningHandlerServer(ctx context.Context, mux *runtime.ServeMux, server LightningServer) error { + + mux.Handle("POST", pattern_Lightning_GenerateInvoice_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/lightning.Lightning/GenerateInvoice", runtime.WithHTTPPathPattern("/v1/lightning/generateinvoice")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Lightning_GenerateInvoice_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Lightning_GenerateInvoice_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Lightning_PayInvoice_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/lightning.Lightning/PayInvoice", runtime.WithHTTPPathPattern("/v1/lightning/payinvoice")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Lightning_PayInvoice_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Lightning_PayInvoice_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Lightning_CheckInvoice_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/lightning.Lightning/CheckInvoice", runtime.WithHTTPPathPattern("/v1/lightning/checkinvoice")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Lightning_CheckInvoice_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Lightning_CheckInvoice_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterLightningHandlerFromEndpoint is same as RegisterLightningHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterLightningHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterLightningHandler(ctx, mux, conn) +} + +// RegisterLightningHandler registers the http handlers for service Lightning to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterLightningHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterLightningHandlerClient(ctx, mux, NewLightningClient(conn)) +} + +// RegisterLightningHandlerClient registers the http handlers for service Lightning +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "LightningClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "LightningClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "LightningClient" to call the correct interceptors. +func RegisterLightningHandlerClient(ctx context.Context, mux *runtime.ServeMux, client LightningClient) error { + + mux.Handle("POST", pattern_Lightning_GenerateInvoice_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req, "/lightning.Lightning/GenerateInvoice", runtime.WithHTTPPathPattern("/v1/lightning/generateinvoice")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Lightning_GenerateInvoice_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Lightning_GenerateInvoice_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Lightning_PayInvoice_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req, "/lightning.Lightning/PayInvoice", runtime.WithHTTPPathPattern("/v1/lightning/payinvoice")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Lightning_PayInvoice_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Lightning_PayInvoice_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Lightning_CheckInvoice_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req, "/lightning.Lightning/CheckInvoice", runtime.WithHTTPPathPattern("/v1/lightning/checkinvoice")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Lightning_CheckInvoice_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Lightning_CheckInvoice_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Lightning_GenerateInvoice_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "lightning", "generateinvoice"}, "")) + + pattern_Lightning_PayInvoice_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "lightning", "payinvoice"}, "")) + + pattern_Lightning_CheckInvoice_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "lightning", "checkinvoice"}, "")) +) + +var ( + forward_Lightning_GenerateInvoice_0 = runtime.ForwardResponseMessage + + forward_Lightning_PayInvoice_0 = runtime.ForwardResponseMessage + + forward_Lightning_CheckInvoice_0 = runtime.ForwardResponseMessage +) diff --git a/go/proto/imp/api/messaging/messaging.pb.go b/go/proto/imp/api/messaging/messaging.pb.go new file mode 100644 index 0000000..75ee6bd --- /dev/null +++ b/go/proto/imp/api/messaging/messaging.pb.go @@ -0,0 +1,335 @@ +/// Allows for p2p messaging between Impervious nodes + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.1 +// protoc v3.17.3 +// source: proto/imp/api/messaging/messaging.proto + +package gen + +import ( + context "context" + _ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options" + _ "google.golang.org/genproto/googleapis/api/annotations" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +//* +// Represents a message send to a far end node +type SendMessageRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Msg string `protobuf:"bytes,1,opt,name=msg,proto3" json:"msg,omitempty"` // the raw message itself to be sent to the far end node + Pubkey string `protobuf:"bytes,2,opt,name=pubkey,proto3" json:"pubkey,omitempty"` // The public key of the far end LND node running IMP +} + +func (x *SendMessageRequest) Reset() { + *x = SendMessageRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_imp_api_messaging_messaging_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SendMessageRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SendMessageRequest) ProtoMessage() {} + +func (x *SendMessageRequest) ProtoReflect() protoreflect.Message { + mi := &file_proto_imp_api_messaging_messaging_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SendMessageRequest.ProtoReflect.Descriptor instead. +func (*SendMessageRequest) Descriptor() ([]byte, []int) { + return file_proto_imp_api_messaging_messaging_proto_rawDescGZIP(), []int{0} +} + +func (x *SendMessageRequest) GetMsg() string { + if x != nil { + return x.Msg + } + return "" +} + +func (x *SendMessageRequest) GetPubkey() string { + if x != nil { + return x.Pubkey + } + return "" +} + +//* +// Represents a response back from a sent message +type SendMessageResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // returned message ID +} + +func (x *SendMessageResponse) Reset() { + *x = SendMessageResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_imp_api_messaging_messaging_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SendMessageResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SendMessageResponse) ProtoMessage() {} + +func (x *SendMessageResponse) ProtoReflect() protoreflect.Message { + mi := &file_proto_imp_api_messaging_messaging_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SendMessageResponse.ProtoReflect.Descriptor instead. +func (*SendMessageResponse) Descriptor() ([]byte, []int) { + return file_proto_imp_api_messaging_messaging_proto_rawDescGZIP(), []int{1} +} + +func (x *SendMessageResponse) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +var File_proto_imp_api_messaging_messaging_proto protoreflect.FileDescriptor + +var file_proto_imp_api_messaging_messaging_proto_rawDesc = []byte{ + 0x0a, 0x27, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x69, 0x6d, 0x70, 0x2f, 0x61, 0x70, 0x69, 0x2f, + 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x69, 0x6e, 0x67, 0x2f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x09, 0x6d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x69, 0x6e, 0x67, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, + 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x6f, + 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x22, 0x3e, 0x0a, 0x12, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6d, 0x73, 0x67, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x75, + 0x62, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x75, 0x62, 0x6b, + 0x65, 0x79, 0x22, 0x25, 0x0a, 0x13, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x32, 0x76, 0x0a, 0x09, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x69, 0x6e, 0x67, 0x12, 0x69, 0x0a, 0x0b, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x1d, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x69, 0x6e, + 0x67, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x69, 0x6e, 0x67, + 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x15, 0x22, 0x10, 0x2f, 0x76, + 0x31, 0x2f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2f, 0x73, 0x65, 0x6e, 0x64, 0x3a, 0x01, + 0x2a, 0x42, 0xdb, 0x01, 0x5a, 0x23, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x69, 0x6d, 0x70, 0x65, 0x72, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x61, 0x69, 0x2f, 0x66, 0x72, + 0x65, 0x65, 0x69, 0x6d, 0x70, 0x2f, 0x67, 0x65, 0x6e, 0x92, 0x41, 0xb2, 0x01, 0x12, 0x41, 0x0a, + 0x12, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x69, 0x6e, 0x67, 0x20, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x73, 0x22, 0x26, 0x0a, 0x0d, 0x49, 0x6d, 0x70, 0x65, 0x72, 0x76, 0x69, 0x6f, 0x75, + 0x73, 0x20, 0x41, 0x49, 0x12, 0x15, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x69, 0x6d, + 0x70, 0x65, 0x72, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x2e, 0x61, 0x69, 0x32, 0x03, 0x31, 0x2e, 0x30, + 0x2a, 0x03, 0x01, 0x02, 0x04, 0x32, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x2f, 0x6a, 0x73, 0x6f, 0x6e, 0x3a, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x73, 0x6f, 0x6e, 0x72, 0x44, 0x0a, 0x14, 0x44, 0x6f, 0x63, + 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x6e, 0x20, 0x49, 0x4d, + 0x50, 0x12, 0x2c, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x6d, 0x70, 0x65, 0x72, 0x76, 0x69, 0x6f, 0x75, 0x73, + 0x61, 0x69, 0x2f, 0x69, 0x6d, 0x70, 0x2d, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x73, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_proto_imp_api_messaging_messaging_proto_rawDescOnce sync.Once + file_proto_imp_api_messaging_messaging_proto_rawDescData = file_proto_imp_api_messaging_messaging_proto_rawDesc +) + +func file_proto_imp_api_messaging_messaging_proto_rawDescGZIP() []byte { + file_proto_imp_api_messaging_messaging_proto_rawDescOnce.Do(func() { + file_proto_imp_api_messaging_messaging_proto_rawDescData = protoimpl.X.CompressGZIP(file_proto_imp_api_messaging_messaging_proto_rawDescData) + }) + return file_proto_imp_api_messaging_messaging_proto_rawDescData +} + +var file_proto_imp_api_messaging_messaging_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_proto_imp_api_messaging_messaging_proto_goTypes = []interface{}{ + (*SendMessageRequest)(nil), // 0: messaging.SendMessageRequest + (*SendMessageResponse)(nil), // 1: messaging.SendMessageResponse +} +var file_proto_imp_api_messaging_messaging_proto_depIdxs = []int32{ + 0, // 0: messaging.Messaging.SendMessage:input_type -> messaging.SendMessageRequest + 1, // 1: messaging.Messaging.SendMessage:output_type -> messaging.SendMessageResponse + 1, // [1:2] is the sub-list for method output_type + 0, // [0:1] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_proto_imp_api_messaging_messaging_proto_init() } +func file_proto_imp_api_messaging_messaging_proto_init() { + if File_proto_imp_api_messaging_messaging_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_proto_imp_api_messaging_messaging_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SendMessageRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_imp_api_messaging_messaging_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SendMessageResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_proto_imp_api_messaging_messaging_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_proto_imp_api_messaging_messaging_proto_goTypes, + DependencyIndexes: file_proto_imp_api_messaging_messaging_proto_depIdxs, + MessageInfos: file_proto_imp_api_messaging_messaging_proto_msgTypes, + }.Build() + File_proto_imp_api_messaging_messaging_proto = out.File + file_proto_imp_api_messaging_messaging_proto_rawDesc = nil + file_proto_imp_api_messaging_messaging_proto_goTypes = nil + file_proto_imp_api_messaging_messaging_proto_depIdxs = nil +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConnInterface + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion6 + +// MessagingClient is the client API for Messaging service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type MessagingClient interface { + SendMessage(ctx context.Context, in *SendMessageRequest, opts ...grpc.CallOption) (*SendMessageResponse, error) +} + +type messagingClient struct { + cc grpc.ClientConnInterface +} + +func NewMessagingClient(cc grpc.ClientConnInterface) MessagingClient { + return &messagingClient{cc} +} + +func (c *messagingClient) SendMessage(ctx context.Context, in *SendMessageRequest, opts ...grpc.CallOption) (*SendMessageResponse, error) { + out := new(SendMessageResponse) + err := c.cc.Invoke(ctx, "/messaging.Messaging/SendMessage", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MessagingServer is the server API for Messaging service. +type MessagingServer interface { + SendMessage(context.Context, *SendMessageRequest) (*SendMessageResponse, error) +} + +// UnimplementedMessagingServer can be embedded to have forward compatible implementations. +type UnimplementedMessagingServer struct { +} + +func (*UnimplementedMessagingServer) SendMessage(context.Context, *SendMessageRequest) (*SendMessageResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SendMessage not implemented") +} + +func RegisterMessagingServer(s *grpc.Server, srv MessagingServer) { + s.RegisterService(&_Messaging_serviceDesc, srv) +} + +func _Messaging_SendMessage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SendMessageRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MessagingServer).SendMessage(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/messaging.Messaging/SendMessage", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MessagingServer).SendMessage(ctx, req.(*SendMessageRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Messaging_serviceDesc = grpc.ServiceDesc{ + ServiceName: "messaging.Messaging", + HandlerType: (*MessagingServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "SendMessage", + Handler: _Messaging_SendMessage_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "proto/imp/api/messaging/messaging.proto", +} diff --git a/go/proto/imp/api/messaging/messaging.pb.gw.go b/go/proto/imp/api/messaging/messaging.pb.gw.go new file mode 100644 index 0000000..4454432 --- /dev/null +++ b/go/proto/imp/api/messaging/messaging.pb.gw.go @@ -0,0 +1,167 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: proto/imp/api/messaging/messaging.proto + +/* +Package gen is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package gen + +import ( + "context" + "io" + "net/http" + + "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" + "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = metadata.Join + +func request_Messaging_SendMessage_0(ctx context.Context, marshaler runtime.Marshaler, client MessagingClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq SendMessageRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.SendMessage(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Messaging_SendMessage_0(ctx context.Context, marshaler runtime.Marshaler, server MessagingServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq SendMessageRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.SendMessage(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterMessagingHandlerServer registers the http handlers for service Messaging to "mux". +// UnaryRPC :call MessagingServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterMessagingHandlerFromEndpoint instead. +func RegisterMessagingHandlerServer(ctx context.Context, mux *runtime.ServeMux, server MessagingServer) error { + + mux.Handle("POST", pattern_Messaging_SendMessage_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/messaging.Messaging/SendMessage", runtime.WithHTTPPathPattern("/v1/message/send")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Messaging_SendMessage_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Messaging_SendMessage_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterMessagingHandlerFromEndpoint is same as RegisterMessagingHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterMessagingHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterMessagingHandler(ctx, mux, conn) +} + +// RegisterMessagingHandler registers the http handlers for service Messaging to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterMessagingHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterMessagingHandlerClient(ctx, mux, NewMessagingClient(conn)) +} + +// RegisterMessagingHandlerClient registers the http handlers for service Messaging +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "MessagingClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "MessagingClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "MessagingClient" to call the correct interceptors. +func RegisterMessagingHandlerClient(ctx context.Context, mux *runtime.ServeMux, client MessagingClient) error { + + mux.Handle("POST", pattern_Messaging_SendMessage_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req, "/messaging.Messaging/SendMessage", runtime.WithHTTPPathPattern("/v1/message/send")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Messaging_SendMessage_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Messaging_SendMessage_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Messaging_SendMessage_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "message", "send"}, "")) +) + +var ( + forward_Messaging_SendMessage_0 = runtime.ForwardResponseMessage +) diff --git a/go/proto/imp/api/signing/signing.pb.go b/go/proto/imp/api/signing/signing.pb.go new file mode 100644 index 0000000..5e3c821 --- /dev/null +++ b/go/proto/imp/api/signing/signing.pb.go @@ -0,0 +1,506 @@ +/// Allows an Imp node to sign and verify messaging with the connected LND + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.1 +// protoc v3.17.3 +// source: proto/imp/api/signing/signing.proto + +package gen + +import ( + context "context" + _ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options" + _ "google.golang.org/genproto/googleapis/api/annotations" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +//* +// Represents a request to sign a message +type SignRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Msg string `protobuf:"bytes,1,opt,name=msg,proto3" json:"msg,omitempty"` // message to be signed +} + +func (x *SignRequest) Reset() { + *x = SignRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_imp_api_signing_signing_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SignRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SignRequest) ProtoMessage() {} + +func (x *SignRequest) ProtoReflect() protoreflect.Message { + mi := &file_proto_imp_api_signing_signing_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SignRequest.ProtoReflect.Descriptor instead. +func (*SignRequest) Descriptor() ([]byte, []int) { + return file_proto_imp_api_signing_signing_proto_rawDescGZIP(), []int{0} +} + +func (x *SignRequest) GetMsg() string { + if x != nil { + return x.Msg + } + return "" +} + +//* +// Represents a response from a signature request +type SignResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Signature string `protobuf:"bytes,1,opt,name=signature,proto3" json:"signature,omitempty"` // signature of signed message returned from LND +} + +func (x *SignResponse) Reset() { + *x = SignResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_imp_api_signing_signing_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SignResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SignResponse) ProtoMessage() {} + +func (x *SignResponse) ProtoReflect() protoreflect.Message { + mi := &file_proto_imp_api_signing_signing_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SignResponse.ProtoReflect.Descriptor instead. +func (*SignResponse) Descriptor() ([]byte, []int) { + return file_proto_imp_api_signing_signing_proto_rawDescGZIP(), []int{1} +} + +func (x *SignResponse) GetSignature() string { + if x != nil { + return x.Signature + } + return "" +} + +//* +// Represents a request to verify a signature and message +type VerifyRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Msg string `protobuf:"bytes,1,opt,name=msg,proto3" json:"msg,omitempty"` // message to be verified + Signature string `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` // signature of message +} + +func (x *VerifyRequest) Reset() { + *x = VerifyRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_imp_api_signing_signing_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *VerifyRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VerifyRequest) ProtoMessage() {} + +func (x *VerifyRequest) ProtoReflect() protoreflect.Message { + mi := &file_proto_imp_api_signing_signing_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use VerifyRequest.ProtoReflect.Descriptor instead. +func (*VerifyRequest) Descriptor() ([]byte, []int) { + return file_proto_imp_api_signing_signing_proto_rawDescGZIP(), []int{2} +} + +func (x *VerifyRequest) GetMsg() string { + if x != nil { + return x.Msg + } + return "" +} + +func (x *VerifyRequest) GetSignature() string { + if x != nil { + return x.Signature + } + return "" +} + +//* +// Represents a response back from a verification request +type VerifyResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Result bool `protobuf:"varint,1,opt,name=result,proto3" json:"result,omitempty"` // result of signature verification +} + +func (x *VerifyResponse) Reset() { + *x = VerifyResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_imp_api_signing_signing_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *VerifyResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VerifyResponse) ProtoMessage() {} + +func (x *VerifyResponse) ProtoReflect() protoreflect.Message { + mi := &file_proto_imp_api_signing_signing_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use VerifyResponse.ProtoReflect.Descriptor instead. +func (*VerifyResponse) Descriptor() ([]byte, []int) { + return file_proto_imp_api_signing_signing_proto_rawDescGZIP(), []int{3} +} + +func (x *VerifyResponse) GetResult() bool { + if x != nil { + return x.Result + } + return false +} + +var File_proto_imp_api_signing_signing_proto protoreflect.FileDescriptor + +var file_proto_imp_api_signing_signing_proto_rawDesc = []byte{ + 0x0a, 0x23, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x69, 0x6d, 0x70, 0x2f, 0x61, 0x70, 0x69, 0x2f, + 0x73, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x2f, 0x73, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x07, 0x73, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x1a, 0x1c, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, + 0x76, 0x32, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x1f, 0x0a, 0x0b, + 0x53, 0x69, 0x67, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6d, + 0x73, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6d, 0x73, 0x67, 0x22, 0x2c, 0x0a, + 0x0c, 0x53, 0x69, 0x67, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1c, 0x0a, + 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0x3f, 0x0a, 0x0d, 0x56, + 0x65, 0x72, 0x69, 0x66, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, + 0x6d, 0x73, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6d, 0x73, 0x67, 0x12, 0x1c, + 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0x28, 0x0a, 0x0e, + 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, + 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, + 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x32, 0xb5, 0x01, 0x0a, 0x07, 0x53, 0x69, 0x67, 0x6e, 0x69, + 0x6e, 0x67, 0x12, 0x4f, 0x0a, 0x0b, 0x53, 0x69, 0x67, 0x6e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, + 0x65, 0x12, 0x14, 0x2e, 0x73, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x2e, 0x53, 0x69, 0x67, 0x6e, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x73, 0x69, 0x67, 0x6e, 0x69, 0x6e, + 0x67, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x13, + 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0d, 0x22, 0x08, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x69, 0x67, 0x6e, + 0x3a, 0x01, 0x2a, 0x12, 0x59, 0x0a, 0x0f, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x53, 0x69, 0x67, + 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x16, 0x2e, 0x73, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, + 0x2e, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, + 0x2e, 0x73, 0x69, 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x2e, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x15, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0f, 0x22, + 0x0a, 0x2f, 0x76, 0x31, 0x2f, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x3a, 0x01, 0x2a, 0x42, 0xd9, + 0x01, 0x5a, 0x23, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x6d, + 0x70, 0x65, 0x72, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x61, 0x69, 0x2f, 0x66, 0x72, 0x65, 0x65, 0x69, + 0x6d, 0x70, 0x2f, 0x67, 0x65, 0x6e, 0x92, 0x41, 0xb0, 0x01, 0x12, 0x3f, 0x0a, 0x10, 0x53, 0x69, + 0x67, 0x6e, 0x69, 0x6e, 0x67, 0x20, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x22, 0x26, + 0x0a, 0x0d, 0x49, 0x6d, 0x70, 0x65, 0x72, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x20, 0x41, 0x49, 0x12, + 0x15, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x69, 0x6d, 0x70, 0x65, 0x72, 0x76, 0x69, + 0x6f, 0x75, 0x73, 0x2e, 0x61, 0x69, 0x32, 0x03, 0x31, 0x2e, 0x30, 0x2a, 0x03, 0x01, 0x02, 0x04, + 0x32, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x73, + 0x6f, 0x6e, 0x3a, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, + 0x6a, 0x73, 0x6f, 0x6e, 0x72, 0x44, 0x0a, 0x14, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x6e, 0x20, 0x49, 0x4d, 0x50, 0x12, 0x2c, 0x68, 0x74, + 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x69, 0x6d, 0x70, 0x65, 0x72, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x61, 0x69, 0x2f, 0x69, 0x6d, + 0x70, 0x2d, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, +} + +var ( + file_proto_imp_api_signing_signing_proto_rawDescOnce sync.Once + file_proto_imp_api_signing_signing_proto_rawDescData = file_proto_imp_api_signing_signing_proto_rawDesc +) + +func file_proto_imp_api_signing_signing_proto_rawDescGZIP() []byte { + file_proto_imp_api_signing_signing_proto_rawDescOnce.Do(func() { + file_proto_imp_api_signing_signing_proto_rawDescData = protoimpl.X.CompressGZIP(file_proto_imp_api_signing_signing_proto_rawDescData) + }) + return file_proto_imp_api_signing_signing_proto_rawDescData +} + +var file_proto_imp_api_signing_signing_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_proto_imp_api_signing_signing_proto_goTypes = []interface{}{ + (*SignRequest)(nil), // 0: signing.SignRequest + (*SignResponse)(nil), // 1: signing.SignResponse + (*VerifyRequest)(nil), // 2: signing.VerifyRequest + (*VerifyResponse)(nil), // 3: signing.VerifyResponse +} +var file_proto_imp_api_signing_signing_proto_depIdxs = []int32{ + 0, // 0: signing.Signing.SignMessage:input_type -> signing.SignRequest + 2, // 1: signing.Signing.VerifySignature:input_type -> signing.VerifyRequest + 1, // 2: signing.Signing.SignMessage:output_type -> signing.SignResponse + 3, // 3: signing.Signing.VerifySignature:output_type -> signing.VerifyResponse + 2, // [2:4] is the sub-list for method output_type + 0, // [0:2] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_proto_imp_api_signing_signing_proto_init() } +func file_proto_imp_api_signing_signing_proto_init() { + if File_proto_imp_api_signing_signing_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_proto_imp_api_signing_signing_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SignRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_imp_api_signing_signing_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SignResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_imp_api_signing_signing_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*VerifyRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_imp_api_signing_signing_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*VerifyResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_proto_imp_api_signing_signing_proto_rawDesc, + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_proto_imp_api_signing_signing_proto_goTypes, + DependencyIndexes: file_proto_imp_api_signing_signing_proto_depIdxs, + MessageInfos: file_proto_imp_api_signing_signing_proto_msgTypes, + }.Build() + File_proto_imp_api_signing_signing_proto = out.File + file_proto_imp_api_signing_signing_proto_rawDesc = nil + file_proto_imp_api_signing_signing_proto_goTypes = nil + file_proto_imp_api_signing_signing_proto_depIdxs = nil +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConnInterface + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion6 + +// SigningClient is the client API for Signing service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type SigningClient interface { + SignMessage(ctx context.Context, in *SignRequest, opts ...grpc.CallOption) (*SignResponse, error) + VerifySignature(ctx context.Context, in *VerifyRequest, opts ...grpc.CallOption) (*VerifyResponse, error) +} + +type signingClient struct { + cc grpc.ClientConnInterface +} + +func NewSigningClient(cc grpc.ClientConnInterface) SigningClient { + return &signingClient{cc} +} + +func (c *signingClient) SignMessage(ctx context.Context, in *SignRequest, opts ...grpc.CallOption) (*SignResponse, error) { + out := new(SignResponse) + err := c.cc.Invoke(ctx, "/signing.Signing/SignMessage", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *signingClient) VerifySignature(ctx context.Context, in *VerifyRequest, opts ...grpc.CallOption) (*VerifyResponse, error) { + out := new(VerifyResponse) + err := c.cc.Invoke(ctx, "/signing.Signing/VerifySignature", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// SigningServer is the server API for Signing service. +type SigningServer interface { + SignMessage(context.Context, *SignRequest) (*SignResponse, error) + VerifySignature(context.Context, *VerifyRequest) (*VerifyResponse, error) +} + +// UnimplementedSigningServer can be embedded to have forward compatible implementations. +type UnimplementedSigningServer struct { +} + +func (*UnimplementedSigningServer) SignMessage(context.Context, *SignRequest) (*SignResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SignMessage not implemented") +} +func (*UnimplementedSigningServer) VerifySignature(context.Context, *VerifyRequest) (*VerifyResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method VerifySignature not implemented") +} + +func RegisterSigningServer(s *grpc.Server, srv SigningServer) { + s.RegisterService(&_Signing_serviceDesc, srv) +} + +func _Signing_SignMessage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SignRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SigningServer).SignMessage(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/signing.Signing/SignMessage", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SigningServer).SignMessage(ctx, req.(*SignRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Signing_VerifySignature_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(VerifyRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SigningServer).VerifySignature(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/signing.Signing/VerifySignature", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SigningServer).VerifySignature(ctx, req.(*VerifyRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Signing_serviceDesc = grpc.ServiceDesc{ + ServiceName: "signing.Signing", + HandlerType: (*SigningServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "SignMessage", + Handler: _Signing_SignMessage_Handler, + }, + { + MethodName: "VerifySignature", + Handler: _Signing_VerifySignature_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "proto/imp/api/signing/signing.proto", +} diff --git a/go/proto/imp/api/signing/signing.pb.gw.go b/go/proto/imp/api/signing/signing.pb.gw.go new file mode 100644 index 0000000..28b7f42 --- /dev/null +++ b/go/proto/imp/api/signing/signing.pb.gw.go @@ -0,0 +1,248 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: proto/imp/api/signing/signing.proto + +/* +Package gen is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package gen + +import ( + "context" + "io" + "net/http" + + "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" + "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = metadata.Join + +func request_Signing_SignMessage_0(ctx context.Context, marshaler runtime.Marshaler, client SigningClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq SignRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.SignMessage(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Signing_SignMessage_0(ctx context.Context, marshaler runtime.Marshaler, server SigningServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq SignRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.SignMessage(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Signing_VerifySignature_0(ctx context.Context, marshaler runtime.Marshaler, client SigningClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq VerifyRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.VerifySignature(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Signing_VerifySignature_0(ctx context.Context, marshaler runtime.Marshaler, server SigningServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq VerifyRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.VerifySignature(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterSigningHandlerServer registers the http handlers for service Signing to "mux". +// UnaryRPC :call SigningServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterSigningHandlerFromEndpoint instead. +func RegisterSigningHandlerServer(ctx context.Context, mux *runtime.ServeMux, server SigningServer) error { + + mux.Handle("POST", pattern_Signing_SignMessage_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/signing.Signing/SignMessage", runtime.WithHTTPPathPattern("/v1/sign")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Signing_SignMessage_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Signing_SignMessage_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Signing_VerifySignature_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/signing.Signing/VerifySignature", runtime.WithHTTPPathPattern("/v1/verify")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Signing_VerifySignature_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Signing_VerifySignature_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterSigningHandlerFromEndpoint is same as RegisterSigningHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterSigningHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterSigningHandler(ctx, mux, conn) +} + +// RegisterSigningHandler registers the http handlers for service Signing to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterSigningHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterSigningHandlerClient(ctx, mux, NewSigningClient(conn)) +} + +// RegisterSigningHandlerClient registers the http handlers for service Signing +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "SigningClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "SigningClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "SigningClient" to call the correct interceptors. +func RegisterSigningHandlerClient(ctx context.Context, mux *runtime.ServeMux, client SigningClient) error { + + mux.Handle("POST", pattern_Signing_SignMessage_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req, "/signing.Signing/SignMessage", runtime.WithHTTPPathPattern("/v1/sign")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Signing_SignMessage_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Signing_SignMessage_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Signing_VerifySignature_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req, "/signing.Signing/VerifySignature", runtime.WithHTTPPathPattern("/v1/verify")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Signing_VerifySignature_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Signing_VerifySignature_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Signing_SignMessage_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "sign"}, "")) + + pattern_Signing_VerifySignature_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "verify"}, "")) +) + +var ( + forward_Signing_SignMessage_0 = runtime.ForwardResponseMessage + + forward_Signing_VerifySignature_0 = runtime.ForwardResponseMessage +) diff --git a/go/proto/imp/api/socket/socket.pb.go b/go/proto/imp/api/socket/socket.pb.go new file mode 100644 index 0000000..a4c68e9 --- /dev/null +++ b/go/proto/imp/api/socket/socket.pb.go @@ -0,0 +1,669 @@ +/// Allows for p2p sockets to be established between Impervious nodes + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.1 +// protoc v3.17.3 +// source: proto/imp/api/socket/socket.proto + +package gen + +import ( + context "context" + _ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options" + _ "google.golang.org/genproto/googleapis/api/annotations" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +//* +// Represents a request to send socket connection information to a far end node +type SendSocketRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Pubkey string `protobuf:"bytes,1,opt,name=pubkey,proto3" json:"pubkey,omitempty"` // The public key of the far end LND node running IMP +} + +func (x *SendSocketRequest) Reset() { + *x = SendSocketRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_imp_api_socket_socket_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SendSocketRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SendSocketRequest) ProtoMessage() {} + +func (x *SendSocketRequest) ProtoReflect() protoreflect.Message { + mi := &file_proto_imp_api_socket_socket_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SendSocketRequest.ProtoReflect.Descriptor instead. +func (*SendSocketRequest) Descriptor() ([]byte, []int) { + return file_proto_imp_api_socket_socket_proto_rawDescGZIP(), []int{0} +} + +func (x *SendSocketRequest) GetPubkey() string { + if x != nil { + return x.Pubkey + } + return "" +} + +//* +// Represents a response back from the request to establish a socket +type SendSocketResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // returned message ID +} + +func (x *SendSocketResponse) Reset() { + *x = SendSocketResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_imp_api_socket_socket_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SendSocketResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SendSocketResponse) ProtoMessage() {} + +func (x *SendSocketResponse) ProtoReflect() protoreflect.Message { + mi := &file_proto_imp_api_socket_socket_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SendSocketResponse.ProtoReflect.Descriptor instead. +func (*SendSocketResponse) Descriptor() ([]byte, []int) { + return file_proto_imp_api_socket_socket_proto_rawDescGZIP(), []int{1} +} + +func (x *SendSocketResponse) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +//* +// Represents a request to start a socket on an owned IMP node +type StartSocketRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *StartSocketRequest) Reset() { + *x = StartSocketRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_imp_api_socket_socket_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StartSocketRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StartSocketRequest) ProtoMessage() {} + +func (x *StartSocketRequest) ProtoReflect() protoreflect.Message { + mi := &file_proto_imp_api_socket_socket_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StartSocketRequest.ProtoReflect.Descriptor instead. +func (*StartSocketRequest) Descriptor() ([]byte, []int) { + return file_proto_imp_api_socket_socket_proto_rawDescGZIP(), []int{2} +} + +//* +// Represents a response containing socket information from a started socket +type StartSocketResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Protocol string `protobuf:"bytes,1,opt,name=protocol,proto3" json:"protocol,omitempty"` // the protocol of the socket connection + Ip string `protobuf:"bytes,2,opt,name=ip,proto3" json:"ip,omitempty"` // the ip of the IMP node to connect to + Port1 string `protobuf:"bytes,3,opt,name=port1,proto3" json:"port1,omitempty"` // the first port of the socket connection + Port2 string `protobuf:"bytes,4,opt,name=port2,proto3" json:"port2,omitempty"` // the second port of the socket connection +} + +func (x *StartSocketResponse) Reset() { + *x = StartSocketResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_imp_api_socket_socket_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StartSocketResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StartSocketResponse) ProtoMessage() {} + +func (x *StartSocketResponse) ProtoReflect() protoreflect.Message { + mi := &file_proto_imp_api_socket_socket_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StartSocketResponse.ProtoReflect.Descriptor instead. +func (*StartSocketResponse) Descriptor() ([]byte, []int) { + return file_proto_imp_api_socket_socket_proto_rawDescGZIP(), []int{3} +} + +func (x *StartSocketResponse) GetProtocol() string { + if x != nil { + return x.Protocol + } + return "" +} + +func (x *StartSocketResponse) GetIp() string { + if x != nil { + return x.Ip + } + return "" +} + +func (x *StartSocketResponse) GetPort1() string { + if x != nil { + return x.Port1 + } + return "" +} + +func (x *StartSocketResponse) GetPort2() string { + if x != nil { + return x.Port2 + } + return "" +} + +//* +// Represents a request to stop a socket on an owned IMP node +type StopSocketRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *StopSocketRequest) Reset() { + *x = StopSocketRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_imp_api_socket_socket_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StopSocketRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StopSocketRequest) ProtoMessage() {} + +func (x *StopSocketRequest) ProtoReflect() protoreflect.Message { + mi := &file_proto_imp_api_socket_socket_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StopSocketRequest.ProtoReflect.Descriptor instead. +func (*StopSocketRequest) Descriptor() ([]byte, []int) { + return file_proto_imp_api_socket_socket_proto_rawDescGZIP(), []int{4} +} + +//* +// Represents a response back from a stopped socket +type StopSocketResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *StopSocketResponse) Reset() { + *x = StopSocketResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_imp_api_socket_socket_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *StopSocketResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*StopSocketResponse) ProtoMessage() {} + +func (x *StopSocketResponse) ProtoReflect() protoreflect.Message { + mi := &file_proto_imp_api_socket_socket_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use StopSocketResponse.ProtoReflect.Descriptor instead. +func (*StopSocketResponse) Descriptor() ([]byte, []int) { + return file_proto_imp_api_socket_socket_proto_rawDescGZIP(), []int{5} +} + +var File_proto_imp_api_socket_socket_proto protoreflect.FileDescriptor + +var file_proto_imp_api_socket_socket_proto_rawDesc = []byte{ + 0x0a, 0x21, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x69, 0x6d, 0x70, 0x2f, 0x61, 0x70, 0x69, 0x2f, + 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x2f, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, + 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2f, + 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x2b, 0x0a, 0x11, 0x53, 0x65, 0x6e, + 0x64, 0x53, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, + 0x0a, 0x06, 0x70, 0x75, 0x62, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, + 0x70, 0x75, 0x62, 0x6b, 0x65, 0x79, 0x22, 0x24, 0x0a, 0x12, 0x53, 0x65, 0x6e, 0x64, 0x53, 0x6f, + 0x63, 0x6b, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x14, 0x0a, 0x12, + 0x53, 0x74, 0x61, 0x72, 0x74, 0x53, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x22, 0x6d, 0x0a, 0x13, 0x53, 0x74, 0x61, 0x72, 0x74, 0x53, 0x6f, 0x63, 0x6b, 0x65, + 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x02, 0x69, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x6f, 0x72, 0x74, 0x31, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x70, 0x6f, 0x72, 0x74, 0x31, 0x12, 0x14, 0x0a, 0x05, 0x70, + 0x6f, 0x72, 0x74, 0x32, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x70, 0x6f, 0x72, 0x74, + 0x32, 0x22, 0x13, 0x0a, 0x11, 0x53, 0x74, 0x6f, 0x70, 0x53, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x14, 0x0a, 0x12, 0x53, 0x74, 0x6f, 0x70, 0x53, 0x6f, + 0x63, 0x6b, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xb6, 0x02, 0x0a, + 0x06, 0x53, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x12, 0x66, 0x0a, 0x0a, 0x53, 0x65, 0x6e, 0x64, 0x53, + 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x12, 0x19, 0x2e, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x53, + 0x65, 0x6e, 0x64, 0x53, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x1a, 0x2e, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x53, 0x6f, + 0x63, 0x6b, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x21, 0x82, 0xd3, + 0xe4, 0x93, 0x02, 0x1b, 0x22, 0x16, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, + 0x2f, 0x73, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x3a, 0x01, 0x2a, 0x12, + 0x63, 0x0a, 0x0b, 0x53, 0x74, 0x61, 0x72, 0x74, 0x53, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x12, 0x1a, + 0x2e, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x53, 0x74, 0x61, 0x72, 0x74, 0x53, 0x6f, 0x63, + 0x6b, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x73, 0x6f, 0x63, + 0x6b, 0x65, 0x74, 0x2e, 0x53, 0x74, 0x61, 0x72, 0x74, 0x53, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x15, 0x22, + 0x10, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x2f, 0x73, 0x74, 0x61, 0x72, + 0x74, 0x3a, 0x01, 0x2a, 0x12, 0x5f, 0x0a, 0x0a, 0x53, 0x74, 0x6f, 0x70, 0x53, 0x6f, 0x63, 0x6b, + 0x65, 0x74, 0x12, 0x19, 0x2e, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x53, 0x74, 0x6f, 0x70, + 0x53, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, + 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x53, 0x74, 0x6f, 0x70, 0x53, 0x6f, 0x63, 0x6b, 0x65, + 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1a, 0x82, 0xd3, 0xe4, 0x93, 0x02, + 0x14, 0x22, 0x0f, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x2f, 0x73, 0x74, + 0x6f, 0x70, 0x3a, 0x01, 0x2a, 0x42, 0xd8, 0x01, 0x5a, 0x23, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x6d, 0x70, 0x65, 0x72, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x61, + 0x69, 0x2f, 0x66, 0x72, 0x65, 0x65, 0x69, 0x6d, 0x70, 0x2f, 0x67, 0x65, 0x6e, 0x92, 0x41, 0xaf, + 0x01, 0x12, 0x3e, 0x0a, 0x0f, 0x53, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x20, 0x53, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x73, 0x22, 0x26, 0x0a, 0x0d, 0x49, 0x6d, 0x70, 0x65, 0x72, 0x76, 0x69, 0x6f, + 0x75, 0x73, 0x20, 0x41, 0x49, 0x12, 0x15, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x69, + 0x6d, 0x70, 0x65, 0x72, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x2e, 0x61, 0x69, 0x32, 0x03, 0x31, 0x2e, + 0x30, 0x2a, 0x03, 0x01, 0x02, 0x04, 0x32, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x73, 0x6f, 0x6e, 0x3a, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x73, 0x6f, 0x6e, 0x72, 0x44, 0x0a, 0x14, 0x44, 0x6f, + 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x6e, 0x20, 0x49, + 0x4d, 0x50, 0x12, 0x2c, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x67, 0x69, 0x74, 0x68, + 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x6d, 0x70, 0x65, 0x72, 0x76, 0x69, 0x6f, 0x75, + 0x73, 0x61, 0x69, 0x2f, 0x69, 0x6d, 0x70, 0x2d, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x73, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_proto_imp_api_socket_socket_proto_rawDescOnce sync.Once + file_proto_imp_api_socket_socket_proto_rawDescData = file_proto_imp_api_socket_socket_proto_rawDesc +) + +func file_proto_imp_api_socket_socket_proto_rawDescGZIP() []byte { + file_proto_imp_api_socket_socket_proto_rawDescOnce.Do(func() { + file_proto_imp_api_socket_socket_proto_rawDescData = protoimpl.X.CompressGZIP(file_proto_imp_api_socket_socket_proto_rawDescData) + }) + return file_proto_imp_api_socket_socket_proto_rawDescData +} + +var file_proto_imp_api_socket_socket_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_proto_imp_api_socket_socket_proto_goTypes = []interface{}{ + (*SendSocketRequest)(nil), // 0: socket.SendSocketRequest + (*SendSocketResponse)(nil), // 1: socket.SendSocketResponse + (*StartSocketRequest)(nil), // 2: socket.StartSocketRequest + (*StartSocketResponse)(nil), // 3: socket.StartSocketResponse + (*StopSocketRequest)(nil), // 4: socket.StopSocketRequest + (*StopSocketResponse)(nil), // 5: socket.StopSocketResponse +} +var file_proto_imp_api_socket_socket_proto_depIdxs = []int32{ + 0, // 0: socket.Socket.SendSocket:input_type -> socket.SendSocketRequest + 2, // 1: socket.Socket.StartSocket:input_type -> socket.StartSocketRequest + 4, // 2: socket.Socket.StopSocket:input_type -> socket.StopSocketRequest + 1, // 3: socket.Socket.SendSocket:output_type -> socket.SendSocketResponse + 3, // 4: socket.Socket.StartSocket:output_type -> socket.StartSocketResponse + 5, // 5: socket.Socket.StopSocket:output_type -> socket.StopSocketResponse + 3, // [3:6] is the sub-list for method output_type + 0, // [0:3] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_proto_imp_api_socket_socket_proto_init() } +func file_proto_imp_api_socket_socket_proto_init() { + if File_proto_imp_api_socket_socket_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_proto_imp_api_socket_socket_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SendSocketRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_imp_api_socket_socket_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SendSocketResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_imp_api_socket_socket_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StartSocketRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_imp_api_socket_socket_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StartSocketResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_imp_api_socket_socket_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StopSocketRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_imp_api_socket_socket_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*StopSocketResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_proto_imp_api_socket_socket_proto_rawDesc, + NumEnums: 0, + NumMessages: 6, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_proto_imp_api_socket_socket_proto_goTypes, + DependencyIndexes: file_proto_imp_api_socket_socket_proto_depIdxs, + MessageInfos: file_proto_imp_api_socket_socket_proto_msgTypes, + }.Build() + File_proto_imp_api_socket_socket_proto = out.File + file_proto_imp_api_socket_socket_proto_rawDesc = nil + file_proto_imp_api_socket_socket_proto_goTypes = nil + file_proto_imp_api_socket_socket_proto_depIdxs = nil +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConnInterface + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion6 + +// SocketClient is the client API for Socket service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type SocketClient interface { + SendSocket(ctx context.Context, in *SendSocketRequest, opts ...grpc.CallOption) (*SendSocketResponse, error) + StartSocket(ctx context.Context, in *StartSocketRequest, opts ...grpc.CallOption) (*StartSocketResponse, error) + StopSocket(ctx context.Context, in *StopSocketRequest, opts ...grpc.CallOption) (*StopSocketResponse, error) +} + +type socketClient struct { + cc grpc.ClientConnInterface +} + +func NewSocketClient(cc grpc.ClientConnInterface) SocketClient { + return &socketClient{cc} +} + +func (c *socketClient) SendSocket(ctx context.Context, in *SendSocketRequest, opts ...grpc.CallOption) (*SendSocketResponse, error) { + out := new(SendSocketResponse) + err := c.cc.Invoke(ctx, "/socket.Socket/SendSocket", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *socketClient) StartSocket(ctx context.Context, in *StartSocketRequest, opts ...grpc.CallOption) (*StartSocketResponse, error) { + out := new(StartSocketResponse) + err := c.cc.Invoke(ctx, "/socket.Socket/StartSocket", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *socketClient) StopSocket(ctx context.Context, in *StopSocketRequest, opts ...grpc.CallOption) (*StopSocketResponse, error) { + out := new(StopSocketResponse) + err := c.cc.Invoke(ctx, "/socket.Socket/StopSocket", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// SocketServer is the server API for Socket service. +type SocketServer interface { + SendSocket(context.Context, *SendSocketRequest) (*SendSocketResponse, error) + StartSocket(context.Context, *StartSocketRequest) (*StartSocketResponse, error) + StopSocket(context.Context, *StopSocketRequest) (*StopSocketResponse, error) +} + +// UnimplementedSocketServer can be embedded to have forward compatible implementations. +type UnimplementedSocketServer struct { +} + +func (*UnimplementedSocketServer) SendSocket(context.Context, *SendSocketRequest) (*SendSocketResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SendSocket not implemented") +} +func (*UnimplementedSocketServer) StartSocket(context.Context, *StartSocketRequest) (*StartSocketResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method StartSocket not implemented") +} +func (*UnimplementedSocketServer) StopSocket(context.Context, *StopSocketRequest) (*StopSocketResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method StopSocket not implemented") +} + +func RegisterSocketServer(s *grpc.Server, srv SocketServer) { + s.RegisterService(&_Socket_serviceDesc, srv) +} + +func _Socket_SendSocket_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SendSocketRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SocketServer).SendSocket(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/socket.Socket/SendSocket", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SocketServer).SendSocket(ctx, req.(*SendSocketRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Socket_StartSocket_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(StartSocketRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SocketServer).StartSocket(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/socket.Socket/StartSocket", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SocketServer).StartSocket(ctx, req.(*StartSocketRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Socket_StopSocket_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(StopSocketRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SocketServer).StopSocket(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/socket.Socket/StopSocket", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SocketServer).StopSocket(ctx, req.(*StopSocketRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Socket_serviceDesc = grpc.ServiceDesc{ + ServiceName: "socket.Socket", + HandlerType: (*SocketServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "SendSocket", + Handler: _Socket_SendSocket_Handler, + }, + { + MethodName: "StartSocket", + Handler: _Socket_StartSocket_Handler, + }, + { + MethodName: "StopSocket", + Handler: _Socket_StopSocket_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "proto/imp/api/socket/socket.proto", +} diff --git a/go/proto/imp/api/socket/socket.pb.gw.go b/go/proto/imp/api/socket/socket.pb.gw.go new file mode 100644 index 0000000..34138bb --- /dev/null +++ b/go/proto/imp/api/socket/socket.pb.gw.go @@ -0,0 +1,329 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: proto/imp/api/socket/socket.proto + +/* +Package gen is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package gen + +import ( + "context" + "io" + "net/http" + + "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" + "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = metadata.Join + +func request_Socket_SendSocket_0(ctx context.Context, marshaler runtime.Marshaler, client SocketClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq SendSocketRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.SendSocket(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Socket_SendSocket_0(ctx context.Context, marshaler runtime.Marshaler, server SocketServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq SendSocketRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.SendSocket(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Socket_StartSocket_0(ctx context.Context, marshaler runtime.Marshaler, client SocketClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq StartSocketRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.StartSocket(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Socket_StartSocket_0(ctx context.Context, marshaler runtime.Marshaler, server SocketServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq StartSocketRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.StartSocket(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Socket_StopSocket_0(ctx context.Context, marshaler runtime.Marshaler, client SocketClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq StopSocketRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.StopSocket(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Socket_StopSocket_0(ctx context.Context, marshaler runtime.Marshaler, server SocketServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq StopSocketRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.StopSocket(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterSocketHandlerServer registers the http handlers for service Socket to "mux". +// UnaryRPC :call SocketServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterSocketHandlerFromEndpoint instead. +func RegisterSocketHandlerServer(ctx context.Context, mux *runtime.ServeMux, server SocketServer) error { + + mux.Handle("POST", pattern_Socket_SendSocket_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/socket.Socket/SendSocket", runtime.WithHTTPPathPattern("/v1/socket/sendRequest")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Socket_SendSocket_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Socket_SendSocket_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Socket_StartSocket_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/socket.Socket/StartSocket", runtime.WithHTTPPathPattern("/v1/socket/start")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Socket_StartSocket_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Socket_StartSocket_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Socket_StopSocket_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/socket.Socket/StopSocket", runtime.WithHTTPPathPattern("/v1/socket/stop")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Socket_StopSocket_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Socket_StopSocket_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterSocketHandlerFromEndpoint is same as RegisterSocketHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterSocketHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterSocketHandler(ctx, mux, conn) +} + +// RegisterSocketHandler registers the http handlers for service Socket to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterSocketHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterSocketHandlerClient(ctx, mux, NewSocketClient(conn)) +} + +// RegisterSocketHandlerClient registers the http handlers for service Socket +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "SocketClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "SocketClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "SocketClient" to call the correct interceptors. +func RegisterSocketHandlerClient(ctx context.Context, mux *runtime.ServeMux, client SocketClient) error { + + mux.Handle("POST", pattern_Socket_SendSocket_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req, "/socket.Socket/SendSocket", runtime.WithHTTPPathPattern("/v1/socket/sendRequest")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Socket_SendSocket_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Socket_SendSocket_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Socket_StartSocket_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req, "/socket.Socket/StartSocket", runtime.WithHTTPPathPattern("/v1/socket/start")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Socket_StartSocket_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Socket_StartSocket_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_Socket_StopSocket_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req, "/socket.Socket/StopSocket", runtime.WithHTTPPathPattern("/v1/socket/stop")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Socket_StopSocket_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Socket_StopSocket_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Socket_SendSocket_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "socket", "sendRequest"}, "")) + + pattern_Socket_StartSocket_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "socket", "start"}, "")) + + pattern_Socket_StopSocket_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "socket", "stop"}, "")) +) + +var ( + forward_Socket_SendSocket_0 = runtime.ForwardResponseMessage + + forward_Socket_StartSocket_0 = runtime.ForwardResponseMessage + + forward_Socket_StopSocket_0 = runtime.ForwardResponseMessage +) diff --git a/go/proto/imp/api/vpn/vpn.pb.go b/go/proto/imp/api/vpn/vpn.pb.go new file mode 100644 index 0000000..7ff493c --- /dev/null +++ b/go/proto/imp/api/vpn/vpn.pb.go @@ -0,0 +1,709 @@ +/// Allows for an Encrypted Wireguard VPN between Impervious nodes + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.1 +// protoc v3.17.3 +// source: proto/imp/api/vpn/vpn.proto + +package gen + +import ( + context "context" + _ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options" + _ "google.golang.org/genproto/googleapis/api/annotations" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +//* +// Represents a request to receive a VPN quote from a far end node +type RequestQuoteRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Pubkey string `protobuf:"bytes,1,opt,name=pubkey,proto3" json:"pubkey,omitempty"` // The public key of the far end LND node running IMP +} + +func (x *RequestQuoteRequest) Reset() { + *x = RequestQuoteRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_imp_api_vpn_vpn_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RequestQuoteRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RequestQuoteRequest) ProtoMessage() {} + +func (x *RequestQuoteRequest) ProtoReflect() protoreflect.Message { + mi := &file_proto_imp_api_vpn_vpn_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RequestQuoteRequest.ProtoReflect.Descriptor instead. +func (*RequestQuoteRequest) Descriptor() ([]byte, []int) { + return file_proto_imp_api_vpn_vpn_proto_rawDescGZIP(), []int{0} +} + +func (x *RequestQuoteRequest) GetPubkey() string { + if x != nil { + return x.Pubkey + } + return "" +} + +//* +// Represents a response back from a VPN Quote Reqeust +type RequestQuoteResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // returned message ID +} + +func (x *RequestQuoteResponse) Reset() { + *x = RequestQuoteResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_imp_api_vpn_vpn_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RequestQuoteResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RequestQuoteResponse) ProtoMessage() {} + +func (x *RequestQuoteResponse) ProtoReflect() protoreflect.Message { + mi := &file_proto_imp_api_vpn_vpn_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RequestQuoteResponse.ProtoReflect.Descriptor instead. +func (*RequestQuoteResponse) Descriptor() ([]byte, []int) { + return file_proto_imp_api_vpn_vpn_proto_rawDescGZIP(), []int{1} +} + +func (x *RequestQuoteResponse) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +//* +// Represents a request to Accept (Pay For) a VPN Quote +type AcceptContractRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Pubkey string `protobuf:"bytes,1,opt,name=pubkey,proto3" json:"pubkey,omitempty"` // The public key of the far end LND node running IMP + Nonce string `protobuf:"bytes,2,opt,name=nonce,proto3" json:"nonce,omitempty"` // the identifier from a requested VPN quote + Price string `protobuf:"bytes,3,opt,name=price,proto3" json:"price,omitempty"` // the agreed upon price from the VPN quote +} + +func (x *AcceptContractRequest) Reset() { + *x = AcceptContractRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_imp_api_vpn_vpn_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AcceptContractRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AcceptContractRequest) ProtoMessage() {} + +func (x *AcceptContractRequest) ProtoReflect() protoreflect.Message { + mi := &file_proto_imp_api_vpn_vpn_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AcceptContractRequest.ProtoReflect.Descriptor instead. +func (*AcceptContractRequest) Descriptor() ([]byte, []int) { + return file_proto_imp_api_vpn_vpn_proto_rawDescGZIP(), []int{2} +} + +func (x *AcceptContractRequest) GetPubkey() string { + if x != nil { + return x.Pubkey + } + return "" +} + +func (x *AcceptContractRequest) GetNonce() string { + if x != nil { + return x.Nonce + } + return "" +} + +func (x *AcceptContractRequest) GetPrice() string { + if x != nil { + return x.Price + } + return "" +} + +//* +// Represents a response back from an accepted VPN Quote +type AcceptContractResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // returned message ID +} + +func (x *AcceptContractResponse) Reset() { + *x = AcceptContractResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_imp_api_vpn_vpn_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AcceptContractResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AcceptContractResponse) ProtoMessage() {} + +func (x *AcceptContractResponse) ProtoReflect() protoreflect.Message { + mi := &file_proto_imp_api_vpn_vpn_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AcceptContractResponse.ProtoReflect.Descriptor instead. +func (*AcceptContractResponse) Descriptor() ([]byte, []int) { + return file_proto_imp_api_vpn_vpn_proto_rawDescGZIP(), []int{3} +} + +func (x *AcceptContractResponse) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +//* +// Represents a request to extend/refresh an expiring VPN Connection (i.e. purchase more time) +type RefreshContractRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Pubkey string `protobuf:"bytes,1,opt,name=pubkey,proto3" json:"pubkey,omitempty"` // The public key of the far end LND node running IMP + Nonce string `protobuf:"bytes,2,opt,name=nonce,proto3" json:"nonce,omitempty"` // the identifier of the VPN connection + Price string `protobuf:"bytes,3,opt,name=price,proto3" json:"price,omitempty"` // the agreed upon price from the VPN quote +} + +func (x *RefreshContractRequest) Reset() { + *x = RefreshContractRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_imp_api_vpn_vpn_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RefreshContractRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RefreshContractRequest) ProtoMessage() {} + +func (x *RefreshContractRequest) ProtoReflect() protoreflect.Message { + mi := &file_proto_imp_api_vpn_vpn_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RefreshContractRequest.ProtoReflect.Descriptor instead. +func (*RefreshContractRequest) Descriptor() ([]byte, []int) { + return file_proto_imp_api_vpn_vpn_proto_rawDescGZIP(), []int{4} +} + +func (x *RefreshContractRequest) GetPubkey() string { + if x != nil { + return x.Pubkey + } + return "" +} + +func (x *RefreshContractRequest) GetNonce() string { + if x != nil { + return x.Nonce + } + return "" +} + +func (x *RefreshContractRequest) GetPrice() string { + if x != nil { + return x.Price + } + return "" +} + +//* +// Represents a reponse back from a refreshed VPN connection +type RefreshContractResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // returned message ID +} + +func (x *RefreshContractResponse) Reset() { + *x = RefreshContractResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_imp_api_vpn_vpn_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RefreshContractResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RefreshContractResponse) ProtoMessage() {} + +func (x *RefreshContractResponse) ProtoReflect() protoreflect.Message { + mi := &file_proto_imp_api_vpn_vpn_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RefreshContractResponse.ProtoReflect.Descriptor instead. +func (*RefreshContractResponse) Descriptor() ([]byte, []int) { + return file_proto_imp_api_vpn_vpn_proto_rawDescGZIP(), []int{5} +} + +func (x *RefreshContractResponse) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +var File_proto_imp_api_vpn_vpn_proto protoreflect.FileDescriptor + +var file_proto_imp_api_vpn_vpn_proto_rawDesc = []byte{ + 0x0a, 0x1b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x69, 0x6d, 0x70, 0x2f, 0x61, 0x70, 0x69, 0x2f, + 0x76, 0x70, 0x6e, 0x2f, 0x76, 0x70, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x03, 0x76, + 0x70, 0x6e, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, + 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x6f, 0x70, 0x65, + 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x61, + 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x22, 0x2d, 0x0a, 0x13, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x51, 0x75, 0x6f, 0x74, 0x65, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x75, 0x62, 0x6b, 0x65, + 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x75, 0x62, 0x6b, 0x65, 0x79, 0x22, + 0x26, 0x0a, 0x14, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x5b, 0x0a, 0x15, 0x41, 0x63, 0x63, 0x65, 0x70, + 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x16, 0x0a, 0x06, 0x70, 0x75, 0x62, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x06, 0x70, 0x75, 0x62, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x6f, 0x6e, 0x63, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x12, 0x14, + 0x0a, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x70, + 0x72, 0x69, 0x63, 0x65, 0x22, 0x28, 0x0a, 0x16, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x43, 0x6f, + 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0e, + 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x5c, + 0x0a, 0x16, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, + 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x75, 0x62, 0x6b, + 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x75, 0x62, 0x6b, 0x65, 0x79, + 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x05, 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x22, 0x29, 0x0a, 0x17, + 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x32, 0xb6, 0x02, 0x0a, 0x03, 0x56, 0x50, 0x4e, 0x12, + 0x5d, 0x0a, 0x0c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x12, + 0x18, 0x2e, 0x76, 0x70, 0x6e, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x51, 0x75, 0x6f, + 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x76, 0x70, 0x6e, 0x2e, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x51, 0x75, 0x6f, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x18, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x12, 0x22, 0x0d, 0x2f, 0x76, + 0x31, 0x2f, 0x76, 0x70, 0x6e, 0x2f, 0x71, 0x75, 0x6f, 0x74, 0x65, 0x3a, 0x01, 0x2a, 0x12, 0x66, + 0x0a, 0x0e, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, + 0x12, 0x1a, 0x2e, 0x76, 0x70, 0x6e, 0x2e, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x43, 0x6f, 0x6e, + 0x74, 0x72, 0x61, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x76, + 0x70, 0x6e, 0x2e, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, + 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1b, 0x82, 0xd3, 0xe4, 0x93, 0x02, + 0x15, 0x22, 0x10, 0x2f, 0x76, 0x31, 0x2f, 0x76, 0x70, 0x6e, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, + 0x61, 0x63, 0x74, 0x3a, 0x01, 0x2a, 0x12, 0x68, 0x0a, 0x0f, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, + 0x68, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x12, 0x1b, 0x2e, 0x76, 0x70, 0x6e, 0x2e, + 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x76, 0x70, 0x6e, 0x2e, 0x52, 0x65, 0x66, + 0x72, 0x65, 0x73, 0x68, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x22, 0x0f, 0x2f, 0x76, + 0x31, 0x2f, 0x76, 0x70, 0x6e, 0x2f, 0x72, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x3a, 0x01, 0x2a, + 0x42, 0xd5, 0x01, 0x5a, 0x23, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, + 0x69, 0x6d, 0x70, 0x65, 0x72, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x61, 0x69, 0x2f, 0x66, 0x72, 0x65, + 0x65, 0x69, 0x6d, 0x70, 0x2f, 0x67, 0x65, 0x6e, 0x92, 0x41, 0xac, 0x01, 0x12, 0x3b, 0x0a, 0x0c, + 0x56, 0x50, 0x4e, 0x20, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x22, 0x26, 0x0a, 0x0d, + 0x49, 0x6d, 0x70, 0x65, 0x72, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x20, 0x41, 0x49, 0x12, 0x15, 0x68, + 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x69, 0x6d, 0x70, 0x65, 0x72, 0x76, 0x69, 0x6f, 0x75, + 0x73, 0x2e, 0x61, 0x69, 0x32, 0x03, 0x31, 0x2e, 0x30, 0x2a, 0x03, 0x01, 0x02, 0x04, 0x32, 0x10, + 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x73, 0x6f, 0x6e, + 0x3a, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x73, + 0x6f, 0x6e, 0x72, 0x44, 0x0a, 0x14, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x6e, 0x20, 0x49, 0x4d, 0x50, 0x12, 0x2c, 0x68, 0x74, 0x74, 0x70, + 0x73, 0x3a, 0x2f, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, + 0x6d, 0x70, 0x65, 0x72, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x61, 0x69, 0x2f, 0x69, 0x6d, 0x70, 0x2d, + 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_proto_imp_api_vpn_vpn_proto_rawDescOnce sync.Once + file_proto_imp_api_vpn_vpn_proto_rawDescData = file_proto_imp_api_vpn_vpn_proto_rawDesc +) + +func file_proto_imp_api_vpn_vpn_proto_rawDescGZIP() []byte { + file_proto_imp_api_vpn_vpn_proto_rawDescOnce.Do(func() { + file_proto_imp_api_vpn_vpn_proto_rawDescData = protoimpl.X.CompressGZIP(file_proto_imp_api_vpn_vpn_proto_rawDescData) + }) + return file_proto_imp_api_vpn_vpn_proto_rawDescData +} + +var file_proto_imp_api_vpn_vpn_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_proto_imp_api_vpn_vpn_proto_goTypes = []interface{}{ + (*RequestQuoteRequest)(nil), // 0: vpn.RequestQuoteRequest + (*RequestQuoteResponse)(nil), // 1: vpn.RequestQuoteResponse + (*AcceptContractRequest)(nil), // 2: vpn.AcceptContractRequest + (*AcceptContractResponse)(nil), // 3: vpn.AcceptContractResponse + (*RefreshContractRequest)(nil), // 4: vpn.RefreshContractRequest + (*RefreshContractResponse)(nil), // 5: vpn.RefreshContractResponse +} +var file_proto_imp_api_vpn_vpn_proto_depIdxs = []int32{ + 0, // 0: vpn.VPN.RequestQuote:input_type -> vpn.RequestQuoteRequest + 2, // 1: vpn.VPN.AcceptContract:input_type -> vpn.AcceptContractRequest + 4, // 2: vpn.VPN.RefreshContract:input_type -> vpn.RefreshContractRequest + 1, // 3: vpn.VPN.RequestQuote:output_type -> vpn.RequestQuoteResponse + 3, // 4: vpn.VPN.AcceptContract:output_type -> vpn.AcceptContractResponse + 5, // 5: vpn.VPN.RefreshContract:output_type -> vpn.RefreshContractResponse + 3, // [3:6] is the sub-list for method output_type + 0, // [0:3] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_proto_imp_api_vpn_vpn_proto_init() } +func file_proto_imp_api_vpn_vpn_proto_init() { + if File_proto_imp_api_vpn_vpn_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_proto_imp_api_vpn_vpn_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RequestQuoteRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_imp_api_vpn_vpn_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RequestQuoteResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_imp_api_vpn_vpn_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AcceptContractRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_imp_api_vpn_vpn_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AcceptContractResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_imp_api_vpn_vpn_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RefreshContractRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_imp_api_vpn_vpn_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RefreshContractResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_proto_imp_api_vpn_vpn_proto_rawDesc, + NumEnums: 0, + NumMessages: 6, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_proto_imp_api_vpn_vpn_proto_goTypes, + DependencyIndexes: file_proto_imp_api_vpn_vpn_proto_depIdxs, + MessageInfos: file_proto_imp_api_vpn_vpn_proto_msgTypes, + }.Build() + File_proto_imp_api_vpn_vpn_proto = out.File + file_proto_imp_api_vpn_vpn_proto_rawDesc = nil + file_proto_imp_api_vpn_vpn_proto_goTypes = nil + file_proto_imp_api_vpn_vpn_proto_depIdxs = nil +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConnInterface + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion6 + +// VPNClient is the client API for VPN service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type VPNClient interface { + RequestQuote(ctx context.Context, in *RequestQuoteRequest, opts ...grpc.CallOption) (*RequestQuoteResponse, error) + AcceptContract(ctx context.Context, in *AcceptContractRequest, opts ...grpc.CallOption) (*AcceptContractResponse, error) + RefreshContract(ctx context.Context, in *RefreshContractRequest, opts ...grpc.CallOption) (*RefreshContractResponse, error) +} + +type vPNClient struct { + cc grpc.ClientConnInterface +} + +func NewVPNClient(cc grpc.ClientConnInterface) VPNClient { + return &vPNClient{cc} +} + +func (c *vPNClient) RequestQuote(ctx context.Context, in *RequestQuoteRequest, opts ...grpc.CallOption) (*RequestQuoteResponse, error) { + out := new(RequestQuoteResponse) + err := c.cc.Invoke(ctx, "/vpn.VPN/RequestQuote", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *vPNClient) AcceptContract(ctx context.Context, in *AcceptContractRequest, opts ...grpc.CallOption) (*AcceptContractResponse, error) { + out := new(AcceptContractResponse) + err := c.cc.Invoke(ctx, "/vpn.VPN/AcceptContract", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *vPNClient) RefreshContract(ctx context.Context, in *RefreshContractRequest, opts ...grpc.CallOption) (*RefreshContractResponse, error) { + out := new(RefreshContractResponse) + err := c.cc.Invoke(ctx, "/vpn.VPN/RefreshContract", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// VPNServer is the server API for VPN service. +type VPNServer interface { + RequestQuote(context.Context, *RequestQuoteRequest) (*RequestQuoteResponse, error) + AcceptContract(context.Context, *AcceptContractRequest) (*AcceptContractResponse, error) + RefreshContract(context.Context, *RefreshContractRequest) (*RefreshContractResponse, error) +} + +// UnimplementedVPNServer can be embedded to have forward compatible implementations. +type UnimplementedVPNServer struct { +} + +func (*UnimplementedVPNServer) RequestQuote(context.Context, *RequestQuoteRequest) (*RequestQuoteResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RequestQuote not implemented") +} +func (*UnimplementedVPNServer) AcceptContract(context.Context, *AcceptContractRequest) (*AcceptContractResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AcceptContract not implemented") +} +func (*UnimplementedVPNServer) RefreshContract(context.Context, *RefreshContractRequest) (*RefreshContractResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RefreshContract not implemented") +} + +func RegisterVPNServer(s *grpc.Server, srv VPNServer) { + s.RegisterService(&_VPN_serviceDesc, srv) +} + +func _VPN_RequestQuote_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RequestQuoteRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(VPNServer).RequestQuote(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/vpn.VPN/RequestQuote", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(VPNServer).RequestQuote(ctx, req.(*RequestQuoteRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _VPN_AcceptContract_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AcceptContractRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(VPNServer).AcceptContract(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/vpn.VPN/AcceptContract", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(VPNServer).AcceptContract(ctx, req.(*AcceptContractRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _VPN_RefreshContract_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RefreshContractRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(VPNServer).RefreshContract(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/vpn.VPN/RefreshContract", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(VPNServer).RefreshContract(ctx, req.(*RefreshContractRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _VPN_serviceDesc = grpc.ServiceDesc{ + ServiceName: "vpn.VPN", + HandlerType: (*VPNServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "RequestQuote", + Handler: _VPN_RequestQuote_Handler, + }, + { + MethodName: "AcceptContract", + Handler: _VPN_AcceptContract_Handler, + }, + { + MethodName: "RefreshContract", + Handler: _VPN_RefreshContract_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "proto/imp/api/vpn/vpn.proto", +} diff --git a/go/proto/imp/api/vpn/vpn.pb.gw.go b/go/proto/imp/api/vpn/vpn.pb.gw.go new file mode 100644 index 0000000..4eae8c1 --- /dev/null +++ b/go/proto/imp/api/vpn/vpn.pb.gw.go @@ -0,0 +1,329 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: proto/imp/api/vpn/vpn.proto + +/* +Package gen is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package gen + +import ( + "context" + "io" + "net/http" + + "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" + "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = metadata.Join + +func request_VPN_RequestQuote_0(ctx context.Context, marshaler runtime.Marshaler, client VPNClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq RequestQuoteRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.RequestQuote(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_VPN_RequestQuote_0(ctx context.Context, marshaler runtime.Marshaler, server VPNServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq RequestQuoteRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.RequestQuote(ctx, &protoReq) + return msg, metadata, err + +} + +func request_VPN_AcceptContract_0(ctx context.Context, marshaler runtime.Marshaler, client VPNClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq AcceptContractRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.AcceptContract(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_VPN_AcceptContract_0(ctx context.Context, marshaler runtime.Marshaler, server VPNServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq AcceptContractRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.AcceptContract(ctx, &protoReq) + return msg, metadata, err + +} + +func request_VPN_RefreshContract_0(ctx context.Context, marshaler runtime.Marshaler, client VPNClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq RefreshContractRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.RefreshContract(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_VPN_RefreshContract_0(ctx context.Context, marshaler runtime.Marshaler, server VPNServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq RefreshContractRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.RefreshContract(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterVPNHandlerServer registers the http handlers for service VPN to "mux". +// UnaryRPC :call VPNServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterVPNHandlerFromEndpoint instead. +func RegisterVPNHandlerServer(ctx context.Context, mux *runtime.ServeMux, server VPNServer) error { + + mux.Handle("POST", pattern_VPN_RequestQuote_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/vpn.VPN/RequestQuote", runtime.WithHTTPPathPattern("/v1/vpn/quote")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_VPN_RequestQuote_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_VPN_RequestQuote_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_VPN_AcceptContract_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/vpn.VPN/AcceptContract", runtime.WithHTTPPathPattern("/v1/vpn/contract")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_VPN_AcceptContract_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_VPN_AcceptContract_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_VPN_RefreshContract_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/vpn.VPN/RefreshContract", runtime.WithHTTPPathPattern("/v1/vpn/refresh")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_VPN_RefreshContract_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_VPN_RefreshContract_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterVPNHandlerFromEndpoint is same as RegisterVPNHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterVPNHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterVPNHandler(ctx, mux, conn) +} + +// RegisterVPNHandler registers the http handlers for service VPN to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterVPNHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterVPNHandlerClient(ctx, mux, NewVPNClient(conn)) +} + +// RegisterVPNHandlerClient registers the http handlers for service VPN +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "VPNClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "VPNClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "VPNClient" to call the correct interceptors. +func RegisterVPNHandlerClient(ctx context.Context, mux *runtime.ServeMux, client VPNClient) error { + + mux.Handle("POST", pattern_VPN_RequestQuote_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req, "/vpn.VPN/RequestQuote", runtime.WithHTTPPathPattern("/v1/vpn/quote")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_VPN_RequestQuote_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_VPN_RequestQuote_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_VPN_AcceptContract_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req, "/vpn.VPN/AcceptContract", runtime.WithHTTPPathPattern("/v1/vpn/contract")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_VPN_AcceptContract_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_VPN_AcceptContract_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_VPN_RefreshContract_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req, "/vpn.VPN/RefreshContract", runtime.WithHTTPPathPattern("/v1/vpn/refresh")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_VPN_RefreshContract_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_VPN_RefreshContract_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_VPN_RequestQuote_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "vpn", "quote"}, "")) + + pattern_VPN_AcceptContract_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "vpn", "contract"}, "")) + + pattern_VPN_RefreshContract_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "vpn", "refresh"}, "")) +) + +var ( + forward_VPN_RequestQuote_0 = runtime.ForwardResponseMessage + + forward_VPN_AcceptContract_0 = runtime.ForwardResponseMessage + + forward_VPN_RefreshContract_0 = runtime.ForwardResponseMessage +) diff --git a/go/proto/imp/api/websocket/websocket.pb.go b/go/proto/imp/api/websocket/websocket.pb.go new file mode 100644 index 0000000..60dfb4c --- /dev/null +++ b/go/proto/imp/api/websocket/websocket.pb.go @@ -0,0 +1,390 @@ +/// Allows for receiving messages from your IMP node + +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.1 +// protoc v3.17.3 +// source: proto/imp/api/websocket/websocket.proto + +package gen + +import ( + context "context" + _ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options" + _ "google.golang.org/genproto/googleapis/api/annotations" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +//* +// Represents a request to subscribe to the event websocket +type SubscribeRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *SubscribeRequest) Reset() { + *x = SubscribeRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_imp_api_websocket_websocket_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SubscribeRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SubscribeRequest) ProtoMessage() {} + +func (x *SubscribeRequest) ProtoReflect() protoreflect.Message { + mi := &file_proto_imp_api_websocket_websocket_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SubscribeRequest.ProtoReflect.Descriptor instead. +func (*SubscribeRequest) Descriptor() ([]byte, []int) { + return file_proto_imp_api_websocket_websocket_proto_rawDescGZIP(), []int{0} +} + +//* +// Represents a response back from the websocket containing event information +type SubscribeResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + ReplyToId string `protobuf:"bytes,2,opt,name=reply_to_id,json=replyToId,proto3" json:"reply_to_id,omitempty"` + FromPubkey string `protobuf:"bytes,3,opt,name=from_pubkey,json=fromPubkey,proto3" json:"from_pubkey,omitempty"` + Data string `protobuf:"bytes,4,opt,name=data,proto3" json:"data,omitempty"` + ServiceType string `protobuf:"bytes,5,opt,name=service_type,json=serviceType,proto3" json:"service_type,omitempty"` + Amount int64 `protobuf:"varint,6,opt,name=amount,proto3" json:"amount,omitempty"` +} + +func (x *SubscribeResponse) Reset() { + *x = SubscribeResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_imp_api_websocket_websocket_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SubscribeResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SubscribeResponse) ProtoMessage() {} + +func (x *SubscribeResponse) ProtoReflect() protoreflect.Message { + mi := &file_proto_imp_api_websocket_websocket_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SubscribeResponse.ProtoReflect.Descriptor instead. +func (*SubscribeResponse) Descriptor() ([]byte, []int) { + return file_proto_imp_api_websocket_websocket_proto_rawDescGZIP(), []int{1} +} + +func (x *SubscribeResponse) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *SubscribeResponse) GetReplyToId() string { + if x != nil { + return x.ReplyToId + } + return "" +} + +func (x *SubscribeResponse) GetFromPubkey() string { + if x != nil { + return x.FromPubkey + } + return "" +} + +func (x *SubscribeResponse) GetData() string { + if x != nil { + return x.Data + } + return "" +} + +func (x *SubscribeResponse) GetServiceType() string { + if x != nil { + return x.ServiceType + } + return "" +} + +func (x *SubscribeResponse) GetAmount() int64 { + if x != nil { + return x.Amount + } + return 0 +} + +var File_proto_imp_api_websocket_websocket_proto protoreflect.FileDescriptor + +var file_proto_imp_api_websocket_websocket_proto_rawDesc = []byte{ + 0x0a, 0x27, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x69, 0x6d, 0x70, 0x2f, 0x61, 0x70, 0x69, 0x2f, + 0x77, 0x65, 0x62, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x2f, 0x77, 0x65, 0x62, 0x73, 0x6f, 0x63, + 0x6b, 0x65, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x09, 0x77, 0x65, 0x62, 0x73, 0x6f, + 0x63, 0x6b, 0x65, 0x74, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, + 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x6f, + 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x76, 0x32, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x22, 0x12, 0x0a, 0x10, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0xb3, 0x01, 0x0a, 0x11, 0x53, 0x75, 0x62, 0x73, 0x63, + 0x72, 0x69, 0x62, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1e, 0x0a, 0x0b, + 0x72, 0x65, 0x70, 0x6c, 0x79, 0x5f, 0x74, 0x6f, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x09, 0x72, 0x65, 0x70, 0x6c, 0x79, 0x54, 0x6f, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, + 0x66, 0x72, 0x6f, 0x6d, 0x5f, 0x70, 0x75, 0x62, 0x6b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0a, 0x66, 0x72, 0x6f, 0x6d, 0x50, 0x75, 0x62, 0x6b, 0x65, 0x79, 0x12, 0x12, 0x0a, + 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x64, 0x61, 0x74, + 0x61, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x74, 0x79, 0x70, + 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x54, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x32, 0x6c, 0x0a, 0x09, + 0x57, 0x65, 0x62, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x12, 0x5f, 0x0a, 0x09, 0x53, 0x75, 0x62, + 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x12, 0x1b, 0x2e, 0x77, 0x65, 0x62, 0x73, 0x6f, 0x63, 0x6b, + 0x65, 0x74, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x77, 0x65, 0x62, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x2e, + 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x15, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0f, 0x12, 0x0d, 0x2f, 0x76, 0x31, 0x2f, 0x73, + 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x30, 0x01, 0x42, 0xdb, 0x01, 0x5a, 0x23, 0x67, + 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x6d, 0x70, 0x65, 0x72, 0x76, + 0x69, 0x6f, 0x75, 0x73, 0x61, 0x69, 0x2f, 0x66, 0x72, 0x65, 0x65, 0x69, 0x6d, 0x70, 0x2f, 0x67, + 0x65, 0x6e, 0x92, 0x41, 0xb2, 0x01, 0x12, 0x41, 0x0a, 0x12, 0x57, 0x65, 0x62, 0x73, 0x6f, 0x63, + 0x6b, 0x65, 0x74, 0x20, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x22, 0x26, 0x0a, 0x0d, + 0x49, 0x6d, 0x70, 0x65, 0x72, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x20, 0x41, 0x49, 0x12, 0x15, 0x68, + 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x69, 0x6d, 0x70, 0x65, 0x72, 0x76, 0x69, 0x6f, 0x75, + 0x73, 0x2e, 0x61, 0x69, 0x32, 0x03, 0x31, 0x2e, 0x30, 0x2a, 0x03, 0x01, 0x02, 0x04, 0x32, 0x10, + 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x73, 0x6f, 0x6e, + 0x3a, 0x10, 0x61, 0x70, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x73, + 0x6f, 0x6e, 0x72, 0x44, 0x0a, 0x14, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x20, 0x6f, 0x6e, 0x20, 0x49, 0x4d, 0x50, 0x12, 0x2c, 0x68, 0x74, 0x74, 0x70, + 0x73, 0x3a, 0x2f, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, + 0x6d, 0x70, 0x65, 0x72, 0x76, 0x69, 0x6f, 0x75, 0x73, 0x61, 0x69, 0x2f, 0x69, 0x6d, 0x70, 0x2d, + 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_proto_imp_api_websocket_websocket_proto_rawDescOnce sync.Once + file_proto_imp_api_websocket_websocket_proto_rawDescData = file_proto_imp_api_websocket_websocket_proto_rawDesc +) + +func file_proto_imp_api_websocket_websocket_proto_rawDescGZIP() []byte { + file_proto_imp_api_websocket_websocket_proto_rawDescOnce.Do(func() { + file_proto_imp_api_websocket_websocket_proto_rawDescData = protoimpl.X.CompressGZIP(file_proto_imp_api_websocket_websocket_proto_rawDescData) + }) + return file_proto_imp_api_websocket_websocket_proto_rawDescData +} + +var file_proto_imp_api_websocket_websocket_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_proto_imp_api_websocket_websocket_proto_goTypes = []interface{}{ + (*SubscribeRequest)(nil), // 0: websocket.SubscribeRequest + (*SubscribeResponse)(nil), // 1: websocket.SubscribeResponse +} +var file_proto_imp_api_websocket_websocket_proto_depIdxs = []int32{ + 0, // 0: websocket.Websocket.Subscribe:input_type -> websocket.SubscribeRequest + 1, // 1: websocket.Websocket.Subscribe:output_type -> websocket.SubscribeResponse + 1, // [1:2] is the sub-list for method output_type + 0, // [0:1] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_proto_imp_api_websocket_websocket_proto_init() } +func file_proto_imp_api_websocket_websocket_proto_init() { + if File_proto_imp_api_websocket_websocket_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_proto_imp_api_websocket_websocket_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SubscribeRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_imp_api_websocket_websocket_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SubscribeResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_proto_imp_api_websocket_websocket_proto_rawDesc, + NumEnums: 0, + NumMessages: 2, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_proto_imp_api_websocket_websocket_proto_goTypes, + DependencyIndexes: file_proto_imp_api_websocket_websocket_proto_depIdxs, + MessageInfos: file_proto_imp_api_websocket_websocket_proto_msgTypes, + }.Build() + File_proto_imp_api_websocket_websocket_proto = out.File + file_proto_imp_api_websocket_websocket_proto_rawDesc = nil + file_proto_imp_api_websocket_websocket_proto_goTypes = nil + file_proto_imp_api_websocket_websocket_proto_depIdxs = nil +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConnInterface + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion6 + +// WebsocketClient is the client API for Websocket service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type WebsocketClient interface { + Subscribe(ctx context.Context, in *SubscribeRequest, opts ...grpc.CallOption) (Websocket_SubscribeClient, error) +} + +type websocketClient struct { + cc grpc.ClientConnInterface +} + +func NewWebsocketClient(cc grpc.ClientConnInterface) WebsocketClient { + return &websocketClient{cc} +} + +func (c *websocketClient) Subscribe(ctx context.Context, in *SubscribeRequest, opts ...grpc.CallOption) (Websocket_SubscribeClient, error) { + stream, err := c.cc.NewStream(ctx, &_Websocket_serviceDesc.Streams[0], "/websocket.Websocket/Subscribe", opts...) + if err != nil { + return nil, err + } + x := &websocketSubscribeClient{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 Websocket_SubscribeClient interface { + Recv() (*SubscribeResponse, error) + grpc.ClientStream +} + +type websocketSubscribeClient struct { + grpc.ClientStream +} + +func (x *websocketSubscribeClient) Recv() (*SubscribeResponse, error) { + m := new(SubscribeResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +// WebsocketServer is the server API for Websocket service. +type WebsocketServer interface { + Subscribe(*SubscribeRequest, Websocket_SubscribeServer) error +} + +// UnimplementedWebsocketServer can be embedded to have forward compatible implementations. +type UnimplementedWebsocketServer struct { +} + +func (*UnimplementedWebsocketServer) Subscribe(*SubscribeRequest, Websocket_SubscribeServer) error { + return status.Errorf(codes.Unimplemented, "method Subscribe not implemented") +} + +func RegisterWebsocketServer(s *grpc.Server, srv WebsocketServer) { + s.RegisterService(&_Websocket_serviceDesc, srv) +} + +func _Websocket_Subscribe_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(SubscribeRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(WebsocketServer).Subscribe(m, &websocketSubscribeServer{stream}) +} + +type Websocket_SubscribeServer interface { + Send(*SubscribeResponse) error + grpc.ServerStream +} + +type websocketSubscribeServer struct { + grpc.ServerStream +} + +func (x *websocketSubscribeServer) Send(m *SubscribeResponse) error { + return x.ServerStream.SendMsg(m) +} + +var _Websocket_serviceDesc = grpc.ServiceDesc{ + ServiceName: "websocket.Websocket", + HandlerType: (*WebsocketServer)(nil), + Methods: []grpc.MethodDesc{}, + Streams: []grpc.StreamDesc{ + { + StreamName: "Subscribe", + Handler: _Websocket_Subscribe_Handler, + ServerStreams: true, + }, + }, + Metadata: "proto/imp/api/websocket/websocket.proto", +} diff --git a/go/proto/imp/api/websocket/websocket.pb.gw.go b/go/proto/imp/api/websocket/websocket.pb.gw.go new file mode 100644 index 0000000..b5f5c35 --- /dev/null +++ b/go/proto/imp/api/websocket/websocket.pb.gw.go @@ -0,0 +1,134 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: proto/imp/api/websocket/websocket.proto + +/* +Package gen is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package gen + +import ( + "context" + "io" + "net/http" + + "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" + "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = metadata.Join + +func request_Websocket_Subscribe_0(ctx context.Context, marshaler runtime.Marshaler, client WebsocketClient, req *http.Request, pathParams map[string]string) (Websocket_SubscribeClient, runtime.ServerMetadata, error) { + var protoReq SubscribeRequest + var metadata runtime.ServerMetadata + + stream, err := client.Subscribe(ctx, &protoReq) + if err != nil { + return nil, metadata, err + } + header, err := stream.Header() + if err != nil { + return nil, metadata, err + } + metadata.HeaderMD = header + return stream, metadata, nil + +} + +// RegisterWebsocketHandlerServer registers the http handlers for service Websocket to "mux". +// UnaryRPC :call WebsocketServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterWebsocketHandlerFromEndpoint instead. +func RegisterWebsocketHandlerServer(ctx context.Context, mux *runtime.ServeMux, server WebsocketServer) error { + + mux.Handle("GET", pattern_Websocket_Subscribe_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + err := status.Error(codes.Unimplemented, "streaming calls are not yet supported in the in-process transport") + _, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + }) + + return nil +} + +// RegisterWebsocketHandlerFromEndpoint is same as RegisterWebsocketHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterWebsocketHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterWebsocketHandler(ctx, mux, conn) +} + +// RegisterWebsocketHandler registers the http handlers for service Websocket to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterWebsocketHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterWebsocketHandlerClient(ctx, mux, NewWebsocketClient(conn)) +} + +// RegisterWebsocketHandlerClient registers the http handlers for service Websocket +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "WebsocketClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "WebsocketClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "WebsocketClient" to call the correct interceptors. +func RegisterWebsocketHandlerClient(ctx context.Context, mux *runtime.ServeMux, client WebsocketClient) error { + + mux.Handle("GET", pattern_Websocket_Subscribe_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req, "/websocket.Websocket/Subscribe", runtime.WithHTTPPathPattern("/v1/subscribe")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Websocket_Subscribe_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Websocket_Subscribe_0(ctx, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Websocket_Subscribe_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "subscribe"}, "")) +) + +var ( + forward_Websocket_Subscribe_0 = runtime.ForwardResponseStream +) diff --git a/js/acceptcontractrequest.js b/js/acceptcontractrequest.js new file mode 100644 index 0000000..b9b4703 --- /dev/null +++ b/js/acceptcontractrequest.js @@ -0,0 +1,230 @@ +// source: proto/imp/api/vpn/vpn.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +goog.provide('proto.vpn.AcceptContractRequest'); + +goog.require('jspb.BinaryReader'); +goog.require('jspb.BinaryWriter'); +goog.require('jspb.Message'); + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.vpn.AcceptContractRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.vpn.AcceptContractRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.vpn.AcceptContractRequest.displayName = 'proto.vpn.AcceptContractRequest'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.vpn.AcceptContractRequest.prototype.toObject = function(opt_includeInstance) { + return proto.vpn.AcceptContractRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.vpn.AcceptContractRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.vpn.AcceptContractRequest.toObject = function(includeInstance, msg) { + var f, obj = { + pubkey: jspb.Message.getFieldWithDefault(msg, 1, ""), + nonce: jspb.Message.getFieldWithDefault(msg, 2, ""), + price: jspb.Message.getFieldWithDefault(msg, 3, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.vpn.AcceptContractRequest} + */ +proto.vpn.AcceptContractRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.vpn.AcceptContractRequest; + return proto.vpn.AcceptContractRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.vpn.AcceptContractRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.vpn.AcceptContractRequest} + */ +proto.vpn.AcceptContractRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setPubkey(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setNonce(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setPrice(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.vpn.AcceptContractRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.vpn.AcceptContractRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.vpn.AcceptContractRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.vpn.AcceptContractRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getPubkey(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getNonce(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getPrice(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } +}; + + +/** + * optional string pubkey = 1; + * @return {string} + */ +proto.vpn.AcceptContractRequest.prototype.getPubkey = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.vpn.AcceptContractRequest} returns this + */ +proto.vpn.AcceptContractRequest.prototype.setPubkey = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional string nonce = 2; + * @return {string} + */ +proto.vpn.AcceptContractRequest.prototype.getNonce = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.vpn.AcceptContractRequest} returns this + */ +proto.vpn.AcceptContractRequest.prototype.setNonce = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * optional string price = 3; + * @return {string} + */ +proto.vpn.AcceptContractRequest.prototype.getPrice = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.vpn.AcceptContractRequest} returns this + */ +proto.vpn.AcceptContractRequest.prototype.setPrice = function(value) { + return jspb.Message.setProto3StringField(this, 3, value); +}; + + diff --git a/js/acceptcontractresponse.js b/js/acceptcontractresponse.js new file mode 100644 index 0000000..778882c --- /dev/null +++ b/js/acceptcontractresponse.js @@ -0,0 +1,170 @@ +// source: proto/imp/api/vpn/vpn.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +goog.provide('proto.vpn.AcceptContractResponse'); + +goog.require('jspb.BinaryReader'); +goog.require('jspb.BinaryWriter'); +goog.require('jspb.Message'); + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.vpn.AcceptContractResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.vpn.AcceptContractResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.vpn.AcceptContractResponse.displayName = 'proto.vpn.AcceptContractResponse'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.vpn.AcceptContractResponse.prototype.toObject = function(opt_includeInstance) { + return proto.vpn.AcceptContractResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.vpn.AcceptContractResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.vpn.AcceptContractResponse.toObject = function(includeInstance, msg) { + var f, obj = { + id: jspb.Message.getFieldWithDefault(msg, 1, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.vpn.AcceptContractResponse} + */ +proto.vpn.AcceptContractResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.vpn.AcceptContractResponse; + return proto.vpn.AcceptContractResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.vpn.AcceptContractResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.vpn.AcceptContractResponse} + */ +proto.vpn.AcceptContractResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setId(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.vpn.AcceptContractResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.vpn.AcceptContractResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.vpn.AcceptContractResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.vpn.AcceptContractResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getId(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * optional string id = 1; + * @return {string} + */ +proto.vpn.AcceptContractResponse.prototype.getId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.vpn.AcceptContractResponse} returns this + */ +proto.vpn.AcceptContractResponse.prototype.setId = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + diff --git a/js/checkinvoicerequest.js b/js/checkinvoicerequest.js new file mode 100644 index 0000000..d4b7fcf --- /dev/null +++ b/js/checkinvoicerequest.js @@ -0,0 +1,168 @@ +// source: proto/imp/api/lightning/lightning.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +goog.provide('proto.lightning.CheckInvoiceRequest'); + +goog.require('jspb.BinaryReader'); +goog.require('jspb.BinaryWriter'); +goog.require('jspb.Message'); + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.lightning.CheckInvoiceRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.lightning.CheckInvoiceRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.lightning.CheckInvoiceRequest.displayName = 'proto.lightning.CheckInvoiceRequest'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.lightning.CheckInvoiceRequest.prototype.toObject = function(opt_includeInstance) { + return proto.lightning.CheckInvoiceRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.lightning.CheckInvoiceRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.lightning.CheckInvoiceRequest.toObject = function(includeInstance, msg) { + var f, obj = { + invoice: jspb.Message.getFieldWithDefault(msg, 1, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.lightning.CheckInvoiceRequest} + */ +proto.lightning.CheckInvoiceRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.lightning.CheckInvoiceRequest; + return proto.lightning.CheckInvoiceRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.lightning.CheckInvoiceRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.lightning.CheckInvoiceRequest} + */ +proto.lightning.CheckInvoiceRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setInvoice(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.lightning.CheckInvoiceRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.lightning.CheckInvoiceRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.lightning.CheckInvoiceRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.lightning.CheckInvoiceRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getInvoice(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * optional string invoice = 1; + * @return {string} + */ +proto.lightning.CheckInvoiceRequest.prototype.getInvoice = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.lightning.CheckInvoiceRequest} returns this + */ +proto.lightning.CheckInvoiceRequest.prototype.setInvoice = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; diff --git a/js/checkinvoiceresponse.js b/js/checkinvoiceresponse.js new file mode 100644 index 0000000..889fdb5 --- /dev/null +++ b/js/checkinvoiceresponse.js @@ -0,0 +1,168 @@ +// source: proto/imp/api/lightning/lightning.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +goog.provide('proto.lightning.CheckInvoiceResponse'); + +goog.require('jspb.BinaryReader'); +goog.require('jspb.BinaryWriter'); +goog.require('jspb.Message'); + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.lightning.CheckInvoiceResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.lightning.CheckInvoiceResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.lightning.CheckInvoiceResponse.displayName = 'proto.lightning.CheckInvoiceResponse'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.lightning.CheckInvoiceResponse.prototype.toObject = function(opt_includeInstance) { + return proto.lightning.CheckInvoiceResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.lightning.CheckInvoiceResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.lightning.CheckInvoiceResponse.toObject = function(includeInstance, msg) { + var f, obj = { + paid: jspb.Message.getBooleanFieldWithDefault(msg, 1, false) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.lightning.CheckInvoiceResponse} + */ +proto.lightning.CheckInvoiceResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.lightning.CheckInvoiceResponse; + return proto.lightning.CheckInvoiceResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.lightning.CheckInvoiceResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.lightning.CheckInvoiceResponse} + */ +proto.lightning.CheckInvoiceResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setPaid(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.lightning.CheckInvoiceResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.lightning.CheckInvoiceResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.lightning.CheckInvoiceResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.lightning.CheckInvoiceResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getPaid(); + if (f) { + writer.writeBool( + 1, + f + ); + } +}; + + +/** + * optional bool paid = 1; + * @return {boolean} + */ +proto.lightning.CheckInvoiceResponse.prototype.getPaid = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 1, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.lightning.CheckInvoiceResponse} returns this + */ +proto.lightning.CheckInvoiceResponse.prototype.setPaid = function(value) { + return jspb.Message.setProto3BooleanField(this, 1, value); +}; diff --git a/js/federaterequest.js b/js/federaterequest.js new file mode 100644 index 0000000..2a6d87f --- /dev/null +++ b/js/federaterequest.js @@ -0,0 +1,168 @@ +// source: proto/imp/api/federate/federate.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +goog.provide('proto.federate.FederateRequest'); + +goog.require('jspb.BinaryReader'); +goog.require('jspb.BinaryWriter'); +goog.require('jspb.Message'); + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.federate.FederateRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.federate.FederateRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.federate.FederateRequest.displayName = 'proto.federate.FederateRequest'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.federate.FederateRequest.prototype.toObject = function(opt_includeInstance) { + return proto.federate.FederateRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.federate.FederateRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.federate.FederateRequest.toObject = function(includeInstance, msg) { + var f, obj = { + pubkey: jspb.Message.getFieldWithDefault(msg, 1, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.federate.FederateRequest} + */ +proto.federate.FederateRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.federate.FederateRequest; + return proto.federate.FederateRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.federate.FederateRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.federate.FederateRequest} + */ +proto.federate.FederateRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setPubkey(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.federate.FederateRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.federate.FederateRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.federate.FederateRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.federate.FederateRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getPubkey(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * optional string pubkey = 1; + * @return {string} + */ +proto.federate.FederateRequest.prototype.getPubkey = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.federate.FederateRequest} returns this + */ +proto.federate.FederateRequest.prototype.setPubkey = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; diff --git a/js/federateresponse.js b/js/federateresponse.js new file mode 100644 index 0000000..fe27001 --- /dev/null +++ b/js/federateresponse.js @@ -0,0 +1,168 @@ +// source: proto/imp/api/federate/federate.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +goog.provide('proto.federate.FederateResponse'); + +goog.require('jspb.BinaryReader'); +goog.require('jspb.BinaryWriter'); +goog.require('jspb.Message'); + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.federate.FederateResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.federate.FederateResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.federate.FederateResponse.displayName = 'proto.federate.FederateResponse'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.federate.FederateResponse.prototype.toObject = function(opt_includeInstance) { + return proto.federate.FederateResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.federate.FederateResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.federate.FederateResponse.toObject = function(includeInstance, msg) { + var f, obj = { + msg: jspb.Message.getFieldWithDefault(msg, 1, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.federate.FederateResponse} + */ +proto.federate.FederateResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.federate.FederateResponse; + return proto.federate.FederateResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.federate.FederateResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.federate.FederateResponse} + */ +proto.federate.FederateResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setMsg(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.federate.FederateResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.federate.FederateResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.federate.FederateResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.federate.FederateResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getMsg(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * optional string msg = 1; + * @return {string} + */ +proto.federate.FederateResponse.prototype.getMsg = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.federate.FederateResponse} returns this + */ +proto.federate.FederateResponse.prototype.setMsg = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; diff --git a/js/generateinvoicerequest.js b/js/generateinvoicerequest.js new file mode 100644 index 0000000..04e1593 --- /dev/null +++ b/js/generateinvoicerequest.js @@ -0,0 +1,198 @@ +// source: proto/imp/api/lightning/lightning.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +goog.provide('proto.lightning.GenerateInvoiceRequest'); + +goog.require('jspb.BinaryReader'); +goog.require('jspb.BinaryWriter'); +goog.require('jspb.Message'); + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.lightning.GenerateInvoiceRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.lightning.GenerateInvoiceRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.lightning.GenerateInvoiceRequest.displayName = 'proto.lightning.GenerateInvoiceRequest'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.lightning.GenerateInvoiceRequest.prototype.toObject = function(opt_includeInstance) { + return proto.lightning.GenerateInvoiceRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.lightning.GenerateInvoiceRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.lightning.GenerateInvoiceRequest.toObject = function(includeInstance, msg) { + var f, obj = { + amount: jspb.Message.getFieldWithDefault(msg, 1, 0), + memo: jspb.Message.getFieldWithDefault(msg, 2, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.lightning.GenerateInvoiceRequest} + */ +proto.lightning.GenerateInvoiceRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.lightning.GenerateInvoiceRequest; + return proto.lightning.GenerateInvoiceRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.lightning.GenerateInvoiceRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.lightning.GenerateInvoiceRequest} + */ +proto.lightning.GenerateInvoiceRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt64()); + msg.setAmount(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setMemo(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.lightning.GenerateInvoiceRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.lightning.GenerateInvoiceRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.lightning.GenerateInvoiceRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.lightning.GenerateInvoiceRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getAmount(); + if (f !== 0) { + writer.writeInt64( + 1, + f + ); + } + f = message.getMemo(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } +}; + + +/** + * optional int64 amount = 1; + * @return {number} + */ +proto.lightning.GenerateInvoiceRequest.prototype.getAmount = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.lightning.GenerateInvoiceRequest} returns this + */ +proto.lightning.GenerateInvoiceRequest.prototype.setAmount = function(value) { + return jspb.Message.setProto3IntField(this, 1, value); +}; + + +/** + * optional string memo = 2; + * @return {string} + */ +proto.lightning.GenerateInvoiceRequest.prototype.getMemo = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.lightning.GenerateInvoiceRequest} returns this + */ +proto.lightning.GenerateInvoiceRequest.prototype.setMemo = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; diff --git a/js/generateinvoiceresponse.js b/js/generateinvoiceresponse.js new file mode 100644 index 0000000..186370a --- /dev/null +++ b/js/generateinvoiceresponse.js @@ -0,0 +1,168 @@ +// source: proto/imp/api/lightning/lightning.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +goog.provide('proto.lightning.GenerateInvoiceResponse'); + +goog.require('jspb.BinaryReader'); +goog.require('jspb.BinaryWriter'); +goog.require('jspb.Message'); + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.lightning.GenerateInvoiceResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.lightning.GenerateInvoiceResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.lightning.GenerateInvoiceResponse.displayName = 'proto.lightning.GenerateInvoiceResponse'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.lightning.GenerateInvoiceResponse.prototype.toObject = function(opt_includeInstance) { + return proto.lightning.GenerateInvoiceResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.lightning.GenerateInvoiceResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.lightning.GenerateInvoiceResponse.toObject = function(includeInstance, msg) { + var f, obj = { + invoice: jspb.Message.getFieldWithDefault(msg, 1, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.lightning.GenerateInvoiceResponse} + */ +proto.lightning.GenerateInvoiceResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.lightning.GenerateInvoiceResponse; + return proto.lightning.GenerateInvoiceResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.lightning.GenerateInvoiceResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.lightning.GenerateInvoiceResponse} + */ +proto.lightning.GenerateInvoiceResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setInvoice(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.lightning.GenerateInvoiceResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.lightning.GenerateInvoiceResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.lightning.GenerateInvoiceResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.lightning.GenerateInvoiceResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getInvoice(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * optional string invoice = 1; + * @return {string} + */ +proto.lightning.GenerateInvoiceResponse.prototype.getInvoice = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.lightning.GenerateInvoiceResponse} returns this + */ +proto.lightning.GenerateInvoiceResponse.prototype.setInvoice = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; diff --git a/js/leavefederationrequest.js b/js/leavefederationrequest.js new file mode 100644 index 0000000..d5290db --- /dev/null +++ b/js/leavefederationrequest.js @@ -0,0 +1,170 @@ +// source: proto/imp/api/federate/federate.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +goog.provide('proto.federate.LeaveFederationRequest'); + +goog.require('jspb.BinaryReader'); +goog.require('jspb.BinaryWriter'); +goog.require('jspb.Message'); + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.federate.LeaveFederationRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.federate.LeaveFederationRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.federate.LeaveFederationRequest.displayName = 'proto.federate.LeaveFederationRequest'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.federate.LeaveFederationRequest.prototype.toObject = function(opt_includeInstance) { + return proto.federate.LeaveFederationRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.federate.LeaveFederationRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.federate.LeaveFederationRequest.toObject = function(includeInstance, msg) { + var f, obj = { + pubkey: jspb.Message.getFieldWithDefault(msg, 1, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.federate.LeaveFederationRequest} + */ +proto.federate.LeaveFederationRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.federate.LeaveFederationRequest; + return proto.federate.LeaveFederationRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.federate.LeaveFederationRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.federate.LeaveFederationRequest} + */ +proto.federate.LeaveFederationRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setPubkey(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.federate.LeaveFederationRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.federate.LeaveFederationRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.federate.LeaveFederationRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.federate.LeaveFederationRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getPubkey(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * optional string pubkey = 1; + * @return {string} + */ +proto.federate.LeaveFederationRequest.prototype.getPubkey = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.federate.LeaveFederationRequest} returns this + */ +proto.federate.LeaveFederationRequest.prototype.setPubkey = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + diff --git a/js/leavefederationresponse.js b/js/leavefederationresponse.js new file mode 100644 index 0000000..488ba3c --- /dev/null +++ b/js/leavefederationresponse.js @@ -0,0 +1,170 @@ +// source: proto/imp/api/federate/federate.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +goog.provide('proto.federate.LeaveFederationResponse'); + +goog.require('jspb.BinaryReader'); +goog.require('jspb.BinaryWriter'); +goog.require('jspb.Message'); + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.federate.LeaveFederationResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.federate.LeaveFederationResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.federate.LeaveFederationResponse.displayName = 'proto.federate.LeaveFederationResponse'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.federate.LeaveFederationResponse.prototype.toObject = function(opt_includeInstance) { + return proto.federate.LeaveFederationResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.federate.LeaveFederationResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.federate.LeaveFederationResponse.toObject = function(includeInstance, msg) { + var f, obj = { + id: jspb.Message.getFieldWithDefault(msg, 1, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.federate.LeaveFederationResponse} + */ +proto.federate.LeaveFederationResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.federate.LeaveFederationResponse; + return proto.federate.LeaveFederationResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.federate.LeaveFederationResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.federate.LeaveFederationResponse} + */ +proto.federate.LeaveFederationResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setId(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.federate.LeaveFederationResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.federate.LeaveFederationResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.federate.LeaveFederationResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.federate.LeaveFederationResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getId(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * optional string id = 1; + * @return {string} + */ +proto.federate.LeaveFederationResponse.prototype.getId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.federate.LeaveFederationResponse} returns this + */ +proto.federate.LeaveFederationResponse.prototype.setId = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + diff --git a/js/messagerequest.js b/js/messagerequest.js new file mode 100644 index 0000000..474088d --- /dev/null +++ b/js/messagerequest.js @@ -0,0 +1,198 @@ +// source: proto/imp/api/messaging/messaging.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +goog.provide('proto.messaging.MessageRequest'); + +goog.require('jspb.BinaryReader'); +goog.require('jspb.BinaryWriter'); +goog.require('jspb.Message'); + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.messaging.MessageRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.messaging.MessageRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.messaging.MessageRequest.displayName = 'proto.messaging.MessageRequest'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.messaging.MessageRequest.prototype.toObject = function(opt_includeInstance) { + return proto.messaging.MessageRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.messaging.MessageRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.messaging.MessageRequest.toObject = function(includeInstance, msg) { + var f, obj = { + body: jspb.Message.getFieldWithDefault(msg, 1, ""), + pubkey: jspb.Message.getFieldWithDefault(msg, 2, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.messaging.MessageRequest} + */ +proto.messaging.MessageRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.messaging.MessageRequest; + return proto.messaging.MessageRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.messaging.MessageRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.messaging.MessageRequest} + */ +proto.messaging.MessageRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setBody(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setPubkey(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.messaging.MessageRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.messaging.MessageRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.messaging.MessageRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.messaging.MessageRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getBody(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getPubkey(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } +}; + + +/** + * optional string body = 1; + * @return {string} + */ +proto.messaging.MessageRequest.prototype.getBody = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.messaging.MessageRequest} returns this + */ +proto.messaging.MessageRequest.prototype.setBody = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional string pubkey = 2; + * @return {string} + */ +proto.messaging.MessageRequest.prototype.getPubkey = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.messaging.MessageRequest} returns this + */ +proto.messaging.MessageRequest.prototype.setPubkey = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; diff --git a/js/messageresponse.js b/js/messageresponse.js new file mode 100644 index 0000000..c3b4ad6 --- /dev/null +++ b/js/messageresponse.js @@ -0,0 +1,168 @@ +// source: proto/imp/api/messaging/messaging.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +goog.provide('proto.messaging.MessageResponse'); + +goog.require('jspb.BinaryReader'); +goog.require('jspb.BinaryWriter'); +goog.require('jspb.Message'); + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.messaging.MessageResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.messaging.MessageResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.messaging.MessageResponse.displayName = 'proto.messaging.MessageResponse'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.messaging.MessageResponse.prototype.toObject = function(opt_includeInstance) { + return proto.messaging.MessageResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.messaging.MessageResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.messaging.MessageResponse.toObject = function(includeInstance, msg) { + var f, obj = { + body: jspb.Message.getFieldWithDefault(msg, 1, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.messaging.MessageResponse} + */ +proto.messaging.MessageResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.messaging.MessageResponse; + return proto.messaging.MessageResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.messaging.MessageResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.messaging.MessageResponse} + */ +proto.messaging.MessageResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setBody(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.messaging.MessageResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.messaging.MessageResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.messaging.MessageResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.messaging.MessageResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getBody(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * optional string body = 1; + * @return {string} + */ +proto.messaging.MessageResponse.prototype.getBody = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.messaging.MessageResponse} returns this + */ +proto.messaging.MessageResponse.prototype.setBody = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; diff --git a/js/payinvoicerequest.js b/js/payinvoicerequest.js new file mode 100644 index 0000000..5ae1a98 --- /dev/null +++ b/js/payinvoicerequest.js @@ -0,0 +1,168 @@ +// source: proto/imp/api/lightning/lightning.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +goog.provide('proto.lightning.PayInvoiceRequest'); + +goog.require('jspb.BinaryReader'); +goog.require('jspb.BinaryWriter'); +goog.require('jspb.Message'); + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.lightning.PayInvoiceRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.lightning.PayInvoiceRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.lightning.PayInvoiceRequest.displayName = 'proto.lightning.PayInvoiceRequest'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.lightning.PayInvoiceRequest.prototype.toObject = function(opt_includeInstance) { + return proto.lightning.PayInvoiceRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.lightning.PayInvoiceRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.lightning.PayInvoiceRequest.toObject = function(includeInstance, msg) { + var f, obj = { + invoice: jspb.Message.getFieldWithDefault(msg, 1, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.lightning.PayInvoiceRequest} + */ +proto.lightning.PayInvoiceRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.lightning.PayInvoiceRequest; + return proto.lightning.PayInvoiceRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.lightning.PayInvoiceRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.lightning.PayInvoiceRequest} + */ +proto.lightning.PayInvoiceRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setInvoice(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.lightning.PayInvoiceRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.lightning.PayInvoiceRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.lightning.PayInvoiceRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.lightning.PayInvoiceRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getInvoice(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * optional string invoice = 1; + * @return {string} + */ +proto.lightning.PayInvoiceRequest.prototype.getInvoice = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.lightning.PayInvoiceRequest} returns this + */ +proto.lightning.PayInvoiceRequest.prototype.setInvoice = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; diff --git a/js/payinvoiceresponse.js b/js/payinvoiceresponse.js new file mode 100644 index 0000000..aa8fcb0 --- /dev/null +++ b/js/payinvoiceresponse.js @@ -0,0 +1,168 @@ +// source: proto/imp/api/lightning/lightning.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +goog.provide('proto.lightning.PayInvoiceResponse'); + +goog.require('jspb.BinaryReader'); +goog.require('jspb.BinaryWriter'); +goog.require('jspb.Message'); + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.lightning.PayInvoiceResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.lightning.PayInvoiceResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.lightning.PayInvoiceResponse.displayName = 'proto.lightning.PayInvoiceResponse'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.lightning.PayInvoiceResponse.prototype.toObject = function(opt_includeInstance) { + return proto.lightning.PayInvoiceResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.lightning.PayInvoiceResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.lightning.PayInvoiceResponse.toObject = function(includeInstance, msg) { + var f, obj = { + preimage: jspb.Message.getFieldWithDefault(msg, 1, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.lightning.PayInvoiceResponse} + */ +proto.lightning.PayInvoiceResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.lightning.PayInvoiceResponse; + return proto.lightning.PayInvoiceResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.lightning.PayInvoiceResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.lightning.PayInvoiceResponse} + */ +proto.lightning.PayInvoiceResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setPreimage(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.lightning.PayInvoiceResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.lightning.PayInvoiceResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.lightning.PayInvoiceResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.lightning.PayInvoiceResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getPreimage(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * optional string preimage = 1; + * @return {string} + */ +proto.lightning.PayInvoiceResponse.prototype.getPreimage = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.lightning.PayInvoiceResponse} returns this + */ +proto.lightning.PayInvoiceResponse.prototype.setPreimage = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; diff --git a/js/refreshcontractrequest.js b/js/refreshcontractrequest.js new file mode 100644 index 0000000..2d197d6 --- /dev/null +++ b/js/refreshcontractrequest.js @@ -0,0 +1,230 @@ +// source: proto/imp/api/vpn/vpn.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +goog.provide('proto.vpn.RefreshContractRequest'); + +goog.require('jspb.BinaryReader'); +goog.require('jspb.BinaryWriter'); +goog.require('jspb.Message'); + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.vpn.RefreshContractRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.vpn.RefreshContractRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.vpn.RefreshContractRequest.displayName = 'proto.vpn.RefreshContractRequest'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.vpn.RefreshContractRequest.prototype.toObject = function(opt_includeInstance) { + return proto.vpn.RefreshContractRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.vpn.RefreshContractRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.vpn.RefreshContractRequest.toObject = function(includeInstance, msg) { + var f, obj = { + pubkey: jspb.Message.getFieldWithDefault(msg, 1, ""), + nonce: jspb.Message.getFieldWithDefault(msg, 2, ""), + price: jspb.Message.getFieldWithDefault(msg, 3, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.vpn.RefreshContractRequest} + */ +proto.vpn.RefreshContractRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.vpn.RefreshContractRequest; + return proto.vpn.RefreshContractRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.vpn.RefreshContractRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.vpn.RefreshContractRequest} + */ +proto.vpn.RefreshContractRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setPubkey(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setNonce(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setPrice(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.vpn.RefreshContractRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.vpn.RefreshContractRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.vpn.RefreshContractRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.vpn.RefreshContractRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getPubkey(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getNonce(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getPrice(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } +}; + + +/** + * optional string pubkey = 1; + * @return {string} + */ +proto.vpn.RefreshContractRequest.prototype.getPubkey = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.vpn.RefreshContractRequest} returns this + */ +proto.vpn.RefreshContractRequest.prototype.setPubkey = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional string nonce = 2; + * @return {string} + */ +proto.vpn.RefreshContractRequest.prototype.getNonce = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.vpn.RefreshContractRequest} returns this + */ +proto.vpn.RefreshContractRequest.prototype.setNonce = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * optional string price = 3; + * @return {string} + */ +proto.vpn.RefreshContractRequest.prototype.getPrice = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.vpn.RefreshContractRequest} returns this + */ +proto.vpn.RefreshContractRequest.prototype.setPrice = function(value) { + return jspb.Message.setProto3StringField(this, 3, value); +}; + + diff --git a/js/refreshcontractresponse.js b/js/refreshcontractresponse.js new file mode 100644 index 0000000..55c97f0 --- /dev/null +++ b/js/refreshcontractresponse.js @@ -0,0 +1,170 @@ +// source: proto/imp/api/vpn/vpn.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +goog.provide('proto.vpn.RefreshContractResponse'); + +goog.require('jspb.BinaryReader'); +goog.require('jspb.BinaryWriter'); +goog.require('jspb.Message'); + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.vpn.RefreshContractResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.vpn.RefreshContractResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.vpn.RefreshContractResponse.displayName = 'proto.vpn.RefreshContractResponse'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.vpn.RefreshContractResponse.prototype.toObject = function(opt_includeInstance) { + return proto.vpn.RefreshContractResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.vpn.RefreshContractResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.vpn.RefreshContractResponse.toObject = function(includeInstance, msg) { + var f, obj = { + id: jspb.Message.getFieldWithDefault(msg, 1, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.vpn.RefreshContractResponse} + */ +proto.vpn.RefreshContractResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.vpn.RefreshContractResponse; + return proto.vpn.RefreshContractResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.vpn.RefreshContractResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.vpn.RefreshContractResponse} + */ +proto.vpn.RefreshContractResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setId(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.vpn.RefreshContractResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.vpn.RefreshContractResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.vpn.RefreshContractResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.vpn.RefreshContractResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getId(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * optional string id = 1; + * @return {string} + */ +proto.vpn.RefreshContractResponse.prototype.getId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.vpn.RefreshContractResponse} returns this + */ +proto.vpn.RefreshContractResponse.prototype.setId = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + diff --git a/js/requestfederaterequest.js b/js/requestfederaterequest.js new file mode 100644 index 0000000..c92eda5 --- /dev/null +++ b/js/requestfederaterequest.js @@ -0,0 +1,170 @@ +// source: proto/imp/api/federate/federate.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +goog.provide('proto.federate.RequestFederateRequest'); + +goog.require('jspb.BinaryReader'); +goog.require('jspb.BinaryWriter'); +goog.require('jspb.Message'); + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.federate.RequestFederateRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.federate.RequestFederateRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.federate.RequestFederateRequest.displayName = 'proto.federate.RequestFederateRequest'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.federate.RequestFederateRequest.prototype.toObject = function(opt_includeInstance) { + return proto.federate.RequestFederateRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.federate.RequestFederateRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.federate.RequestFederateRequest.toObject = function(includeInstance, msg) { + var f, obj = { + pubkey: jspb.Message.getFieldWithDefault(msg, 1, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.federate.RequestFederateRequest} + */ +proto.federate.RequestFederateRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.federate.RequestFederateRequest; + return proto.federate.RequestFederateRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.federate.RequestFederateRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.federate.RequestFederateRequest} + */ +proto.federate.RequestFederateRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setPubkey(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.federate.RequestFederateRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.federate.RequestFederateRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.federate.RequestFederateRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.federate.RequestFederateRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getPubkey(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * optional string pubkey = 1; + * @return {string} + */ +proto.federate.RequestFederateRequest.prototype.getPubkey = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.federate.RequestFederateRequest} returns this + */ +proto.federate.RequestFederateRequest.prototype.setPubkey = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + diff --git a/js/requestfederateresponse.js b/js/requestfederateresponse.js new file mode 100644 index 0000000..37f1da8 --- /dev/null +++ b/js/requestfederateresponse.js @@ -0,0 +1,170 @@ +// source: proto/imp/api/federate/federate.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +goog.provide('proto.federate.RequestFederateResponse'); + +goog.require('jspb.BinaryReader'); +goog.require('jspb.BinaryWriter'); +goog.require('jspb.Message'); + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.federate.RequestFederateResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.federate.RequestFederateResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.federate.RequestFederateResponse.displayName = 'proto.federate.RequestFederateResponse'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.federate.RequestFederateResponse.prototype.toObject = function(opt_includeInstance) { + return proto.federate.RequestFederateResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.federate.RequestFederateResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.federate.RequestFederateResponse.toObject = function(includeInstance, msg) { + var f, obj = { + id: jspb.Message.getFieldWithDefault(msg, 1, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.federate.RequestFederateResponse} + */ +proto.federate.RequestFederateResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.federate.RequestFederateResponse; + return proto.federate.RequestFederateResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.federate.RequestFederateResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.federate.RequestFederateResponse} + */ +proto.federate.RequestFederateResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setId(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.federate.RequestFederateResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.federate.RequestFederateResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.federate.RequestFederateResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.federate.RequestFederateResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getId(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * optional string id = 1; + * @return {string} + */ +proto.federate.RequestFederateResponse.prototype.getId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.federate.RequestFederateResponse} returns this + */ +proto.federate.RequestFederateResponse.prototype.setId = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + diff --git a/js/requestquoterequest.js b/js/requestquoterequest.js new file mode 100644 index 0000000..561b840 --- /dev/null +++ b/js/requestquoterequest.js @@ -0,0 +1,170 @@ +// source: proto/imp/api/vpn/vpn.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +goog.provide('proto.vpn.RequestQuoteRequest'); + +goog.require('jspb.BinaryReader'); +goog.require('jspb.BinaryWriter'); +goog.require('jspb.Message'); + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.vpn.RequestQuoteRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.vpn.RequestQuoteRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.vpn.RequestQuoteRequest.displayName = 'proto.vpn.RequestQuoteRequest'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.vpn.RequestQuoteRequest.prototype.toObject = function(opt_includeInstance) { + return proto.vpn.RequestQuoteRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.vpn.RequestQuoteRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.vpn.RequestQuoteRequest.toObject = function(includeInstance, msg) { + var f, obj = { + pubkey: jspb.Message.getFieldWithDefault(msg, 1, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.vpn.RequestQuoteRequest} + */ +proto.vpn.RequestQuoteRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.vpn.RequestQuoteRequest; + return proto.vpn.RequestQuoteRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.vpn.RequestQuoteRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.vpn.RequestQuoteRequest} + */ +proto.vpn.RequestQuoteRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setPubkey(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.vpn.RequestQuoteRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.vpn.RequestQuoteRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.vpn.RequestQuoteRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.vpn.RequestQuoteRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getPubkey(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * optional string pubkey = 1; + * @return {string} + */ +proto.vpn.RequestQuoteRequest.prototype.getPubkey = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.vpn.RequestQuoteRequest} returns this + */ +proto.vpn.RequestQuoteRequest.prototype.setPubkey = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + diff --git a/js/requestquoteresponse.js b/js/requestquoteresponse.js new file mode 100644 index 0000000..02bab52 --- /dev/null +++ b/js/requestquoteresponse.js @@ -0,0 +1,170 @@ +// source: proto/imp/api/vpn/vpn.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +goog.provide('proto.vpn.RequestQuoteResponse'); + +goog.require('jspb.BinaryReader'); +goog.require('jspb.BinaryWriter'); +goog.require('jspb.Message'); + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.vpn.RequestQuoteResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.vpn.RequestQuoteResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.vpn.RequestQuoteResponse.displayName = 'proto.vpn.RequestQuoteResponse'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.vpn.RequestQuoteResponse.prototype.toObject = function(opt_includeInstance) { + return proto.vpn.RequestQuoteResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.vpn.RequestQuoteResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.vpn.RequestQuoteResponse.toObject = function(includeInstance, msg) { + var f, obj = { + id: jspb.Message.getFieldWithDefault(msg, 1, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.vpn.RequestQuoteResponse} + */ +proto.vpn.RequestQuoteResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.vpn.RequestQuoteResponse; + return proto.vpn.RequestQuoteResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.vpn.RequestQuoteResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.vpn.RequestQuoteResponse} + */ +proto.vpn.RequestQuoteResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setId(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.vpn.RequestQuoteResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.vpn.RequestQuoteResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.vpn.RequestQuoteResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.vpn.RequestQuoteResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getId(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * optional string id = 1; + * @return {string} + */ +proto.vpn.RequestQuoteResponse.prototype.getId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.vpn.RequestQuoteResponse} returns this + */ +proto.vpn.RequestQuoteResponse.prototype.setId = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + diff --git a/js/sendmessagerequest.js b/js/sendmessagerequest.js new file mode 100644 index 0000000..0b8c0c3 --- /dev/null +++ b/js/sendmessagerequest.js @@ -0,0 +1,200 @@ +// source: proto/imp/api/messaging/messaging.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +goog.provide('proto.messaging.SendMessageRequest'); + +goog.require('jspb.BinaryReader'); +goog.require('jspb.BinaryWriter'); +goog.require('jspb.Message'); + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.messaging.SendMessageRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.messaging.SendMessageRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.messaging.SendMessageRequest.displayName = 'proto.messaging.SendMessageRequest'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.messaging.SendMessageRequest.prototype.toObject = function(opt_includeInstance) { + return proto.messaging.SendMessageRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.messaging.SendMessageRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.messaging.SendMessageRequest.toObject = function(includeInstance, msg) { + var f, obj = { + msg: jspb.Message.getFieldWithDefault(msg, 1, ""), + pubkey: jspb.Message.getFieldWithDefault(msg, 2, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.messaging.SendMessageRequest} + */ +proto.messaging.SendMessageRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.messaging.SendMessageRequest; + return proto.messaging.SendMessageRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.messaging.SendMessageRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.messaging.SendMessageRequest} + */ +proto.messaging.SendMessageRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setMsg(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setPubkey(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.messaging.SendMessageRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.messaging.SendMessageRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.messaging.SendMessageRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.messaging.SendMessageRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getMsg(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getPubkey(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } +}; + + +/** + * optional string msg = 1; + * @return {string} + */ +proto.messaging.SendMessageRequest.prototype.getMsg = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.messaging.SendMessageRequest} returns this + */ +proto.messaging.SendMessageRequest.prototype.setMsg = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional string pubkey = 2; + * @return {string} + */ +proto.messaging.SendMessageRequest.prototype.getPubkey = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.messaging.SendMessageRequest} returns this + */ +proto.messaging.SendMessageRequest.prototype.setPubkey = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + diff --git a/js/sendmessageresponse.js b/js/sendmessageresponse.js new file mode 100644 index 0000000..5f132f7 --- /dev/null +++ b/js/sendmessageresponse.js @@ -0,0 +1,170 @@ +// source: proto/imp/api/messaging/messaging.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +goog.provide('proto.messaging.SendMessageResponse'); + +goog.require('jspb.BinaryReader'); +goog.require('jspb.BinaryWriter'); +goog.require('jspb.Message'); + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.messaging.SendMessageResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.messaging.SendMessageResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.messaging.SendMessageResponse.displayName = 'proto.messaging.SendMessageResponse'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.messaging.SendMessageResponse.prototype.toObject = function(opt_includeInstance) { + return proto.messaging.SendMessageResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.messaging.SendMessageResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.messaging.SendMessageResponse.toObject = function(includeInstance, msg) { + var f, obj = { + id: jspb.Message.getFieldWithDefault(msg, 1, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.messaging.SendMessageResponse} + */ +proto.messaging.SendMessageResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.messaging.SendMessageResponse; + return proto.messaging.SendMessageResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.messaging.SendMessageResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.messaging.SendMessageResponse} + */ +proto.messaging.SendMessageResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setId(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.messaging.SendMessageResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.messaging.SendMessageResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.messaging.SendMessageResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.messaging.SendMessageResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getId(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * optional string id = 1; + * @return {string} + */ +proto.messaging.SendMessageResponse.prototype.getId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.messaging.SendMessageResponse} returns this + */ +proto.messaging.SendMessageResponse.prototype.setId = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + diff --git a/js/sendsocketrequest.js b/js/sendsocketrequest.js new file mode 100644 index 0000000..623fd25 --- /dev/null +++ b/js/sendsocketrequest.js @@ -0,0 +1,170 @@ +// source: proto/imp/api/socket/socket.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +goog.provide('proto.socket.SendSocketRequest'); + +goog.require('jspb.BinaryReader'); +goog.require('jspb.BinaryWriter'); +goog.require('jspb.Message'); + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.socket.SendSocketRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.socket.SendSocketRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.socket.SendSocketRequest.displayName = 'proto.socket.SendSocketRequest'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.socket.SendSocketRequest.prototype.toObject = function(opt_includeInstance) { + return proto.socket.SendSocketRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.socket.SendSocketRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.socket.SendSocketRequest.toObject = function(includeInstance, msg) { + var f, obj = { + pubkey: jspb.Message.getFieldWithDefault(msg, 1, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.socket.SendSocketRequest} + */ +proto.socket.SendSocketRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.socket.SendSocketRequest; + return proto.socket.SendSocketRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.socket.SendSocketRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.socket.SendSocketRequest} + */ +proto.socket.SendSocketRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setPubkey(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.socket.SendSocketRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.socket.SendSocketRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.socket.SendSocketRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.socket.SendSocketRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getPubkey(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * optional string pubkey = 1; + * @return {string} + */ +proto.socket.SendSocketRequest.prototype.getPubkey = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.socket.SendSocketRequest} returns this + */ +proto.socket.SendSocketRequest.prototype.setPubkey = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + diff --git a/js/sendsocketresponse.js b/js/sendsocketresponse.js new file mode 100644 index 0000000..5c04f9e --- /dev/null +++ b/js/sendsocketresponse.js @@ -0,0 +1,170 @@ +// source: proto/imp/api/socket/socket.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +goog.provide('proto.socket.SendSocketResponse'); + +goog.require('jspb.BinaryReader'); +goog.require('jspb.BinaryWriter'); +goog.require('jspb.Message'); + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.socket.SendSocketResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.socket.SendSocketResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.socket.SendSocketResponse.displayName = 'proto.socket.SendSocketResponse'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.socket.SendSocketResponse.prototype.toObject = function(opt_includeInstance) { + return proto.socket.SendSocketResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.socket.SendSocketResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.socket.SendSocketResponse.toObject = function(includeInstance, msg) { + var f, obj = { + id: jspb.Message.getFieldWithDefault(msg, 1, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.socket.SendSocketResponse} + */ +proto.socket.SendSocketResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.socket.SendSocketResponse; + return proto.socket.SendSocketResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.socket.SendSocketResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.socket.SendSocketResponse} + */ +proto.socket.SendSocketResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setId(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.socket.SendSocketResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.socket.SendSocketResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.socket.SendSocketResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.socket.SendSocketResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getId(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * optional string id = 1; + * @return {string} + */ +proto.socket.SendSocketResponse.prototype.getId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.socket.SendSocketResponse} returns this + */ +proto.socket.SendSocketResponse.prototype.setId = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + diff --git a/js/signrequest.js b/js/signrequest.js new file mode 100644 index 0000000..fb9d8d5 --- /dev/null +++ b/js/signrequest.js @@ -0,0 +1,170 @@ +// source: proto/imp/api/signing/signing.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +goog.provide('proto.signing.SignRequest'); + +goog.require('jspb.BinaryReader'); +goog.require('jspb.BinaryWriter'); +goog.require('jspb.Message'); + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.signing.SignRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.signing.SignRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.signing.SignRequest.displayName = 'proto.signing.SignRequest'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.signing.SignRequest.prototype.toObject = function(opt_includeInstance) { + return proto.signing.SignRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.signing.SignRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.signing.SignRequest.toObject = function(includeInstance, msg) { + var f, obj = { + msg: jspb.Message.getFieldWithDefault(msg, 1, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.signing.SignRequest} + */ +proto.signing.SignRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.signing.SignRequest; + return proto.signing.SignRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.signing.SignRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.signing.SignRequest} + */ +proto.signing.SignRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setMsg(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.signing.SignRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.signing.SignRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.signing.SignRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.signing.SignRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getMsg(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * optional string msg = 1; + * @return {string} + */ +proto.signing.SignRequest.prototype.getMsg = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.signing.SignRequest} returns this + */ +proto.signing.SignRequest.prototype.setMsg = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + diff --git a/js/signresponse.js b/js/signresponse.js new file mode 100644 index 0000000..1165292 --- /dev/null +++ b/js/signresponse.js @@ -0,0 +1,170 @@ +// source: proto/imp/api/signing/signing.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +goog.provide('proto.signing.SignResponse'); + +goog.require('jspb.BinaryReader'); +goog.require('jspb.BinaryWriter'); +goog.require('jspb.Message'); + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.signing.SignResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.signing.SignResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.signing.SignResponse.displayName = 'proto.signing.SignResponse'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.signing.SignResponse.prototype.toObject = function(opt_includeInstance) { + return proto.signing.SignResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.signing.SignResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.signing.SignResponse.toObject = function(includeInstance, msg) { + var f, obj = { + signature: jspb.Message.getFieldWithDefault(msg, 1, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.signing.SignResponse} + */ +proto.signing.SignResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.signing.SignResponse; + return proto.signing.SignResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.signing.SignResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.signing.SignResponse} + */ +proto.signing.SignResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setSignature(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.signing.SignResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.signing.SignResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.signing.SignResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.signing.SignResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getSignature(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * optional string signature = 1; + * @return {string} + */ +proto.signing.SignResponse.prototype.getSignature = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.signing.SignResponse} returns this + */ +proto.signing.SignResponse.prototype.setSignature = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + diff --git a/js/socketrequest.js b/js/socketrequest.js new file mode 100644 index 0000000..57ca18a --- /dev/null +++ b/js/socketrequest.js @@ -0,0 +1,141 @@ +// source: proto/imp/api/socket/socket.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +goog.provide('proto.socket.SocketRequest'); + +goog.require('jspb.BinaryReader'); +goog.require('jspb.BinaryWriter'); +goog.require('jspb.Message'); + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.socket.SocketRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.socket.SocketRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.socket.SocketRequest.displayName = 'proto.socket.SocketRequest'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.socket.SocketRequest.prototype.toObject = function(opt_includeInstance) { + return proto.socket.SocketRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.socket.SocketRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.socket.SocketRequest.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.socket.SocketRequest} + */ +proto.socket.SocketRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.socket.SocketRequest; + return proto.socket.SocketRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.socket.SocketRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.socket.SocketRequest} + */ +proto.socket.SocketRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.socket.SocketRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.socket.SocketRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.socket.SocketRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.socket.SocketRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + diff --git a/js/socketresponse.js b/js/socketresponse.js new file mode 100644 index 0000000..c71169e --- /dev/null +++ b/js/socketresponse.js @@ -0,0 +1,170 @@ +// source: proto/imp/api/socket/socket.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +goog.provide('proto.socket.SocketResponse'); + +goog.require('jspb.BinaryReader'); +goog.require('jspb.BinaryWriter'); +goog.require('jspb.Message'); + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.socket.SocketResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.socket.SocketResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.socket.SocketResponse.displayName = 'proto.socket.SocketResponse'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.socket.SocketResponse.prototype.toObject = function(opt_includeInstance) { + return proto.socket.SocketResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.socket.SocketResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.socket.SocketResponse.toObject = function(includeInstance, msg) { + var f, obj = { + msg: jspb.Message.getFieldWithDefault(msg, 1, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.socket.SocketResponse} + */ +proto.socket.SocketResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.socket.SocketResponse; + return proto.socket.SocketResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.socket.SocketResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.socket.SocketResponse} + */ +proto.socket.SocketResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setMsg(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.socket.SocketResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.socket.SocketResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.socket.SocketResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.socket.SocketResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getMsg(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * optional string msg = 1; + * @return {string} + */ +proto.socket.SocketResponse.prototype.getMsg = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.socket.SocketResponse} returns this + */ +proto.socket.SocketResponse.prototype.setMsg = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + diff --git a/js/startsocketrequest.js b/js/startsocketrequest.js new file mode 100644 index 0000000..4f72fe3 --- /dev/null +++ b/js/startsocketrequest.js @@ -0,0 +1,141 @@ +// source: proto/imp/api/socket/socket.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +goog.provide('proto.socket.StartSocketRequest'); + +goog.require('jspb.BinaryReader'); +goog.require('jspb.BinaryWriter'); +goog.require('jspb.Message'); + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.socket.StartSocketRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.socket.StartSocketRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.socket.StartSocketRequest.displayName = 'proto.socket.StartSocketRequest'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.socket.StartSocketRequest.prototype.toObject = function(opt_includeInstance) { + return proto.socket.StartSocketRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.socket.StartSocketRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.socket.StartSocketRequest.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.socket.StartSocketRequest} + */ +proto.socket.StartSocketRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.socket.StartSocketRequest; + return proto.socket.StartSocketRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.socket.StartSocketRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.socket.StartSocketRequest} + */ +proto.socket.StartSocketRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.socket.StartSocketRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.socket.StartSocketRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.socket.StartSocketRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.socket.StartSocketRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + diff --git a/js/startsocketresponse.js b/js/startsocketresponse.js new file mode 100644 index 0000000..4a1ab56 --- /dev/null +++ b/js/startsocketresponse.js @@ -0,0 +1,260 @@ +// source: proto/imp/api/socket/socket.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +goog.provide('proto.socket.StartSocketResponse'); + +goog.require('jspb.BinaryReader'); +goog.require('jspb.BinaryWriter'); +goog.require('jspb.Message'); + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.socket.StartSocketResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.socket.StartSocketResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.socket.StartSocketResponse.displayName = 'proto.socket.StartSocketResponse'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.socket.StartSocketResponse.prototype.toObject = function(opt_includeInstance) { + return proto.socket.StartSocketResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.socket.StartSocketResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.socket.StartSocketResponse.toObject = function(includeInstance, msg) { + var f, obj = { + protocol: jspb.Message.getFieldWithDefault(msg, 1, ""), + ip: jspb.Message.getFieldWithDefault(msg, 2, ""), + port1: jspb.Message.getFieldWithDefault(msg, 3, ""), + port2: jspb.Message.getFieldWithDefault(msg, 4, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.socket.StartSocketResponse} + */ +proto.socket.StartSocketResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.socket.StartSocketResponse; + return proto.socket.StartSocketResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.socket.StartSocketResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.socket.StartSocketResponse} + */ +proto.socket.StartSocketResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setProtocol(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setIp(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setPort1(value); + break; + case 4: + var value = /** @type {string} */ (reader.readString()); + msg.setPort2(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.socket.StartSocketResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.socket.StartSocketResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.socket.StartSocketResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.socket.StartSocketResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getProtocol(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getIp(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getPort1(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } + f = message.getPort2(); + if (f.length > 0) { + writer.writeString( + 4, + f + ); + } +}; + + +/** + * optional string protocol = 1; + * @return {string} + */ +proto.socket.StartSocketResponse.prototype.getProtocol = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.socket.StartSocketResponse} returns this + */ +proto.socket.StartSocketResponse.prototype.setProtocol = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional string ip = 2; + * @return {string} + */ +proto.socket.StartSocketResponse.prototype.getIp = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.socket.StartSocketResponse} returns this + */ +proto.socket.StartSocketResponse.prototype.setIp = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * optional string port1 = 3; + * @return {string} + */ +proto.socket.StartSocketResponse.prototype.getPort1 = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.socket.StartSocketResponse} returns this + */ +proto.socket.StartSocketResponse.prototype.setPort1 = function(value) { + return jspb.Message.setProto3StringField(this, 3, value); +}; + + +/** + * optional string port2 = 4; + * @return {string} + */ +proto.socket.StartSocketResponse.prototype.getPort2 = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); +}; + + +/** + * @param {string} value + * @return {!proto.socket.StartSocketResponse} returns this + */ +proto.socket.StartSocketResponse.prototype.setPort2 = function(value) { + return jspb.Message.setProto3StringField(this, 4, value); +}; + + diff --git a/js/stopsocketrequest.js b/js/stopsocketrequest.js new file mode 100644 index 0000000..f1eb5b5 --- /dev/null +++ b/js/stopsocketrequest.js @@ -0,0 +1,141 @@ +// source: proto/imp/api/socket/socket.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +goog.provide('proto.socket.StopSocketRequest'); + +goog.require('jspb.BinaryReader'); +goog.require('jspb.BinaryWriter'); +goog.require('jspb.Message'); + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.socket.StopSocketRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.socket.StopSocketRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.socket.StopSocketRequest.displayName = 'proto.socket.StopSocketRequest'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.socket.StopSocketRequest.prototype.toObject = function(opt_includeInstance) { + return proto.socket.StopSocketRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.socket.StopSocketRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.socket.StopSocketRequest.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.socket.StopSocketRequest} + */ +proto.socket.StopSocketRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.socket.StopSocketRequest; + return proto.socket.StopSocketRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.socket.StopSocketRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.socket.StopSocketRequest} + */ +proto.socket.StopSocketRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.socket.StopSocketRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.socket.StopSocketRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.socket.StopSocketRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.socket.StopSocketRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + diff --git a/js/stopsocketresponse.js b/js/stopsocketresponse.js new file mode 100644 index 0000000..e9715b3 --- /dev/null +++ b/js/stopsocketresponse.js @@ -0,0 +1,141 @@ +// source: proto/imp/api/socket/socket.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +goog.provide('proto.socket.StopSocketResponse'); + +goog.require('jspb.BinaryReader'); +goog.require('jspb.BinaryWriter'); +goog.require('jspb.Message'); + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.socket.StopSocketResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.socket.StopSocketResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.socket.StopSocketResponse.displayName = 'proto.socket.StopSocketResponse'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.socket.StopSocketResponse.prototype.toObject = function(opt_includeInstance) { + return proto.socket.StopSocketResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.socket.StopSocketResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.socket.StopSocketResponse.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.socket.StopSocketResponse} + */ +proto.socket.StopSocketResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.socket.StopSocketResponse; + return proto.socket.StopSocketResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.socket.StopSocketResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.socket.StopSocketResponse} + */ +proto.socket.StopSocketResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.socket.StopSocketResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.socket.StopSocketResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.socket.StopSocketResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.socket.StopSocketResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + diff --git a/js/subscriberequest.js b/js/subscriberequest.js new file mode 100644 index 0000000..159f345 --- /dev/null +++ b/js/subscriberequest.js @@ -0,0 +1,141 @@ +// source: proto/imp/api/websocket/websocket.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +goog.provide('proto.websocket.SubscribeRequest'); + +goog.require('jspb.BinaryReader'); +goog.require('jspb.BinaryWriter'); +goog.require('jspb.Message'); + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.websocket.SubscribeRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.websocket.SubscribeRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.websocket.SubscribeRequest.displayName = 'proto.websocket.SubscribeRequest'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.websocket.SubscribeRequest.prototype.toObject = function(opt_includeInstance) { + return proto.websocket.SubscribeRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.websocket.SubscribeRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.websocket.SubscribeRequest.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.websocket.SubscribeRequest} + */ +proto.websocket.SubscribeRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.websocket.SubscribeRequest; + return proto.websocket.SubscribeRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.websocket.SubscribeRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.websocket.SubscribeRequest} + */ +proto.websocket.SubscribeRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.websocket.SubscribeRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.websocket.SubscribeRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.websocket.SubscribeRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.websocket.SubscribeRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + diff --git a/js/subscriberesponse.js b/js/subscriberesponse.js new file mode 100644 index 0000000..6765a9a --- /dev/null +++ b/js/subscriberesponse.js @@ -0,0 +1,320 @@ +// source: proto/imp/api/websocket/websocket.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +goog.provide('proto.websocket.SubscribeResponse'); + +goog.require('jspb.BinaryReader'); +goog.require('jspb.BinaryWriter'); +goog.require('jspb.Message'); + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.websocket.SubscribeResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.websocket.SubscribeResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.websocket.SubscribeResponse.displayName = 'proto.websocket.SubscribeResponse'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.websocket.SubscribeResponse.prototype.toObject = function(opt_includeInstance) { + return proto.websocket.SubscribeResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.websocket.SubscribeResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.websocket.SubscribeResponse.toObject = function(includeInstance, msg) { + var f, obj = { + id: jspb.Message.getFieldWithDefault(msg, 1, ""), + replyToId: jspb.Message.getFieldWithDefault(msg, 2, ""), + fromPubkey: jspb.Message.getFieldWithDefault(msg, 3, ""), + data: jspb.Message.getFieldWithDefault(msg, 4, ""), + serviceType: jspb.Message.getFieldWithDefault(msg, 5, ""), + amount: jspb.Message.getFieldWithDefault(msg, 6, 0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.websocket.SubscribeResponse} + */ +proto.websocket.SubscribeResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.websocket.SubscribeResponse; + return proto.websocket.SubscribeResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.websocket.SubscribeResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.websocket.SubscribeResponse} + */ +proto.websocket.SubscribeResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setId(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setReplyToId(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setFromPubkey(value); + break; + case 4: + var value = /** @type {string} */ (reader.readString()); + msg.setData(value); + break; + case 5: + var value = /** @type {string} */ (reader.readString()); + msg.setServiceType(value); + break; + case 6: + var value = /** @type {number} */ (reader.readInt64()); + msg.setAmount(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.websocket.SubscribeResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.websocket.SubscribeResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.websocket.SubscribeResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.websocket.SubscribeResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getId(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getReplyToId(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getFromPubkey(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } + f = message.getData(); + if (f.length > 0) { + writer.writeString( + 4, + f + ); + } + f = message.getServiceType(); + if (f.length > 0) { + writer.writeString( + 5, + f + ); + } + f = message.getAmount(); + if (f !== 0) { + writer.writeInt64( + 6, + f + ); + } +}; + + +/** + * optional string id = 1; + * @return {string} + */ +proto.websocket.SubscribeResponse.prototype.getId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.websocket.SubscribeResponse} returns this + */ +proto.websocket.SubscribeResponse.prototype.setId = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional string reply_to_id = 2; + * @return {string} + */ +proto.websocket.SubscribeResponse.prototype.getReplyToId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.websocket.SubscribeResponse} returns this + */ +proto.websocket.SubscribeResponse.prototype.setReplyToId = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * optional string from_pubkey = 3; + * @return {string} + */ +proto.websocket.SubscribeResponse.prototype.getFromPubkey = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.websocket.SubscribeResponse} returns this + */ +proto.websocket.SubscribeResponse.prototype.setFromPubkey = function(value) { + return jspb.Message.setProto3StringField(this, 3, value); +}; + + +/** + * optional string data = 4; + * @return {string} + */ +proto.websocket.SubscribeResponse.prototype.getData = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); +}; + + +/** + * @param {string} value + * @return {!proto.websocket.SubscribeResponse} returns this + */ +proto.websocket.SubscribeResponse.prototype.setData = function(value) { + return jspb.Message.setProto3StringField(this, 4, value); +}; + + +/** + * optional string service_type = 5; + * @return {string} + */ +proto.websocket.SubscribeResponse.prototype.getServiceType = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "")); +}; + + +/** + * @param {string} value + * @return {!proto.websocket.SubscribeResponse} returns this + */ +proto.websocket.SubscribeResponse.prototype.setServiceType = function(value) { + return jspb.Message.setProto3StringField(this, 5, value); +}; + + +/** + * optional int64 amount = 6; + * @return {number} + */ +proto.websocket.SubscribeResponse.prototype.getAmount = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 6, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.websocket.SubscribeResponse} returns this + */ +proto.websocket.SubscribeResponse.prototype.setAmount = function(value) { + return jspb.Message.setProto3IntField(this, 6, value); +}; + + diff --git a/js/verifyrequest.js b/js/verifyrequest.js new file mode 100644 index 0000000..892fc98 --- /dev/null +++ b/js/verifyrequest.js @@ -0,0 +1,200 @@ +// source: proto/imp/api/signing/signing.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +goog.provide('proto.signing.VerifyRequest'); + +goog.require('jspb.BinaryReader'); +goog.require('jspb.BinaryWriter'); +goog.require('jspb.Message'); + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.signing.VerifyRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.signing.VerifyRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.signing.VerifyRequest.displayName = 'proto.signing.VerifyRequest'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.signing.VerifyRequest.prototype.toObject = function(opt_includeInstance) { + return proto.signing.VerifyRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.signing.VerifyRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.signing.VerifyRequest.toObject = function(includeInstance, msg) { + var f, obj = { + msg: jspb.Message.getFieldWithDefault(msg, 1, ""), + signature: jspb.Message.getFieldWithDefault(msg, 2, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.signing.VerifyRequest} + */ +proto.signing.VerifyRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.signing.VerifyRequest; + return proto.signing.VerifyRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.signing.VerifyRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.signing.VerifyRequest} + */ +proto.signing.VerifyRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setMsg(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setSignature(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.signing.VerifyRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.signing.VerifyRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.signing.VerifyRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.signing.VerifyRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getMsg(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getSignature(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } +}; + + +/** + * optional string msg = 1; + * @return {string} + */ +proto.signing.VerifyRequest.prototype.getMsg = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.signing.VerifyRequest} returns this + */ +proto.signing.VerifyRequest.prototype.setMsg = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional string signature = 2; + * @return {string} + */ +proto.signing.VerifyRequest.prototype.getSignature = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.signing.VerifyRequest} returns this + */ +proto.signing.VerifyRequest.prototype.setSignature = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + diff --git a/js/verifyresponse.js b/js/verifyresponse.js new file mode 100644 index 0000000..a0064bb --- /dev/null +++ b/js/verifyresponse.js @@ -0,0 +1,170 @@ +// source: proto/imp/api/signing/signing.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +goog.provide('proto.signing.VerifyResponse'); + +goog.require('jspb.BinaryReader'); +goog.require('jspb.BinaryWriter'); +goog.require('jspb.Message'); + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.signing.VerifyResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.signing.VerifyResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.signing.VerifyResponse.displayName = 'proto.signing.VerifyResponse'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.signing.VerifyResponse.prototype.toObject = function(opt_includeInstance) { + return proto.signing.VerifyResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.signing.VerifyResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.signing.VerifyResponse.toObject = function(includeInstance, msg) { + var f, obj = { + result: jspb.Message.getBooleanFieldWithDefault(msg, 1, false) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.signing.VerifyResponse} + */ +proto.signing.VerifyResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.signing.VerifyResponse; + return proto.signing.VerifyResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.signing.VerifyResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.signing.VerifyResponse} + */ +proto.signing.VerifyResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setResult(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.signing.VerifyResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.signing.VerifyResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.signing.VerifyResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.signing.VerifyResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getResult(); + if (f) { + writer.writeBool( + 1, + f + ); + } +}; + + +/** + * optional bool result = 1; + * @return {boolean} + */ +proto.signing.VerifyResponse.prototype.getResult = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 1, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.signing.VerifyResponse} returns this + */ +proto.signing.VerifyResponse.prototype.setResult = function(value) { + return jspb.Message.setProto3BooleanField(this, 1, value); +}; + + diff --git a/js/vpnrequest.js b/js/vpnrequest.js new file mode 100644 index 0000000..0e94f48 --- /dev/null +++ b/js/vpnrequest.js @@ -0,0 +1,228 @@ +// source: proto/imp/api/vpn/vpn.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +goog.provide('proto.vpn.VPNRequest'); + +goog.require('jspb.BinaryReader'); +goog.require('jspb.BinaryWriter'); +goog.require('jspb.Message'); + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.vpn.VPNRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.vpn.VPNRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.vpn.VPNRequest.displayName = 'proto.vpn.VPNRequest'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.vpn.VPNRequest.prototype.toObject = function(opt_includeInstance) { + return proto.vpn.VPNRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.vpn.VPNRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.vpn.VPNRequest.toObject = function(includeInstance, msg) { + var f, obj = { + pubkey: jspb.Message.getFieldWithDefault(msg, 1, ""), + nonce: jspb.Message.getFieldWithDefault(msg, 2, ""), + price: jspb.Message.getFieldWithDefault(msg, 3, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.vpn.VPNRequest} + */ +proto.vpn.VPNRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.vpn.VPNRequest; + return proto.vpn.VPNRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.vpn.VPNRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.vpn.VPNRequest} + */ +proto.vpn.VPNRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setPubkey(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setNonce(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setPrice(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.vpn.VPNRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.vpn.VPNRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.vpn.VPNRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.vpn.VPNRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getPubkey(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } + f = message.getNonce(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } + f = message.getPrice(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } +}; + + +/** + * optional string pubkey = 1; + * @return {string} + */ +proto.vpn.VPNRequest.prototype.getPubkey = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.vpn.VPNRequest} returns this + */ +proto.vpn.VPNRequest.prototype.setPubkey = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + +/** + * optional string nonce = 2; + * @return {string} + */ +proto.vpn.VPNRequest.prototype.getNonce = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.vpn.VPNRequest} returns this + */ +proto.vpn.VPNRequest.prototype.setNonce = function(value) { + return jspb.Message.setProto3StringField(this, 2, value); +}; + + +/** + * optional string price = 3; + * @return {string} + */ +proto.vpn.VPNRequest.prototype.getPrice = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.vpn.VPNRequest} returns this + */ +proto.vpn.VPNRequest.prototype.setPrice = function(value) { + return jspb.Message.setProto3StringField(this, 3, value); +}; diff --git a/js/vpnresponse.js b/js/vpnresponse.js new file mode 100644 index 0000000..2ce6861 --- /dev/null +++ b/js/vpnresponse.js @@ -0,0 +1,168 @@ +// source: proto/imp/api/vpn/vpn.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +goog.provide('proto.vpn.VPNResponse'); + +goog.require('jspb.BinaryReader'); +goog.require('jspb.BinaryWriter'); +goog.require('jspb.Message'); + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.vpn.VPNResponse = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.vpn.VPNResponse, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.vpn.VPNResponse.displayName = 'proto.vpn.VPNResponse'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.vpn.VPNResponse.prototype.toObject = function(opt_includeInstance) { + return proto.vpn.VPNResponse.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.vpn.VPNResponse} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.vpn.VPNResponse.toObject = function(includeInstance, msg) { + var f, obj = { + msg: jspb.Message.getFieldWithDefault(msg, 1, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.vpn.VPNResponse} + */ +proto.vpn.VPNResponse.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.vpn.VPNResponse; + return proto.vpn.VPNResponse.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.vpn.VPNResponse} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.vpn.VPNResponse} + */ +proto.vpn.VPNResponse.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setMsg(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.vpn.VPNResponse.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.vpn.VPNResponse.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.vpn.VPNResponse} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.vpn.VPNResponse.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getMsg(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * optional string msg = 1; + * @return {string} + */ +proto.vpn.VPNResponse.prototype.getMsg = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.vpn.VPNResponse} returns this + */ +proto.vpn.VPNResponse.prototype.setMsg = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; diff --git a/openapiv2/proto/imp/api/federate/federate.go b/openapiv2/proto/imp/api/federate/federate.go new file mode 100644 index 0000000..b68cc3b --- /dev/null +++ b/openapiv2/proto/imp/api/federate/federate.go @@ -0,0 +1,171 @@ +package federate + +var SwaggerJSON = ` +{ + "swagger": "2.0", + "info": { + "title": "Federate Services", + "version": "1.0", + "contact": { + "name": "Impervious AI", + "url": "https://impervious.ai" + } + }, + "tags": [ + { + "name": "Federate" + } + ], + "schemes": [ + "http", + "https", + "wss" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": { + "/v1/federate/leave": { + "post": { + "summary": "*\nLeaveFederation performs the removal of a federated peer (upon message receipt).", + "operationId": "Federate_LeaveFederation", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/federateLeaveFederationResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/federateLeaveFederationRequest" + } + } + ], + "tags": [ + "Federate" + ] + } + }, + "/v1/federate/request": { + "post": { + "summary": "*\nRequestFederation performs the federation request to a specific peer.", + "operationId": "Federate_RequestFederate", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/federateRequestFederateResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/federateRequestFederateRequest" + } + } + ], + "tags": [ + "Federate" + ] + } + } + }, + "definitions": { + "federateLeaveFederationRequest": { + "type": "object", + "properties": { + "pubkey": { + "type": "string" + } + }, + "title": "*\nRepresents a request to leave a federation from a far end node" + }, + "federateLeaveFederationResponse": { + "type": "object", + "properties": { + "id": { + "type": "string" + } + }, + "title": "*\nRepresents a response back from a Leave Federation Request" + }, + "federateRequestFederateRequest": { + "type": "object", + "properties": { + "pubkey": { + "type": "string" + } + }, + "title": "*\nRepresents a request to federate with a far end node" + }, + "federateRequestFederateResponse": { + "type": "object", + "properties": { + "id": { + "type": "string" + } + }, + "title": "*\nRepresents a response back from a Federation Request" + }, + "protobufAny": { + "type": "object", + "properties": { + "typeUrl": { + "type": "string" + }, + "value": { + "type": "string", + "format": "byte" + } + } + }, + "rpcStatus": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "$ref": "#/definitions/protobufAny" + } + } + } + } + }, + "externalDocs": { + "description": "Documentation on IMP", + "url": "https://github.com/imperviousai/imp-releases" + } +} +` diff --git a/openapiv2/proto/imp/api/federate/federate.swagger.json b/openapiv2/proto/imp/api/federate/federate.swagger.json new file mode 100644 index 0000000..27eda3f --- /dev/null +++ b/openapiv2/proto/imp/api/federate/federate.swagger.json @@ -0,0 +1,167 @@ +{ + "swagger": "2.0", + "info": { + "title": "Federate Services", + "version": "1.0", + "contact": { + "name": "Impervious AI", + "url": "https://impervious.ai" + } + }, + "tags": [ + { + "name": "Federate" + } + ], + "schemes": [ + "http", + "https", + "wss" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": { + "/v1/federate/leave": { + "post": { + "summary": "*\nLeaveFederation performs the removal of a federated peer (upon message receipt).", + "operationId": "Federate_LeaveFederation", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/federateLeaveFederationResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/federateLeaveFederationRequest" + } + } + ], + "tags": [ + "Federate" + ] + } + }, + "/v1/federate/request": { + "post": { + "summary": "*\nRequestFederation performs the federation request to a specific peer.", + "operationId": "Federate_RequestFederate", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/federateRequestFederateResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/federateRequestFederateRequest" + } + } + ], + "tags": [ + "Federate" + ] + } + } + }, + "definitions": { + "federateLeaveFederationRequest": { + "type": "object", + "properties": { + "pubkey": { + "type": "string" + } + }, + "title": "*\nRepresents a request to leave a federation from a far end node" + }, + "federateLeaveFederationResponse": { + "type": "object", + "properties": { + "id": { + "type": "string" + } + }, + "title": "*\nRepresents a response back from a Leave Federation Request" + }, + "federateRequestFederateRequest": { + "type": "object", + "properties": { + "pubkey": { + "type": "string" + } + }, + "title": "*\nRepresents a request to federate with a far end node" + }, + "federateRequestFederateResponse": { + "type": "object", + "properties": { + "id": { + "type": "string" + } + }, + "title": "*\nRepresents a response back from a Federation Request" + }, + "protobufAny": { + "type": "object", + "properties": { + "typeUrl": { + "type": "string" + }, + "value": { + "type": "string", + "format": "byte" + } + } + }, + "rpcStatus": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "$ref": "#/definitions/protobufAny" + } + } + } + } + }, + "externalDocs": { + "description": "Documentation on IMP", + "url": "https://github.com/imperviousai/imp-releases" + } +} diff --git a/openapiv2/proto/imp/api/lightning/lightning.go b/openapiv2/proto/imp/api/lightning/lightning.go new file mode 100644 index 0000000..0330f4e --- /dev/null +++ b/openapiv2/proto/imp/api/lightning/lightning.go @@ -0,0 +1,223 @@ +package lightning + +var SwaggerJSON = ` +{ + "swagger": "2.0", + "info": { + "title": "Lightning Services", + "version": "1.0", + "contact": { + "name": "Impervious AI", + "url": "https://impervious.ai" + } + }, + "tags": [ + { + "name": "Lightning" + } + ], + "schemes": [ + "http", + "https", + "wss" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": { + "/v1/lightning/checkinvoice": { + "post": { + "operationId": "Lightning_CheckInvoice", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/lightningCheckInvoiceResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/lightningCheckInvoiceRequest" + } + } + ], + "tags": [ + "Lightning" + ] + } + }, + "/v1/lightning/generateinvoice": { + "post": { + "operationId": "Lightning_GenerateInvoice", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/lightningGenerateInvoiceResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/lightningGenerateInvoiceRequest" + } + } + ], + "tags": [ + "Lightning" + ] + } + }, + "/v1/lightning/payinvoice": { + "post": { + "operationId": "Lightning_PayInvoice", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/lightningPayInvoiceResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/lightningPayInvoiceRequest" + } + } + ], + "tags": [ + "Lightning" + ] + } + } + }, + "definitions": { + "lightningCheckInvoiceRequest": { + "type": "object", + "properties": { + "invoice": { + "type": "string" + } + }, + "description": "*\nRepresents an request to check an invoice." + }, + "lightningCheckInvoiceResponse": { + "type": "object", + "properties": { + "paid": { + "type": "boolean" + } + }, + "description": "*\nRepresents a response back from the invoice check." + }, + "lightningGenerateInvoiceRequest": { + "type": "object", + "properties": { + "amount": { + "type": "string", + "format": "int64" + }, + "memo": { + "type": "string" + } + }, + "description": "*\nRepresents an invoice creation request from your lightning node." + }, + "lightningGenerateInvoiceResponse": { + "type": "object", + "properties": { + "invoice": { + "type": "string" + } + }, + "description": "*\nRepresents a response back from an invoice generation request." + }, + "lightningPayInvoiceRequest": { + "type": "object", + "properties": { + "invoice": { + "type": "string" + } + }, + "description": "*\nRepresents an invoice that will be paid by your lightning node." + }, + "lightningPayInvoiceResponse": { + "type": "object", + "properties": { + "preimage": { + "type": "string" + } + }, + "description": "*\nRepresents a response back from the payment result." + }, + "protobufAny": { + "type": "object", + "properties": { + "typeUrl": { + "type": "string" + }, + "value": { + "type": "string", + "format": "byte" + } + } + }, + "rpcStatus": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "$ref": "#/definitions/protobufAny" + } + } + } + } + }, + "externalDocs": { + "description": "Documentation on IMP", + "url": "https://github.com/imperviousai/imp-releases" + } +} +` diff --git a/openapiv2/proto/imp/api/lightning/lightning.swagger.json b/openapiv2/proto/imp/api/lightning/lightning.swagger.json new file mode 100644 index 0000000..0e6fb1e --- /dev/null +++ b/openapiv2/proto/imp/api/lightning/lightning.swagger.json @@ -0,0 +1,219 @@ +{ + "swagger": "2.0", + "info": { + "title": "Lightning Services", + "version": "1.0", + "contact": { + "name": "Impervious AI", + "url": "https://impervious.ai" + } + }, + "tags": [ + { + "name": "Lightning" + } + ], + "schemes": [ + "http", + "https", + "wss" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": { + "/v1/lightning/checkinvoice": { + "post": { + "operationId": "Lightning_CheckInvoice", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/lightningCheckInvoiceResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/lightningCheckInvoiceRequest" + } + } + ], + "tags": [ + "Lightning" + ] + } + }, + "/v1/lightning/generateinvoice": { + "post": { + "operationId": "Lightning_GenerateInvoice", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/lightningGenerateInvoiceResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/lightningGenerateInvoiceRequest" + } + } + ], + "tags": [ + "Lightning" + ] + } + }, + "/v1/lightning/payinvoice": { + "post": { + "operationId": "Lightning_PayInvoice", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/lightningPayInvoiceResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/lightningPayInvoiceRequest" + } + } + ], + "tags": [ + "Lightning" + ] + } + } + }, + "definitions": { + "lightningCheckInvoiceRequest": { + "type": "object", + "properties": { + "invoice": { + "type": "string" + } + }, + "description": "*\nRepresents an request to check an invoice." + }, + "lightningCheckInvoiceResponse": { + "type": "object", + "properties": { + "paid": { + "type": "boolean" + } + }, + "description": "*\nRepresents a response back from the invoice check." + }, + "lightningGenerateInvoiceRequest": { + "type": "object", + "properties": { + "amount": { + "type": "string", + "format": "int64" + }, + "memo": { + "type": "string" + } + }, + "description": "*\nRepresents an invoice creation request from your lightning node." + }, + "lightningGenerateInvoiceResponse": { + "type": "object", + "properties": { + "invoice": { + "type": "string" + } + }, + "description": "*\nRepresents a response back from an invoice generation request." + }, + "lightningPayInvoiceRequest": { + "type": "object", + "properties": { + "invoice": { + "type": "string" + } + }, + "description": "*\nRepresents an invoice that will be paid by your lightning node." + }, + "lightningPayInvoiceResponse": { + "type": "object", + "properties": { + "preimage": { + "type": "string" + } + }, + "description": "*\nRepresents a response back from the payment result." + }, + "protobufAny": { + "type": "object", + "properties": { + "typeUrl": { + "type": "string" + }, + "value": { + "type": "string", + "format": "byte" + } + } + }, + "rpcStatus": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "$ref": "#/definitions/protobufAny" + } + } + } + } + }, + "externalDocs": { + "description": "Documentation on IMP", + "url": "https://github.com/imperviousai/imp-releases" + } +} diff --git a/openapiv2/proto/imp/api/messaging/messaging.go b/openapiv2/proto/imp/api/messaging/messaging.go new file mode 100644 index 0000000..7286372 --- /dev/null +++ b/openapiv2/proto/imp/api/messaging/messaging.go @@ -0,0 +1,122 @@ +package messaging + +var SwaggerJSON = ` +{ + "swagger": "2.0", + "info": { + "title": "Messaging Services", + "version": "1.0", + "contact": { + "name": "Impervious AI", + "url": "https://impervious.ai" + } + }, + "tags": [ + { + "name": "Messaging" + } + ], + "schemes": [ + "http", + "https", + "wss" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": { + "/v1/message/send": { + "post": { + "operationId": "Messaging_SendMessage", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/messagingSendMessageResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/messagingSendMessageRequest" + } + } + ], + "tags": [ + "Messaging" + ] + } + } + }, + "definitions": { + "messagingSendMessageRequest": { + "type": "object", + "properties": { + "msg": { + "type": "string" + }, + "pubkey": { + "type": "string" + } + }, + "title": "*\nRepresents a message send to a far end node" + }, + "messagingSendMessageResponse": { + "type": "object", + "properties": { + "id": { + "type": "string" + } + }, + "title": "*\nRepresents a response back from a sent message" + }, + "protobufAny": { + "type": "object", + "properties": { + "typeUrl": { + "type": "string" + }, + "value": { + "type": "string", + "format": "byte" + } + } + }, + "rpcStatus": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "$ref": "#/definitions/protobufAny" + } + } + } + } + }, + "externalDocs": { + "description": "Documentation on IMP", + "url": "https://github.com/imperviousai/imp-releases" + } +} +` diff --git a/openapiv2/proto/imp/api/messaging/messaging.swagger.json b/openapiv2/proto/imp/api/messaging/messaging.swagger.json new file mode 100644 index 0000000..10740e2 --- /dev/null +++ b/openapiv2/proto/imp/api/messaging/messaging.swagger.json @@ -0,0 +1,118 @@ +{ + "swagger": "2.0", + "info": { + "title": "Messaging Services", + "version": "1.0", + "contact": { + "name": "Impervious AI", + "url": "https://impervious.ai" + } + }, + "tags": [ + { + "name": "Messaging" + } + ], + "schemes": [ + "http", + "https", + "wss" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": { + "/v1/message/send": { + "post": { + "operationId": "Messaging_SendMessage", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/messagingSendMessageResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/messagingSendMessageRequest" + } + } + ], + "tags": [ + "Messaging" + ] + } + } + }, + "definitions": { + "messagingSendMessageRequest": { + "type": "object", + "properties": { + "msg": { + "type": "string" + }, + "pubkey": { + "type": "string" + } + }, + "title": "*\nRepresents a message send to a far end node" + }, + "messagingSendMessageResponse": { + "type": "object", + "properties": { + "id": { + "type": "string" + } + }, + "title": "*\nRepresents a response back from a sent message" + }, + "protobufAny": { + "type": "object", + "properties": { + "typeUrl": { + "type": "string" + }, + "value": { + "type": "string", + "format": "byte" + } + } + }, + "rpcStatus": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "$ref": "#/definitions/protobufAny" + } + } + } + } + }, + "externalDocs": { + "description": "Documentation on IMP", + "url": "https://github.com/imperviousai/imp-releases" + } +} diff --git a/openapiv2/proto/imp/api/signing/signing.go b/openapiv2/proto/imp/api/signing/signing.go new file mode 100644 index 0000000..a500956 --- /dev/null +++ b/openapiv2/proto/imp/api/signing/signing.go @@ -0,0 +1,172 @@ +package signing + +var SwaggerJSON = ` +{ + "swagger": "2.0", + "info": { + "title": "Signing Services", + "version": "1.0", + "contact": { + "name": "Impervious AI", + "url": "https://impervious.ai" + } + }, + "tags": [ + { + "name": "Signing" + } + ], + "schemes": [ + "http", + "https", + "wss" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": { + "/v1/sign": { + "post": { + "operationId": "Signing_SignMessage", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/signingSignResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/signingSignRequest" + } + } + ], + "tags": [ + "Signing" + ] + } + }, + "/v1/verify": { + "post": { + "operationId": "Signing_VerifySignature", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/signingVerifyResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/signingVerifyRequest" + } + } + ], + "tags": [ + "Signing" + ] + } + } + }, + "definitions": { + "protobufAny": { + "type": "object", + "properties": { + "typeUrl": { + "type": "string" + }, + "value": { + "type": "string", + "format": "byte" + } + } + }, + "rpcStatus": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "$ref": "#/definitions/protobufAny" + } + } + } + }, + "signingSignRequest": { + "type": "object", + "properties": { + "msg": { + "type": "string" + } + }, + "title": "*\nRepresents a request to sign a message" + }, + "signingSignResponse": { + "type": "object", + "properties": { + "signature": { + "type": "string" + } + }, + "title": "*\nRepresents a response from a signature request" + }, + "signingVerifyRequest": { + "type": "object", + "properties": { + "msg": { + "type": "string" + }, + "signature": { + "type": "string" + } + }, + "title": "*\nRepresents a request to verify a signature and message" + }, + "signingVerifyResponse": { + "type": "object", + "properties": { + "result": { + "type": "boolean" + } + }, + "title": "*\nRepresents a response back from a verification request" + } + }, + "externalDocs": { + "description": "Documentation on IMP", + "url": "https://github.com/imperviousai/imp-releases" + } +} +` diff --git a/openapiv2/proto/imp/api/signing/signing.swagger.json b/openapiv2/proto/imp/api/signing/signing.swagger.json new file mode 100644 index 0000000..ff78ff5 --- /dev/null +++ b/openapiv2/proto/imp/api/signing/signing.swagger.json @@ -0,0 +1,168 @@ +{ + "swagger": "2.0", + "info": { + "title": "Signing Services", + "version": "1.0", + "contact": { + "name": "Impervious AI", + "url": "https://impervious.ai" + } + }, + "tags": [ + { + "name": "Signing" + } + ], + "schemes": [ + "http", + "https", + "wss" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": { + "/v1/sign": { + "post": { + "operationId": "Signing_SignMessage", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/signingSignResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/signingSignRequest" + } + } + ], + "tags": [ + "Signing" + ] + } + }, + "/v1/verify": { + "post": { + "operationId": "Signing_VerifySignature", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/signingVerifyResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/signingVerifyRequest" + } + } + ], + "tags": [ + "Signing" + ] + } + } + }, + "definitions": { + "protobufAny": { + "type": "object", + "properties": { + "typeUrl": { + "type": "string" + }, + "value": { + "type": "string", + "format": "byte" + } + } + }, + "rpcStatus": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "$ref": "#/definitions/protobufAny" + } + } + } + }, + "signingSignRequest": { + "type": "object", + "properties": { + "msg": { + "type": "string" + } + }, + "title": "*\nRepresents a request to sign a message" + }, + "signingSignResponse": { + "type": "object", + "properties": { + "signature": { + "type": "string" + } + }, + "title": "*\nRepresents a response from a signature request" + }, + "signingVerifyRequest": { + "type": "object", + "properties": { + "msg": { + "type": "string" + }, + "signature": { + "type": "string" + } + }, + "title": "*\nRepresents a request to verify a signature and message" + }, + "signingVerifyResponse": { + "type": "object", + "properties": { + "result": { + "type": "boolean" + } + }, + "title": "*\nRepresents a response back from a verification request" + } + }, + "externalDocs": { + "description": "Documentation on IMP", + "url": "https://github.com/imperviousai/imp-releases" + } +} diff --git a/openapiv2/proto/imp/api/socket/socket.go b/openapiv2/proto/imp/api/socket/socket.go new file mode 100644 index 0000000..4bcd979 --- /dev/null +++ b/openapiv2/proto/imp/api/socket/socket.go @@ -0,0 +1,213 @@ +package socket + +var SwaggerJSON = ` +{ + "swagger": "2.0", + "info": { + "title": "Socket Services", + "version": "1.0", + "contact": { + "name": "Impervious AI", + "url": "https://impervious.ai" + } + }, + "tags": [ + { + "name": "Socket" + } + ], + "schemes": [ + "http", + "https", + "wss" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": { + "/v1/socket/sendRequest": { + "post": { + "operationId": "Socket_SendSocket", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/socketSendSocketResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/socketSendSocketRequest" + } + } + ], + "tags": [ + "Socket" + ] + } + }, + "/v1/socket/start": { + "post": { + "operationId": "Socket_StartSocket", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/socketStartSocketResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/socketStartSocketRequest" + } + } + ], + "tags": [ + "Socket" + ] + } + }, + "/v1/socket/stop": { + "post": { + "operationId": "Socket_StopSocket", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/socketStopSocketResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/socketStopSocketRequest" + } + } + ], + "tags": [ + "Socket" + ] + } + } + }, + "definitions": { + "protobufAny": { + "type": "object", + "properties": { + "typeUrl": { + "type": "string" + }, + "value": { + "type": "string", + "format": "byte" + } + } + }, + "rpcStatus": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "$ref": "#/definitions/protobufAny" + } + } + } + }, + "socketSendSocketRequest": { + "type": "object", + "properties": { + "pubkey": { + "type": "string" + } + }, + "title": "*\nRepresents a request to send socket connection information to a far end node" + }, + "socketSendSocketResponse": { + "type": "object", + "properties": { + "id": { + "type": "string" + } + }, + "title": "*\nRepresents a response back from the request to establish a socket" + }, + "socketStartSocketRequest": { + "type": "object", + "title": "*\nRepresents a request to start a socket on an owned IMP node" + }, + "socketStartSocketResponse": { + "type": "object", + "properties": { + "protocol": { + "type": "string" + }, + "ip": { + "type": "string" + }, + "port1": { + "type": "string" + }, + "port2": { + "type": "string" + } + }, + "title": "*\nRepresents a response containing socket information from a started socket" + }, + "socketStopSocketRequest": { + "type": "object", + "title": "*\nRepresents a request to stop a socket on an owned IMP node" + }, + "socketStopSocketResponse": { + "type": "object", + "title": "*\nRepresents a response back from a stopped socket" + } + }, + "externalDocs": { + "description": "Documentation on IMP", + "url": "https://github.com/imperviousai/imp-releases" + } +} +` diff --git a/openapiv2/proto/imp/api/socket/socket.swagger.json b/openapiv2/proto/imp/api/socket/socket.swagger.json new file mode 100644 index 0000000..df74fe2 --- /dev/null +++ b/openapiv2/proto/imp/api/socket/socket.swagger.json @@ -0,0 +1,209 @@ +{ + "swagger": "2.0", + "info": { + "title": "Socket Services", + "version": "1.0", + "contact": { + "name": "Impervious AI", + "url": "https://impervious.ai" + } + }, + "tags": [ + { + "name": "Socket" + } + ], + "schemes": [ + "http", + "https", + "wss" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": { + "/v1/socket/sendRequest": { + "post": { + "operationId": "Socket_SendSocket", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/socketSendSocketResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/socketSendSocketRequest" + } + } + ], + "tags": [ + "Socket" + ] + } + }, + "/v1/socket/start": { + "post": { + "operationId": "Socket_StartSocket", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/socketStartSocketResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/socketStartSocketRequest" + } + } + ], + "tags": [ + "Socket" + ] + } + }, + "/v1/socket/stop": { + "post": { + "operationId": "Socket_StopSocket", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/socketStopSocketResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/socketStopSocketRequest" + } + } + ], + "tags": [ + "Socket" + ] + } + } + }, + "definitions": { + "protobufAny": { + "type": "object", + "properties": { + "typeUrl": { + "type": "string" + }, + "value": { + "type": "string", + "format": "byte" + } + } + }, + "rpcStatus": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "$ref": "#/definitions/protobufAny" + } + } + } + }, + "socketSendSocketRequest": { + "type": "object", + "properties": { + "pubkey": { + "type": "string" + } + }, + "title": "*\nRepresents a request to send socket connection information to a far end node" + }, + "socketSendSocketResponse": { + "type": "object", + "properties": { + "id": { + "type": "string" + } + }, + "title": "*\nRepresents a response back from the request to establish a socket" + }, + "socketStartSocketRequest": { + "type": "object", + "title": "*\nRepresents a request to start a socket on an owned IMP node" + }, + "socketStartSocketResponse": { + "type": "object", + "properties": { + "protocol": { + "type": "string" + }, + "ip": { + "type": "string" + }, + "port1": { + "type": "string" + }, + "port2": { + "type": "string" + } + }, + "title": "*\nRepresents a response containing socket information from a started socket" + }, + "socketStopSocketRequest": { + "type": "object", + "title": "*\nRepresents a request to stop a socket on an owned IMP node" + }, + "socketStopSocketResponse": { + "type": "object", + "title": "*\nRepresents a response back from a stopped socket" + } + }, + "externalDocs": { + "description": "Documentation on IMP", + "url": "https://github.com/imperviousai/imp-releases" + } +} diff --git a/openapiv2/proto/imp/api/vpn/vpn.go b/openapiv2/proto/imp/api/vpn/vpn.go new file mode 100644 index 0000000..1e7ce77 --- /dev/null +++ b/openapiv2/proto/imp/api/vpn/vpn.go @@ -0,0 +1,231 @@ +package vpn + +var SwaggerJSON = ` +{ + "swagger": "2.0", + "info": { + "title": "VPN Services", + "version": "1.0", + "contact": { + "name": "Impervious AI", + "url": "https://impervious.ai" + } + }, + "tags": [ + { + "name": "VPN" + } + ], + "schemes": [ + "http", + "https", + "wss" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": { + "/v1/vpn/contract": { + "post": { + "operationId": "VPN_AcceptContract", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/vpnAcceptContractResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/vpnAcceptContractRequest" + } + } + ], + "tags": [ + "VPN" + ] + } + }, + "/v1/vpn/quote": { + "post": { + "operationId": "VPN_RequestQuote", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/vpnRequestQuoteResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/vpnRequestQuoteRequest" + } + } + ], + "tags": [ + "VPN" + ] + } + }, + "/v1/vpn/refresh": { + "post": { + "operationId": "VPN_RefreshContract", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/vpnRefreshContractResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/vpnRefreshContractRequest" + } + } + ], + "tags": [ + "VPN" + ] + } + } + }, + "definitions": { + "protobufAny": { + "type": "object", + "properties": { + "typeUrl": { + "type": "string" + }, + "value": { + "type": "string", + "format": "byte" + } + } + }, + "rpcStatus": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "$ref": "#/definitions/protobufAny" + } + } + } + }, + "vpnAcceptContractRequest": { + "type": "object", + "properties": { + "pubkey": { + "type": "string" + }, + "nonce": { + "type": "string" + }, + "price": { + "type": "string" + } + }, + "title": "*\nRepresents a request to Accept (Pay For) a VPN Quote" + }, + "vpnAcceptContractResponse": { + "type": "object", + "properties": { + "id": { + "type": "string" + } + }, + "title": "*\nRepresents a response back from an accepted VPN Quote" + }, + "vpnRefreshContractRequest": { + "type": "object", + "properties": { + "pubkey": { + "type": "string" + }, + "nonce": { + "type": "string" + }, + "price": { + "type": "string" + } + }, + "title": "*\nRepresents a request to extend/refresh an expiring VPN Connection (i.e. purchase more time)" + }, + "vpnRefreshContractResponse": { + "type": "object", + "properties": { + "id": { + "type": "string" + } + }, + "title": "*\nRepresents a reponse back from a refreshed VPN connection" + }, + "vpnRequestQuoteRequest": { + "type": "object", + "properties": { + "pubkey": { + "type": "string" + } + }, + "title": "*\nRepresents a request to receive a VPN quote from a far end node" + }, + "vpnRequestQuoteResponse": { + "type": "object", + "properties": { + "id": { + "type": "string" + } + }, + "title": "*\nRepresents a response back from a VPN Quote Reqeust" + } + }, + "externalDocs": { + "description": "Documentation on IMP", + "url": "https://github.com/imperviousai/imp-releases" + } +} +` diff --git a/openapiv2/proto/imp/api/vpn/vpn.swagger.json b/openapiv2/proto/imp/api/vpn/vpn.swagger.json new file mode 100644 index 0000000..bfb1e69 --- /dev/null +++ b/openapiv2/proto/imp/api/vpn/vpn.swagger.json @@ -0,0 +1,227 @@ +{ + "swagger": "2.0", + "info": { + "title": "VPN Services", + "version": "1.0", + "contact": { + "name": "Impervious AI", + "url": "https://impervious.ai" + } + }, + "tags": [ + { + "name": "VPN" + } + ], + "schemes": [ + "http", + "https", + "wss" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": { + "/v1/vpn/contract": { + "post": { + "operationId": "VPN_AcceptContract", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/vpnAcceptContractResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/vpnAcceptContractRequest" + } + } + ], + "tags": [ + "VPN" + ] + } + }, + "/v1/vpn/quote": { + "post": { + "operationId": "VPN_RequestQuote", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/vpnRequestQuoteResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/vpnRequestQuoteRequest" + } + } + ], + "tags": [ + "VPN" + ] + } + }, + "/v1/vpn/refresh": { + "post": { + "operationId": "VPN_RefreshContract", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/vpnRefreshContractResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/vpnRefreshContractRequest" + } + } + ], + "tags": [ + "VPN" + ] + } + } + }, + "definitions": { + "protobufAny": { + "type": "object", + "properties": { + "typeUrl": { + "type": "string" + }, + "value": { + "type": "string", + "format": "byte" + } + } + }, + "rpcStatus": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "$ref": "#/definitions/protobufAny" + } + } + } + }, + "vpnAcceptContractRequest": { + "type": "object", + "properties": { + "pubkey": { + "type": "string" + }, + "nonce": { + "type": "string" + }, + "price": { + "type": "string" + } + }, + "title": "*\nRepresents a request to Accept (Pay For) a VPN Quote" + }, + "vpnAcceptContractResponse": { + "type": "object", + "properties": { + "id": { + "type": "string" + } + }, + "title": "*\nRepresents a response back from an accepted VPN Quote" + }, + "vpnRefreshContractRequest": { + "type": "object", + "properties": { + "pubkey": { + "type": "string" + }, + "nonce": { + "type": "string" + }, + "price": { + "type": "string" + } + }, + "title": "*\nRepresents a request to extend/refresh an expiring VPN Connection (i.e. purchase more time)" + }, + "vpnRefreshContractResponse": { + "type": "object", + "properties": { + "id": { + "type": "string" + } + }, + "title": "*\nRepresents a reponse back from a refreshed VPN connection" + }, + "vpnRequestQuoteRequest": { + "type": "object", + "properties": { + "pubkey": { + "type": "string" + } + }, + "title": "*\nRepresents a request to receive a VPN quote from a far end node" + }, + "vpnRequestQuoteResponse": { + "type": "object", + "properties": { + "id": { + "type": "string" + } + }, + "title": "*\nRepresents a response back from a VPN Quote Reqeust" + } + }, + "externalDocs": { + "description": "Documentation on IMP", + "url": "https://github.com/imperviousai/imp-releases" + } +} diff --git a/openapiv2/proto/imp/api/websocket/websocket.go b/openapiv2/proto/imp/api/websocket/websocket.go new file mode 100644 index 0000000..f13cbf2 --- /dev/null +++ b/openapiv2/proto/imp/api/websocket/websocket.go @@ -0,0 +1,125 @@ +package websocket + +var SwaggerJSON = ` +{ + "swagger": "2.0", + "info": { + "title": "Websocket Services", + "version": "1.0", + "contact": { + "name": "Impervious AI", + "url": "https://impervious.ai" + } + }, + "tags": [ + { + "name": "Websocket" + } + ], + "schemes": [ + "http", + "https", + "wss" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": { + "/v1/subscribe": { + "get": { + "operationId": "Websocket_Subscribe", + "responses": { + "200": { + "description": "A successful response.(streaming responses)", + "schema": { + "type": "object", + "properties": { + "result": { + "$ref": "#/definitions/websocketSubscribeResponse" + }, + "error": { + "$ref": "#/definitions/rpcStatus" + } + }, + "title": "Stream result of websocketSubscribeResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "tags": [ + "Websocket" + ] + } + } + }, + "definitions": { + "protobufAny": { + "type": "object", + "properties": { + "typeUrl": { + "type": "string" + }, + "value": { + "type": "string", + "format": "byte" + } + } + }, + "rpcStatus": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "$ref": "#/definitions/protobufAny" + } + } + } + }, + "websocketSubscribeResponse": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "replyToId": { + "type": "string" + }, + "fromPubkey": { + "type": "string" + }, + "data": { + "type": "string" + }, + "serviceType": { + "type": "string" + }, + "amount": { + "type": "string", + "format": "int64" + } + }, + "title": "*\nRepresents a response back from the websocket containing event information" + } + }, + "externalDocs": { + "description": "Documentation on IMP", + "url": "https://github.com/imperviousai/imp-releases" + } +} +` diff --git a/openapiv2/proto/imp/api/websocket/websocket.swagger.json b/openapiv2/proto/imp/api/websocket/websocket.swagger.json new file mode 100644 index 0000000..fbb4737 --- /dev/null +++ b/openapiv2/proto/imp/api/websocket/websocket.swagger.json @@ -0,0 +1,121 @@ +{ + "swagger": "2.0", + "info": { + "title": "Websocket Services", + "version": "1.0", + "contact": { + "name": "Impervious AI", + "url": "https://impervious.ai" + } + }, + "tags": [ + { + "name": "Websocket" + } + ], + "schemes": [ + "http", + "https", + "wss" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": { + "/v1/subscribe": { + "get": { + "operationId": "Websocket_Subscribe", + "responses": { + "200": { + "description": "A successful response.(streaming responses)", + "schema": { + "type": "object", + "properties": { + "result": { + "$ref": "#/definitions/websocketSubscribeResponse" + }, + "error": { + "$ref": "#/definitions/rpcStatus" + } + }, + "title": "Stream result of websocketSubscribeResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "tags": [ + "Websocket" + ] + } + } + }, + "definitions": { + "protobufAny": { + "type": "object", + "properties": { + "typeUrl": { + "type": "string" + }, + "value": { + "type": "string", + "format": "byte" + } + } + }, + "rpcStatus": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + }, + "details": { + "type": "array", + "items": { + "$ref": "#/definitions/protobufAny" + } + } + } + }, + "websocketSubscribeResponse": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "replyToId": { + "type": "string" + }, + "fromPubkey": { + "type": "string" + }, + "data": { + "type": "string" + }, + "serviceType": { + "type": "string" + }, + "amount": { + "type": "string", + "format": "int64" + } + }, + "title": "*\nRepresents a response back from the websocket containing event information" + } + }, + "externalDocs": { + "description": "Documentation on IMP", + "url": "https://github.com/imperviousai/imp-releases" + } +} diff --git a/proto/federate.proto b/proto/federate.proto new file mode 100644 index 0000000..b8af074 --- /dev/null +++ b/proto/federate.proto @@ -0,0 +1,80 @@ +/// Allows for p2p federation between Impervious nodes +syntax = 'proto3'; + +package federate; + +option go_package = "github.com/imperviousai/freeimp/gen"; + +import "google/api/annotations.proto"; +import "protoc-gen-openapiv2/options/annotations.proto"; + +option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { + info: { + title: "Federate Services"; + version: "1.0"; + contact: { + name: "Impervious AI"; + url: "https://impervious.ai"; + }; + }; + external_docs: { + url: "https://github.com/imperviousai/imp-releases"; + description: "Documentation on IMP"; + } + schemes: HTTP; + schemes: HTTPS; + schemes: WSS; + consumes: "application/json"; + produces: "application/json"; +}; + + +service Federate { + /** + * RequestFederation performs the federation request to a specific peer. + */ + rpc RequestFederate(RequestFederateRequest) returns (RequestFederateResponse) { + option (google.api.http) = { + post: "/v1/federate/request" + body: "*" + }; + } + + /** + * LeaveFederation performs the removal of a federated peer (upon message receipt). + */ + rpc LeaveFederation(LeaveFederationRequest) returns (LeaveFederationResponse) { + option (google.api.http) = { + post: "/v1/federate/leave" + body: "*" + }; + } +} + +/** + * Represents a request to federate with a far end node + */ +message RequestFederateRequest { + string pubkey = 1; // The public key of the far end LND node running IMP +} + +/** + * Represents a response back from a Federation Request + */ +message RequestFederateResponse { + string id = 1; // returned message ID +} + +/** + * Represents a request to leave a federation from a far end node + */ +message LeaveFederationRequest { + string pubkey = 1; // The public key of the far end LND node running IMP +} + +/** + * Represents a response back from a Leave Federation Request + */ +message LeaveFederationResponse { + string id = 1; // returned message ID +} diff --git a/proto/lightning.proto b/proto/lightning.proto new file mode 100644 index 0000000..6b6c6c0 --- /dev/null +++ b/proto/lightning.proto @@ -0,0 +1,95 @@ +/// Allows for p2p messaging between Impervious nodes +syntax = 'proto3'; + +package lightning; + +option go_package = "github.com/imperviousai/freeimp/gen"; + +import "google/api/annotations.proto"; +import "protoc-gen-openapiv2/options/annotations.proto"; + +option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { + info: { + title: "Lightning Services"; + version: "1.0"; + contact: { + name: "Impervious AI"; + url: "https://impervious.ai"; + }; + }; + external_docs: { + url: "https://github.com/imperviousai/imp-releases"; + description: "Documentation on IMP"; + } + schemes: HTTP; + schemes: HTTPS; + schemes: WSS; + consumes: "application/json"; + produces: "application/json"; +}; + +service Lightning { + rpc GenerateInvoice(GenerateInvoiceRequest) returns (GenerateInvoiceResponse) { + option (google.api.http) = { + post: "/v1/lightning/generateinvoice" + body: "*" + }; + } + + rpc PayInvoice(PayInvoiceRequest) returns (PayInvoiceResponse) { + option (google.api.http) = { + post: "/v1/lightning/payinvoice" + body: "*" + }; + } + + rpc CheckInvoice(CheckInvoiceRequest) returns (CheckInvoiceResponse) { + option (google.api.http) = { + post: "/v1/lightning/checkinvoice" + body: "*" + }; + } +} + +/** + * Represents an invoice creation request from your lightning node. + */ +message GenerateInvoiceRequest { + int64 amount = 1; // The amount of satoshis you want to receive + string memo = 2; // The human readable memo you want the sender to see +} + +/** + * Represents a response back from an invoice generation request. + */ +message GenerateInvoiceResponse { + string invoice = 1; // The invoice from your lightning node +} + +/** + * Represents an invoice that will be paid by your lightning node. + */ +message PayInvoiceRequest { + string invoice = 1; // The invoice to pay +} + +/** + * Represents a response back from the payment result. + */ +message PayInvoiceResponse { + string preimage = 1; // The preimage from the payment result, if successful +} + +/** + * Represents an request to check an invoice. + */ +message CheckInvoiceRequest { + string invoice = 1; // The invoice to check +} + +/** + * Represents a response back from the invoice check. + */ +message CheckInvoiceResponse { + bool paid = 1; // The boolean result representing whether or not the invoice was paid +} diff --git a/proto/messaging.proto b/proto/messaging.proto new file mode 100644 index 0000000..66d726c --- /dev/null +++ b/proto/messaging.proto @@ -0,0 +1,53 @@ +/// Allows for p2p messaging between Impervious nodes +syntax = 'proto3'; + +package messaging; + +option go_package = "github.com/imperviousai/freeimp/gen"; + +import "google/api/annotations.proto"; +import "protoc-gen-openapiv2/options/annotations.proto"; + +option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { + info: { + title: "Messaging Services"; + version: "1.0"; + contact: { + name: "Impervious AI"; + url: "https://impervious.ai"; + }; + }; + external_docs: { + url: "https://github.com/imperviousai/imp-releases"; + description: "Documentation on IMP"; + } + schemes: HTTP; + schemes: HTTPS; + schemes: WSS; + consumes: "application/json"; + produces: "application/json"; +}; + +service Messaging { + rpc SendMessage(SendMessageRequest) returns (SendMessageResponse) { + option (google.api.http) = { + post: "/v1/message/send" + body: "*" + }; + } +} + +/** + * Represents a message send to a far end node + */ +message SendMessageRequest { + string msg = 1; // the raw message itself to be sent to the far end node + string pubkey = 2; // The public key of the far end LND node running IMP +} + +/** + * Represents a response back from a sent message + */ +message SendMessageResponse { + string id = 1; // returned message ID +} diff --git a/proto/signing.proto b/proto/signing.proto new file mode 100644 index 0000000..9c7e735 --- /dev/null +++ b/proto/signing.proto @@ -0,0 +1,74 @@ +/// Allows an Imp node to sign and verify messaging with the connected LND +syntax = 'proto3'; + +package signing; + +option go_package = "github.com/imperviousai/freeimp/gen"; + +import "google/api/annotations.proto"; +import "protoc-gen-openapiv2/options/annotations.proto"; + +option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { + info: { + title: "Signing Services"; + version: "1.0"; + contact: { + name: "Impervious AI"; + url: "https://impervious.ai"; + }; + }; + external_docs: { + url: "https://github.com/imperviousai/imp-releases"; + description: "Documentation on IMP"; + } + schemes: HTTP; + schemes: HTTPS; + schemes: WSS; + consumes: "application/json"; + produces: "application/json"; +}; + +service Signing { + rpc SignMessage(SignRequest) returns (SignResponse) { + option (google.api.http) = { + post: "/v1/sign" + body: "*" + }; + } + + rpc VerifySignature(VerifyRequest) returns (VerifyResponse) { + option (google.api.http) = { + post: "/v1/verify" + body: "*" + }; + } +} + +/** + * Represents a request to sign a message + */ +message SignRequest { + string msg = 1; // message to be signed +} + +/** + * Represents a response from a signature request + */ +message SignResponse { + string signature = 1; // signature of signed message returned from LND +} + +/** + * Represents a request to verify a signature and message + */ +message VerifyRequest { + string msg = 1; // message to be verified + string signature = 2; // signature of message +} + +/** + * Represents a response back from a verification request + */ +message VerifyResponse { + bool result = 1; // result of signature verification +} diff --git a/proto/socket.proto b/proto/socket.proto new file mode 100644 index 0000000..2a7b596 --- /dev/null +++ b/proto/socket.proto @@ -0,0 +1,94 @@ +/// Allows for p2p sockets to be established between Impervious nodes +syntax = 'proto3'; + +package socket; + +option go_package = "github.com/imperviousai/freeimp/gen"; + +import "google/api/annotations.proto"; +import "protoc-gen-openapiv2/options/annotations.proto"; + +option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { + info: { + title: "Socket Services"; + version: "1.0"; + contact: { + name: "Impervious AI"; + url: "https://impervious.ai"; + }; + }; + external_docs: { + url: "https://github.com/imperviousai/imp-releases"; + description: "Documentation on IMP"; + } + schemes: HTTP; + schemes: HTTPS; + schemes: WSS; + consumes: "application/json"; + produces: "application/json"; +}; + +service Socket { + rpc SendSocket(SendSocketRequest) returns (SendSocketResponse) { + option (google.api.http) = { + post: "/v1/socket/sendRequest" + body: "*" + }; + } + + rpc StartSocket(StartSocketRequest) returns (StartSocketResponse) { + option (google.api.http) = { + post: "/v1/socket/start" + body: "*" + }; + } + + rpc StopSocket(StopSocketRequest) returns (StopSocketResponse) { + option (google.api.http) = { + post: "/v1/socket/stop" + body: "*" + }; + } +} + +/** + * Represents a request to send socket connection information to a far end node + */ +message SendSocketRequest { + string pubkey = 1; // The public key of the far end LND node running IMP +} + +/** + * Represents a response back from the request to establish a socket + */ +message SendSocketResponse { + string id = 1; // returned message ID +} + +/** + * Represents a request to start a socket on an owned IMP node + */ +message StartSocketRequest { +} + +/** + * Represents a response containing socket information from a started socket + */ +message StartSocketResponse { + string protocol = 1; // the protocol of the socket connection + string ip = 2; // the ip of the IMP node to connect to + string port1 = 3; // the first port of the socket connection + string port2 = 4; // the second port of the socket connection +} + +/** + * Represents a request to stop a socket on an owned IMP node + */ +message StopSocketRequest { +} + +/** + * Represents a response back from a stopped socket + */ +message StopSocketResponse { +} diff --git a/proto/vpn.proto b/proto/vpn.proto new file mode 100644 index 0000000..beeaa5e --- /dev/null +++ b/proto/vpn.proto @@ -0,0 +1,98 @@ +/// Allows for an Encrypted Wireguard VPN between Impervious nodes +syntax = 'proto3'; + +package vpn; + +option go_package = "github.com/imperviousai/freeimp/gen"; + +import "google/api/annotations.proto"; +import "protoc-gen-openapiv2/options/annotations.proto"; + +option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { + info: { + title: "VPN Services"; + version: "1.0"; + contact: { + name: "Impervious AI"; + url: "https://impervious.ai"; + }; + }; + external_docs: { + url: "https://github.com/imperviousai/imp-releases"; + description: "Documentation on IMP"; + } + schemes: HTTP; + schemes: HTTPS; + schemes: WSS; + consumes: "application/json"; + produces: "application/json"; +}; + +service VPN { + rpc RequestQuote(RequestQuoteRequest) returns (RequestQuoteResponse) { + option (google.api.http) = { + post: "/v1/vpn/quote" + body: "*" + }; + } + + rpc AcceptContract(AcceptContractRequest) returns (AcceptContractResponse) { + option (google.api.http) = { + post: "/v1/vpn/contract" + body: "*" + }; + } + + rpc RefreshContract(RefreshContractRequest) returns (RefreshContractResponse) { + option (google.api.http) = { + post: "/v1/vpn/refresh" + body: "*" + }; + } +} + +/** + * Represents a request to receive a VPN quote from a far end node + */ +message RequestQuoteRequest { + string pubkey = 1; // The public key of the far end LND node running IMP +} + +/** + * Represents a response back from a VPN Quote Reqeust + */ +message RequestQuoteResponse { + string id = 1; // returned message ID +} + +/** + * Represents a request to Accept (Pay For) a VPN Quote + */ +message AcceptContractRequest { + string pubkey = 1; // The public key of the far end LND node running IMP + string nonce = 2; // the identifier from a requested VPN quote + string price = 3; // the agreed upon price from the VPN quote +} + +/** + * Represents a response back from an accepted VPN Quote + */ +message AcceptContractResponse { + string id = 1; // returned message ID +} + +/** + * Represents a request to extend/refresh an expiring VPN Connection (i.e. purchase more time) + */ +message RefreshContractRequest { + string pubkey = 1; // The public key of the far end LND node running IMP + string nonce = 2; // the identifier of the VPN connection + string price = 3; // the agreed upon price from the VPN quote +} + +/** + * Represents a reponse back from a refreshed VPN connection + */ +message RefreshContractResponse { + string id = 1; // returned message ID +} diff --git a/proto/websocket.proto b/proto/websocket.proto new file mode 100644 index 0000000..34960ba --- /dev/null +++ b/proto/websocket.proto @@ -0,0 +1,56 @@ +/// Allows for receiving messages from your IMP node +syntax = 'proto3'; + +package websocket; + +option go_package = "github.com/imperviousai/freeimp/gen"; + +import "google/api/annotations.proto"; +import "protoc-gen-openapiv2/options/annotations.proto"; + +option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = { + info: { + title: "Websocket Services"; + version: "1.0"; + contact: { + name: "Impervious AI"; + url: "https://impervious.ai"; + }; + }; + external_docs: { + url: "https://github.com/imperviousai/imp-releases"; + description: "Documentation on IMP"; + } + schemes: HTTP; + schemes: HTTPS; + schemes: WSS; + consumes: "application/json"; + produces: "application/json"; +}; + +service Websocket { + rpc Subscribe(SubscribeRequest) returns (stream SubscribeResponse) { + option (google.api.http) = { + get: "/v1/subscribe" + }; + } +} + +/** + * Represents a request to subscribe to the event websocket + */ +message SubscribeRequest { + +} + +/** + * Represents a response back from the websocket containing event information + */ +message SubscribeResponse { + string id = 1; + string reply_to_id = 2; + string from_pubkey = 3; + string data = 4; + string service_type = 5; + int64 amount = 6; +}