diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index a5c50d82..4fd860f9 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -31,11 +31,6 @@ jobs: # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support steps: - - name: Harden Runner - uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0 - with: - egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs - - name: Checkout repository uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml index 3acf1430..a64f75f2 100644 --- a/.github/workflows/dependency-review.yml +++ b/.github/workflows/dependency-review.yml @@ -14,11 +14,6 @@ jobs: dependency-review: runs-on: ubuntu-latest steps: - - name: Harden Runner - uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0 - with: - egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs - - name: 'Checkout Repository' uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - name: 'Dependency Review' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 090fb51a..d8571f03 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,12 +15,6 @@ jobs: matrix: go: ['1.22'] steps: - - name: Harden Runner - uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0 - with: - disable-sudo: true - egress-policy: audit - - name: Checkout uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 with: diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0fc65e7b..c35b1a85 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -20,33 +20,39 @@ jobs: node: [21.x] timeout-minutes: 10 steps: - - uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0 - with: - disable-sudo: true - egress-policy: audit - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - name: Setup Go ${{ matrix.go }} uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 with: go-version: ${{ matrix.go }} + - name: Setup Node.JS ${{ matrix.node }} uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 with: node-version: ${{ matrix.node }} cache: 'yarn' + - name: Test Go run: make test + - name: Yarn install run: yarn install + - name: Build Javascript run: yarn run build + - name: Test Js run: yarn test:js + - name: Lint Javascript run: yarn run lint:js + - name: Lint Go run: yarn run lint:go + - name: Depcheck JS run: yarn run deps + - name: Check goreleaser build run: make hack/bin/goreleaser diff --git a/Makefile b/Makefile index 0f6e96c4..f45a29fb 100644 --- a/Makefile +++ b/Makefile @@ -1,22 +1,18 @@ -# https://github.com/aperturerobotics/protobuf-project +# https://github.com/aperturerobotics/template SHELL:=bash PROTOWRAP=hack/bin/protowrap -PROTOC_GEN_GO=hack/bin/protoc-gen-go +PROTOC_GEN_GO=hack/bin/protoc-gen-go-lite PROTOC_GEN_STARPC=hack/bin/protoc-gen-go-starpc -PROTOC_GEN_VTPROTO=hack/bin/protoc-gen-go-vtproto -PROTOC_GEN_GO_DRPC=hack/bin/protoc-gen-go-drpc GOIMPORTS=hack/bin/goimports GOFUMPT=hack/bin/gofumpt GOLANGCI_LINT=hack/bin/golangci-lint GO_MOD_OUTDATED=hack/bin/go-mod-outdated -WASMSERVE=hack/bin/wasmserve -GORELEASER=hack/bin/goreleaser GOLIST=go list -f "{{ .Dir }}" -m export GO111MODULE=on -undefine GOOS undefine GOARCH +undefine GOOS all: @@ -26,26 +22,8 @@ vendor: $(PROTOC_GEN_GO): cd ./hack; \ go build -v \ - -o ./bin/protoc-gen-go \ - google.golang.org/protobuf/cmd/protoc-gen-go - -$(PROTOC_GEN_VTPROTO): - cd ./hack; \ - go build -v \ - -o ./bin/protoc-gen-go-vtproto \ - github.com/planetscale/vtprotobuf/cmd/protoc-gen-go-vtproto - -$(PROTOC_GEN_GO_DRPC): - cd ./hack; \ - go build -v \ - -o ./bin/protoc-gen-go-drpc \ - storj.io/drpc/cmd/protoc-gen-go-drpc - -$(PROTOC_GEN_STARPC): - cd ./hack; \ - go build -v \ - -o ./bin/protoc-gen-go-starpc \ - github.com/aperturerobotics/starpc/cmd/protoc-gen-go-starpc + -o ./bin/protoc-gen-go-lite \ + github.com/aperturerobotics/protobuf-go-lite/cmd/protoc-gen-go-lite $(GOIMPORTS): cd ./hack; \ @@ -77,87 +55,53 @@ $(GO_MOD_OUTDATED): -o ./bin/go-mod-outdated \ github.com/psampaz/go-mod-outdated -$(WASMSERVE): - cd ./hack; \ - go build -v \ - -o ./bin/wasmserve \ - github.com/hajimehoshi/wasmserve - -$(GORELEASER): +$(PROTOC_GEN_STARPC): cd ./hack; \ go build -v \ - -o ./bin/goreleaser \ - github.com/goreleaser/goreleaser - -.PHONY: gengo -gengo: $(GOIMPORTS) $(PROTOWRAP) $(PROTOC_GEN_GO) $(PROTOC_GEN_VTPROTO) $(PROTOC_GEN_GO_DRPC) $(PROTOC_GEN_STARPC) - shopt -s globstar; \ - set -eo pipefail; \ - export PROJECT=$$(go list -m); \ - export PATH=$$(pwd)/hack/bin:$${PATH}; \ - mkdir -p $$(pwd)/vendor/$$(dirname $${PROJECT}); \ - rm $$(pwd)/vendor/$${PROJECT} || true; \ - ln -s $$(pwd) $$(pwd)/vendor/$${PROJECT} ; \ - $(PROTOWRAP) \ - -I $$(pwd)/vendor \ - --go_out=$$(pwd)/vendor \ - --go-vtproto_out=$$(pwd)/vendor \ - --go-vtproto_opt=features=marshal+unmarshal+size+equal+clone \ - --go-drpc_out=$$(pwd)/vendor \ - --go-drpc_opt=json=false \ - --go-drpc_opt=protolib=github.com/golang/protobuf/proto \ - --go-drpc_opt=protolib=github.com/planetscale/vtprotobuf/codec/drpc \ - --go-starpc_out=$$(pwd)/vendor \ - --proto_path $$(pwd)/vendor \ - --print_structure \ - --only_specified_files \ - $$(\ - git \ - ls-files "*.proto" |\ - xargs printf -- \ - "$$(pwd)/vendor/$${PROJECT}/%s "); \ - rm $$(pwd)/vendor/$${PROJECT} || true - $(GOIMPORTS) -w ./ + -o ./bin/protoc-gen-go-starpc \ + github.com/aperturerobotics/starpc/cmd/protoc-gen-go-starpc node_modules: yarn install -.PHONY: gents -gents: $(PROTOWRAP) node_modules +.PHONY: genproto +genproto: vendor node_modules $(GOIMPORTS) $(PROTOWRAP) $(PROTOC_GEN_GO) $(PROTOC_GEN_STARPC) shopt -s globstar; \ set -eo pipefail; \ export PROJECT=$$(go list -m); \ export PATH=$$(pwd)/hack/bin:$${PATH}; \ - mkdir -p $$(pwd)/vendor/$$(dirname $${PROJECT}); \ + export OUT=$$(pwd)/vendor; \ + mkdir -p $${OUT}/$$(dirname $${PROJECT}); \ rm $$(pwd)/vendor/$${PROJECT} || true; \ ln -s $$(pwd) $$(pwd)/vendor/$${PROJECT} ; \ - $(PROTOWRAP) \ - -I $$(pwd)/vendor \ - --plugin=./node_modules/.bin/protoc-gen-ts_proto \ - --ts_proto_out=$$(pwd)/vendor \ - --ts_proto_opt=esModuleInterop=true \ - --ts_proto_opt=fileSuffix=.pb \ - --ts_proto_opt=importSuffix=.js \ - --ts_proto_opt=forceLong=long \ - --ts_proto_opt=oneof=unions \ - --ts_proto_opt=outputServices=default,outputServices=generic-definitions \ - --ts_proto_opt=useAbortSignal=true \ - --ts_proto_opt=useAsyncIterable=true \ - --ts_proto_opt=useDate=true \ - --proto_path $$(pwd)/vendor \ - --print_structure \ - --only_specified_files \ - $$(\ - git \ - ls-files "*.proto" |\ - xargs printf -- \ - "$$(pwd)/vendor/$${PROJECT}/%s "); \ + protogen() { \ + $(PROTOWRAP) \ + -I $${OUT} \ + --plugin=./node_modules/.bin/protoc-gen-es \ + --plugin=./node_modules/.bin/protoc-gen-es-starpc \ + --go-lite_out=$${OUT} \ + --go-lite_opt=features=marshal+unmarshal+size+equal+json+clone \ + --go-starpc_out=$${OUT} \ + --es_out=$${OUT} \ + --es_opt target=ts \ + --es_opt ts_nocheck=false \ + --es-starpc_out=$${OUT} \ + --es-starpc_opt target=ts \ + --es-starpc_opt ts_nocheck=false \ + --proto_path $${OUT} \ + --print_structure \ + --only_specified_files \ + $$(\ + git \ + ls-files "$$1" |\ + xargs printf -- \ + "$$(pwd)/vendor/$${PROJECT}/%s "); \ + }; \ + protogen "./*.proto"; \ rm $$(pwd)/vendor/$${PROJECT} || true + $(GOIMPORTS) -w ./ npm run format:js -.PHONY: genproto -genproto: gengo gents - .PHONY: gen gen: genproto @@ -171,25 +115,17 @@ list: $(GO_MOD_OUTDATED) .PHONY: lint lint: $(GOLANGCI_LINT) - $(GOLANGCI_LINT) run --timeout=10m + $(GOLANGCI_LINT) run .PHONY: fix fix: $(GOLANGCI_LINT) - $(GOLANGCI_LINT) run --fix --timeout=10m - -.PHONY: format -format: $(GOFUMPT) $(GOIMPORTS) - $(GOIMPORTS) -w ./ - $(GOFUMPT) -w ./ + $(GOLANGCI_LINT) run --fix .PHONY: test test: go test -v ./... -.PHONY: release -release: $(GORELEASER) - $(GORELEASER) release --clean - -.PHONY: serve-example -serve-example: $(WASMSERVE) - $(WASMSERVE) -http ":8090" ./examples/websocket-browser-link/browser +.PHONY: format +format: $(GOFUMPT) $(GOIMPORTS) + $(GOIMPORTS) -w ./ + $(GOFUMPT) -w ./ diff --git a/README.md b/README.md index db8e075f..0b14de08 100644 --- a/README.md +++ b/README.md @@ -36,10 +36,9 @@ Bifrost is designed around the following core concepts: - **PubSub**: at-least-once delivery of messages to named topics. - **Signaling**: exchanging messages between peers via a relay server. -Integrates with networking, pubsub, and RPC libraries like [libp2p], [drpc], -[starpc], [nats], and [pion webrtc]. +Integrates with networking, pubsub, and RPC libraries like [libp2p], [starpc], +[nats], and [pion webrtc]. -[drpc]: https://github.com/storj/drpc [libp2p]: https://libp2p.io/ [nats]: https://nats.io [starpc]: https://github.com/aperturerobotics/starpc diff --git a/cli/client_accept.go b/cli/client_accept.go index 3703a1d9..48855a9c 100644 --- a/cli/client_accept.go +++ b/cli/client_accept.go @@ -32,9 +32,9 @@ func (a *ClientArgs) RunAccept(*cli.Context) error { return err } - drpc := stream_api.NewAcceptStreamClientRPC(client) + rpcClient := stream_api.NewAcceptStreamClientRPC(client) return stream_api_rpc.AttachRPCToStream( - drpc, + rpcClient, rwc.NewReadWriteCloser(os.Stdin, os.Stdout), nil, ) diff --git a/cli/client_dial.go b/cli/client_dial.go index be09d34f..3c0dcf13 100644 --- a/cli/client_dial.go +++ b/cli/client_dial.go @@ -32,9 +32,9 @@ func (a *ClientArgs) RunDial(*cli.Context) error { return err } - drpc := stream_api.NewDialStreamClientRPC(client) + rpcClient := stream_api.NewDialStreamClientRPC(client) return stream_api_rpc.AttachRPCToStream( - drpc, + rpcClient, rwc.NewReadWriteCloser(os.Stdin, os.Stdout), nil, ) diff --git a/cli/util/util.go b/cli/util/util.go index 0fe40713..18f849d8 100644 --- a/cli/util/util.go +++ b/cli/util/util.go @@ -11,7 +11,7 @@ import ( "github.com/aperturerobotics/bifrost/peer" peer_ssh "github.com/aperturerobotics/bifrost/peer/ssh" "github.com/aperturerobotics/bifrost/util/confparse" - "github.com/aperturerobotics/timestamp" + "github.com/aperturerobotics/protobuf-go-lite/types/known/timestamppb" "github.com/pkg/errors" "github.com/urfave/cli/v2" "golang.org/x/crypto/ssh" @@ -19,7 +19,7 @@ import ( // RunTimestamp runs the timestamp util command. func (a *UtilArgs) RunTimestamp(_ *cli.Context) error { - var ts *timestamp.Timestamp + var ts *timestamppb.Timestamp if a.Timestamp != "" { var err error ts, err = confparse.ParseTimestamp(a.Timestamp) @@ -27,10 +27,10 @@ func (a *UtilArgs) RunTimestamp(_ *cli.Context) error { return err } } else { - ts = timestamp.Now() + ts = timestamppb.Now() } - formatted := ts.ToRFC3339() + "\n" + formatted := ts.AsRFC3339() + "\n" return writeIfNotExists(a.OutPath, bytes.NewReader([]byte(formatted))) } diff --git a/cmd/bifrost/cmd_daemon.go b/cmd/bifrost/cmd_daemon.go index 037113fd..8da7df2c 100644 --- a/cmd/bifrost/cmd_daemon.go +++ b/cmd/bifrost/cmd_daemon.go @@ -69,7 +69,7 @@ func init() { }, &cli.StringFlag{ Name: "api-listen", - Usage: "if set, will listen on address for API drpc connections, ex :5110", + Usage: "if set, will listen on address for API srpc connections, ex :5110", EnvVars: []string{"BIFROST_API_LISTEN"}, Destination: &daemonFlags.APIListen, }, diff --git a/daemon/api/api.pb.go b/daemon/api/api.pb.go index 09310b03..9198a3ec 100644 --- a/daemon/api/api.pb.go +++ b/daemon/api/api.pb.go @@ -1,155 +1,264 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0-devel -// protoc v5.26.1 +// Code generated by protoc-gen-go-lite. DO NOT EDIT. +// protoc-gen-go-lite version: v0.4.5 // source: github.com/aperturerobotics/bifrost/daemon/api/api.proto package bifrost_api import ( - reflect "reflect" - sync "sync" + io "io" api "github.com/aperturerobotics/controllerbus/bus/api" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) + protobuf_go_lite "github.com/aperturerobotics/protobuf-go-lite" + json "github.com/aperturerobotics/protobuf-go-lite/json" + errors "github.com/pkg/errors" ) // Config configures the API. type Config struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + unknownFields []byte // BusConfig configures the bus api. - BusConfig *api.Config `protobuf:"bytes,1,opt,name=bus_config,json=busConfig,proto3" json:"bus_config,omitempty"` + BusConfig *api.Config `protobuf:"bytes,1,opt,name=bus_config,json=busConfig,proto3" json:"busConfig,omitempty"` } func (x *Config) Reset() { *x = Config{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_daemon_api_api_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) +} + +func (*Config) ProtoMessage() {} + +func (x *Config) GetBusConfig() *api.Config { + if x != nil { + return x.BusConfig } + return nil } -func (x *Config) String() string { - return protoimpl.X.MessageStringOf(x) +func (m *Config) CloneVT() *Config { + if m == nil { + return (*Config)(nil) + } + r := new(Config) + if rhs := m.BusConfig; rhs != nil { + r.BusConfig = rhs.CloneVT() + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r } -func (*Config) ProtoMessage() {} +func (m *Config) CloneMessageVT() any { + return m.CloneVT() +} -func (x *Config) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_daemon_api_api_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms +func (this *Config) EqualVT(that *Config) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if !this.BusConfig.EqualVT(that.BusConfig) { + return false } - return mi.MessageOf(x) + return string(this.unknownFields) == string(that.unknownFields) } -// Deprecated: Use Config.ProtoReflect.Descriptor instead. -func (*Config) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_daemon_api_api_proto_rawDescGZIP(), []int{0} +func (this *Config) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*Config) + if !ok { + return false + } + return this.EqualVT(that) } -func (x *Config) GetBusConfig() *api.Config { - if x != nil { - return x.BusConfig +// MarshalProtoJSON marshals the Config message to JSON. +func (x *Config) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return } - return nil + s.WriteObjectStart() + var wroteField bool + if x.BusConfig != nil || s.HasField("busConfig") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("busConfig") + x.BusConfig.MarshalProtoJSON(s.WithField("busConfig")) + } + s.WriteObjectEnd() } -var File_github_com_aperturerobotics_bifrost_daemon_api_api_proto protoreflect.FileDescriptor +// MarshalJSON marshals the Config to JSON. +func (x *Config) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) +} -var file_github_com_aperturerobotics_bifrost_daemon_api_api_proto_rawDesc = []byte{ - 0x0a, 0x38, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, - 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x62, 0x69, - 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2f, 0x64, 0x61, 0x65, 0x6d, 0x6f, 0x6e, 0x2f, 0x61, 0x70, 0x69, - 0x2f, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x62, 0x69, 0x66, 0x72, - 0x6f, 0x73, 0x74, 0x2e, 0x61, 0x70, 0x69, 0x1a, 0x3b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, - 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, - 0x74, 0x69, 0x63, 0x73, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x62, - 0x75, 0x73, 0x2f, 0x62, 0x75, 0x73, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x70, 0x69, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x38, 0x0a, 0x06, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x2e, - 0x0a, 0x0a, 0x62, 0x75, 0x73, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x62, 0x75, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x43, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x52, 0x09, 0x62, 0x75, 0x73, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +// UnmarshalProtoJSON unmarshals the Config message from JSON. +func (x *Config) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { + return + } + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "bus_config", "busConfig": + if s.ReadNil() { + x.BusConfig = nil + return + } + x.BusConfig = &api.Config{} + x.BusConfig.UnmarshalProtoJSON(s.WithField("bus_config", true)) + } + }) } -var ( - file_github_com_aperturerobotics_bifrost_daemon_api_api_proto_rawDescOnce sync.Once - file_github_com_aperturerobotics_bifrost_daemon_api_api_proto_rawDescData = file_github_com_aperturerobotics_bifrost_daemon_api_api_proto_rawDesc -) +// UnmarshalJSON unmarshals the Config from JSON. +func (x *Config) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} -func file_github_com_aperturerobotics_bifrost_daemon_api_api_proto_rawDescGZIP() []byte { - file_github_com_aperturerobotics_bifrost_daemon_api_api_proto_rawDescOnce.Do(func() { - file_github_com_aperturerobotics_bifrost_daemon_api_api_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_aperturerobotics_bifrost_daemon_api_api_proto_rawDescData) - }) - return file_github_com_aperturerobotics_bifrost_daemon_api_api_proto_rawDescData +func (m *Config) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil } -var file_github_com_aperturerobotics_bifrost_daemon_api_api_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_github_com_aperturerobotics_bifrost_daemon_api_api_proto_goTypes = []interface{}{ - (*Config)(nil), // 0: bifrost.api.Config - (*api.Config)(nil), // 1: bus.api.Config +func (m *Config) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) } -var file_github_com_aperturerobotics_bifrost_daemon_api_api_proto_depIdxs = []int32{ - 1, // 0: bifrost.api.Config.bus_config:type_name -> bus.api.Config - 1, // [1:1] is the sub-list for method output_type - 1, // [1:1] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name + +func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.BusConfig != nil { + size, err := m.BusConfig.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } -func init() { file_github_com_aperturerobotics_bifrost_daemon_api_api_proto_init() } -func file_github_com_aperturerobotics_bifrost_daemon_api_api_proto_init() { - if File_github_com_aperturerobotics_bifrost_daemon_api_api_proto != nil { - return +func (m *Config) SizeVT() (n int) { + if m == nil { + return 0 } - if !protoimpl.UnsafeEnabled { - file_github_com_aperturerobotics_bifrost_daemon_api_api_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Config); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil + var l int + _ = l + if m.BusConfig != nil { + l = m.BusConfig.SizeVT() + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *Config) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: Config: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: Config: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field BusConfig", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.BusConfig == nil { + m.BusConfig = &api.Config{} + } + if err := m.BusConfig.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy } } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_github_com_aperturerobotics_bifrost_daemon_api_api_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_github_com_aperturerobotics_bifrost_daemon_api_api_proto_goTypes, - DependencyIndexes: file_github_com_aperturerobotics_bifrost_daemon_api_api_proto_depIdxs, - MessageInfos: file_github_com_aperturerobotics_bifrost_daemon_api_api_proto_msgTypes, - }.Build() - File_github_com_aperturerobotics_bifrost_daemon_api_api_proto = out.File - file_github_com_aperturerobotics_bifrost_daemon_api_api_proto_rawDesc = nil - file_github_com_aperturerobotics_bifrost_daemon_api_api_proto_goTypes = nil - file_github_com_aperturerobotics_bifrost_daemon_api_api_proto_depIdxs = nil + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil } diff --git a/daemon/api/api.pb.ts b/daemon/api/api.pb.ts deleted file mode 100644 index 5cf7ab0c..00000000 --- a/daemon/api/api.pb.ts +++ /dev/null @@ -1,155 +0,0 @@ -/* eslint-disable */ -import { Config as Config1 } from '@go/github.com/aperturerobotics/controllerbus/bus/api/api.pb.js' -import Long from 'long' -import _m0 from 'protobufjs/minimal.js' - -export const protobufPackage = 'bifrost.api' - -/** Config configures the API. */ -export interface Config { - /** BusConfig configures the bus api. */ - busConfig: Config1 | undefined -} - -function createBaseConfig(): Config { - return { busConfig: undefined } -} - -export const Config = { - encode( - message: Config, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.busConfig !== undefined) { - Config1.encode(message.busConfig, writer.uint32(10).fork()).ldelim() - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Config { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseConfig() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break - } - - message.busConfig = Config1.decode(reader, reader.uint32()) - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: AsyncIterable | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config.encode(p).finish()] - } - } else { - yield* [Config.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config.decode(p)] - } - } else { - yield* [Config.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): Config { - return { - busConfig: isSet(object.busConfig) - ? Config1.fromJSON(object.busConfig) - : undefined, - } - }, - - toJSON(message: Config): unknown { - const obj: any = {} - if (message.busConfig !== undefined) { - obj.busConfig = Config1.toJSON(message.busConfig) - } - return obj - }, - - create, I>>(base?: I): Config { - return Config.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>(object: I): Config { - const message = createBaseConfig() - message.busConfig = - object.busConfig !== undefined && object.busConfig !== null - ? Config1.fromPartial(object.busConfig) - : undefined - return message - }, -} - -type Builtin = - | Date - | Function - | Uint8Array - | string - | number - | boolean - | undefined - -export type DeepPartial = T extends Builtin - ? T - : T extends Long - ? string | number | Long - : T extends globalThis.Array - ? globalThis.Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends { $case: string } - ? { [K in keyof Omit]?: DeepPartial } & { - $case: T['$case'] - } - : T extends {} - ? { [K in keyof T]?: DeepPartial } - : Partial - -type KeysOfUnion = T extends T ? keyof T : never -export type Exact = P extends Builtin - ? P - : P & { [K in keyof P]: Exact } & { - [K in Exclude>]: never - } - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any - _m0.configure() -} - -function isSet(value: any): boolean { - return value !== null && value !== undefined -} diff --git a/daemon/api/api_pb.ts b/daemon/api/api_pb.ts new file mode 100644 index 00000000..095e34ae --- /dev/null +++ b/daemon/api/api_pb.ts @@ -0,0 +1,67 @@ +// @generated by protoc-gen-es v1.8.0 with parameter "target=ts,ts_nocheck=false" +// @generated from file github.com/aperturerobotics/bifrost/daemon/api/api.proto (package bifrost.api, syntax proto3) +/* eslint-disable */ + +import type { + BinaryReadOptions, + FieldList, + JsonReadOptions, + JsonValue, + PartialMessage, + PlainMessage, +} from '@bufbuild/protobuf' +import { Message, proto3 } from '@bufbuild/protobuf' +import { Config as Config$1 } from '../../../controllerbus/bus/api/api_pb.js' + +/** + * Config configures the API. + * + * @generated from message bifrost.api.Config + */ +export class Config extends Message { + /** + * BusConfig configures the bus api. + * + * @generated from field: bus.api.Config bus_config = 1; + */ + busConfig?: Config$1 + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'bifrost.api.Config' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: 'bus_config', kind: 'message', T: Config$1 }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): Config { + return new Config().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): Config { + return new Config().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): Config { + return new Config().fromJsonString(jsonString, options) + } + + static equals( + a: Config | PlainMessage | undefined, + b: Config | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(Config, a, b) + } +} diff --git a/daemon/api/api_vtproto.pb.go b/daemon/api/api_vtproto.pb.go deleted file mode 100644 index c6f14c93..00000000 --- a/daemon/api/api_vtproto.pb.go +++ /dev/null @@ -1,239 +0,0 @@ -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// protoc-gen-go-vtproto version: v0.6.0 -// source: github.com/aperturerobotics/bifrost/daemon/api/api.proto - -package bifrost_api - -import ( - fmt "fmt" - io "io" - - api "github.com/aperturerobotics/controllerbus/bus/api" - protohelpers "github.com/planetscale/vtprotobuf/protohelpers" - proto "google.golang.org/protobuf/proto" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) -) - -func (m *Config) CloneVT() *Config { - if m == nil { - return (*Config)(nil) - } - r := new(Config) - if rhs := m.BusConfig; rhs != nil { - if vtpb, ok := interface{}(rhs).(interface{ CloneVT() *api.Config }); ok { - r.BusConfig = vtpb.CloneVT() - } else { - r.BusConfig = proto.Clone(rhs).(*api.Config) - } - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Config) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (this *Config) EqualVT(that *Config) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if equal, ok := interface{}(this.BusConfig).(interface{ EqualVT(*api.Config) bool }); ok { - if !equal.EqualVT(that.BusConfig) { - return false - } - } else if !proto.Equal(this.BusConfig, that.BusConfig) { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Config) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Config) - if !ok { - return false - } - return this.EqualVT(that) -} -func (m *Config) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Config) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.BusConfig != nil { - if vtmsg, ok := interface{}(m.BusConfig).(interface { - MarshalToSizedBufferVT([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.BusConfig) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Config) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.BusConfig != nil { - if size, ok := interface{}(m.BusConfig).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.BusConfig) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *Config) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Config: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Config: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BusConfig", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.BusConfig == nil { - m.BusConfig = &api.Config{} - } - if unmarshal, ok := interface{}(m.BusConfig).(interface { - UnmarshalVT([]byte) error - }); ok { - if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - } else { - if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.BusConfig); err != nil { - return err - } - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} diff --git a/daemon/api/controller/controller.pb.go b/daemon/api/controller/controller.pb.go index f7c4863d..f700fa0f 100644 --- a/daemon/api/controller/controller.pb.go +++ b/daemon/api/controller/controller.pb.go @@ -1,77 +1,39 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0-devel -// protoc v5.26.1 +// Code generated by protoc-gen-go-lite. DO NOT EDIT. +// protoc-gen-go-lite version: v0.4.5 // source: github.com/aperturerobotics/bifrost/daemon/api/controller/controller.proto package bifrost_api_controller import ( - reflect "reflect" - sync "sync" + io "io" api "github.com/aperturerobotics/bifrost/daemon/api" api1 "github.com/aperturerobotics/controllerbus/bus/api" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) + protobuf_go_lite "github.com/aperturerobotics/protobuf-go-lite" + json "github.com/aperturerobotics/protobuf-go-lite/json" + errors "github.com/pkg/errors" ) // Config configures the API. type Config struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + unknownFields []byte // ListenAddr is the address to listen on for connections. - ListenAddr string `protobuf:"bytes,1,opt,name=listen_addr,json=listenAddr,proto3" json:"listen_addr,omitempty"` + ListenAddr string `protobuf:"bytes,1,opt,name=listen_addr,json=listenAddr,proto3" json:"listenAddr,omitempty"` // ApiConfig are api config options. - ApiConfig *api.Config `protobuf:"bytes,2,opt,name=api_config,json=apiConfig,proto3" json:"api_config,omitempty"` + ApiConfig *api.Config `protobuf:"bytes,2,opt,name=api_config,json=apiConfig,proto3" json:"apiConfig,omitempty"` // DisableBusApi disables the bus api. - DisableBusApi bool `protobuf:"varint,3,opt,name=disable_bus_api,json=disableBusApi,proto3" json:"disable_bus_api,omitempty"` + DisableBusApi bool `protobuf:"varint,3,opt,name=disable_bus_api,json=disableBusApi,proto3" json:"disableBusApi,omitempty"` // BusApiConfig are controller-bus bus api config options. // BusApiConfig are options for controller bus api. - BusApiConfig *api1.Config `protobuf:"bytes,4,opt,name=bus_api_config,json=busApiConfig,proto3" json:"bus_api_config,omitempty"` + BusApiConfig *api1.Config `protobuf:"bytes,4,opt,name=bus_api_config,json=busApiConfig,proto3" json:"busApiConfig,omitempty"` } func (x *Config) Reset() { *x = Config{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_daemon_api_controller_controller_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Config) String() string { - return protoimpl.X.MessageStringOf(x) } func (*Config) ProtoMessage() {} -func (x *Config) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_daemon_api_controller_controller_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 Config.ProtoReflect.Descriptor instead. -func (*Config) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_daemon_api_controller_controller_proto_rawDescGZIP(), []int{0} -} - func (x *Config) GetListenAddr() string { if x != nil { return x.ListenAddr @@ -100,101 +62,400 @@ func (x *Config) GetBusApiConfig() *api1.Config { return nil } -var File_github_com_aperturerobotics_bifrost_daemon_api_controller_controller_proto protoreflect.FileDescriptor - -var file_github_com_aperturerobotics_bifrost_daemon_api_controller_controller_proto_rawDesc = []byte{ - 0x0a, 0x4a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, - 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x62, 0x69, - 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2f, 0x64, 0x61, 0x65, 0x6d, 0x6f, 0x6e, 0x2f, 0x61, 0x70, 0x69, - 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x63, 0x6f, 0x6e, 0x74, - 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x16, 0x62, 0x69, - 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, - 0x6c, 0x6c, 0x65, 0x72, 0x1a, 0x38, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, - 0x2f, 0x61, 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, - 0x73, 0x2f, 0x62, 0x69, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2f, 0x64, 0x61, 0x65, 0x6d, 0x6f, 0x6e, - 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x3b, - 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, 0x72, 0x74, - 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x63, 0x6f, 0x6e, 0x74, - 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x62, 0x75, 0x73, 0x2f, 0x62, 0x75, 0x73, 0x2f, 0x61, 0x70, - 0x69, 0x2f, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xbc, 0x01, 0x0a, 0x06, - 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x1f, 0x0a, 0x0b, 0x6c, 0x69, 0x73, 0x74, 0x65, 0x6e, - 0x5f, 0x61, 0x64, 0x64, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6c, 0x69, 0x73, - 0x74, 0x65, 0x6e, 0x41, 0x64, 0x64, 0x72, 0x12, 0x32, 0x0a, 0x0a, 0x61, 0x70, 0x69, 0x5f, 0x63, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x62, 0x69, - 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x52, 0x09, 0x61, 0x70, 0x69, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x26, 0x0a, 0x0f, 0x64, - 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x62, 0x75, 0x73, 0x5f, 0x61, 0x70, 0x69, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x42, 0x75, 0x73, - 0x41, 0x70, 0x69, 0x12, 0x35, 0x0a, 0x0e, 0x62, 0x75, 0x73, 0x5f, 0x61, 0x70, 0x69, 0x5f, 0x63, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x62, 0x75, - 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x0c, 0x62, 0x75, - 0x73, 0x41, 0x70, 0x69, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, -} - -var ( - file_github_com_aperturerobotics_bifrost_daemon_api_controller_controller_proto_rawDescOnce sync.Once - file_github_com_aperturerobotics_bifrost_daemon_api_controller_controller_proto_rawDescData = file_github_com_aperturerobotics_bifrost_daemon_api_controller_controller_proto_rawDesc -) +func (m *Config) CloneVT() *Config { + if m == nil { + return (*Config)(nil) + } + r := new(Config) + r.ListenAddr = m.ListenAddr + r.DisableBusApi = m.DisableBusApi + if rhs := m.ApiConfig; rhs != nil { + r.ApiConfig = rhs.CloneVT() + } + if rhs := m.BusApiConfig; rhs != nil { + r.BusApiConfig = rhs.CloneVT() + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} -func file_github_com_aperturerobotics_bifrost_daemon_api_controller_controller_proto_rawDescGZIP() []byte { - file_github_com_aperturerobotics_bifrost_daemon_api_controller_controller_proto_rawDescOnce.Do(func() { - file_github_com_aperturerobotics_bifrost_daemon_api_controller_controller_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_aperturerobotics_bifrost_daemon_api_controller_controller_proto_rawDescData) - }) - return file_github_com_aperturerobotics_bifrost_daemon_api_controller_controller_proto_rawDescData +func (m *Config) CloneMessageVT() any { + return m.CloneVT() +} + +func (this *Config) EqualVT(that *Config) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.ListenAddr != that.ListenAddr { + return false + } + if !this.ApiConfig.EqualVT(that.ApiConfig) { + return false + } + if this.DisableBusApi != that.DisableBusApi { + return false + } + if !this.BusApiConfig.EqualVT(that.BusApiConfig) { + return false + } + return string(this.unknownFields) == string(that.unknownFields) } -var file_github_com_aperturerobotics_bifrost_daemon_api_controller_controller_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_github_com_aperturerobotics_bifrost_daemon_api_controller_controller_proto_goTypes = []interface{}{ - (*Config)(nil), // 0: bifrost.api.controller.Config - (*api.Config)(nil), // 1: bifrost.api.Config - (*api1.Config)(nil), // 2: bus.api.Config +func (this *Config) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*Config) + if !ok { + return false + } + return this.EqualVT(that) } -var file_github_com_aperturerobotics_bifrost_daemon_api_controller_controller_proto_depIdxs = []int32{ - 1, // 0: bifrost.api.controller.Config.api_config:type_name -> bifrost.api.Config - 2, // 1: bifrost.api.controller.Config.bus_api_config:type_name -> bus.api.Config - 2, // [2:2] is the sub-list for method output_type - 2, // [2:2] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name + +// MarshalProtoJSON marshals the Config message to JSON. +func (x *Config) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return + } + s.WriteObjectStart() + var wroteField bool + if x.ListenAddr != "" || s.HasField("listenAddr") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("listenAddr") + s.WriteString(x.ListenAddr) + } + if x.ApiConfig != nil || s.HasField("apiConfig") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("apiConfig") + x.ApiConfig.MarshalProtoJSON(s.WithField("apiConfig")) + } + if x.DisableBusApi || s.HasField("disableBusApi") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("disableBusApi") + s.WriteBool(x.DisableBusApi) + } + if x.BusApiConfig != nil || s.HasField("busApiConfig") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("busApiConfig") + x.BusApiConfig.MarshalProtoJSON(s.WithField("busApiConfig")) + } + s.WriteObjectEnd() +} + +// MarshalJSON marshals the Config to JSON. +func (x *Config) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) } -func init() { file_github_com_aperturerobotics_bifrost_daemon_api_controller_controller_proto_init() } -func file_github_com_aperturerobotics_bifrost_daemon_api_controller_controller_proto_init() { - if File_github_com_aperturerobotics_bifrost_daemon_api_controller_controller_proto != nil { +// UnmarshalProtoJSON unmarshals the Config message from JSON. +func (x *Config) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { return } - if !protoimpl.UnsafeEnabled { - file_github_com_aperturerobotics_bifrost_daemon_api_controller_controller_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Config); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "listen_addr", "listenAddr": + s.AddField("listen_addr") + x.ListenAddr = s.ReadString() + case "api_config", "apiConfig": + if s.ReadNil() { + x.ApiConfig = nil + return + } + x.ApiConfig = &api.Config{} + x.ApiConfig.UnmarshalProtoJSON(s.WithField("api_config", true)) + case "disable_bus_api", "disableBusApi": + s.AddField("disable_bus_api") + x.DisableBusApi = s.ReadBool() + case "bus_api_config", "busApiConfig": + if s.ReadNil() { + x.BusApiConfig = nil + return + } + x.BusApiConfig = &api1.Config{} + x.BusApiConfig.UnmarshalProtoJSON(s.WithField("bus_api_config", true)) + } + }) +} + +// UnmarshalJSON unmarshals the Config from JSON. +func (x *Config) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +func (m *Config) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Config) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.BusApiConfig != nil { + size, err := m.BusApiConfig.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x22 + } + if m.DisableBusApi { + i-- + if m.DisableBusApi { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x18 + } + if m.ApiConfig != nil { + size, err := m.ApiConfig.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x12 + } + if len(m.ListenAddr) > 0 { + i -= len(m.ListenAddr) + copy(dAtA[i:], m.ListenAddr) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.ListenAddr))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Config) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ListenAddr) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + if m.ApiConfig != nil { + l = m.ApiConfig.SizeVT() + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + if m.DisableBusApi { + n += 2 + } + if m.BusApiConfig != nil { + l = m.BusApiConfig.SizeVT() + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *Config) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: Config: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: Config: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field ListenAddr", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ListenAddr = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field ApiConfig", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ApiConfig == nil { + m.ApiConfig = &api.Config{} + } + if err := m.ApiConfig.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return errors.Errorf("proto: wrong wireType = %d for field DisableBusApi", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.DisableBusApi = bool(v != 0) + case 4: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field BusApiConfig", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.BusApiConfig == nil { + m.BusApiConfig = &api1.Config{} + } + if err := m.BusApiConfig.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy } } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_github_com_aperturerobotics_bifrost_daemon_api_controller_controller_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_github_com_aperturerobotics_bifrost_daemon_api_controller_controller_proto_goTypes, - DependencyIndexes: file_github_com_aperturerobotics_bifrost_daemon_api_controller_controller_proto_depIdxs, - MessageInfos: file_github_com_aperturerobotics_bifrost_daemon_api_controller_controller_proto_msgTypes, - }.Build() - File_github_com_aperturerobotics_bifrost_daemon_api_controller_controller_proto = out.File - file_github_com_aperturerobotics_bifrost_daemon_api_controller_controller_proto_rawDesc = nil - file_github_com_aperturerobotics_bifrost_daemon_api_controller_controller_proto_goTypes = nil - file_github_com_aperturerobotics_bifrost_daemon_api_controller_controller_proto_depIdxs = nil + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil } diff --git a/daemon/api/controller/controller.pb.ts b/daemon/api/controller/controller.pb.ts deleted file mode 100644 index d558e199..00000000 --- a/daemon/api/controller/controller.pb.ts +++ /dev/null @@ -1,224 +0,0 @@ -/* eslint-disable */ -import { Config as Config2 } from '@go/github.com/aperturerobotics/controllerbus/bus/api/api.pb.js' -import Long from 'long' -import _m0 from 'protobufjs/minimal.js' -import { Config as Config1 } from '../api.pb.js' - -export const protobufPackage = 'bifrost.api.controller' - -/** Config configures the API. */ -export interface Config { - /** ListenAddr is the address to listen on for connections. */ - listenAddr: string - /** ApiConfig are api config options. */ - apiConfig: Config1 | undefined - /** DisableBusApi disables the bus api. */ - disableBusApi: boolean - /** - * BusApiConfig are controller-bus bus api config options. - * BusApiConfig are options for controller bus api. - */ - busApiConfig: Config2 | undefined -} - -function createBaseConfig(): Config { - return { - listenAddr: '', - apiConfig: undefined, - disableBusApi: false, - busApiConfig: undefined, - } -} - -export const Config = { - encode( - message: Config, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.listenAddr !== '') { - writer.uint32(10).string(message.listenAddr) - } - if (message.apiConfig !== undefined) { - Config1.encode(message.apiConfig, writer.uint32(18).fork()).ldelim() - } - if (message.disableBusApi !== false) { - writer.uint32(24).bool(message.disableBusApi) - } - if (message.busApiConfig !== undefined) { - Config2.encode(message.busApiConfig, writer.uint32(34).fork()).ldelim() - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Config { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseConfig() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break - } - - message.listenAddr = reader.string() - continue - case 2: - if (tag !== 18) { - break - } - - message.apiConfig = Config1.decode(reader, reader.uint32()) - continue - case 3: - if (tag !== 24) { - break - } - - message.disableBusApi = reader.bool() - continue - case 4: - if (tag !== 34) { - break - } - - message.busApiConfig = Config2.decode(reader, reader.uint32()) - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: AsyncIterable | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config.encode(p).finish()] - } - } else { - yield* [Config.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config.decode(p)] - } - } else { - yield* [Config.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): Config { - return { - listenAddr: isSet(object.listenAddr) - ? globalThis.String(object.listenAddr) - : '', - apiConfig: isSet(object.apiConfig) - ? Config1.fromJSON(object.apiConfig) - : undefined, - disableBusApi: isSet(object.disableBusApi) - ? globalThis.Boolean(object.disableBusApi) - : false, - busApiConfig: isSet(object.busApiConfig) - ? Config2.fromJSON(object.busApiConfig) - : undefined, - } - }, - - toJSON(message: Config): unknown { - const obj: any = {} - if (message.listenAddr !== '') { - obj.listenAddr = message.listenAddr - } - if (message.apiConfig !== undefined) { - obj.apiConfig = Config1.toJSON(message.apiConfig) - } - if (message.disableBusApi !== false) { - obj.disableBusApi = message.disableBusApi - } - if (message.busApiConfig !== undefined) { - obj.busApiConfig = Config2.toJSON(message.busApiConfig) - } - return obj - }, - - create, I>>(base?: I): Config { - return Config.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>(object: I): Config { - const message = createBaseConfig() - message.listenAddr = object.listenAddr ?? '' - message.apiConfig = - object.apiConfig !== undefined && object.apiConfig !== null - ? Config1.fromPartial(object.apiConfig) - : undefined - message.disableBusApi = object.disableBusApi ?? false - message.busApiConfig = - object.busApiConfig !== undefined && object.busApiConfig !== null - ? Config2.fromPartial(object.busApiConfig) - : undefined - return message - }, -} - -type Builtin = - | Date - | Function - | Uint8Array - | string - | number - | boolean - | undefined - -export type DeepPartial = T extends Builtin - ? T - : T extends Long - ? string | number | Long - : T extends globalThis.Array - ? globalThis.Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends { $case: string } - ? { [K in keyof Omit]?: DeepPartial } & { - $case: T['$case'] - } - : T extends {} - ? { [K in keyof T]?: DeepPartial } - : Partial - -type KeysOfUnion = T extends T ? keyof T : never -export type Exact = P extends Builtin - ? P - : P & { [K in keyof P]: Exact } & { - [K in Exclude>]: never - } - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any - _m0.configure() -} - -function isSet(value: any): boolean { - return value !== null && value !== undefined -} diff --git a/daemon/api/controller/controller_pb.ts b/daemon/api/controller/controller_pb.ts new file mode 100644 index 00000000..f06eb2f4 --- /dev/null +++ b/daemon/api/controller/controller_pb.ts @@ -0,0 +1,103 @@ +// @generated by protoc-gen-es v1.8.0 with parameter "target=ts,ts_nocheck=false" +// @generated from file github.com/aperturerobotics/bifrost/daemon/api/controller/controller.proto (package bifrost.api.controller, syntax proto3) +/* eslint-disable */ + +import type { + BinaryReadOptions, + FieldList, + JsonReadOptions, + JsonValue, + PartialMessage, + PlainMessage, +} from '@bufbuild/protobuf' +import { Message, proto3 } from '@bufbuild/protobuf' +import { Config as Config$1 } from '../api_pb.js' +import { Config as Config$2 } from '../../../../controllerbus/bus/api/api_pb.js' + +/** + * Config configures the API. + * + * @generated from message bifrost.api.controller.Config + */ +export class Config extends Message { + /** + * ListenAddr is the address to listen on for connections. + * + * @generated from field: string listen_addr = 1; + */ + listenAddr = '' + + /** + * ApiConfig are api config options. + * + * @generated from field: bifrost.api.Config api_config = 2; + */ + apiConfig?: Config$1 + + /** + * DisableBusApi disables the bus api. + * + * @generated from field: bool disable_bus_api = 3; + */ + disableBusApi = false + + /** + * BusApiConfig are controller-bus bus api config options. + * BusApiConfig are options for controller bus api. + * + * @generated from field: bus.api.Config bus_api_config = 4; + */ + busApiConfig?: Config$2 + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'bifrost.api.controller.Config' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { + no: 1, + name: 'listen_addr', + kind: 'scalar', + T: 9 /* ScalarType.STRING */, + }, + { no: 2, name: 'api_config', kind: 'message', T: Config$1 }, + { + no: 3, + name: 'disable_bus_api', + kind: 'scalar', + T: 8 /* ScalarType.BOOL */, + }, + { no: 4, name: 'bus_api_config', kind: 'message', T: Config$2 }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): Config { + return new Config().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): Config { + return new Config().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): Config { + return new Config().fromJsonString(jsonString, options) + } + + static equals( + a: Config | PlainMessage | undefined, + b: Config | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(Config, a, b) + } +} diff --git a/daemon/api/controller/controller_vtproto.pb.go b/daemon/api/controller/controller_vtproto.pb.go deleted file mode 100644 index fd6d35fe..00000000 --- a/daemon/api/controller/controller_vtproto.pb.go +++ /dev/null @@ -1,414 +0,0 @@ -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// protoc-gen-go-vtproto version: v0.6.0 -// source: github.com/aperturerobotics/bifrost/daemon/api/controller/controller.proto - -package bifrost_api_controller - -import ( - fmt "fmt" - io "io" - - api "github.com/aperturerobotics/bifrost/daemon/api" - api1 "github.com/aperturerobotics/controllerbus/bus/api" - protohelpers "github.com/planetscale/vtprotobuf/protohelpers" - proto "google.golang.org/protobuf/proto" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) -) - -func (m *Config) CloneVT() *Config { - if m == nil { - return (*Config)(nil) - } - r := new(Config) - r.ListenAddr = m.ListenAddr - r.DisableBusApi = m.DisableBusApi - if rhs := m.ApiConfig; rhs != nil { - if vtpb, ok := interface{}(rhs).(interface{ CloneVT() *api.Config }); ok { - r.ApiConfig = vtpb.CloneVT() - } else { - r.ApiConfig = proto.Clone(rhs).(*api.Config) - } - } - if rhs := m.BusApiConfig; rhs != nil { - if vtpb, ok := interface{}(rhs).(interface{ CloneVT() *api1.Config }); ok { - r.BusApiConfig = vtpb.CloneVT() - } else { - r.BusApiConfig = proto.Clone(rhs).(*api1.Config) - } - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Config) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (this *Config) EqualVT(that *Config) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.ListenAddr != that.ListenAddr { - return false - } - if equal, ok := interface{}(this.ApiConfig).(interface{ EqualVT(*api.Config) bool }); ok { - if !equal.EqualVT(that.ApiConfig) { - return false - } - } else if !proto.Equal(this.ApiConfig, that.ApiConfig) { - return false - } - if this.DisableBusApi != that.DisableBusApi { - return false - } - if equal, ok := interface{}(this.BusApiConfig).(interface{ EqualVT(*api1.Config) bool }); ok { - if !equal.EqualVT(that.BusApiConfig) { - return false - } - } else if !proto.Equal(this.BusApiConfig, that.BusApiConfig) { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Config) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Config) - if !ok { - return false - } - return this.EqualVT(that) -} -func (m *Config) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Config) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.BusApiConfig != nil { - if vtmsg, ok := interface{}(m.BusApiConfig).(interface { - MarshalToSizedBufferVT([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.BusApiConfig) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0x22 - } - if m.DisableBusApi { - i-- - if m.DisableBusApi { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x18 - } - if m.ApiConfig != nil { - if vtmsg, ok := interface{}(m.ApiConfig).(interface { - MarshalToSizedBufferVT([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.ApiConfig) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0x12 - } - if len(m.ListenAddr) > 0 { - i -= len(m.ListenAddr) - copy(dAtA[i:], m.ListenAddr) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.ListenAddr))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Config) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ListenAddr) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.ApiConfig != nil { - if size, ok := interface{}(m.ApiConfig).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.ApiConfig) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.DisableBusApi { - n += 2 - } - if m.BusApiConfig != nil { - if size, ok := interface{}(m.BusApiConfig).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.BusApiConfig) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *Config) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Config: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Config: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListenAddr", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ListenAddr = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ApiConfig", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.ApiConfig == nil { - m.ApiConfig = &api.Config{} - } - if unmarshal, ok := interface{}(m.ApiConfig).(interface { - UnmarshalVT([]byte) error - }); ok { - if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - } else { - if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.ApiConfig); err != nil { - return err - } - } - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field DisableBusApi", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.DisableBusApi = bool(v != 0) - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BusApiConfig", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.BusApiConfig == nil { - m.BusApiConfig = &api1.Config{} - } - if unmarshal, ok := interface{}(m.BusApiConfig).(interface { - UnmarshalVT([]byte) error - }); ok { - if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - } else { - if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.BusApiConfig); err != nil { - return err - } - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} diff --git a/entitygraph/config.pb.go b/entitygraph/config.pb.go index 193d459b..85533443 100644 --- a/entitygraph/config.pb.go +++ b/entitygraph/config.pb.go @@ -1,136 +1,179 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0-devel -// protoc v5.26.1 +// Code generated by protoc-gen-go-lite. DO NOT EDIT. +// protoc-gen-go-lite version: v0.4.5 // source: github.com/aperturerobotics/bifrost/entitygraph/config.proto package bifrost_entitygraph import ( - reflect "reflect" - sync "sync" + io "io" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) + protobuf_go_lite "github.com/aperturerobotics/protobuf-go-lite" + json "github.com/aperturerobotics/protobuf-go-lite/json" + errors "github.com/pkg/errors" ) // Config is the config object for the entitygraph repoter. type Config struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields + unknownFields []byte } func (x *Config) Reset() { *x = Config{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_entitygraph_config_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) +} + +func (*Config) ProtoMessage() {} + +func (m *Config) CloneVT() *Config { + if m == nil { + return (*Config)(nil) + } + r := new(Config) + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) } + return r } -func (x *Config) String() string { - return protoimpl.X.MessageStringOf(x) +func (m *Config) CloneMessageVT() any { + return m.CloneVT() } -func (*Config) ProtoMessage() {} +func (this *Config) EqualVT(that *Config) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} -func (x *Config) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_entitygraph_config_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms +func (this *Config) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*Config) + if !ok { + return false } - return mi.MessageOf(x) + return this.EqualVT(that) } -// Deprecated: Use Config.ProtoReflect.Descriptor instead. -func (*Config) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_entitygraph_config_proto_rawDescGZIP(), []int{0} +// MarshalProtoJSON marshals the Config message to JSON. +func (x *Config) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return + } + s.WriteObjectStart() + s.WriteObjectEnd() } -var File_github_com_aperturerobotics_bifrost_entitygraph_config_proto protoreflect.FileDescriptor +// MarshalJSON marshals the Config to JSON. +func (x *Config) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) +} -var file_github_com_aperturerobotics_bifrost_entitygraph_config_proto_rawDesc = []byte{ - 0x0a, 0x3c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, - 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x62, 0x69, - 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2f, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x67, 0x72, 0x61, 0x70, - 0x68, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x13, - 0x62, 0x69, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2e, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x67, 0x72, - 0x61, 0x70, 0x68, 0x22, 0x08, 0x0a, 0x06, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, +// UnmarshalProtoJSON unmarshals the Config message from JSON. +func (x *Config) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { + return + } } -var ( - file_github_com_aperturerobotics_bifrost_entitygraph_config_proto_rawDescOnce sync.Once - file_github_com_aperturerobotics_bifrost_entitygraph_config_proto_rawDescData = file_github_com_aperturerobotics_bifrost_entitygraph_config_proto_rawDesc -) +// UnmarshalJSON unmarshals the Config from JSON. +func (x *Config) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} -func file_github_com_aperturerobotics_bifrost_entitygraph_config_proto_rawDescGZIP() []byte { - file_github_com_aperturerobotics_bifrost_entitygraph_config_proto_rawDescOnce.Do(func() { - file_github_com_aperturerobotics_bifrost_entitygraph_config_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_aperturerobotics_bifrost_entitygraph_config_proto_rawDescData) - }) - return file_github_com_aperturerobotics_bifrost_entitygraph_config_proto_rawDescData +func (m *Config) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil } -var file_github_com_aperturerobotics_bifrost_entitygraph_config_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_github_com_aperturerobotics_bifrost_entitygraph_config_proto_goTypes = []interface{}{ - (*Config)(nil), // 0: bifrost.entitygraph.Config +func (m *Config) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) } -var file_github_com_aperturerobotics_bifrost_entitygraph_config_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] 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 (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + return len(dAtA) - i, nil } -func init() { file_github_com_aperturerobotics_bifrost_entitygraph_config_proto_init() } -func file_github_com_aperturerobotics_bifrost_entitygraph_config_proto_init() { - if File_github_com_aperturerobotics_bifrost_entitygraph_config_proto != nil { - return +func (m *Config) SizeVT() (n int) { + if m == nil { + return 0 } - if !protoimpl.UnsafeEnabled { - file_github_com_aperturerobotics_bifrost_entitygraph_config_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Config); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil + var l int + _ = l + n += len(m.unknownFields) + return n +} + +func (m *Config) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: Config: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: Config: illegal tag %d (wire type %d)", fieldNum, wire) } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_github_com_aperturerobotics_bifrost_entitygraph_config_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_github_com_aperturerobotics_bifrost_entitygraph_config_proto_goTypes, - DependencyIndexes: file_github_com_aperturerobotics_bifrost_entitygraph_config_proto_depIdxs, - MessageInfos: file_github_com_aperturerobotics_bifrost_entitygraph_config_proto_msgTypes, - }.Build() - File_github_com_aperturerobotics_bifrost_entitygraph_config_proto = out.File - file_github_com_aperturerobotics_bifrost_entitygraph_config_proto_rawDesc = nil - file_github_com_aperturerobotics_bifrost_entitygraph_config_proto_goTypes = nil - file_github_com_aperturerobotics_bifrost_entitygraph_config_proto_depIdxs = nil + return nil } diff --git a/entitygraph/config.pb.ts b/entitygraph/config.pb.ts deleted file mode 100644 index 09f88a7e..00000000 --- a/entitygraph/config.pb.ts +++ /dev/null @@ -1,123 +0,0 @@ -/* eslint-disable */ -import Long from 'long' -import _m0 from 'protobufjs/minimal.js' - -export const protobufPackage = 'bifrost.entitygraph' - -/** Config is the config object for the entitygraph repoter. */ -export interface Config {} - -function createBaseConfig(): Config { - return {} -} - -export const Config = { - encode(_: Config, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Config { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseConfig() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: AsyncIterable | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config.encode(p).finish()] - } - } else { - yield* [Config.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config.decode(p)] - } - } else { - yield* [Config.decode(pkt as any)] - } - } - }, - - fromJSON(_: any): Config { - return {} - }, - - toJSON(_: Config): unknown { - const obj: any = {} - return obj - }, - - create, I>>(base?: I): Config { - return Config.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>(_: I): Config { - const message = createBaseConfig() - return message - }, -} - -type Builtin = - | Date - | Function - | Uint8Array - | string - | number - | boolean - | undefined - -export type DeepPartial = T extends Builtin - ? T - : T extends Long - ? string | number | Long - : T extends globalThis.Array - ? globalThis.Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends { $case: string } - ? { [K in keyof Omit]?: DeepPartial } & { - $case: T['$case'] - } - : T extends {} - ? { [K in keyof T]?: DeepPartial } - : Partial - -type KeysOfUnion = T extends T ? keyof T : never -export type Exact = P extends Builtin - ? P - : P & { [K in keyof P]: Exact } & { - [K in Exclude>]: never - } - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any - _m0.configure() -} diff --git a/entitygraph/config_pb.ts b/entitygraph/config_pb.ts new file mode 100644 index 00000000..718fee53 --- /dev/null +++ b/entitygraph/config_pb.ts @@ -0,0 +1,57 @@ +// @generated by protoc-gen-es v1.8.0 with parameter "target=ts,ts_nocheck=false" +// @generated from file github.com/aperturerobotics/bifrost/entitygraph/config.proto (package bifrost.entitygraph, syntax proto3) +/* eslint-disable */ + +import type { + BinaryReadOptions, + FieldList, + JsonReadOptions, + JsonValue, + PartialMessage, + PlainMessage, +} from '@bufbuild/protobuf' +import { Message, proto3 } from '@bufbuild/protobuf' + +/** + * Config is the config object for the entitygraph repoter. + * + * @generated from message bifrost.entitygraph.Config + */ +export class Config extends Message { + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'bifrost.entitygraph.Config' + static readonly fields: FieldList = proto3.util.newFieldList(() => []) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): Config { + return new Config().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): Config { + return new Config().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): Config { + return new Config().fromJsonString(jsonString, options) + } + + static equals( + a: Config | PlainMessage | undefined, + b: Config | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(Config, a, b) + } +} diff --git a/entitygraph/config_vtproto.pb.go b/entitygraph/config_vtproto.pb.go deleted file mode 100644 index 4327d6da..00000000 --- a/entitygraph/config_vtproto.pb.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// protoc-gen-go-vtproto version: v0.6.0 -// source: github.com/aperturerobotics/bifrost/entitygraph/config.proto - -package bifrost_entitygraph - -import ( - fmt "fmt" - io "io" - - protohelpers "github.com/planetscale/vtprotobuf/protohelpers" - proto "google.golang.org/protobuf/proto" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) -) - -func (m *Config) CloneVT() *Config { - if m == nil { - return (*Config)(nil) - } - r := new(Config) - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Config) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (this *Config) EqualVT(that *Config) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Config) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Config) - if !ok { - return false - } - return this.EqualVT(that) -} -func (m *Config) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Config) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - return len(dAtA) - i, nil -} - -func (m *Config) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - n += len(m.unknownFields) - return n -} - -func (m *Config) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Config: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Config: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} diff --git a/go.mod b/go.mod index de304f66..a4f792f7 100644 --- a/go.mod +++ b/go.mod @@ -3,12 +3,11 @@ module github.com/aperturerobotics/bifrost go 1.22 require ( - github.com/aperturerobotics/controllerbus v0.40.0 // latest - github.com/aperturerobotics/entitygraph v0.8.0 - github.com/aperturerobotics/starpc v0.28.1 // latest - github.com/aperturerobotics/timestamp v0.8.2 - github.com/aperturerobotics/ts-proto-common-types v0.20.2 // latest - github.com/aperturerobotics/util v1.16.5 // master + github.com/aperturerobotics/controllerbus v0.41.2 // latest + github.com/aperturerobotics/entitygraph v0.8.1 + github.com/aperturerobotics/protobuf-go-lite v0.4.7 // latest + github.com/aperturerobotics/starpc v0.31.2 // latest + github.com/aperturerobotics/util v1.18.2-0.20240422064924-0aa0a8ef68ac // master ) // aperture: use compatibility forks @@ -22,9 +21,7 @@ replace ( github.com/quic-go/quic-go => github.com/aperturerobotics/quic-go v0.41.1-0.20240125035303-1093432c45e9 // aperture github.com/sirupsen/logrus => github.com/aperturerobotics/logrus v1.9.4-0.20240119050608-13332fb58195 // aperture go.bug.st/serial => github.com/paralin/go-serial v0.0.0-20240220235126-6223594b0314 // fix-wasm-1 - google.golang.org/protobuf => github.com/aperturerobotics/protobuf-go v1.33.1-0.20240322235918-b46c9358eab6 // aperture nhooyr.io/websocket => github.com/paralin/nhooyr-websocket v1.8.8-0.20220321125022-7defdf942f07 // aperture - storj.io/drpc => github.com/paralin/drpc v0.0.31-0.20220527065730-0e2a1370bccb // aperture ) require ( @@ -43,19 +40,15 @@ require ( github.com/pion/sdp/v3 v3.0.9 github.com/pion/webrtc/v4 v4.0.0-beta.16 github.com/pkg/errors v0.9.1 - github.com/planetscale/vtprotobuf v0.6.0 github.com/quic-go/quic-go v0.42.0 github.com/sasha-s/go-deadlock v0.3.1 github.com/sirupsen/logrus v1.9.3 github.com/urfave/cli/v2 v2.27.1 - github.com/valyala/fastjson v1.6.4 github.com/zeebo/blake3 v0.2.3 golang.org/x/crypto v0.22.0 - golang.org/x/exp v0.0.0-20240409090435-93d18d7e34b8 + golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f gonum.org/v1/gonum v0.15.0 - google.golang.org/protobuf v1.33.0 nhooyr.io/websocket v1.8.11 - storj.io/drpc v0.0.34 ) require ( @@ -66,18 +59,20 @@ require ( github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect github.com/ghodss/yaml v1.0.0 // indirect github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect - github.com/golang/protobuf v1.5.3 // indirect github.com/google/pprof v0.0.0-20240207164012-fb44976bdcd5 // indirect github.com/google/uuid v1.6.0 // indirect github.com/ipfs/go-cid v0.4.1 // indirect github.com/ipfs/go-log/v2 v2.5.1 // indirect github.com/jbenet/go-temp-err-catcher v0.1.0 // indirect + github.com/json-iterator/go v1.1.12 // indirect github.com/klauspost/cpuid/v2 v2.2.7 // indirect github.com/kr/text v0.2.0 // indirect github.com/libp2p/go-buffer-pool v0.1.0 // indirect github.com/libp2p/go-yamux/v4 v4.0.2-0.20240322071716-53ef5820bd48 // indirect github.com/minio/highwayhash v1.0.2 // indirect github.com/minio/sha256-simd v1.0.1 // indirect + github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 // indirect + github.com/modern-go/reflect2 v1.0.2 // indirect github.com/multiformats/go-base32 v0.1.0 // indirect github.com/multiformats/go-base36 v0.2.0 // indirect github.com/multiformats/go-multibase v0.2.0 // indirect @@ -107,14 +102,15 @@ require ( github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/spaolacci/murmur3 v1.1.1-0.20190317074736-539464a789e9 // indirect github.com/stretchr/testify v1.9.0 // indirect + github.com/valyala/fastjson v1.6.4 // indirect github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect - github.com/zeebo/errs v1.2.2 // indirect go.uber.org/mock v0.4.0 // indirect golang.org/x/mod v0.17.0 // indirect golang.org/x/net v0.24.0 // indirect golang.org/x/sys v0.19.0 // indirect golang.org/x/time v0.3.0 // indirect golang.org/x/tools v0.20.0 // indirect + google.golang.org/protobuf v1.33.0 // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/go.sum b/go.sum index 4a35ed7a..2d4acff0 100644 --- a/go.sum +++ b/go.sum @@ -6,26 +6,20 @@ github.com/aperturerobotics/bifrost-nats-client v1.10.1-0.20200831103200-24c3d04 github.com/aperturerobotics/bifrost-nats-client v1.10.1-0.20200831103200-24c3d0464e58/go.mod h1:ougcjYEZDYV8pVtaNbA5sgYDukkYHyKtSsW/T3B13j0= github.com/aperturerobotics/bifrost-nats-server/v2 v2.1.8-0.20221228081037-b7c2df0c151f h1:bmScByQNGDPPy9T+zdwu816XaCbFtD5UDyqZMRiHJ80= github.com/aperturerobotics/bifrost-nats-server/v2 v2.1.8-0.20221228081037-b7c2df0c151f/go.mod h1:kIcZtLpq4UIZzOqduYLm1mYU1nuMBtN6XuDCtQ21QT8= -github.com/aperturerobotics/controllerbus v0.40.0 h1:aYWm9RgFXPzACNGNKDXxjqO0uBucrhYzIQH+o15c0nk= -github.com/aperturerobotics/controllerbus v0.40.0/go.mod h1:tkKOIvGrqfCS4UGKn3CCJVO4ONrpQFjXwa1g07iJ+nM= -github.com/aperturerobotics/entitygraph v0.8.0 h1:1tEsGPAk4kzJRLrwxn69JZbQreSOkqHgr3Ue5BGpE0M= -github.com/aperturerobotics/entitygraph v0.8.0/go.mod h1:F9CfzYNTnIj9d7z79+2l0owNqsuVfz/U2cTPZbEcFTw= +github.com/aperturerobotics/controllerbus v0.41.2 h1:xclf9u+r1llfwQZ2TJ0ysA89CuLBJwbEFzlYe7OvAgk= +github.com/aperturerobotics/controllerbus v0.41.2/go.mod h1:egxlosO3WYXDGTvpv/xDVTtTPD19SQ/NXxt2Fw5NyBA= +github.com/aperturerobotics/entitygraph v0.8.1 h1:QHYefRt4c4zvLukj9iq0JDt1GtPwB2+b7xtXdEDJLW8= +github.com/aperturerobotics/entitygraph v0.8.1/go.mod h1:44ZScdA0eornV60JNJT8nM7nRVjxffastOdwsMi5baM= github.com/aperturerobotics/logrus v1.9.4-0.20240119050608-13332fb58195 h1:uyeD1J23j/kFiCFO7rx+GQA4tCqOEy3IJyMK4f6vamE= github.com/aperturerobotics/logrus v1.9.4-0.20240119050608-13332fb58195/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= -github.com/aperturerobotics/protobuf-go v1.33.1-0.20240322235918-b46c9358eab6 h1:ScQPbkbABsFb7e86ArWSRtoOemQGrX4BDKeHj+JAgbQ= -github.com/aperturerobotics/protobuf-go v1.33.1-0.20240322235918-b46c9358eab6/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +github.com/aperturerobotics/protobuf-go-lite v0.4.7 h1:ImZI7cNuWO2WXBy7/w0DFdiOENsroQf0trct3EG7K+w= +github.com/aperturerobotics/protobuf-go-lite v0.4.7/go.mod h1:wRZn4YydbTn8Bdx4NB6ms0doF19llgim+0SNBvQ7M9c= github.com/aperturerobotics/quic-go v0.41.1-0.20240125035303-1093432c45e9 h1:QLhCPPV6tnQpbHqJLvU/aOdp9RNajGLDTAwFsKi7Kow= github.com/aperturerobotics/quic-go v0.41.1-0.20240125035303-1093432c45e9/go.mod h1:tY2LVzdNWloFW0Gbg9bK8L49s4UhyUe9uCZIOF6KtuI= -github.com/aperturerobotics/starpc v0.28.0 h1:axzzg+NVmnuIUQ45+XP2PY+JRiJdrYBn7MPos6gOldw= -github.com/aperturerobotics/starpc v0.28.0/go.mod h1:Ie+AE8AikN3Xs/c5jB0F6wTjxfdlAFTd6U64exVWsTA= -github.com/aperturerobotics/starpc v0.28.1 h1:LxWUrRZhvZRZeeyWEWu3RNFoCyx9M6/TpNPfLKpul5c= -github.com/aperturerobotics/starpc v0.28.1/go.mod h1:nFkiJ9LcjeZDY0rhm4ogIGVGV8KEWL85xBypG3blBeM= -github.com/aperturerobotics/timestamp v0.8.2 h1:+HA/uI9ZGz8qqim+kkXqz3cijR8kMcQ4/ZRTw5fW7yI= -github.com/aperturerobotics/timestamp v0.8.2/go.mod h1:nrwzlUGvxs244CIBjDWHZ8qRudqk8m/SQ5n5GKXaFVw= -github.com/aperturerobotics/ts-proto-common-types v0.20.2 h1:xFy3ErasS5PNWV0ABdlJxqfUsZGL2OLlc0Kio5aIm2s= -github.com/aperturerobotics/ts-proto-common-types v0.20.2/go.mod h1:TgjsdPI5YvNF1iewbvCPmEnVkV8WVP1AyZxiOc9SEbo= -github.com/aperturerobotics/util v1.16.5 h1:zW6l07O1cCZMG+cbE08D5gv6p/tYfGipGRO5WaXpd1c= -github.com/aperturerobotics/util v1.16.5/go.mod h1:UzxQN3nK8D+T7ruiBqvNiZOuEerkgsM1fN8eAvjsIMo= +github.com/aperturerobotics/starpc v0.31.2 h1:9zRZbRpZ7TK3O/5ENz0rwShfLS5jkw0SkqIU2pbuvZk= +github.com/aperturerobotics/starpc v0.31.2/go.mod h1:Q5dAx56ZUhOlytE37LoMA2JhRAPFe68BcMDzHw7kwxs= +github.com/aperturerobotics/util v1.18.2-0.20240422064924-0aa0a8ef68ac h1:Gkum665f+ip3MAo4JFL78rBgWWmptZXIGIudISKwvlc= +github.com/aperturerobotics/util v1.18.2-0.20240422064924-0aa0a8ef68ac/go.mod h1:Ro0NkbbyHDyZgSl7OW9qE/iqtQCQ97gS9LYYlqmZsdk= github.com/blang/semver v3.5.1+incompatible h1:cQNTCjp13qL8KC3Nbxr/y2Bqb63oX6wdnnjpJbkM4JQ= github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4= @@ -58,14 +52,20 @@ github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/E github.com/gobwas/ws v1.2.1 h1:F2aeBZrm2NDsc7vbovKrWSogd4wvfAxg0FQ89/iqOTk= github.com/gobwas/ws v1.2.1/go.mod h1:hRKAFb8wOxFROYNsT1bqfWnhX+b5MFeJM9r2ZSwg/KY= github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/pprof v0.0.0-20240207164012-fb44976bdcd5 h1:E/LAvt58di64hlYjx7AsNS6C/ysHWYo+2qPCZKTQhRo= github.com/google/pprof v0.0.0-20240207164012-fb44976bdcd5/go.mod h1:czg5+yv1E0ZGTi6S6vVK1mke0fV+FaUhNGcd6VRS9Ik= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= @@ -77,9 +77,9 @@ github.com/ipfs/go-cid v0.4.1 h1:A/T3qGvxi4kpKWWcPC/PgbvDA2bjVLO7n4UeVwnbs/s= github.com/ipfs/go-cid v0.4.1/go.mod h1:uQHwDeX4c6CtyrFwdqyhpNcxVewur1M7l7fNU7LKwZk= github.com/jbenet/go-temp-err-catcher v0.1.0 h1:zpb3ZH6wIE8Shj2sKS+khgRvf7T7RABoLk/+KKHggpk= github.com/jbenet/go-temp-err-catcher v0.1.0/go.mod h1:0kJRvmDZXNMIiJirNPEYfhpPwbGVtZVWC34vc5WLsDk= +github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= -github.com/klauspost/compress v1.17.7 h1:ehO88t2UGzQK66LMdE8tibEd1ErmzZjNEqWkjLAKQQg= -github.com/klauspost/compress v1.17.7/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= github.com/klauspost/compress v1.17.8 h1:YcnTYrq7MikUT7k0Yb5eceMmALQPYBW/Xltxn0NAMnU= github.com/klauspost/compress v1.17.8/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= github.com/klauspost/cpuid/v2 v2.0.12/go.mod h1:g2LTdtYhdyuGPqyWyv7qRAmj1WBqxuObKfj5c0PQa7c= @@ -107,6 +107,10 @@ github.com/minio/highwayhash v1.0.2 h1:Aak5U0nElisjDCfPSG79Tgzkn2gl66NxOMspRrKnA github.com/minio/highwayhash v1.0.2/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= github.com/minio/sha256-simd v1.0.1 h1:6kaan5IFmwTNynnKKpDHe6FWHohJOHhCPchzK49dzMM= github.com/minio/sha256-simd v1.0.1/go.mod h1:Pz6AKMiUdngCLpeTL/RJY1M9rUuPMYujV5xJjtbRSN8= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o= github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= github.com/multiformats/go-base32 v0.1.0 h1:pVx9xoSPqEIQG8o+UbAe7DNi51oej1NtK+aGkbLYxPE= @@ -136,8 +140,6 @@ github.com/onsi/ginkgo/v2 v2.15.0 h1:79HwNRBAZHOEwrczrgSOPy+eFTTlIGELKy5as+ClttY github.com/onsi/ginkgo/v2 v2.15.0/go.mod h1:HlxMHtYF57y6Dpf+mc5529KKmSq9h2FpCF+/ZkwUxKM= github.com/onsi/gomega v1.30.0 h1:hvMK7xYz4D3HapigLTeGdId/NcfQx1VHMJc60ew99+8= github.com/onsi/gomega v1.30.0/go.mod h1:9sxs+SwGrKI0+PWe4Fxa9tFQQBG5xSsSbMXOI8PPpoQ= -github.com/paralin/drpc v0.0.31-0.20220527065730-0e2a1370bccb h1:TovWNMdDXg+PcU/4EX9VFdnaC8IG3rLXJdmuk6A4EEo= -github.com/paralin/drpc v0.0.31-0.20220527065730-0e2a1370bccb/go.mod h1:opUwvtQEv6hbheTyWeDgvb8CrqPHp8ggJetOOiAQODI= github.com/paralin/go-multiaddr v0.12.4-0.20240407071906-6f0354cc6755 h1:xxzUX1AaOQWbYq/LCoJIWfju2xByAw/nWrWXMTI5O8Y= github.com/paralin/go-multiaddr v0.12.4-0.20240407071906-6f0354cc6755/go.mod h1:sBXrNzucqkFJhvKOiwwLyqamGa/P5EIXNPLovyhQCII= github.com/paralin/ipfs-go-logrus v0.0.0-20240410105224-e24cb05f9e98 h1:8VijFMz4qJ70+ObyaByu6XZctKPhjllz/XfEoVZDQGo= @@ -191,8 +193,6 @@ github.com/pion/webrtc/v4 v4.0.0-beta.16 h1:FYzly1p5k0Jzi9ZDWlEaPeqXq8qqc9T5afTo github.com/pion/webrtc/v4 v4.0.0-beta.16/go.mod h1:75pRrJRrcwTuIkO/2zkzh4/pEzy3xkZVrS6+0C/0CCA= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/planetscale/vtprotobuf v0.6.0 h1:nBeETjudeJ5ZgBHUz1fVHvbqUKnYOXNhsIEabROxmNA= -github.com/planetscale/vtprotobuf v0.6.0/go.mod h1:t/avpk3KcrXxUnYOhZhMXJlSEyie6gQbtLq5NM3loB8= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= @@ -205,6 +205,7 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= @@ -220,13 +221,10 @@ github.com/valyala/fastjson v1.6.4/go.mod h1:CLCAqky6SMuOcxStkYQvblddUtoRxhYMGLr github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +github.com/zeebo/assert v1.1.0 h1:hU1L1vLTHsnO8x8c9KAR5GmM5QscxHg5RNU5z5qbUWY= github.com/zeebo/assert v1.1.0/go.mod h1:Pq9JiuJQpG8JLJdtkwrJESF0Foym2/D9XMU5ciN/wJ0= -github.com/zeebo/assert v1.3.0 h1:g7C04CbJuIDKNPFHmsk4hwZDO5O+kntRxzaUoNXj+IQ= -github.com/zeebo/assert v1.3.0/go.mod h1:Pq9JiuJQpG8JLJdtkwrJESF0Foym2/D9XMU5ciN/wJ0= github.com/zeebo/blake3 v0.2.3 h1:TFoLXsjeXqRNFxSbk35Dk4YtszE/MQQGK10BH4ptoTg= github.com/zeebo/blake3 v0.2.3/go.mod h1:mjJjZpnsyIVtVgTOSpJ9vmRE4wgDeyt2HU3qXvvKCaQ= -github.com/zeebo/errs v1.2.2 h1:5NFypMTuSdoySVTqlNs1dEoU21QVamMQJxW/Fii5O7g= -github.com/zeebo/errs v1.2.2/go.mod h1:sgbWHsvVuTPHcqJJGQ1WhI5KbWlHYz+2+2C/LSEtCw4= github.com/zeebo/pcg v1.0.1 h1:lyqfGeWiv4ahac6ttHs+I5hwtH/+1mrhlCtVNQM2kHo= github.com/zeebo/pcg v1.0.1/go.mod h1:09F0S9iiKrwn9rlI5yjLkmrug154/YRW6KnnXVDM/l4= go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU= @@ -243,8 +241,8 @@ golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDf golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30= golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M= -golang.org/x/exp v0.0.0-20240409090435-93d18d7e34b8 h1:ESSUROHIBHg7USnszlcdmjBEwdMj9VUvU+OPk4yl2mc= -golang.org/x/exp v0.0.0-20240409090435-93d18d7e34b8/go.mod h1:/lliqkxwWAhPjf5oSOIJup2XcqJaw8RGS6k3TGEc7GI= +golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f h1:99ci1mjWVBWwJiEKYY6jWa4d2nTQVIEhZIptnrVb1XY= +golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f/go.mod h1:/lliqkxwWAhPjf5oSOIJup2XcqJaw8RGS6k3TGEc7GI= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= @@ -319,6 +317,14 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gonum.org/v1/gonum v0.15.0 h1:2lYxjRbTYyxkJxlhC+LvJIx3SsANPdRybu1tGj9/OrQ= gonum.org/v1/gonum v0.15.0/go.mod h1:xzZVBJBtS+Mz4q0Yl2LJTk+OxOg4jiXZ7qBoM0uISGo= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= diff --git a/hack/go.mod b/hack/go.mod index af36fbdf..031202da 100644 --- a/hack/go.mod +++ b/hack/go.mod @@ -4,14 +4,11 @@ go 1.22 replace github.com/aperturerobotics/bifrost => ../ -replace ( - github.com/sirupsen/logrus => github.com/aperturerobotics/logrus v1.9.4-0.20240119050608-13332fb58195 // aperture - google.golang.org/protobuf => github.com/aperturerobotics/protobuf-go v1.33.1-0.20240322235918-b46c9358eab6 // aperture -) +replace github.com/sirupsen/logrus => github.com/aperturerobotics/logrus v1.9.4-0.20240119050608-13332fb58195 // aperture require ( github.com/aperturerobotics/goprotowrap v0.3.1 // master - github.com/aperturerobotics/starpc v0.27.3 + github.com/aperturerobotics/starpc v0.31.2 // latest ) require ( @@ -21,12 +18,11 @@ require ( github.com/planetscale/vtprotobuf v0.6.0 github.com/psampaz/go-mod-outdated v0.9.0 google.golang.org/protobuf v1.33.0 - storj.io/drpc v0.0.34 ) require ( - github.com/aperturerobotics/controllerbus v0.37.0 - golang.org/x/tools v0.19.0 + github.com/aperturerobotics/controllerbus v0.41.2 + golang.org/x/tools v0.20.0 mvdan.cc/gofumpt v0.6.0 ) @@ -77,7 +73,8 @@ require ( github.com/alexkohler/nakedret/v2 v2.0.2 // indirect github.com/alexkohler/prealloc v1.0.0 // indirect github.com/alingse/asasalint v0.0.11 // indirect - github.com/aperturerobotics/util v1.16.0 // indirect + github.com/aperturerobotics/protobuf-go-lite v0.4.5 // indirect + github.com/aperturerobotics/util v1.18.2-0.20240422064924-0aa0a8ef68ac // indirect github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect github.com/ashanbrown/forbidigo v1.5.3 // indirect github.com/ashanbrown/makezero v1.1.1 // indirect @@ -243,6 +240,7 @@ require ( github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/josharian/intern v1.0.0 // indirect + github.com/json-iterator/go v1.1.12 // indirect github.com/julz/importas v0.1.0 // indirect github.com/kevinburke/ssh_config v1.2.0 // indirect github.com/kisielk/errcheck v1.6.3 // indirect @@ -275,6 +273,8 @@ require ( github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mitchellh/reflectwalk v1.0.2 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.2 // indirect github.com/moricho/tparallel v0.3.1 // indirect github.com/muesli/mango v0.1.0 // indirect github.com/muesli/mango-cobra v1.2.0 // indirect @@ -376,15 +376,15 @@ require ( go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect gocloud.dev v0.36.0 // indirect - golang.org/x/crypto v0.21.0 // indirect - golang.org/x/exp v0.0.0-20240325151524-a685a6edb6d8 // indirect + golang.org/x/crypto v0.22.0 // indirect + golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f // indirect golang.org/x/exp/typeparams v0.0.0-20230224173230-c95f2b4c22f2 // indirect - golang.org/x/mod v0.16.0 // indirect - golang.org/x/net v0.23.0 // indirect + golang.org/x/mod v0.17.0 // indirect + golang.org/x/net v0.24.0 // indirect golang.org/x/oauth2 v0.16.0 // indirect - golang.org/x/sync v0.6.0 // indirect - golang.org/x/sys v0.18.0 // indirect - golang.org/x/term v0.18.0 // indirect + golang.org/x/sync v0.7.0 // indirect + golang.org/x/sys v0.19.0 // indirect + golang.org/x/term v0.19.0 // indirect golang.org/x/text v0.14.0 // indirect golang.org/x/time v0.5.0 // indirect golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect @@ -401,6 +401,7 @@ require ( gopkg.in/warnings.v0 v0.1.2 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect + gotest.tools/v3 v3.5.2-0.20231012011814-1fa4ef36538c // indirect honnef.co/go/tools v0.4.3 // indirect mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed // indirect mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b // indirect diff --git a/hack/go.sum b/hack/go.sum index 615126bf..2501abd4 100644 --- a/hack/go.sum +++ b/hack/go.sum @@ -159,18 +159,18 @@ github.com/alingse/asasalint v0.0.11 h1:SFwnQXJ49Kx/1GghOFz1XGqHYKp21Kq1nHad/0WQ github.com/alingse/asasalint v0.0.11/go.mod h1:nCaoMhw7a9kSJObvQyVzNTPBDbNpdocqrSP7t/cW5+I= github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFIImctFaOjnTIavg87rW78vTPkQqLI8= github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be/go.mod h1:ySMOLuWl6zY27l47sB3qLNK6tF2fkHG55UZxx8oIVo4= -github.com/aperturerobotics/controllerbus v0.37.0 h1:0Jut71UFBNeQywGy6S+esdtsGSMn6SvSpj3qlu1bwP4= -github.com/aperturerobotics/controllerbus v0.37.0/go.mod h1:NJITG4lLK3lDI+GdhxjG9dyA9kxOLJzjajkNRs5hctc= +github.com/aperturerobotics/controllerbus v0.41.2 h1:xclf9u+r1llfwQZ2TJ0ysA89CuLBJwbEFzlYe7OvAgk= +github.com/aperturerobotics/controllerbus v0.41.2/go.mod h1:egxlosO3WYXDGTvpv/xDVTtTPD19SQ/NXxt2Fw5NyBA= github.com/aperturerobotics/goprotowrap v0.3.1 h1:nFCWZ4QNQEzpsgCN1mVWLDVTF/Jm0hWtlCMUMGm3p1Y= github.com/aperturerobotics/goprotowrap v0.3.1/go.mod h1:5tRlYsb4VF0ySzx2/My3u9PtzTWNu5o2bqYHj0TRw+U= github.com/aperturerobotics/logrus v1.9.4-0.20240119050608-13332fb58195 h1:uyeD1J23j/kFiCFO7rx+GQA4tCqOEy3IJyMK4f6vamE= github.com/aperturerobotics/logrus v1.9.4-0.20240119050608-13332fb58195/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= -github.com/aperturerobotics/protobuf-go v1.33.1-0.20240322235918-b46c9358eab6 h1:ScQPbkbABsFb7e86ArWSRtoOemQGrX4BDKeHj+JAgbQ= -github.com/aperturerobotics/protobuf-go v1.33.1-0.20240322235918-b46c9358eab6/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= -github.com/aperturerobotics/starpc v0.27.3 h1:spXXh7FsNd32dIOnBElRWQeYSAJLIulVz3xI6O+ezGg= -github.com/aperturerobotics/starpc v0.27.3/go.mod h1:pAETN2gY3W2i+A7CGZgFMvc594H3HN65VMylF8Fp8eY= -github.com/aperturerobotics/util v1.16.0 h1:w0XOUw8pT+Dg/Q9eTXO9ZFALLIalV0AK7Ba8Nf8i1XU= -github.com/aperturerobotics/util v1.16.0/go.mod h1:aMfWWor4v05bs0dTekucKSjVkmnTxKE6UPs3rCe84YM= +github.com/aperturerobotics/protobuf-go-lite v0.4.5 h1:t7MyE0xB0spkQlN5Ei/wI8XmiOXVEFwkSm09DMPbpDg= +github.com/aperturerobotics/protobuf-go-lite v0.4.5/go.mod h1:wRZn4YydbTn8Bdx4NB6ms0doF19llgim+0SNBvQ7M9c= +github.com/aperturerobotics/starpc v0.31.2 h1:9zRZbRpZ7TK3O/5ENz0rwShfLS5jkw0SkqIU2pbuvZk= +github.com/aperturerobotics/starpc v0.31.2/go.mod h1:Q5dAx56ZUhOlytE37LoMA2JhRAPFe68BcMDzHw7kwxs= +github.com/aperturerobotics/util v1.18.2-0.20240422064924-0aa0a8ef68ac h1:Gkum665f+ip3MAo4JFL78rBgWWmptZXIGIudISKwvlc= +github.com/aperturerobotics/util v1.18.2-0.20240422064924-0aa0a8ef68ac/go.mod h1:Ro0NkbbyHDyZgSl7OW9qE/iqtQCQ97gS9LYYlqmZsdk= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= @@ -541,6 +541,10 @@ github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5y github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= @@ -732,6 +736,7 @@ github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= @@ -837,9 +842,11 @@ github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0= github.com/moby/term v0.5.0/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= github.com/moricho/tparallel v0.3.1 h1:fQKD4U1wRMAYNngDonW5XupoB/ZGJHdpzrWqgyg9krA= @@ -1179,8 +1186,8 @@ golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2Uz golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= -golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= -golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= +golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30= +golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -1191,8 +1198,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/exp v0.0.0-20240325151524-a685a6edb6d8 h1:aAcj0Da7eBAtrTp03QXWvm88pSyOt+UgdZw2BFZ+lEw= -golang.org/x/exp v0.0.0-20240325151524-a685a6edb6d8/go.mod h1:CQ1k9gNrJ50XIzaKCRR2hssIjF07kZFEiieALBM/ARQ= +golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f h1:99ci1mjWVBWwJiEKYY6jWa4d2nTQVIEhZIptnrVb1XY= +golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f/go.mod h1:/lliqkxwWAhPjf5oSOIJup2XcqJaw8RGS6k3TGEc7GI= golang.org/x/exp/typeparams v0.0.0-20220428152302-39d4317da171/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/exp/typeparams v0.0.0-20230203172020-98cc5a0785f9/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/exp/typeparams v0.0.0-20230224173230-c95f2b4c22f2 h1:J74nGeMgeFnYQJN59eFwh06jX/V8g0lB7LWpjSLxtgU= @@ -1227,8 +1234,8 @@ golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91 golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI= golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.16.0 h1:QX4fJ0Rr5cPQCF7O9lh9Se4pmwfwskqZfq5moyldzic= -golang.org/x/mod v0.16.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= +golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1275,8 +1282,8 @@ golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= -golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= +golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= +golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1303,8 +1310,8 @@ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= -golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= +golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1371,8 +1378,8 @@ golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= -golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= +golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -1382,8 +1389,8 @@ golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= -golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8= -golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58= +golang.org/x/term v0.19.0 h1:+ThwsDv+tYfnJFhF4L8jITxu1tdTWRTZpdsWgEgjL6Q= +golang.org/x/term v0.19.0/go.mod h1:2CuTdWZ7KHSQwUzKva0cbMg6q2DMI3Mmxp+gKJbskEk= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1481,8 +1488,8 @@ golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k= golang.org/x/tools v0.5.0/go.mod h1:N+Kgy78s5I24c24dU8OfWNEotWjutIs8SnJvn5IDq+k= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.19.0 h1:tfGCXNR1OsFG+sVdLAitlpjAvD/I6dHDKnYrpEZUHkw= -golang.org/x/tools v0.19.0/go.mod h1:qoJWxmGSIBmAeriMx19ogtrEPrGtDbPK634QFIcLAhc= +golang.org/x/tools v0.20.0 h1:hz/CVckiOxybQvFw6h7b/q80NTr9IUQb4s1IIzW7KNY= +golang.org/x/tools v0.20.0/go.mod h1:WvitBU7JJf6A4jOdg4S1tviW9bhUxkgeCui/0JHctQg= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -1579,6 +1586,20 @@ google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA5 google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk= google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc h1:2gGKlE2+asNV9m7xrywl36YYNnBG5ZQ0r/BOOxqPpmk= gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc/go.mod h1:m7x9LTH6d71AHyAX77c9yqWCCa3UKHcVEj9y7hAtKDk= @@ -1612,8 +1633,8 @@ gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gotest.tools/v3 v3.0.3 h1:4AuOwCGf4lLR9u3YOe2awrHygurzhO/HeQ6laiA6Sx0= -gotest.tools/v3 v3.0.3/go.mod h1:Z7Lb0S5l+klDB31fvDQX8ss/FlKDxtlFlw3Oa8Ymbl8= +gotest.tools/v3 v3.5.2-0.20231012011814-1fa4ef36538c h1:GDUkfV+JwbrM66NUDnRFYrPhZwDPi+HQ4uSkFWbsAUw= +gotest.tools/v3 v3.5.2-0.20231012011814-1fa4ef36538c/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= @@ -1639,5 +1660,3 @@ sigs.k8s.io/kind v0.20.0/go.mod h1:aBlbxg08cauDgZ612shr017/rZwqd7AS563FvpWKPVs= sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8= sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY= -storj.io/drpc v0.0.34 h1:q9zlQKfJ5A7x8NQNFk8x7eKUF78FMhmAbZLnFK+og7I= -storj.io/drpc v0.0.34/go.mod h1:Y9LZaa8esL1PW2IDMqJE7CFSNq7d5bQ3RI7mGPtmKMg= diff --git a/hack/tools.go b/hack/tools.go index 57fa9151..de5be6f5 100644 --- a/hack/tools.go +++ b/hack/tools.go @@ -15,8 +15,6 @@ import ( _ "github.com/hajimehoshi/wasmserve" // _ imports protowrap _ "github.com/aperturerobotics/goprotowrap/cmd/protowrap" - // _ imports drpc - _ "storj.io/drpc/cmd/protoc-gen-go-drpc" // _ imports protoc-gen-go _ "google.golang.org/protobuf/cmd/protoc-gen-go" // _ imports protoc-gen-go-vtproto diff --git a/hash/hash.go b/hash/hash.go index 5b801f88..2d03dbab 100644 --- a/hash/hash.go +++ b/hash/hash.go @@ -3,19 +3,15 @@ package hash import ( "bytes" "crypto/sha256" - "encoding/json" "hash" - "strconv" // We include sha1 for git support. "crypto/sha1" //nolint:gosec b58 "github.com/mr-tron/base58/base58" "github.com/pkg/errors" - "github.com/valyala/fastjson" "github.com/zeebo/blake3" "golang.org/x/exp/slices" - "google.golang.org/protobuf/proto" ) // ErrHashMismatch is returned when hashes mismatch. @@ -35,52 +31,13 @@ var SupportedHashTypes = []HashType{ // Note: not guaranteed to stay the same between Bifrost versions. const RecommendedHashType = HashType_HashType_BLAKE3 -// UnmarshalHashTypeFastJSON unmarshals a HashType from FastJSON value. -func UnmarshalHashTypeFastJSON(val *fastjson.Value) (HashType, error) { - if val == nil { - return 0, nil - } - switch val.Type() { - case fastjson.TypeString: - valStr := string(val.GetStringBytes()) - if len(valStr) == 0 { - return 0, nil - } - val, ok := HashType_value[valStr] - if !ok { - return 0, errors.Wrap(ErrHashTypeUnknown, valStr) - } - return HashType(val), nil - case fastjson.TypeNumber: - ht := HashType(val.GetInt()) - if err := ht.Validate(); err != nil { - return 0, err - } - return ht, nil - default: - return 0, errors.Errorf("unexpected json type for hash type: %v", val.Type().String()) - } -} - -// UnmarshalHashJSON unmarshals a Hash from JSON. +// UnmarshalHashJSON unmarshals a hash from json. func UnmarshalHashJSON(data []byte) (*Hash, error) { - val, err := fastjson.Parse(string(data)) - if err != nil { - return nil, err - } - return UnmarshalHashFastJSON(val) -} - -// UnmarshalHashFastJSON unmarshals a Hash from FastJSON value. -func UnmarshalHashFastJSON(val *fastjson.Value) (*Hash, error) { - out := &Hash{} - if val == nil { - return out, nil - } - if err := out.UnmarshalFastJSON(val); err != nil { + h := &Hash{} + if err := h.UnmarshalJSON(data); err != nil { return nil, err } - return out, nil + return h, nil } // IsNil checks if the object is nil. @@ -232,7 +189,7 @@ func (h *Hash) MarshalString() string { if h == nil { return "" } - dat, err := proto.Marshal(h) + dat, err := h.MarshalVT() if err != nil { return "" } @@ -244,29 +201,10 @@ func (h *Hash) MarshalDigest() []byte { if h == nil { return nil } - dat, _ := proto.Marshal(h) + dat, _ := h.MarshalVT() return dat } -// MarshalJSON marshals the hash to a JSON string. -// Returns "" if the hash is nil. -func (h *Hash) MarshalJSON() ([]byte, error) { - return []byte(strconv.Quote(h.MarshalString())), nil -} - -// UnmarshalJSON unmarshals the reference from a JSON string or object. -// Also accepts an object (in jsonpb format). -func (h *Hash) UnmarshalJSON(data []byte) error { - if len(data) == 0 || h == nil { - return nil - } - val, err := fastjson.ParseBytes(data) - if err != nil { - return err - } - return h.UnmarshalFastJSON(val) -} - // ParseFromB58 parses the object ref from a base58 string. func (h *Hash) ParseFromB58(ref string) error { dat, err := b58.Decode(ref) @@ -275,47 +213,3 @@ func (h *Hash) ParseFromB58(ref string) error { } return h.UnmarshalVT(dat) } - -// UnmarshalFastJSON unmarshals the fast json container. -// If the val or object ref are nil, does nothing. -func (h *Hash) UnmarshalFastJSON(val *fastjson.Value) error { - if val == nil || h == nil { - return nil - } - switch val.Type() { - case fastjson.TypeString: - return h.ParseFromB58(string(val.GetStringBytes())) - case fastjson.TypeObject: - - default: - return errors.Errorf("unexpected json type for hash: %v", val.Type().String()) - } - - if hashTypeVal := val.Get("hashType"); hashTypeVal != nil { - var err error - h.HashType, err = UnmarshalHashTypeFastJSON(hashTypeVal) - if err != nil { - return err - } - } - - if hashVal := val.Get("hash"); hashVal != nil { - // expect b58 string - hashStr, err := hashVal.StringBytes() - if err != nil { - return errors.Wrap(err, "hash") - } - hashData, err := b58.Decode(string(hashStr)) - if err != nil { - return errors.Wrap(err, "hash") - } - h.Hash = hashData - } - - return nil -} - -var ( - _ json.Marshaler = ((*Hash)(nil)) - _ json.Unmarshaler = ((*Hash)(nil)) -) diff --git a/hash/hash.pb.go b/hash/hash.pb.go index e25c152c..5d7019d6 100644 --- a/hash/hash.pb.go +++ b/hash/hash.pb.go @@ -1,24 +1,16 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0-devel -// protoc v5.26.1 +// Code generated by protoc-gen-go-lite. DO NOT EDIT. +// protoc-gen-go-lite version: v0.4.5 // source: github.com/aperturerobotics/bifrost/hash/hash.proto package hash import ( - reflect "reflect" - sync "sync" + io "io" + strconv "strconv" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) + protobuf_go_lite "github.com/aperturerobotics/protobuf-go-lite" + json "github.com/aperturerobotics/protobuf-go-lite/json" + errors "github.com/pkg/errors" ) // HashType identifies the hash type in use. @@ -60,167 +52,340 @@ func (x HashType) Enum() *HashType { } func (x HashType) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) + name, valid := HashType_name[int32(x)] + if valid { + return name + } + return strconv.Itoa(int(x)) } -func (HashType) Descriptor() protoreflect.EnumDescriptor { - return file_github_com_aperturerobotics_bifrost_hash_hash_proto_enumTypes[0].Descriptor() +// Hash is a hash of a binary blob. +type Hash struct { + unknownFields []byte + // HashType is the hash type in use. + HashType HashType `protobuf:"varint,1,opt,name=hash_type,json=hashType,proto3" json:"hashType,omitempty"` + // Hash is the hash value. + Hash []byte `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash,omitempty"` } -func (HashType) Type() protoreflect.EnumType { - return &file_github_com_aperturerobotics_bifrost_hash_hash_proto_enumTypes[0] +func (x *Hash) Reset() { + *x = Hash{} } -func (x HashType) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) +func (*Hash) ProtoMessage() {} + +func (x *Hash) GetHashType() HashType { + if x != nil { + return x.HashType + } + return HashType_HashType_UNKNOWN } -// Deprecated: Use HashType.Descriptor instead. -func (HashType) EnumDescriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_hash_hash_proto_rawDescGZIP(), []int{0} +func (x *Hash) GetHash() []byte { + if x != nil { + return x.Hash + } + return nil } -// Hash is a hash of a binary blob. -type Hash struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields +func (m *Hash) CloneVT() *Hash { + if m == nil { + return (*Hash)(nil) + } + r := new(Hash) + r.HashType = m.HashType + if rhs := m.Hash; rhs != nil { + tmpBytes := make([]byte, len(rhs)) + copy(tmpBytes, rhs) + r.Hash = tmpBytes + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} - // HashType is the hash type in use. - HashType HashType `protobuf:"varint,1,opt,name=hash_type,json=hashType,proto3,enum=hash.HashType" json:"hash_type,omitempty"` - // Hash is the hash value. - Hash []byte `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash,omitempty"` +func (m *Hash) CloneMessageVT() any { + return m.CloneVT() } -func (x *Hash) Reset() { - *x = Hash{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_hash_hash_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) +func (this *Hash) EqualVT(that *Hash) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.HashType != that.HashType { + return false + } + if string(this.Hash) != string(that.Hash) { + return false } + return string(this.unknownFields) == string(that.unknownFields) } -func (x *Hash) String() string { - return protoimpl.X.MessageStringOf(x) +func (this *Hash) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*Hash) + if !ok { + return false + } + return this.EqualVT(that) } -func (*Hash) ProtoMessage() {} +// MarshalProtoJSON marshals the HashType to JSON. +func (x HashType) MarshalProtoJSON(s *json.MarshalState) { + s.WriteEnumString(int32(x), HashType_name) +} -func (x *Hash) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_hash_hash_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) +// MarshalText marshals the HashType to text. +func (x HashType) MarshalText() ([]byte, error) { + return []byte(json.GetEnumString(int32(x), HashType_name)), nil } -// Deprecated: Use Hash.ProtoReflect.Descriptor instead. -func (*Hash) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_hash_hash_proto_rawDescGZIP(), []int{0} +// MarshalJSON marshals the HashType to JSON. +func (x HashType) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) } -func (x *Hash) GetHashType() HashType { - if x != nil { - return x.HashType +// UnmarshalProtoJSON unmarshals the HashType from JSON. +func (x *HashType) UnmarshalProtoJSON(s *json.UnmarshalState) { + v := s.ReadEnum(HashType_value) + if err := s.Err(); err != nil { + s.SetErrorf("could not read HashType enum: %v", err) + return } - return HashType_HashType_UNKNOWN + *x = HashType(v) } -func (x *Hash) GetHash() []byte { - if x != nil { - return x.Hash +// UnmarshalText unmarshals the HashType from text. +func (x *HashType) UnmarshalText(b []byte) error { + i, err := json.ParseEnumString(string(b), HashType_value) + if err != nil { + return err } + *x = HashType(i) return nil } -var File_github_com_aperturerobotics_bifrost_hash_hash_proto protoreflect.FileDescriptor +// UnmarshalJSON unmarshals the HashType from JSON. +func (x *HashType) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} -var file_github_com_aperturerobotics_bifrost_hash_hash_proto_rawDesc = []byte{ - 0x0a, 0x33, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, - 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x62, 0x69, - 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2f, 0x68, 0x61, 0x73, 0x68, 0x2f, 0x68, 0x61, 0x73, 0x68, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x04, 0x68, 0x61, 0x73, 0x68, 0x22, 0x47, 0x0a, 0x04, 0x48, - 0x61, 0x73, 0x68, 0x12, 0x2b, 0x0a, 0x09, 0x68, 0x61, 0x73, 0x68, 0x5f, 0x74, 0x79, 0x70, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0e, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x2e, 0x48, 0x61, - 0x73, 0x68, 0x54, 0x79, 0x70, 0x65, 0x52, 0x08, 0x68, 0x61, 0x73, 0x68, 0x54, 0x79, 0x70, 0x65, - 0x12, 0x12, 0x0a, 0x04, 0x68, 0x61, 0x73, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, - 0x68, 0x61, 0x73, 0x68, 0x2a, 0x5d, 0x0a, 0x08, 0x48, 0x61, 0x73, 0x68, 0x54, 0x79, 0x70, 0x65, - 0x12, 0x14, 0x0a, 0x10, 0x48, 0x61, 0x73, 0x68, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x55, 0x4e, 0x4b, - 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x13, 0x0a, 0x0f, 0x48, 0x61, 0x73, 0x68, 0x54, 0x79, - 0x70, 0x65, 0x5f, 0x53, 0x48, 0x41, 0x32, 0x35, 0x36, 0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, 0x48, - 0x61, 0x73, 0x68, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x53, 0x48, 0x41, 0x31, 0x10, 0x02, 0x12, 0x13, - 0x0a, 0x0f, 0x48, 0x61, 0x73, 0x68, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x42, 0x4c, 0x41, 0x4b, 0x45, - 0x33, 0x10, 0x03, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +// MarshalProtoJSON marshals the Hash message to JSON. +func (x *Hash) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return + } + s.WriteObjectStart() + var wroteField bool + if x.HashType != 0 || s.HasField("hashType") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("hashType") + x.HashType.MarshalProtoJSON(s) + } + if len(x.Hash) > 0 || s.HasField("hash") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("hash") + s.WriteBytes(x.Hash) + } + s.WriteObjectEnd() } -var ( - file_github_com_aperturerobotics_bifrost_hash_hash_proto_rawDescOnce sync.Once - file_github_com_aperturerobotics_bifrost_hash_hash_proto_rawDescData = file_github_com_aperturerobotics_bifrost_hash_hash_proto_rawDesc -) +// MarshalJSON marshals the Hash to JSON. +func (x *Hash) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) +} -func file_github_com_aperturerobotics_bifrost_hash_hash_proto_rawDescGZIP() []byte { - file_github_com_aperturerobotics_bifrost_hash_hash_proto_rawDescOnce.Do(func() { - file_github_com_aperturerobotics_bifrost_hash_hash_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_aperturerobotics_bifrost_hash_hash_proto_rawDescData) +// UnmarshalProtoJSON unmarshals the Hash message from JSON. +func (x *Hash) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { + return + } + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "hash_type", "hashType": + s.AddField("hash_type") + x.HashType.UnmarshalProtoJSON(s) + case "hash": + s.AddField("hash") + x.Hash = s.ReadBytes() + } }) - return file_github_com_aperturerobotics_bifrost_hash_hash_proto_rawDescData } -var file_github_com_aperturerobotics_bifrost_hash_hash_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_github_com_aperturerobotics_bifrost_hash_hash_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_github_com_aperturerobotics_bifrost_hash_hash_proto_goTypes = []interface{}{ - (HashType)(0), // 0: hash.HashType - (*Hash)(nil), // 1: hash.Hash +// UnmarshalJSON unmarshals the Hash from JSON. +func (x *Hash) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) } -var file_github_com_aperturerobotics_bifrost_hash_hash_proto_depIdxs = []int32{ - 0, // 0: hash.Hash.hash_type:type_name -> hash.HashType - 1, // [1:1] is the sub-list for method output_type - 1, // [1:1] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name + +func (m *Hash) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil } -func init() { file_github_com_aperturerobotics_bifrost_hash_hash_proto_init() } -func file_github_com_aperturerobotics_bifrost_hash_hash_proto_init() { - if File_github_com_aperturerobotics_bifrost_hash_hash_proto != nil { - return +func (m *Hash) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *Hash) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.Hash) > 0 { + i -= len(m.Hash) + copy(dAtA[i:], m.Hash) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.Hash))) + i-- + dAtA[i] = 0x12 + } + if m.HashType != 0 { + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(m.HashType)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *Hash) SizeVT() (n int) { + if m == nil { + return 0 } - if !protoimpl.UnsafeEnabled { - file_github_com_aperturerobotics_bifrost_hash_hash_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Hash); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil + var l int + _ = l + if m.HashType != 0 { + n += 1 + protobuf_go_lite.SizeOfVarint(uint64(m.HashType)) + } + l = len(m.Hash) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *Hash) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break } } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: Hash: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: Hash: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return errors.Errorf("proto: wrong wireType = %d for field HashType", wireType) + } + m.HashType = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.HashType |= HashType(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field Hash", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Hash = append(m.Hash[:0], dAtA[iNdEx:postIndex]...) + if m.Hash == nil { + m.Hash = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_github_com_aperturerobotics_bifrost_hash_hash_proto_rawDesc, - NumEnums: 1, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_github_com_aperturerobotics_bifrost_hash_hash_proto_goTypes, - DependencyIndexes: file_github_com_aperturerobotics_bifrost_hash_hash_proto_depIdxs, - EnumInfos: file_github_com_aperturerobotics_bifrost_hash_hash_proto_enumTypes, - MessageInfos: file_github_com_aperturerobotics_bifrost_hash_hash_proto_msgTypes, - }.Build() - File_github_com_aperturerobotics_bifrost_hash_hash_proto = out.File - file_github_com_aperturerobotics_bifrost_hash_hash_proto_rawDesc = nil - file_github_com_aperturerobotics_bifrost_hash_hash_proto_goTypes = nil - file_github_com_aperturerobotics_bifrost_hash_hash_proto_depIdxs = nil + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil } diff --git a/hash/hash.pb.ts b/hash/hash.pb.ts deleted file mode 100644 index c3bbf65e..00000000 --- a/hash/hash.pb.ts +++ /dev/null @@ -1,246 +0,0 @@ -/* eslint-disable */ -import Long from 'long' -import _m0 from 'protobufjs/minimal.js' - -export const protobufPackage = 'hash' - -/** HashType identifies the hash type in use. */ -export enum HashType { - /** HashType_UNKNOWN - HashType_UNKNOWN is an unknown hash type. */ - HashType_UNKNOWN = 0, - /** HashType_SHA256 - HashType_SHA256 is the sha256 hash type. */ - HashType_SHA256 = 1, - /** - * HashType_SHA1 - HashType_SHA1 is the sha1 hash type. - * NOTE: Do not use SHA1 unless you absolutely have to for backwards compat! (Git) - */ - HashType_SHA1 = 2, - /** - * HashType_BLAKE3 - HashType_BLAKE3 is the blake3 hash type. - * Uses a 32-byte digest size. - */ - HashType_BLAKE3 = 3, - UNRECOGNIZED = -1, -} - -export function hashTypeFromJSON(object: any): HashType { - switch (object) { - case 0: - case 'HashType_UNKNOWN': - return HashType.HashType_UNKNOWN - case 1: - case 'HashType_SHA256': - return HashType.HashType_SHA256 - case 2: - case 'HashType_SHA1': - return HashType.HashType_SHA1 - case 3: - case 'HashType_BLAKE3': - return HashType.HashType_BLAKE3 - case -1: - case 'UNRECOGNIZED': - default: - return HashType.UNRECOGNIZED - } -} - -export function hashTypeToJSON(object: HashType): string { - switch (object) { - case HashType.HashType_UNKNOWN: - return 'HashType_UNKNOWN' - case HashType.HashType_SHA256: - return 'HashType_SHA256' - case HashType.HashType_SHA1: - return 'HashType_SHA1' - case HashType.HashType_BLAKE3: - return 'HashType_BLAKE3' - case HashType.UNRECOGNIZED: - default: - return 'UNRECOGNIZED' - } -} - -/** Hash is a hash of a binary blob. */ -export interface Hash { - /** HashType is the hash type in use. */ - hashType: HashType - /** Hash is the hash value. */ - hash: Uint8Array -} - -function createBaseHash(): Hash { - return { hashType: 0, hash: new Uint8Array(0) } -} - -export const Hash = { - encode(message: Hash, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.hashType !== 0) { - writer.uint32(8).int32(message.hashType) - } - if (message.hash.length !== 0) { - writer.uint32(18).bytes(message.hash) - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Hash { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseHash() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 8) { - break - } - - message.hashType = reader.int32() as any - continue - case 2: - if (tag !== 18) { - break - } - - message.hash = reader.bytes() - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: AsyncIterable | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Hash.encode(p).finish()] - } - } else { - yield* [Hash.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Hash.decode(p)] - } - } else { - yield* [Hash.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): Hash { - return { - hashType: isSet(object.hashType) ? hashTypeFromJSON(object.hashType) : 0, - hash: isSet(object.hash) - ? bytesFromBase64(object.hash) - : new Uint8Array(0), - } - }, - - toJSON(message: Hash): unknown { - const obj: any = {} - if (message.hashType !== 0) { - obj.hashType = hashTypeToJSON(message.hashType) - } - if (message.hash.length !== 0) { - obj.hash = base64FromBytes(message.hash) - } - return obj - }, - - create, I>>(base?: I): Hash { - return Hash.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>(object: I): Hash { - const message = createBaseHash() - message.hashType = object.hashType ?? 0 - message.hash = object.hash ?? new Uint8Array(0) - return message - }, -} - -function bytesFromBase64(b64: string): Uint8Array { - if ((globalThis as any).Buffer) { - return Uint8Array.from(globalThis.Buffer.from(b64, 'base64')) - } else { - const bin = globalThis.atob(b64) - const arr = new Uint8Array(bin.length) - for (let i = 0; i < bin.length; ++i) { - arr[i] = bin.charCodeAt(i) - } - return arr - } -} - -function base64FromBytes(arr: Uint8Array): string { - if ((globalThis as any).Buffer) { - return globalThis.Buffer.from(arr).toString('base64') - } else { - const bin: string[] = [] - arr.forEach((byte) => { - bin.push(globalThis.String.fromCharCode(byte)) - }) - return globalThis.btoa(bin.join('')) - } -} - -type Builtin = - | Date - | Function - | Uint8Array - | string - | number - | boolean - | undefined - -export type DeepPartial = T extends Builtin - ? T - : T extends Long - ? string | number | Long - : T extends globalThis.Array - ? globalThis.Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends { $case: string } - ? { [K in keyof Omit]?: DeepPartial } & { - $case: T['$case'] - } - : T extends {} - ? { [K in keyof T]?: DeepPartial } - : Partial - -type KeysOfUnion = T extends T ? keyof T : never -export type Exact = P extends Builtin - ? P - : P & { [K in keyof P]: Exact } & { - [K in Exclude>]: never - } - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any - _m0.configure() -} - -function isSet(value: any): boolean { - return value !== null && value !== undefined -} diff --git a/hash/hash_pb.ts b/hash/hash_pb.ts new file mode 100644 index 00000000..77c50fde --- /dev/null +++ b/hash/hash_pb.ts @@ -0,0 +1,118 @@ +// @generated by protoc-gen-es v1.8.0 with parameter "target=ts,ts_nocheck=false" +// @generated from file github.com/aperturerobotics/bifrost/hash/hash.proto (package hash, syntax proto3) +/* eslint-disable */ + +import type { + BinaryReadOptions, + FieldList, + JsonReadOptions, + JsonValue, + PartialMessage, + PlainMessage, +} from '@bufbuild/protobuf' +import { Message, proto3 } from '@bufbuild/protobuf' + +/** + * HashType identifies the hash type in use. + * + * @generated from enum hash.HashType + */ +export enum HashType { + /** + * HashType_UNKNOWN is an unknown hash type. + * + * @generated from enum value: HashType_UNKNOWN = 0; + */ + HashType_UNKNOWN = 0, + + /** + * HashType_SHA256 is the sha256 hash type. + * + * @generated from enum value: HashType_SHA256 = 1; + */ + HashType_SHA256 = 1, + + /** + * HashType_SHA1 is the sha1 hash type. + * NOTE: Do not use SHA1 unless you absolutely have to for backwards compat! (Git) + * + * @generated from enum value: HashType_SHA1 = 2; + */ + HashType_SHA1 = 2, + + /** + * HashType_BLAKE3 is the blake3 hash type. + * Uses a 32-byte digest size. + * + * @generated from enum value: HashType_BLAKE3 = 3; + */ + HashType_BLAKE3 = 3, +} +// Retrieve enum metadata with: proto3.getEnumType(HashType) +proto3.util.setEnumType(HashType, 'hash.HashType', [ + { no: 0, name: 'HashType_UNKNOWN' }, + { no: 1, name: 'HashType_SHA256' }, + { no: 2, name: 'HashType_SHA1' }, + { no: 3, name: 'HashType_BLAKE3' }, +]) + +/** + * Hash is a hash of a binary blob. + * + * @generated from message hash.Hash + */ +export class Hash extends Message { + /** + * HashType is the hash type in use. + * + * @generated from field: hash.HashType hash_type = 1; + */ + hashType = HashType.HashType_UNKNOWN + + /** + * Hash is the hash value. + * + * @generated from field: bytes hash = 2; + */ + hash = new Uint8Array(0) + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'hash.Hash' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: 'hash_type', kind: 'enum', T: proto3.getEnumType(HashType) }, + { no: 2, name: 'hash', kind: 'scalar', T: 12 /* ScalarType.BYTES */ }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): Hash { + return new Hash().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): Hash { + return new Hash().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): Hash { + return new Hash().fromJsonString(jsonString, options) + } + + static equals( + a: Hash | PlainMessage | undefined, + b: Hash | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(Hash, a, b) + } +} diff --git a/hash/hash_vtproto.pb.go b/hash/hash_vtproto.pb.go deleted file mode 100644 index 650a56ee..00000000 --- a/hash/hash_vtproto.pb.go +++ /dev/null @@ -1,232 +0,0 @@ -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// protoc-gen-go-vtproto version: v0.6.0 -// source: github.com/aperturerobotics/bifrost/hash/hash.proto - -package hash - -import ( - fmt "fmt" - io "io" - - protohelpers "github.com/planetscale/vtprotobuf/protohelpers" - proto "google.golang.org/protobuf/proto" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) -) - -func (m *Hash) CloneVT() *Hash { - if m == nil { - return (*Hash)(nil) - } - r := new(Hash) - r.HashType = m.HashType - if rhs := m.Hash; rhs != nil { - tmpBytes := make([]byte, len(rhs)) - copy(tmpBytes, rhs) - r.Hash = tmpBytes - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Hash) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (this *Hash) EqualVT(that *Hash) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.HashType != that.HashType { - return false - } - if string(this.Hash) != string(that.Hash) { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Hash) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Hash) - if !ok { - return false - } - return this.EqualVT(that) -} -func (m *Hash) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Hash) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Hash) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Hash) > 0 { - i -= len(m.Hash) - copy(dAtA[i:], m.Hash) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Hash))) - i-- - dAtA[i] = 0x12 - } - if m.HashType != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.HashType)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *Hash) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.HashType != 0 { - n += 1 + protohelpers.SizeOfVarint(uint64(m.HashType)) - } - l = len(m.Hash) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *Hash) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Hash: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Hash: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field HashType", wireType) - } - m.HashType = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.HashType |= HashType(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Hash = append(m.Hash[:0], dAtA[iNdEx:postIndex]...) - if m.Hash == nil { - m.Hash = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} diff --git a/http/listener/config.pb.go b/http/listener/config.pb.go index 62421903..4126668b 100644 --- a/http/listener/config.pb.go +++ b/http/listener/config.pb.go @@ -1,47 +1,35 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0-devel -// protoc v5.26.1 +// Code generated by protoc-gen-go-lite. DO NOT EDIT. +// protoc-gen-go-lite version: v0.4.5 // source: github.com/aperturerobotics/bifrost/http/listener/config.proto package bifrost_http_listener import ( - reflect "reflect" - sync "sync" + io "io" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) + protobuf_go_lite "github.com/aperturerobotics/protobuf-go-lite" + json "github.com/aperturerobotics/protobuf-go-lite/json" + errors "github.com/pkg/errors" ) // Config configures a http server that listens on a port. // // Handles incoming requests with LookupHTTPHandler. type Config struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + unknownFields []byte // Addr is the address to listen. // // Example: 0.0.0.0:8080 Addr string `protobuf:"bytes,1,opt,name=addr,proto3" json:"addr,omitempty"` // ClientId is the client id to set on LookupHTTPHandler. - ClientId string `protobuf:"bytes,2,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` + ClientId string `protobuf:"bytes,2,opt,name=client_id,json=clientId,proto3" json:"clientId,omitempty"` // CertFile is the path to the certificate file to use for https. // Can be unset to use HTTP. - CertFile string `protobuf:"bytes,3,opt,name=cert_file,json=certFile,proto3" json:"cert_file,omitempty"` + CertFile string `protobuf:"bytes,3,opt,name=cert_file,json=certFile,proto3" json:"certFile,omitempty"` // KeyFile is the path to the key file to use for https. // Cannot be unset if cert_file is set. // Otherwise can be unset. - KeyFile string `protobuf:"bytes,4,opt,name=key_file,json=keyFile,proto3" json:"key_file,omitempty"` + KeyFile string `protobuf:"bytes,4,opt,name=key_file,json=keyFile,proto3" json:"keyFile,omitempty"` // Wait indicates to wait for LookupHTTPHandler even if it becomes idle. // If false: returns 404 not found if LookupHTTPHandler becomes idle. Wait bool `protobuf:"varint,5,opt,name=wait,proto3" json:"wait,omitempty"` @@ -49,36 +37,10 @@ type Config struct { func (x *Config) Reset() { *x = Config{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_http_listener_config_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Config) String() string { - return protoimpl.X.MessageStringOf(x) } func (*Config) ProtoMessage() {} -func (x *Config) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_http_listener_config_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 Config.ProtoReflect.Descriptor instead. -func (*Config) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_http_listener_config_proto_rawDescGZIP(), []int{0} -} - func (x *Config) GetAddr() string { if x != nil { return x.Addr @@ -114,85 +76,429 @@ func (x *Config) GetWait() bool { return false } -var File_github_com_aperturerobotics_bifrost_http_listener_config_proto protoreflect.FileDescriptor - -var file_github_com_aperturerobotics_bifrost_http_listener_config_proto_rawDesc = []byte{ - 0x0a, 0x3e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, - 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x62, 0x69, - 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2f, 0x68, 0x74, 0x74, 0x70, 0x2f, 0x6c, 0x69, 0x73, 0x74, 0x65, - 0x6e, 0x65, 0x72, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x12, 0x15, 0x62, 0x69, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2e, 0x68, 0x74, 0x74, 0x70, 0x2e, 0x6c, - 0x69, 0x73, 0x74, 0x65, 0x6e, 0x65, 0x72, 0x22, 0x85, 0x01, 0x0a, 0x06, 0x43, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x61, 0x64, 0x64, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x04, 0x61, 0x64, 0x64, 0x72, 0x12, 0x1b, 0x0a, 0x09, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, - 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6c, 0x69, 0x65, 0x6e, - 0x74, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x63, 0x65, 0x72, 0x74, 0x5f, 0x66, 0x69, 0x6c, 0x65, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x65, 0x72, 0x74, 0x46, 0x69, 0x6c, 0x65, - 0x12, 0x19, 0x0a, 0x08, 0x6b, 0x65, 0x79, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x07, 0x6b, 0x65, 0x79, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x77, - 0x61, 0x69, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x77, 0x61, 0x69, 0x74, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_github_com_aperturerobotics_bifrost_http_listener_config_proto_rawDescOnce sync.Once - file_github_com_aperturerobotics_bifrost_http_listener_config_proto_rawDescData = file_github_com_aperturerobotics_bifrost_http_listener_config_proto_rawDesc -) +func (m *Config) CloneVT() *Config { + if m == nil { + return (*Config)(nil) + } + r := new(Config) + r.Addr = m.Addr + r.ClientId = m.ClientId + r.CertFile = m.CertFile + r.KeyFile = m.KeyFile + r.Wait = m.Wait + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} -func file_github_com_aperturerobotics_bifrost_http_listener_config_proto_rawDescGZIP() []byte { - file_github_com_aperturerobotics_bifrost_http_listener_config_proto_rawDescOnce.Do(func() { - file_github_com_aperturerobotics_bifrost_http_listener_config_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_aperturerobotics_bifrost_http_listener_config_proto_rawDescData) - }) - return file_github_com_aperturerobotics_bifrost_http_listener_config_proto_rawDescData +func (m *Config) CloneMessageVT() any { + return m.CloneVT() } -var file_github_com_aperturerobotics_bifrost_http_listener_config_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_github_com_aperturerobotics_bifrost_http_listener_config_proto_goTypes = []interface{}{ - (*Config)(nil), // 0: bifrost.http.listener.Config +func (this *Config) EqualVT(that *Config) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.Addr != that.Addr { + return false + } + if this.ClientId != that.ClientId { + return false + } + if this.CertFile != that.CertFile { + return false + } + if this.KeyFile != that.KeyFile { + return false + } + if this.Wait != that.Wait { + return false + } + return string(this.unknownFields) == string(that.unknownFields) } -var file_github_com_aperturerobotics_bifrost_http_listener_config_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] 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 (this *Config) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*Config) + if !ok { + return false + } + return this.EqualVT(that) } -func init() { file_github_com_aperturerobotics_bifrost_http_listener_config_proto_init() } -func file_github_com_aperturerobotics_bifrost_http_listener_config_proto_init() { - if File_github_com_aperturerobotics_bifrost_http_listener_config_proto != nil { +// MarshalProtoJSON marshals the Config message to JSON. +func (x *Config) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() return } - if !protoimpl.UnsafeEnabled { - file_github_com_aperturerobotics_bifrost_http_listener_config_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Config); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil + s.WriteObjectStart() + var wroteField bool + if x.Addr != "" || s.HasField("addr") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("addr") + s.WriteString(x.Addr) + } + if x.ClientId != "" || s.HasField("clientId") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("clientId") + s.WriteString(x.ClientId) + } + if x.CertFile != "" || s.HasField("certFile") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("certFile") + s.WriteString(x.CertFile) + } + if x.KeyFile != "" || s.HasField("keyFile") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("keyFile") + s.WriteString(x.KeyFile) + } + if x.Wait || s.HasField("wait") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("wait") + s.WriteBool(x.Wait) + } + s.WriteObjectEnd() +} + +// MarshalJSON marshals the Config to JSON. +func (x *Config) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) +} + +// UnmarshalProtoJSON unmarshals the Config message from JSON. +func (x *Config) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { + return + } + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "addr": + s.AddField("addr") + x.Addr = s.ReadString() + case "client_id", "clientId": + s.AddField("client_id") + x.ClientId = s.ReadString() + case "cert_file", "certFile": + s.AddField("cert_file") + x.CertFile = s.ReadString() + case "key_file", "keyFile": + s.AddField("key_file") + x.KeyFile = s.ReadString() + case "wait": + s.AddField("wait") + x.Wait = s.ReadBool() + } + }) +} + +// UnmarshalJSON unmarshals the Config from JSON. +func (x *Config) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +func (m *Config) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Config) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.Wait { + i-- + if m.Wait { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x28 + } + if len(m.KeyFile) > 0 { + i -= len(m.KeyFile) + copy(dAtA[i:], m.KeyFile) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.KeyFile))) + i-- + dAtA[i] = 0x22 + } + if len(m.CertFile) > 0 { + i -= len(m.CertFile) + copy(dAtA[i:], m.CertFile) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.CertFile))) + i-- + dAtA[i] = 0x1a + } + if len(m.ClientId) > 0 { + i -= len(m.ClientId) + copy(dAtA[i:], m.ClientId) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.ClientId))) + i-- + dAtA[i] = 0x12 + } + if len(m.Addr) > 0 { + i -= len(m.Addr) + copy(dAtA[i:], m.Addr) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.Addr))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Config) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Addr) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + l = len(m.ClientId) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + l = len(m.CertFile) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + l = len(m.KeyFile) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + if m.Wait { + n += 2 + } + n += len(m.unknownFields) + return n +} + +func (m *Config) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break } } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: Config: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: Config: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field Addr", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Addr = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field ClientId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ClientId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field CertFile", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CertFile = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field KeyFile", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.KeyFile = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 0 { + return errors.Errorf("proto: wrong wireType = %d for field Wait", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Wait = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_github_com_aperturerobotics_bifrost_http_listener_config_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_github_com_aperturerobotics_bifrost_http_listener_config_proto_goTypes, - DependencyIndexes: file_github_com_aperturerobotics_bifrost_http_listener_config_proto_depIdxs, - MessageInfos: file_github_com_aperturerobotics_bifrost_http_listener_config_proto_msgTypes, - }.Build() - File_github_com_aperturerobotics_bifrost_http_listener_config_proto = out.File - file_github_com_aperturerobotics_bifrost_http_listener_config_proto_rawDesc = nil - file_github_com_aperturerobotics_bifrost_http_listener_config_proto_goTypes = nil - file_github_com_aperturerobotics_bifrost_http_listener_config_proto_depIdxs = nil + return nil } diff --git a/http/listener/config.pb.ts b/http/listener/config.pb.ts deleted file mode 100644 index 3ffa8f2c..00000000 --- a/http/listener/config.pb.ts +++ /dev/null @@ -1,239 +0,0 @@ -/* eslint-disable */ -import Long from 'long' -import _m0 from 'protobufjs/minimal.js' - -export const protobufPackage = 'bifrost.http.listener' - -/** - * Config configures a http server that listens on a port. - * - * Handles incoming requests with LookupHTTPHandler. - */ -export interface Config { - /** - * Addr is the address to listen. - * - * Example: 0.0.0.0:8080 - */ - addr: string - /** ClientId is the client id to set on LookupHTTPHandler. */ - clientId: string - /** - * CertFile is the path to the certificate file to use for https. - * Can be unset to use HTTP. - */ - certFile: string - /** - * KeyFile is the path to the key file to use for https. - * Cannot be unset if cert_file is set. - * Otherwise can be unset. - */ - keyFile: string - /** - * Wait indicates to wait for LookupHTTPHandler even if it becomes idle. - * If false: returns 404 not found if LookupHTTPHandler becomes idle. - */ - wait: boolean -} - -function createBaseConfig(): Config { - return { addr: '', clientId: '', certFile: '', keyFile: '', wait: false } -} - -export const Config = { - encode( - message: Config, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.addr !== '') { - writer.uint32(10).string(message.addr) - } - if (message.clientId !== '') { - writer.uint32(18).string(message.clientId) - } - if (message.certFile !== '') { - writer.uint32(26).string(message.certFile) - } - if (message.keyFile !== '') { - writer.uint32(34).string(message.keyFile) - } - if (message.wait !== false) { - writer.uint32(40).bool(message.wait) - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Config { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseConfig() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break - } - - message.addr = reader.string() - continue - case 2: - if (tag !== 18) { - break - } - - message.clientId = reader.string() - continue - case 3: - if (tag !== 26) { - break - } - - message.certFile = reader.string() - continue - case 4: - if (tag !== 34) { - break - } - - message.keyFile = reader.string() - continue - case 5: - if (tag !== 40) { - break - } - - message.wait = reader.bool() - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: AsyncIterable | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config.encode(p).finish()] - } - } else { - yield* [Config.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config.decode(p)] - } - } else { - yield* [Config.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): Config { - return { - addr: isSet(object.addr) ? globalThis.String(object.addr) : '', - clientId: isSet(object.clientId) - ? globalThis.String(object.clientId) - : '', - certFile: isSet(object.certFile) - ? globalThis.String(object.certFile) - : '', - keyFile: isSet(object.keyFile) ? globalThis.String(object.keyFile) : '', - wait: isSet(object.wait) ? globalThis.Boolean(object.wait) : false, - } - }, - - toJSON(message: Config): unknown { - const obj: any = {} - if (message.addr !== '') { - obj.addr = message.addr - } - if (message.clientId !== '') { - obj.clientId = message.clientId - } - if (message.certFile !== '') { - obj.certFile = message.certFile - } - if (message.keyFile !== '') { - obj.keyFile = message.keyFile - } - if (message.wait !== false) { - obj.wait = message.wait - } - return obj - }, - - create, I>>(base?: I): Config { - return Config.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>(object: I): Config { - const message = createBaseConfig() - message.addr = object.addr ?? '' - message.clientId = object.clientId ?? '' - message.certFile = object.certFile ?? '' - message.keyFile = object.keyFile ?? '' - message.wait = object.wait ?? false - return message - }, -} - -type Builtin = - | Date - | Function - | Uint8Array - | string - | number - | boolean - | undefined - -export type DeepPartial = T extends Builtin - ? T - : T extends Long - ? string | number | Long - : T extends globalThis.Array - ? globalThis.Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends { $case: string } - ? { [K in keyof Omit]?: DeepPartial } & { - $case: T['$case'] - } - : T extends {} - ? { [K in keyof T]?: DeepPartial } - : Partial - -type KeysOfUnion = T extends T ? keyof T : never -export type Exact = P extends Builtin - ? P - : P & { [K in keyof P]: Exact } & { - [K in Exclude>]: never - } - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any - _m0.configure() -} - -function isSet(value: any): boolean { - return value !== null && value !== undefined -} diff --git a/http/listener/config_pb.ts b/http/listener/config_pb.ts new file mode 100644 index 00000000..10ac37d0 --- /dev/null +++ b/http/listener/config_pb.ts @@ -0,0 +1,106 @@ +// @generated by protoc-gen-es v1.8.0 with parameter "target=ts,ts_nocheck=false" +// @generated from file github.com/aperturerobotics/bifrost/http/listener/config.proto (package bifrost.http.listener, syntax proto3) +/* eslint-disable */ + +import type { + BinaryReadOptions, + FieldList, + JsonReadOptions, + JsonValue, + PartialMessage, + PlainMessage, +} from '@bufbuild/protobuf' +import { Message, proto3 } from '@bufbuild/protobuf' + +/** + * Config configures a http server that listens on a port. + * + * Handles incoming requests with LookupHTTPHandler. + * + * @generated from message bifrost.http.listener.Config + */ +export class Config extends Message { + /** + * Addr is the address to listen. + * + * Example: 0.0.0.0:8080 + * + * @generated from field: string addr = 1; + */ + addr = '' + + /** + * ClientId is the client id to set on LookupHTTPHandler. + * + * @generated from field: string client_id = 2; + */ + clientId = '' + + /** + * CertFile is the path to the certificate file to use for https. + * Can be unset to use HTTP. + * + * @generated from field: string cert_file = 3; + */ + certFile = '' + + /** + * KeyFile is the path to the key file to use for https. + * Cannot be unset if cert_file is set. + * Otherwise can be unset. + * + * @generated from field: string key_file = 4; + */ + keyFile = '' + + /** + * Wait indicates to wait for LookupHTTPHandler even if it becomes idle. + * If false: returns 404 not found if LookupHTTPHandler becomes idle. + * + * @generated from field: bool wait = 5; + */ + wait = false + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'bifrost.http.listener.Config' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: 'addr', kind: 'scalar', T: 9 /* ScalarType.STRING */ }, + { no: 2, name: 'client_id', kind: 'scalar', T: 9 /* ScalarType.STRING */ }, + { no: 3, name: 'cert_file', kind: 'scalar', T: 9 /* ScalarType.STRING */ }, + { no: 4, name: 'key_file', kind: 'scalar', T: 9 /* ScalarType.STRING */ }, + { no: 5, name: 'wait', kind: 'scalar', T: 8 /* ScalarType.BOOL */ }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): Config { + return new Config().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): Config { + return new Config().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): Config { + return new Config().fromJsonString(jsonString, options) + } + + static equals( + a: Config | PlainMessage | undefined, + b: Config | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(Config, a, b) + } +} diff --git a/http/listener/config_vtproto.pb.go b/http/listener/config_vtproto.pb.go deleted file mode 100644 index b7eb476f..00000000 --- a/http/listener/config_vtproto.pb.go +++ /dev/null @@ -1,373 +0,0 @@ -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// protoc-gen-go-vtproto version: v0.6.0 -// source: github.com/aperturerobotics/bifrost/http/listener/config.proto - -package bifrost_http_listener - -import ( - fmt "fmt" - io "io" - - protohelpers "github.com/planetscale/vtprotobuf/protohelpers" - proto "google.golang.org/protobuf/proto" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) -) - -func (m *Config) CloneVT() *Config { - if m == nil { - return (*Config)(nil) - } - r := new(Config) - r.Addr = m.Addr - r.ClientId = m.ClientId - r.CertFile = m.CertFile - r.KeyFile = m.KeyFile - r.Wait = m.Wait - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Config) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (this *Config) EqualVT(that *Config) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.Addr != that.Addr { - return false - } - if this.ClientId != that.ClientId { - return false - } - if this.CertFile != that.CertFile { - return false - } - if this.KeyFile != that.KeyFile { - return false - } - if this.Wait != that.Wait { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Config) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Config) - if !ok { - return false - } - return this.EqualVT(that) -} -func (m *Config) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Config) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Wait { - i-- - if m.Wait { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x28 - } - if len(m.KeyFile) > 0 { - i -= len(m.KeyFile) - copy(dAtA[i:], m.KeyFile) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.KeyFile))) - i-- - dAtA[i] = 0x22 - } - if len(m.CertFile) > 0 { - i -= len(m.CertFile) - copy(dAtA[i:], m.CertFile) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.CertFile))) - i-- - dAtA[i] = 0x1a - } - if len(m.ClientId) > 0 { - i -= len(m.ClientId) - copy(dAtA[i:], m.ClientId) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.ClientId))) - i-- - dAtA[i] = 0x12 - } - if len(m.Addr) > 0 { - i -= len(m.Addr) - copy(dAtA[i:], m.Addr) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Addr))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Config) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Addr) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - l = len(m.ClientId) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - l = len(m.CertFile) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - l = len(m.KeyFile) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.Wait { - n += 2 - } - n += len(m.unknownFields) - return n -} - -func (m *Config) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Config: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Config: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Addr", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Addr = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClientId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClientId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CertFile", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.CertFile = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field KeyFile", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.KeyFile = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Wait", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Wait = bool(v != 0) - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} diff --git a/link/establish/config.pb.go b/link/establish/config.pb.go index fd685385..3daaf642 100644 --- a/link/establish/config.pb.go +++ b/link/establish/config.pb.go @@ -1,72 +1,34 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0-devel -// protoc v5.26.1 +// Code generated by protoc-gen-go-lite. DO NOT EDIT. +// protoc-gen-go-lite version: v0.4.5 // source: github.com/aperturerobotics/bifrost/link/establish/config.proto package link_establish_controller import ( - reflect "reflect" - sync "sync" + io "io" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) + protobuf_go_lite "github.com/aperturerobotics/protobuf-go-lite" + json "github.com/aperturerobotics/protobuf-go-lite/json" + errors "github.com/pkg/errors" ) // Config is the link establish controller config. // The establish controller attempts to establish links with configured peers. type Config struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + unknownFields []byte // PeerIds is the list of peer IDs to attempt to establish links to. - PeerIds []string `protobuf:"bytes,1,rep,name=peer_ids,json=peerIds,proto3" json:"peer_ids,omitempty"` + PeerIds []string `protobuf:"bytes,1,rep,name=peer_ids,json=peerIds,proto3" json:"peerIds,omitempty"` // SrcPeerId is the source peer id to establish links from. // Can be empty. - SrcPeerId string `protobuf:"bytes,2,opt,name=src_peer_id,json=srcPeerId,proto3" json:"src_peer_id,omitempty"` + SrcPeerId string `protobuf:"bytes,2,opt,name=src_peer_id,json=srcPeerId,proto3" json:"srcPeerId,omitempty"` } func (x *Config) Reset() { *x = Config{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_link_establish_config_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Config) String() string { - return protoimpl.X.MessageStringOf(x) } func (*Config) ProtoMessage() {} -func (x *Config) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_link_establish_config_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 Config.ProtoReflect.Descriptor instead. -func (*Config) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_link_establish_config_proto_rawDescGZIP(), []int{0} -} - func (x *Config) GetPeerIds() []string { if x != nil { return x.PeerIds @@ -81,81 +43,292 @@ func (x *Config) GetSrcPeerId() string { return "" } -var File_github_com_aperturerobotics_bifrost_link_establish_config_proto protoreflect.FileDescriptor +func (m *Config) CloneVT() *Config { + if m == nil { + return (*Config)(nil) + } + r := new(Config) + r.SrcPeerId = m.SrcPeerId + if rhs := m.PeerIds; rhs != nil { + tmpContainer := make([]string, len(rhs)) + copy(tmpContainer, rhs) + r.PeerIds = tmpContainer + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} -var file_github_com_aperturerobotics_bifrost_link_establish_config_proto_rawDesc = []byte{ - 0x0a, 0x3f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, - 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x62, 0x69, - 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2f, 0x6c, 0x69, 0x6e, 0x6b, 0x2f, 0x65, 0x73, 0x74, 0x61, 0x62, - 0x6c, 0x69, 0x73, 0x68, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x12, 0x19, 0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0x65, 0x73, 0x74, 0x61, 0x62, 0x6c, 0x69, 0x73, - 0x68, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x22, 0x43, 0x0a, 0x06, - 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x19, 0x0a, 0x08, 0x70, 0x65, 0x65, 0x72, 0x5f, 0x69, - 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x70, 0x65, 0x65, 0x72, 0x49, 0x64, - 0x73, 0x12, 0x1e, 0x0a, 0x0b, 0x73, 0x72, 0x63, 0x5f, 0x70, 0x65, 0x65, 0x72, 0x5f, 0x69, 0x64, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x72, 0x63, 0x50, 0x65, 0x65, 0x72, 0x49, - 0x64, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +func (m *Config) CloneMessageVT() any { + return m.CloneVT() } -var ( - file_github_com_aperturerobotics_bifrost_link_establish_config_proto_rawDescOnce sync.Once - file_github_com_aperturerobotics_bifrost_link_establish_config_proto_rawDescData = file_github_com_aperturerobotics_bifrost_link_establish_config_proto_rawDesc -) +func (this *Config) EqualVT(that *Config) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if len(this.PeerIds) != len(that.PeerIds) { + return false + } + for i, vx := range this.PeerIds { + vy := that.PeerIds[i] + if vx != vy { + return false + } + } + if this.SrcPeerId != that.SrcPeerId { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} -func file_github_com_aperturerobotics_bifrost_link_establish_config_proto_rawDescGZIP() []byte { - file_github_com_aperturerobotics_bifrost_link_establish_config_proto_rawDescOnce.Do(func() { - file_github_com_aperturerobotics_bifrost_link_establish_config_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_aperturerobotics_bifrost_link_establish_config_proto_rawDescData) - }) - return file_github_com_aperturerobotics_bifrost_link_establish_config_proto_rawDescData +func (this *Config) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*Config) + if !ok { + return false + } + return this.EqualVT(that) } -var file_github_com_aperturerobotics_bifrost_link_establish_config_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_github_com_aperturerobotics_bifrost_link_establish_config_proto_goTypes = []interface{}{ - (*Config)(nil), // 0: link.establish.controller.Config +// MarshalProtoJSON marshals the Config message to JSON. +func (x *Config) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return + } + s.WriteObjectStart() + var wroteField bool + if len(x.PeerIds) > 0 || s.HasField("peerIds") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("peerIds") + s.WriteStringArray(x.PeerIds) + } + if x.SrcPeerId != "" || s.HasField("srcPeerId") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("srcPeerId") + s.WriteString(x.SrcPeerId) + } + s.WriteObjectEnd() } -var file_github_com_aperturerobotics_bifrost_link_establish_config_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] 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 + +// MarshalJSON marshals the Config to JSON. +func (x *Config) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) } -func init() { file_github_com_aperturerobotics_bifrost_link_establish_config_proto_init() } -func file_github_com_aperturerobotics_bifrost_link_establish_config_proto_init() { - if File_github_com_aperturerobotics_bifrost_link_establish_config_proto != nil { +// UnmarshalProtoJSON unmarshals the Config message from JSON. +func (x *Config) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { return } - if !protoimpl.UnsafeEnabled { - file_github_com_aperturerobotics_bifrost_link_establish_config_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Config); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "peer_ids", "peerIds": + s.AddField("peer_ids") + if s.ReadNil() { + x.PeerIds = nil + return } + x.PeerIds = s.ReadStringArray() + case "src_peer_id", "srcPeerId": + s.AddField("src_peer_id") + x.SrcPeerId = s.ReadString() } + }) +} + +// UnmarshalJSON unmarshals the Config from JSON. +func (x *Config) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +func (m *Config) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_github_com_aperturerobotics_bifrost_link_establish_config_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_github_com_aperturerobotics_bifrost_link_establish_config_proto_goTypes, - DependencyIndexes: file_github_com_aperturerobotics_bifrost_link_establish_config_proto_depIdxs, - MessageInfos: file_github_com_aperturerobotics_bifrost_link_establish_config_proto_msgTypes, - }.Build() - File_github_com_aperturerobotics_bifrost_link_establish_config_proto = out.File - file_github_com_aperturerobotics_bifrost_link_establish_config_proto_rawDesc = nil - file_github_com_aperturerobotics_bifrost_link_establish_config_proto_goTypes = nil - file_github_com_aperturerobotics_bifrost_link_establish_config_proto_depIdxs = nil + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Config) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.SrcPeerId) > 0 { + i -= len(m.SrcPeerId) + copy(dAtA[i:], m.SrcPeerId) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.SrcPeerId))) + i-- + dAtA[i] = 0x12 + } + if len(m.PeerIds) > 0 { + for iNdEx := len(m.PeerIds) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.PeerIds[iNdEx]) + copy(dAtA[i:], m.PeerIds[iNdEx]) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.PeerIds[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *Config) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.PeerIds) > 0 { + for _, s := range m.PeerIds { + l = len(s) + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + } + l = len(m.SrcPeerId) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *Config) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: Config: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: Config: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field PeerIds", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PeerIds = append(m.PeerIds, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 2: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field SrcPeerId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SrcPeerId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil } diff --git a/link/establish/config.pb.ts b/link/establish/config.pb.ts deleted file mode 100644 index 31c2eaed..00000000 --- a/link/establish/config.pb.ts +++ /dev/null @@ -1,176 +0,0 @@ -/* eslint-disable */ -import Long from 'long' -import _m0 from 'protobufjs/minimal.js' - -export const protobufPackage = 'link.establish.controller' - -/** - * Config is the link establish controller config. - * The establish controller attempts to establish links with configured peers. - */ -export interface Config { - /** PeerIds is the list of peer IDs to attempt to establish links to. */ - peerIds: string[] - /** - * SrcPeerId is the source peer id to establish links from. - * Can be empty. - */ - srcPeerId: string -} - -function createBaseConfig(): Config { - return { peerIds: [], srcPeerId: '' } -} - -export const Config = { - encode( - message: Config, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - for (const v of message.peerIds) { - writer.uint32(10).string(v!) - } - if (message.srcPeerId !== '') { - writer.uint32(18).string(message.srcPeerId) - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Config { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseConfig() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break - } - - message.peerIds.push(reader.string()) - continue - case 2: - if (tag !== 18) { - break - } - - message.srcPeerId = reader.string() - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: AsyncIterable | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config.encode(p).finish()] - } - } else { - yield* [Config.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config.decode(p)] - } - } else { - yield* [Config.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): Config { - return { - peerIds: globalThis.Array.isArray(object?.peerIds) - ? object.peerIds.map((e: any) => globalThis.String(e)) - : [], - srcPeerId: isSet(object.srcPeerId) - ? globalThis.String(object.srcPeerId) - : '', - } - }, - - toJSON(message: Config): unknown { - const obj: any = {} - if (message.peerIds?.length) { - obj.peerIds = message.peerIds - } - if (message.srcPeerId !== '') { - obj.srcPeerId = message.srcPeerId - } - return obj - }, - - create, I>>(base?: I): Config { - return Config.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>(object: I): Config { - const message = createBaseConfig() - message.peerIds = object.peerIds?.map((e) => e) || [] - message.srcPeerId = object.srcPeerId ?? '' - return message - }, -} - -type Builtin = - | Date - | Function - | Uint8Array - | string - | number - | boolean - | undefined - -export type DeepPartial = T extends Builtin - ? T - : T extends Long - ? string | number | Long - : T extends globalThis.Array - ? globalThis.Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends { $case: string } - ? { [K in keyof Omit]?: DeepPartial } & { - $case: T['$case'] - } - : T extends {} - ? { [K in keyof T]?: DeepPartial } - : Partial - -type KeysOfUnion = T extends T ? keyof T : never -export type Exact = P extends Builtin - ? P - : P & { [K in keyof P]: Exact } & { - [K in Exclude>]: never - } - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any - _m0.configure() -} - -function isSet(value: any): boolean { - return value !== null && value !== undefined -} diff --git a/link/establish/config_pb.ts b/link/establish/config_pb.ts new file mode 100644 index 00000000..df4ef76b --- /dev/null +++ b/link/establish/config_pb.ts @@ -0,0 +1,87 @@ +// @generated by protoc-gen-es v1.8.0 with parameter "target=ts,ts_nocheck=false" +// @generated from file github.com/aperturerobotics/bifrost/link/establish/config.proto (package link.establish.controller, syntax proto3) +/* eslint-disable */ + +import type { + BinaryReadOptions, + FieldList, + JsonReadOptions, + JsonValue, + PartialMessage, + PlainMessage, +} from '@bufbuild/protobuf' +import { Message, proto3 } from '@bufbuild/protobuf' + +/** + * Config is the link establish controller config. + * The establish controller attempts to establish links with configured peers. + * + * @generated from message link.establish.controller.Config + */ +export class Config extends Message { + /** + * PeerIds is the list of peer IDs to attempt to establish links to. + * + * @generated from field: repeated string peer_ids = 1; + */ + peerIds: string[] = [] + + /** + * SrcPeerId is the source peer id to establish links from. + * Can be empty. + * + * @generated from field: string src_peer_id = 2; + */ + srcPeerId = '' + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'link.establish.controller.Config' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { + no: 1, + name: 'peer_ids', + kind: 'scalar', + T: 9 /* ScalarType.STRING */, + repeated: true, + }, + { + no: 2, + name: 'src_peer_id', + kind: 'scalar', + T: 9 /* ScalarType.STRING */, + }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): Config { + return new Config().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): Config { + return new Config().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): Config { + return new Config().fromJsonString(jsonString, options) + } + + static equals( + a: Config | PlainMessage | undefined, + b: Config | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(Config, a, b) + } +} diff --git a/link/establish/config_vtproto.pb.go b/link/establish/config_vtproto.pb.go deleted file mode 100644 index e584b28b..00000000 --- a/link/establish/config_vtproto.pb.go +++ /dev/null @@ -1,256 +0,0 @@ -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// protoc-gen-go-vtproto version: v0.6.0 -// source: github.com/aperturerobotics/bifrost/link/establish/config.proto - -package link_establish_controller - -import ( - fmt "fmt" - io "io" - - protohelpers "github.com/planetscale/vtprotobuf/protohelpers" - proto "google.golang.org/protobuf/proto" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) -) - -func (m *Config) CloneVT() *Config { - if m == nil { - return (*Config)(nil) - } - r := new(Config) - r.SrcPeerId = m.SrcPeerId - if rhs := m.PeerIds; rhs != nil { - tmpContainer := make([]string, len(rhs)) - copy(tmpContainer, rhs) - r.PeerIds = tmpContainer - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Config) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (this *Config) EqualVT(that *Config) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if len(this.PeerIds) != len(that.PeerIds) { - return false - } - for i, vx := range this.PeerIds { - vy := that.PeerIds[i] - if vx != vy { - return false - } - } - if this.SrcPeerId != that.SrcPeerId { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Config) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Config) - if !ok { - return false - } - return this.EqualVT(that) -} -func (m *Config) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Config) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.SrcPeerId) > 0 { - i -= len(m.SrcPeerId) - copy(dAtA[i:], m.SrcPeerId) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.SrcPeerId))) - i-- - dAtA[i] = 0x12 - } - if len(m.PeerIds) > 0 { - for iNdEx := len(m.PeerIds) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.PeerIds[iNdEx]) - copy(dAtA[i:], m.PeerIds[iNdEx]) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.PeerIds[iNdEx]))) - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *Config) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.PeerIds) > 0 { - for _, s := range m.PeerIds { - l = len(s) - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - } - l = len(m.SrcPeerId) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *Config) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Config: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Config: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PeerIds", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PeerIds = append(m.PeerIds, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SrcPeerId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SrcPeerId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} diff --git a/link/hold-open/config.pb.go b/link/hold-open/config.pb.go index 0805a22b..67db8c01 100644 --- a/link/hold-open/config.pb.go +++ b/link/hold-open/config.pb.go @@ -1,136 +1,179 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0-devel -// protoc v5.26.1 +// Code generated by protoc-gen-go-lite. DO NOT EDIT. +// protoc-gen-go-lite version: v0.4.5 // source: github.com/aperturerobotics/bifrost/link/hold-open/config.proto package link_holdopen_controller import ( - reflect "reflect" - sync "sync" + io "io" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) + protobuf_go_lite "github.com/aperturerobotics/protobuf-go-lite" + json "github.com/aperturerobotics/protobuf-go-lite/json" + errors "github.com/pkg/errors" ) // Config is the hold-open controller config. type Config struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields + unknownFields []byte } func (x *Config) Reset() { *x = Config{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_link_hold_open_config_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) +} + +func (*Config) ProtoMessage() {} + +func (m *Config) CloneVT() *Config { + if m == nil { + return (*Config)(nil) + } + r := new(Config) + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) } + return r } -func (x *Config) String() string { - return protoimpl.X.MessageStringOf(x) +func (m *Config) CloneMessageVT() any { + return m.CloneVT() } -func (*Config) ProtoMessage() {} +func (this *Config) EqualVT(that *Config) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} -func (x *Config) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_link_hold_open_config_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms +func (this *Config) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*Config) + if !ok { + return false } - return mi.MessageOf(x) + return this.EqualVT(that) } -// Deprecated: Use Config.ProtoReflect.Descriptor instead. -func (*Config) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_link_hold_open_config_proto_rawDescGZIP(), []int{0} +// MarshalProtoJSON marshals the Config message to JSON. +func (x *Config) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return + } + s.WriteObjectStart() + s.WriteObjectEnd() } -var File_github_com_aperturerobotics_bifrost_link_hold_open_config_proto protoreflect.FileDescriptor +// MarshalJSON marshals the Config to JSON. +func (x *Config) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) +} -var file_github_com_aperturerobotics_bifrost_link_hold_open_config_proto_rawDesc = []byte{ - 0x0a, 0x3f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, - 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x62, 0x69, - 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2f, 0x6c, 0x69, 0x6e, 0x6b, 0x2f, 0x68, 0x6f, 0x6c, 0x64, 0x2d, - 0x6f, 0x70, 0x65, 0x6e, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x12, 0x18, 0x6c, 0x69, 0x6e, 0x6b, 0x2e, 0x68, 0x6f, 0x6c, 0x64, 0x6f, 0x70, 0x65, 0x6e, - 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x22, 0x08, 0x0a, 0x06, 0x43, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +// UnmarshalProtoJSON unmarshals the Config message from JSON. +func (x *Config) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { + return + } } -var ( - file_github_com_aperturerobotics_bifrost_link_hold_open_config_proto_rawDescOnce sync.Once - file_github_com_aperturerobotics_bifrost_link_hold_open_config_proto_rawDescData = file_github_com_aperturerobotics_bifrost_link_hold_open_config_proto_rawDesc -) +// UnmarshalJSON unmarshals the Config from JSON. +func (x *Config) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} -func file_github_com_aperturerobotics_bifrost_link_hold_open_config_proto_rawDescGZIP() []byte { - file_github_com_aperturerobotics_bifrost_link_hold_open_config_proto_rawDescOnce.Do(func() { - file_github_com_aperturerobotics_bifrost_link_hold_open_config_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_aperturerobotics_bifrost_link_hold_open_config_proto_rawDescData) - }) - return file_github_com_aperturerobotics_bifrost_link_hold_open_config_proto_rawDescData +func (m *Config) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil } -var file_github_com_aperturerobotics_bifrost_link_hold_open_config_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_github_com_aperturerobotics_bifrost_link_hold_open_config_proto_goTypes = []interface{}{ - (*Config)(nil), // 0: link.holdopen.controller.Config +func (m *Config) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) } -var file_github_com_aperturerobotics_bifrost_link_hold_open_config_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] 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 (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + return len(dAtA) - i, nil } -func init() { file_github_com_aperturerobotics_bifrost_link_hold_open_config_proto_init() } -func file_github_com_aperturerobotics_bifrost_link_hold_open_config_proto_init() { - if File_github_com_aperturerobotics_bifrost_link_hold_open_config_proto != nil { - return +func (m *Config) SizeVT() (n int) { + if m == nil { + return 0 } - if !protoimpl.UnsafeEnabled { - file_github_com_aperturerobotics_bifrost_link_hold_open_config_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Config); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil + var l int + _ = l + n += len(m.unknownFields) + return n +} + +func (m *Config) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: Config: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: Config: illegal tag %d (wire type %d)", fieldNum, wire) } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_github_com_aperturerobotics_bifrost_link_hold_open_config_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_github_com_aperturerobotics_bifrost_link_hold_open_config_proto_goTypes, - DependencyIndexes: file_github_com_aperturerobotics_bifrost_link_hold_open_config_proto_depIdxs, - MessageInfos: file_github_com_aperturerobotics_bifrost_link_hold_open_config_proto_msgTypes, - }.Build() - File_github_com_aperturerobotics_bifrost_link_hold_open_config_proto = out.File - file_github_com_aperturerobotics_bifrost_link_hold_open_config_proto_rawDesc = nil - file_github_com_aperturerobotics_bifrost_link_hold_open_config_proto_goTypes = nil - file_github_com_aperturerobotics_bifrost_link_hold_open_config_proto_depIdxs = nil + return nil } diff --git a/link/hold-open/config.pb.ts b/link/hold-open/config.pb.ts deleted file mode 100644 index 2b52c2cc..00000000 --- a/link/hold-open/config.pb.ts +++ /dev/null @@ -1,123 +0,0 @@ -/* eslint-disable */ -import Long from 'long' -import _m0 from 'protobufjs/minimal.js' - -export const protobufPackage = 'link.holdopen.controller' - -/** Config is the hold-open controller config. */ -export interface Config {} - -function createBaseConfig(): Config { - return {} -} - -export const Config = { - encode(_: Config, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Config { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseConfig() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: AsyncIterable | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config.encode(p).finish()] - } - } else { - yield* [Config.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config.decode(p)] - } - } else { - yield* [Config.decode(pkt as any)] - } - } - }, - - fromJSON(_: any): Config { - return {} - }, - - toJSON(_: Config): unknown { - const obj: any = {} - return obj - }, - - create, I>>(base?: I): Config { - return Config.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>(_: I): Config { - const message = createBaseConfig() - return message - }, -} - -type Builtin = - | Date - | Function - | Uint8Array - | string - | number - | boolean - | undefined - -export type DeepPartial = T extends Builtin - ? T - : T extends Long - ? string | number | Long - : T extends globalThis.Array - ? globalThis.Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends { $case: string } - ? { [K in keyof Omit]?: DeepPartial } & { - $case: T['$case'] - } - : T extends {} - ? { [K in keyof T]?: DeepPartial } - : Partial - -type KeysOfUnion = T extends T ? keyof T : never -export type Exact = P extends Builtin - ? P - : P & { [K in keyof P]: Exact } & { - [K in Exclude>]: never - } - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any - _m0.configure() -} diff --git a/link/hold-open/config_pb.ts b/link/hold-open/config_pb.ts new file mode 100644 index 00000000..543fb479 --- /dev/null +++ b/link/hold-open/config_pb.ts @@ -0,0 +1,59 @@ +// @generated by protoc-gen-es v1.8.0 with parameter "target=ts,ts_nocheck=false" +// @generated from file github.com/aperturerobotics/bifrost/link/hold-open/config.proto (package link.holdopen.controller, syntax proto3) +/* eslint-disable */ + +import type { + BinaryReadOptions, + FieldList, + JsonReadOptions, + JsonValue, + PartialMessage, + PlainMessage, +} from '@bufbuild/protobuf' +import { Message, proto3 } from '@bufbuild/protobuf' + +/** + * Config is the hold-open controller config. + * + * TODO: limit to specific transport ID, etc. + * + * @generated from message link.holdopen.controller.Config + */ +export class Config extends Message { + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'link.holdopen.controller.Config' + static readonly fields: FieldList = proto3.util.newFieldList(() => []) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): Config { + return new Config().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): Config { + return new Config().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): Config { + return new Config().fromJsonString(jsonString, options) + } + + static equals( + a: Config | PlainMessage | undefined, + b: Config | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(Config, a, b) + } +} diff --git a/link/hold-open/config_vtproto.pb.go b/link/hold-open/config_vtproto.pb.go deleted file mode 100644 index 47631539..00000000 --- a/link/hold-open/config_vtproto.pb.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// protoc-gen-go-vtproto version: v0.6.0 -// source: github.com/aperturerobotics/bifrost/link/hold-open/config.proto - -package link_holdopen_controller - -import ( - fmt "fmt" - io "io" - - protohelpers "github.com/planetscale/vtprotobuf/protohelpers" - proto "google.golang.org/protobuf/proto" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) -) - -func (m *Config) CloneVT() *Config { - if m == nil { - return (*Config)(nil) - } - r := new(Config) - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Config) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (this *Config) EqualVT(that *Config) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Config) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Config) - if !ok { - return false - } - return this.EqualVT(that) -} -func (m *Config) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Config) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - return len(dAtA) - i, nil -} - -func (m *Config) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - n += len(m.unknownFields) - return n -} - -func (m *Config) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Config: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Config: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} diff --git a/link/mounted-stream.go b/link/mounted-stream.go index a45722f9..97331dea 100644 --- a/link/mounted-stream.go +++ b/link/mounted-stream.go @@ -39,10 +39,6 @@ type MountedStreamHandler interface { // MountedStreamContext is the value attached to a Context containing // information about the current mounted stream. -// -// Used in several places to pass stream info via Context, for example: -// - stream/srpc/server: attach stream info to RPC context -// - stream/drpc/server: attach stream info to RPC context type MountedStreamContext = MountedStream // mountedStreamContextKey is the context key used for WithValue. diff --git a/package.json b/package.json index 332d51dd..d721dcd0 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "build": "tsc --project tsconfig.json --noEmit false --module ES6 --target es2022 --outDir ./dist/", "check": "npm run typecheck", "typecheck": "tsc --noEmit", - "deps": "depcheck --ignore-patterns=.eslintrc.js,package.json --ignores depcheck,patch-package,prettier,typescript,bufferutil,utf-8-validate,starpc,ts-proto,ts-poet,@aperturerobotics/ts-common,@go/github.com", + "deps": "depcheck --ignore-patterns=.eslintrc.js,package.json --ignores depcheck,prettier,typescript,starpc,@aperturerobotics/ts-common,@bufbuild/protoc-gen-es", "codegen": "npm run gen", "ci": "npm run build && npm run lint:js && npm run lint:go", "format": "npm run format:js && npm run format:go", @@ -35,8 +35,7 @@ "lint": "npm run lint:go && npm run lint:js", "lint:go": "make lint", "lint:js": "ESLINT_USE_FLAT_CONFIG=false eslint -c .eslintrc.js --ignore-pattern wasm_exec.js ./", - "patch": "patch-package --use-yarn --patch-dir ./node_modules/@aperturerobotics/ts-common/patches", - "prepare": "npm run patch && go mod vendor", + "prepare": "go mod vendor", "precommit": "npm run format" }, "prettier": { @@ -44,20 +43,14 @@ "singleQuote": true }, "devDependencies": { - "@aperturerobotics/ts-common": "0.9.1", + "@aperturerobotics/ts-common": "0.11.0", + "@bufbuild/protoc-gen-es": "^1.8.0", "depcheck": "^1.4.6", - "patch-package": "^8.0.0", "prettier": "^3.1.1", - "ts-poet": "6.8.0", - "ts-proto": "^1.171.0", "typescript": "^5.4.4" }, "dependencies": { - "@aperturerobotics/ts-proto-common-types": "^0.3.0", - "bufferutil": "^4.0.7", - "long": "^5.2.3", - "protobufjs": "^7.2.4", - "starpc": "^0.28.0", - "utf-8-validate": "^6.0.3" + "@bufbuild/protobuf": "^1.8.0", + "starpc": "^0.31.2" } } diff --git a/peer/api/api.pb.go b/peer/api/api.pb.go index da43414a..0bbf620b 100644 --- a/peer/api/api.pb.go +++ b/peer/api/api.pb.go @@ -1,70 +1,32 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0-devel -// protoc v5.26.1 +// Code generated by protoc-gen-go-lite. DO NOT EDIT. +// protoc-gen-go-lite version: v0.4.5 // source: github.com/aperturerobotics/bifrost/peer/api/api.proto package peer_api import ( - reflect "reflect" - sync "sync" + io "io" controller "github.com/aperturerobotics/bifrost/peer/controller" exec "github.com/aperturerobotics/controllerbus/controller/exec" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) + protobuf_go_lite "github.com/aperturerobotics/protobuf-go-lite" + json "github.com/aperturerobotics/protobuf-go-lite/json" + errors "github.com/pkg/errors" ) // IdentifyRequest is a request to load an identity. type IdentifyRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + unknownFields []byte // Config is the request to configure the peer controller. Config *controller.Config `protobuf:"bytes,1,opt,name=config,proto3" json:"config,omitempty"` } func (x *IdentifyRequest) Reset() { *x = IdentifyRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_peer_api_api_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *IdentifyRequest) String() string { - return protoimpl.X.MessageStringOf(x) } func (*IdentifyRequest) ProtoMessage() {} -func (x *IdentifyRequest) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_peer_api_api_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 IdentifyRequest.ProtoReflect.Descriptor instead. -func (*IdentifyRequest) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_peer_api_api_proto_rawDescGZIP(), []int{0} -} - func (x *IdentifyRequest) GetConfig() *controller.Config { if x != nil { return x.Config @@ -74,46 +36,17 @@ func (x *IdentifyRequest) GetConfig() *controller.Config { // IdentifyResponse is a response to an identify request. type IdentifyResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + unknownFields []byte // ControllerStatus is the status of the peer controller. - ControllerStatus exec.ControllerStatus `protobuf:"varint,1,opt,name=controller_status,json=controllerStatus,proto3,enum=controller.exec.ControllerStatus" json:"controller_status,omitempty"` + ControllerStatus exec.ControllerStatus `protobuf:"varint,1,opt,name=controller_status,json=controllerStatus,proto3" json:"controllerStatus,omitempty"` } func (x *IdentifyResponse) Reset() { *x = IdentifyResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_peer_api_api_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *IdentifyResponse) String() string { - return protoimpl.X.MessageStringOf(x) } func (*IdentifyResponse) ProtoMessage() {} -func (x *IdentifyResponse) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_peer_api_api_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 IdentifyResponse.ProtoReflect.Descriptor instead. -func (*IdentifyResponse) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_peer_api_api_proto_rawDescGZIP(), []int{1} -} - func (x *IdentifyResponse) GetControllerStatus() exec.ControllerStatus { if x != nil { return x.ControllerStatus @@ -123,46 +56,17 @@ func (x *IdentifyResponse) GetControllerStatus() exec.ControllerStatus { // GetPeerInfoRequest is the request type for GetPeerInfo. type GetPeerInfoRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + unknownFields []byte // PeerId restricts the response to a specific peer ID. - PeerId string `protobuf:"bytes,1,opt,name=peer_id,json=peerId,proto3" json:"peer_id,omitempty"` + PeerId string `protobuf:"bytes,1,opt,name=peer_id,json=peerId,proto3" json:"peerId,omitempty"` } func (x *GetPeerInfoRequest) Reset() { *x = GetPeerInfoRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_peer_api_api_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GetPeerInfoRequest) String() string { - return protoimpl.X.MessageStringOf(x) } func (*GetPeerInfoRequest) ProtoMessage() {} -func (x *GetPeerInfoRequest) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_peer_api_api_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 GetPeerInfoRequest.ProtoReflect.Descriptor instead. -func (*GetPeerInfoRequest) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_peer_api_api_proto_rawDescGZIP(), []int{2} -} - func (x *GetPeerInfoRequest) GetPeerId() string { if x != nil { return x.PeerId @@ -172,46 +76,17 @@ func (x *GetPeerInfoRequest) GetPeerId() string { // PeerInfo is basic information about a peer. type PeerInfo struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + unknownFields []byte // PeerId is the b58 peer ID. - PeerId string `protobuf:"bytes,1,opt,name=peer_id,json=peerId,proto3" json:"peer_id,omitempty"` + PeerId string `protobuf:"bytes,1,opt,name=peer_id,json=peerId,proto3" json:"peerId,omitempty"` } func (x *PeerInfo) Reset() { *x = PeerInfo{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_peer_api_api_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PeerInfo) String() string { - return protoimpl.X.MessageStringOf(x) } func (*PeerInfo) ProtoMessage() {} -func (x *PeerInfo) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_peer_api_api_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 PeerInfo.ProtoReflect.Descriptor instead. -func (*PeerInfo) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_peer_api_api_proto_rawDescGZIP(), []int{3} -} - func (x *PeerInfo) GetPeerId() string { if x != nil { return x.PeerId @@ -221,222 +96,1144 @@ func (x *PeerInfo) GetPeerId() string { // GetPeerInfoResponse is the response type for GetPeerInfo. type GetPeerInfoResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + unknownFields []byte // LocalPeers is the set of peers loaded. - LocalPeers []*PeerInfo `protobuf:"bytes,1,rep,name=local_peers,json=localPeers,proto3" json:"local_peers,omitempty"` + LocalPeers []*PeerInfo `protobuf:"bytes,1,rep,name=local_peers,json=localPeers,proto3" json:"localPeers,omitempty"` } func (x *GetPeerInfoResponse) Reset() { *x = GetPeerInfoResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_peer_api_api_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) +} + +func (*GetPeerInfoResponse) ProtoMessage() {} + +func (x *GetPeerInfoResponse) GetLocalPeers() []*PeerInfo { + if x != nil { + return x.LocalPeers } + return nil } -func (x *GetPeerInfoResponse) String() string { - return protoimpl.X.MessageStringOf(x) +func (m *IdentifyRequest) CloneVT() *IdentifyRequest { + if m == nil { + return (*IdentifyRequest)(nil) + } + r := new(IdentifyRequest) + if rhs := m.Config; rhs != nil { + r.Config = rhs.CloneVT() + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r } -func (*GetPeerInfoResponse) ProtoMessage() {} +func (m *IdentifyRequest) CloneMessageVT() any { + return m.CloneVT() +} + +func (m *IdentifyResponse) CloneVT() *IdentifyResponse { + if m == nil { + return (*IdentifyResponse)(nil) + } + r := new(IdentifyResponse) + r.ControllerStatus = m.ControllerStatus + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *IdentifyResponse) CloneMessageVT() any { + return m.CloneVT() +} + +func (m *GetPeerInfoRequest) CloneVT() *GetPeerInfoRequest { + if m == nil { + return (*GetPeerInfoRequest)(nil) + } + r := new(GetPeerInfoRequest) + r.PeerId = m.PeerId + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *GetPeerInfoRequest) CloneMessageVT() any { + return m.CloneVT() +} + +func (m *PeerInfo) CloneVT() *PeerInfo { + if m == nil { + return (*PeerInfo)(nil) + } + r := new(PeerInfo) + r.PeerId = m.PeerId + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} -func (x *GetPeerInfoResponse) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_peer_api_api_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) +func (m *PeerInfo) CloneMessageVT() any { + return m.CloneVT() +} + +func (m *GetPeerInfoResponse) CloneVT() *GetPeerInfoResponse { + if m == nil { + return (*GetPeerInfoResponse)(nil) + } + r := new(GetPeerInfoResponse) + if rhs := m.LocalPeers; rhs != nil { + tmpContainer := make([]*PeerInfo, len(rhs)) + for k, v := range rhs { + tmpContainer[k] = v.CloneVT() } - return ms + r.LocalPeers = tmpContainer + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) } - return mi.MessageOf(x) + return r } -// Deprecated: Use GetPeerInfoResponse.ProtoReflect.Descriptor instead. -func (*GetPeerInfoResponse) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_peer_api_api_proto_rawDescGZIP(), []int{4} +func (m *GetPeerInfoResponse) CloneMessageVT() any { + return m.CloneVT() } -func (x *GetPeerInfoResponse) GetLocalPeers() []*PeerInfo { - if x != nil { - return x.LocalPeers +func (this *IdentifyRequest) EqualVT(that *IdentifyRequest) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false } - return nil + if !this.Config.EqualVT(that.Config) { + return false + } + return string(this.unknownFields) == string(that.unknownFields) } -var File_github_com_aperturerobotics_bifrost_peer_api_api_proto protoreflect.FileDescriptor - -var file_github_com_aperturerobotics_bifrost_peer_api_api_proto_rawDesc = []byte{ - 0x0a, 0x36, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, - 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x62, 0x69, - 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2f, 0x70, 0x65, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, - 0x70, 0x69, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x08, 0x70, 0x65, 0x65, 0x72, 0x2e, 0x61, - 0x70, 0x69, 0x1a, 0x40, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, - 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, - 0x62, 0x69, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2f, 0x70, 0x65, 0x65, 0x72, 0x2f, 0x63, 0x6f, 0x6e, - 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x44, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, - 0x2f, 0x61, 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, - 0x73, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x62, 0x75, 0x73, 0x2f, - 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x65, 0x78, 0x65, 0x63, 0x2f, - 0x65, 0x78, 0x65, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x42, 0x0a, 0x0f, 0x49, 0x64, - 0x65, 0x6e, 0x74, 0x69, 0x66, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2f, 0x0a, - 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, - 0x70, 0x65, 0x65, 0x72, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, - 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x22, 0x62, - 0x0a, 0x10, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x4e, 0x0a, 0x11, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, - 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x21, 0x2e, - 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x65, 0x78, 0x65, 0x63, 0x2e, - 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, - 0x52, 0x10, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x22, 0x2d, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x50, 0x65, 0x65, 0x72, 0x49, 0x6e, 0x66, - 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x70, 0x65, 0x65, 0x72, - 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x65, 0x65, 0x72, 0x49, - 0x64, 0x22, 0x23, 0x0a, 0x08, 0x50, 0x65, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x17, 0x0a, - 0x07, 0x70, 0x65, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, - 0x70, 0x65, 0x65, 0x72, 0x49, 0x64, 0x22, 0x4a, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x50, 0x65, 0x65, - 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x33, 0x0a, - 0x0b, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x5f, 0x70, 0x65, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x50, 0x65, - 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0a, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x50, 0x65, 0x65, - 0x72, 0x73, 0x32, 0xa2, 0x01, 0x0a, 0x0b, 0x50, 0x65, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x12, 0x45, 0x0a, 0x08, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x79, 0x12, 0x19, - 0x2e, 0x70, 0x65, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, - 0x66, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x70, 0x65, 0x65, 0x72, - 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x79, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x30, 0x01, 0x12, 0x4c, 0x0a, 0x0b, 0x47, 0x65, 0x74, - 0x50, 0x65, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1c, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x2e, - 0x61, 0x70, 0x69, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x65, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x2e, 0x61, 0x70, - 0x69, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x65, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_github_com_aperturerobotics_bifrost_peer_api_api_proto_rawDescOnce sync.Once - file_github_com_aperturerobotics_bifrost_peer_api_api_proto_rawDescData = file_github_com_aperturerobotics_bifrost_peer_api_api_proto_rawDesc -) +func (this *IdentifyRequest) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*IdentifyRequest) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *IdentifyResponse) EqualVT(that *IdentifyResponse) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.ControllerStatus != that.ControllerStatus { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *IdentifyResponse) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*IdentifyResponse) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *GetPeerInfoRequest) EqualVT(that *GetPeerInfoRequest) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.PeerId != that.PeerId { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *GetPeerInfoRequest) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*GetPeerInfoRequest) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *PeerInfo) EqualVT(that *PeerInfo) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.PeerId != that.PeerId { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} -func file_github_com_aperturerobotics_bifrost_peer_api_api_proto_rawDescGZIP() []byte { - file_github_com_aperturerobotics_bifrost_peer_api_api_proto_rawDescOnce.Do(func() { - file_github_com_aperturerobotics_bifrost_peer_api_api_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_aperturerobotics_bifrost_peer_api_api_proto_rawDescData) +func (this *PeerInfo) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*PeerInfo) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *GetPeerInfoResponse) EqualVT(that *GetPeerInfoResponse) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if len(this.LocalPeers) != len(that.LocalPeers) { + return false + } + for i, vx := range this.LocalPeers { + vy := that.LocalPeers[i] + if p, q := vx, vy; p != q { + if p == nil { + p = &PeerInfo{} + } + if q == nil { + q = &PeerInfo{} + } + if !p.EqualVT(q) { + return false + } + } + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *GetPeerInfoResponse) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*GetPeerInfoResponse) + if !ok { + return false + } + return this.EqualVT(that) +} + +// MarshalProtoJSON marshals the IdentifyRequest message to JSON. +func (x *IdentifyRequest) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return + } + s.WriteObjectStart() + var wroteField bool + if x.Config != nil || s.HasField("config") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("config") + x.Config.MarshalProtoJSON(s.WithField("config")) + } + s.WriteObjectEnd() +} + +// MarshalJSON marshals the IdentifyRequest to JSON. +func (x *IdentifyRequest) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) +} + +// UnmarshalProtoJSON unmarshals the IdentifyRequest message from JSON. +func (x *IdentifyRequest) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { + return + } + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "config": + if s.ReadNil() { + x.Config = nil + return + } + x.Config = &controller.Config{} + x.Config.UnmarshalProtoJSON(s.WithField("config", true)) + } }) - return file_github_com_aperturerobotics_bifrost_peer_api_api_proto_rawDescData -} - -var file_github_com_aperturerobotics_bifrost_peer_api_api_proto_msgTypes = make([]protoimpl.MessageInfo, 5) -var file_github_com_aperturerobotics_bifrost_peer_api_api_proto_goTypes = []interface{}{ - (*IdentifyRequest)(nil), // 0: peer.api.IdentifyRequest - (*IdentifyResponse)(nil), // 1: peer.api.IdentifyResponse - (*GetPeerInfoRequest)(nil), // 2: peer.api.GetPeerInfoRequest - (*PeerInfo)(nil), // 3: peer.api.PeerInfo - (*GetPeerInfoResponse)(nil), // 4: peer.api.GetPeerInfoResponse - (*controller.Config)(nil), // 5: peer.controller.Config - (exec.ControllerStatus)(0), // 6: controller.exec.ControllerStatus -} -var file_github_com_aperturerobotics_bifrost_peer_api_api_proto_depIdxs = []int32{ - 5, // 0: peer.api.IdentifyRequest.config:type_name -> peer.controller.Config - 6, // 1: peer.api.IdentifyResponse.controller_status:type_name -> controller.exec.ControllerStatus - 3, // 2: peer.api.GetPeerInfoResponse.local_peers:type_name -> peer.api.PeerInfo - 0, // 3: peer.api.PeerService.Identify:input_type -> peer.api.IdentifyRequest - 2, // 4: peer.api.PeerService.GetPeerInfo:input_type -> peer.api.GetPeerInfoRequest - 1, // 5: peer.api.PeerService.Identify:output_type -> peer.api.IdentifyResponse - 4, // 6: peer.api.PeerService.GetPeerInfo:output_type -> peer.api.GetPeerInfoResponse - 5, // [5:7] is the sub-list for method output_type - 3, // [3:5] is the sub-list for method input_type - 3, // [3:3] is the sub-list for extension type_name - 3, // [3:3] is the sub-list for extension extendee - 0, // [0:3] is the sub-list for field type_name -} - -func init() { file_github_com_aperturerobotics_bifrost_peer_api_api_proto_init() } -func file_github_com_aperturerobotics_bifrost_peer_api_api_proto_init() { - if File_github_com_aperturerobotics_bifrost_peer_api_api_proto != nil { +} + +// UnmarshalJSON unmarshals the IdentifyRequest from JSON. +func (x *IdentifyRequest) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +// MarshalProtoJSON marshals the IdentifyResponse message to JSON. +func (x *IdentifyResponse) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() return } - if !protoimpl.UnsafeEnabled { - file_github_com_aperturerobotics_bifrost_peer_api_api_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*IdentifyRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil + s.WriteObjectStart() + var wroteField bool + if x.ControllerStatus != 0 || s.HasField("controllerStatus") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("controllerStatus") + x.ControllerStatus.MarshalProtoJSON(s) + } + s.WriteObjectEnd() +} + +// MarshalJSON marshals the IdentifyResponse to JSON. +func (x *IdentifyResponse) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) +} + +// UnmarshalProtoJSON unmarshals the IdentifyResponse message from JSON. +func (x *IdentifyResponse) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { + return + } + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "controller_status", "controllerStatus": + s.AddField("controller_status") + x.ControllerStatus.UnmarshalProtoJSON(s) + } + }) +} + +// UnmarshalJSON unmarshals the IdentifyResponse from JSON. +func (x *IdentifyResponse) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +// MarshalProtoJSON marshals the GetPeerInfoRequest message to JSON. +func (x *GetPeerInfoRequest) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return + } + s.WriteObjectStart() + var wroteField bool + if x.PeerId != "" || s.HasField("peerId") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("peerId") + s.WriteString(x.PeerId) + } + s.WriteObjectEnd() +} + +// MarshalJSON marshals the GetPeerInfoRequest to JSON. +func (x *GetPeerInfoRequest) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) +} + +// UnmarshalProtoJSON unmarshals the GetPeerInfoRequest message from JSON. +func (x *GetPeerInfoRequest) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { + return + } + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "peer_id", "peerId": + s.AddField("peer_id") + x.PeerId = s.ReadString() + } + }) +} + +// UnmarshalJSON unmarshals the GetPeerInfoRequest from JSON. +func (x *GetPeerInfoRequest) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +// MarshalProtoJSON marshals the PeerInfo message to JSON. +func (x *PeerInfo) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return + } + s.WriteObjectStart() + var wroteField bool + if x.PeerId != "" || s.HasField("peerId") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("peerId") + s.WriteString(x.PeerId) + } + s.WriteObjectEnd() +} + +// MarshalJSON marshals the PeerInfo to JSON. +func (x *PeerInfo) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) +} + +// UnmarshalProtoJSON unmarshals the PeerInfo message from JSON. +func (x *PeerInfo) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { + return + } + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "peer_id", "peerId": + s.AddField("peer_id") + x.PeerId = s.ReadString() + } + }) +} + +// UnmarshalJSON unmarshals the PeerInfo from JSON. +func (x *PeerInfo) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +// MarshalProtoJSON marshals the GetPeerInfoResponse message to JSON. +func (x *GetPeerInfoResponse) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return + } + s.WriteObjectStart() + var wroteField bool + if len(x.LocalPeers) > 0 || s.HasField("localPeers") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("localPeers") + s.WriteArrayStart() + var wroteElement bool + for _, element := range x.LocalPeers { + s.WriteMoreIf(&wroteElement) + element.MarshalProtoJSON(s.WithField("localPeers")) + } + s.WriteArrayEnd() + } + s.WriteObjectEnd() +} + +// MarshalJSON marshals the GetPeerInfoResponse to JSON. +func (x *GetPeerInfoResponse) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) +} + +// UnmarshalProtoJSON unmarshals the GetPeerInfoResponse message from JSON. +func (x *GetPeerInfoResponse) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { + return + } + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "local_peers", "localPeers": + s.AddField("local_peers") + if s.ReadNil() { + x.LocalPeers = nil + return } + s.ReadArray(func() { + if s.ReadNil() { + x.LocalPeers = append(x.LocalPeers, nil) + return + } + v := &PeerInfo{} + v.UnmarshalProtoJSON(s.WithField("local_peers", false)) + if s.Err() != nil { + return + } + x.LocalPeers = append(x.LocalPeers, v) + }) } - file_github_com_aperturerobotics_bifrost_peer_api_api_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*IdentifyResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil + }) +} + +// UnmarshalJSON unmarshals the GetPeerInfoResponse from JSON. +func (x *GetPeerInfoResponse) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +func (m *IdentifyRequest) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *IdentifyRequest) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *IdentifyRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.Config != nil { + size, err := m.Config.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *IdentifyResponse) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *IdentifyResponse) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *IdentifyResponse) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.ControllerStatus != 0 { + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(m.ControllerStatus)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *GetPeerInfoRequest) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetPeerInfoRequest) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *GetPeerInfoRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.PeerId) > 0 { + i -= len(m.PeerId) + copy(dAtA[i:], m.PeerId) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.PeerId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *PeerInfo) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PeerInfo) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *PeerInfo) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.PeerId) > 0 { + i -= len(m.PeerId) + copy(dAtA[i:], m.PeerId) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.PeerId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *GetPeerInfoResponse) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GetPeerInfoResponse) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *GetPeerInfoResponse) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.LocalPeers) > 0 { + for iNdEx := len(m.LocalPeers) - 1; iNdEx >= 0; iNdEx-- { + size, err := m.LocalPeers[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err } + i -= size + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *IdentifyRequest) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Config != nil { + l = m.Config.SizeVT() + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *IdentifyResponse) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ControllerStatus != 0 { + n += 1 + protobuf_go_lite.SizeOfVarint(uint64(m.ControllerStatus)) + } + n += len(m.unknownFields) + return n +} + +func (m *GetPeerInfoRequest) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.PeerId) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *PeerInfo) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.PeerId) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *GetPeerInfoResponse) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.LocalPeers) > 0 { + for _, e := range m.LocalPeers { + l = e.SizeVT() + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) } - file_github_com_aperturerobotics_bifrost_peer_api_api_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetPeerInfoRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil + } + n += len(m.unknownFields) + return n +} + +func (m *IdentifyRequest) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break } } - file_github_com_aperturerobotics_bifrost_peer_api_api_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PeerInfo); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: IdentifyRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: IdentifyRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field Config", wireType) } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Config == nil { + m.Config = &controller.Config{} + } + if err := m.Config.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *IdentifyResponse) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: IdentifyResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: IdentifyResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return errors.Errorf("proto: wrong wireType = %d for field ControllerStatus", wireType) + } + m.ControllerStatus = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ControllerStatus |= exec.ControllerStatus(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetPeerInfoRequest) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: GetPeerInfoRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: GetPeerInfoRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field PeerId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PeerId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PeerInfo) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: PeerInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: PeerInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field PeerId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PeerId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy } - file_github_com_aperturerobotics_bifrost_peer_api_api_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetPeerInfoResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *GetPeerInfoResponse) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: GetPeerInfoResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: GetPeerInfoResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field LocalPeers", wireType) } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.LocalPeers = append(m.LocalPeers, &PeerInfo{}) + if err := m.LocalPeers[len(m.LocalPeers)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy } } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_github_com_aperturerobotics_bifrost_peer_api_api_proto_rawDesc, - NumEnums: 0, - NumMessages: 5, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_github_com_aperturerobotics_bifrost_peer_api_api_proto_goTypes, - DependencyIndexes: file_github_com_aperturerobotics_bifrost_peer_api_api_proto_depIdxs, - MessageInfos: file_github_com_aperturerobotics_bifrost_peer_api_api_proto_msgTypes, - }.Build() - File_github_com_aperturerobotics_bifrost_peer_api_api_proto = out.File - file_github_com_aperturerobotics_bifrost_peer_api_api_proto_rawDesc = nil - file_github_com_aperturerobotics_bifrost_peer_api_api_proto_goTypes = nil - file_github_com_aperturerobotics_bifrost_peer_api_api_proto_depIdxs = nil + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil } diff --git a/peer/api/api.pb.ts b/peer/api/api.pb.ts deleted file mode 100644 index a6dcbd25..00000000 --- a/peer/api/api.pb.ts +++ /dev/null @@ -1,710 +0,0 @@ -/* eslint-disable */ -import { - ControllerStatus, - controllerStatusFromJSON, - controllerStatusToJSON, -} from '@go/github.com/aperturerobotics/controllerbus/controller/exec/exec.pb.js' -import Long from 'long' -import _m0 from 'protobufjs/minimal.js' -import { Config } from '../controller/config.pb.js' - -export const protobufPackage = 'peer.api' - -/** IdentifyRequest is a request to load an identity. */ -export interface IdentifyRequest { - /** Config is the request to configure the peer controller. */ - config: Config | undefined -} - -/** IdentifyResponse is a response to an identify request. */ -export interface IdentifyResponse { - /** ControllerStatus is the status of the peer controller. */ - controllerStatus: ControllerStatus -} - -/** GetPeerInfoRequest is the request type for GetPeerInfo. */ -export interface GetPeerInfoRequest { - /** PeerId restricts the response to a specific peer ID. */ - peerId: string -} - -/** PeerInfo is basic information about a peer. */ -export interface PeerInfo { - /** PeerId is the b58 peer ID. */ - peerId: string -} - -/** GetPeerInfoResponse is the response type for GetPeerInfo. */ -export interface GetPeerInfoResponse { - /** LocalPeers is the set of peers loaded. */ - localPeers: PeerInfo[] -} - -function createBaseIdentifyRequest(): IdentifyRequest { - return { config: undefined } -} - -export const IdentifyRequest = { - encode( - message: IdentifyRequest, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.config !== undefined) { - Config.encode(message.config, writer.uint32(10).fork()).ldelim() - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): IdentifyRequest { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseIdentifyRequest() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break - } - - message.config = Config.decode(reader, reader.uint32()) - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [IdentifyRequest.encode(p).finish()] - } - } else { - yield* [IdentifyRequest.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [IdentifyRequest.decode(p)] - } - } else { - yield* [IdentifyRequest.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): IdentifyRequest { - return { - config: isSet(object.config) ? Config.fromJSON(object.config) : undefined, - } - }, - - toJSON(message: IdentifyRequest): unknown { - const obj: any = {} - if (message.config !== undefined) { - obj.config = Config.toJSON(message.config) - } - return obj - }, - - create, I>>( - base?: I, - ): IdentifyRequest { - return IdentifyRequest.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>( - object: I, - ): IdentifyRequest { - const message = createBaseIdentifyRequest() - message.config = - object.config !== undefined && object.config !== null - ? Config.fromPartial(object.config) - : undefined - return message - }, -} - -function createBaseIdentifyResponse(): IdentifyResponse { - return { controllerStatus: 0 } -} - -export const IdentifyResponse = { - encode( - message: IdentifyResponse, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.controllerStatus !== 0) { - writer.uint32(8).int32(message.controllerStatus) - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): IdentifyResponse { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseIdentifyResponse() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 8) { - break - } - - message.controllerStatus = reader.int32() as any - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [IdentifyResponse.encode(p).finish()] - } - } else { - yield* [IdentifyResponse.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [IdentifyResponse.decode(p)] - } - } else { - yield* [IdentifyResponse.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): IdentifyResponse { - return { - controllerStatus: isSet(object.controllerStatus) - ? controllerStatusFromJSON(object.controllerStatus) - : 0, - } - }, - - toJSON(message: IdentifyResponse): unknown { - const obj: any = {} - if (message.controllerStatus !== 0) { - obj.controllerStatus = controllerStatusToJSON(message.controllerStatus) - } - return obj - }, - - create, I>>( - base?: I, - ): IdentifyResponse { - return IdentifyResponse.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>( - object: I, - ): IdentifyResponse { - const message = createBaseIdentifyResponse() - message.controllerStatus = object.controllerStatus ?? 0 - return message - }, -} - -function createBaseGetPeerInfoRequest(): GetPeerInfoRequest { - return { peerId: '' } -} - -export const GetPeerInfoRequest = { - encode( - message: GetPeerInfoRequest, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.peerId !== '') { - writer.uint32(10).string(message.peerId) - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GetPeerInfoRequest { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseGetPeerInfoRequest() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break - } - - message.peerId = reader.string() - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [GetPeerInfoRequest.encode(p).finish()] - } - } else { - yield* [GetPeerInfoRequest.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [GetPeerInfoRequest.decode(p)] - } - } else { - yield* [GetPeerInfoRequest.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): GetPeerInfoRequest { - return { - peerId: isSet(object.peerId) ? globalThis.String(object.peerId) : '', - } - }, - - toJSON(message: GetPeerInfoRequest): unknown { - const obj: any = {} - if (message.peerId !== '') { - obj.peerId = message.peerId - } - return obj - }, - - create, I>>( - base?: I, - ): GetPeerInfoRequest { - return GetPeerInfoRequest.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>( - object: I, - ): GetPeerInfoRequest { - const message = createBaseGetPeerInfoRequest() - message.peerId = object.peerId ?? '' - return message - }, -} - -function createBasePeerInfo(): PeerInfo { - return { peerId: '' } -} - -export const PeerInfo = { - encode( - message: PeerInfo, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.peerId !== '') { - writer.uint32(10).string(message.peerId) - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): PeerInfo { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBasePeerInfo() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break - } - - message.peerId = reader.string() - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [PeerInfo.encode(p).finish()] - } - } else { - yield* [PeerInfo.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [PeerInfo.decode(p)] - } - } else { - yield* [PeerInfo.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): PeerInfo { - return { - peerId: isSet(object.peerId) ? globalThis.String(object.peerId) : '', - } - }, - - toJSON(message: PeerInfo): unknown { - const obj: any = {} - if (message.peerId !== '') { - obj.peerId = message.peerId - } - return obj - }, - - create, I>>(base?: I): PeerInfo { - return PeerInfo.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>(object: I): PeerInfo { - const message = createBasePeerInfo() - message.peerId = object.peerId ?? '' - return message - }, -} - -function createBaseGetPeerInfoResponse(): GetPeerInfoResponse { - return { localPeers: [] } -} - -export const GetPeerInfoResponse = { - encode( - message: GetPeerInfoResponse, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - for (const v of message.localPeers) { - PeerInfo.encode(v!, writer.uint32(10).fork()).ldelim() - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): GetPeerInfoResponse { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseGetPeerInfoResponse() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break - } - - message.localPeers.push(PeerInfo.decode(reader, reader.uint32())) - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [GetPeerInfoResponse.encode(p).finish()] - } - } else { - yield* [GetPeerInfoResponse.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [GetPeerInfoResponse.decode(p)] - } - } else { - yield* [GetPeerInfoResponse.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): GetPeerInfoResponse { - return { - localPeers: globalThis.Array.isArray(object?.localPeers) - ? object.localPeers.map((e: any) => PeerInfo.fromJSON(e)) - : [], - } - }, - - toJSON(message: GetPeerInfoResponse): unknown { - const obj: any = {} - if (message.localPeers?.length) { - obj.localPeers = message.localPeers.map((e) => PeerInfo.toJSON(e)) - } - return obj - }, - - create, I>>( - base?: I, - ): GetPeerInfoResponse { - return GetPeerInfoResponse.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>( - object: I, - ): GetPeerInfoResponse { - const message = createBaseGetPeerInfoResponse() - message.localPeers = - object.localPeers?.map((e) => PeerInfo.fromPartial(e)) || [] - return message - }, -} - -/** PeerService implements a bifrost peer service. */ -export interface PeerService { - /** Identify loads and manages a private key identity. */ - Identify( - request: IdentifyRequest, - abortSignal?: AbortSignal, - ): AsyncIterable - /** GetPeerInfo returns information about attached peers. */ - GetPeerInfo( - request: GetPeerInfoRequest, - abortSignal?: AbortSignal, - ): Promise -} - -export const PeerServiceServiceName = 'peer.api.PeerService' -export class PeerServiceClientImpl implements PeerService { - private readonly rpc: Rpc - private readonly service: string - constructor(rpc: Rpc, opts?: { service?: string }) { - this.service = opts?.service || PeerServiceServiceName - this.rpc = rpc - this.Identify = this.Identify.bind(this) - this.GetPeerInfo = this.GetPeerInfo.bind(this) - } - Identify( - request: IdentifyRequest, - abortSignal?: AbortSignal, - ): AsyncIterable { - const data = IdentifyRequest.encode(request).finish() - const result = this.rpc.serverStreamingRequest( - this.service, - 'Identify', - data, - abortSignal || undefined, - ) - return IdentifyResponse.decodeTransform(result) - } - - GetPeerInfo( - request: GetPeerInfoRequest, - abortSignal?: AbortSignal, - ): Promise { - const data = GetPeerInfoRequest.encode(request).finish() - const promise = this.rpc.request( - this.service, - 'GetPeerInfo', - data, - abortSignal || undefined, - ) - return promise.then((data) => - GetPeerInfoResponse.decode(_m0.Reader.create(data)), - ) - } -} - -/** PeerService implements a bifrost peer service. */ -export type PeerServiceDefinition = typeof PeerServiceDefinition -export const PeerServiceDefinition = { - name: 'PeerService', - fullName: 'peer.api.PeerService', - methods: { - /** Identify loads and manages a private key identity. */ - identify: { - name: 'Identify', - requestType: IdentifyRequest, - requestStream: false, - responseType: IdentifyResponse, - responseStream: true, - options: {}, - }, - /** GetPeerInfo returns information about attached peers. */ - getPeerInfo: { - name: 'GetPeerInfo', - requestType: GetPeerInfoRequest, - requestStream: false, - responseType: GetPeerInfoResponse, - responseStream: false, - options: {}, - }, - }, -} as const - -interface Rpc { - request( - service: string, - method: string, - data: Uint8Array, - abortSignal?: AbortSignal, - ): Promise - clientStreamingRequest( - service: string, - method: string, - data: AsyncIterable, - abortSignal?: AbortSignal, - ): Promise - serverStreamingRequest( - service: string, - method: string, - data: Uint8Array, - abortSignal?: AbortSignal, - ): AsyncIterable - bidirectionalStreamingRequest( - service: string, - method: string, - data: AsyncIterable, - abortSignal?: AbortSignal, - ): AsyncIterable -} - -type Builtin = - | Date - | Function - | Uint8Array - | string - | number - | boolean - | undefined - -export type DeepPartial = T extends Builtin - ? T - : T extends Long - ? string | number | Long - : T extends globalThis.Array - ? globalThis.Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends { $case: string } - ? { [K in keyof Omit]?: DeepPartial } & { - $case: T['$case'] - } - : T extends {} - ? { [K in keyof T]?: DeepPartial } - : Partial - -type KeysOfUnion = T extends T ? keyof T : never -export type Exact = P extends Builtin - ? P - : P & { [K in keyof P]: Exact } & { - [K in Exclude>]: never - } - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any - _m0.configure() -} - -function isSet(value: any): boolean { - return value !== null && value !== undefined -} diff --git a/peer/api/api_drpc.pb.go b/peer/api/api_drpc.pb.go deleted file mode 100644 index 9ba565f5..00000000 --- a/peer/api/api_drpc.pb.go +++ /dev/null @@ -1,167 +0,0 @@ -// Code generated by protoc-gen-go-drpc. DO NOT EDIT. -// protoc-gen-go-drpc version: v0.0.34 -// source: github.com/aperturerobotics/bifrost/peer/api/api.proto - -package peer_api - -import ( - context "context" - errors "errors" - - drpc1 "github.com/planetscale/vtprotobuf/codec/drpc" - drpc "storj.io/drpc" - drpcerr "storj.io/drpc/drpcerr" -) - -type drpcEncoding_File_github_com_aperturerobotics_bifrost_peer_api_api_proto struct{} - -func (drpcEncoding_File_github_com_aperturerobotics_bifrost_peer_api_api_proto) Marshal(msg drpc.Message) ([]byte, error) { - return drpc1.Marshal(msg) -} - -func (drpcEncoding_File_github_com_aperturerobotics_bifrost_peer_api_api_proto) Unmarshal(buf []byte, msg drpc.Message) error { - return drpc1.Unmarshal(buf, msg) -} - -type DRPCPeerServiceClient interface { - DRPCConn() drpc.Conn - - Identify(ctx context.Context, in *IdentifyRequest) (DRPCPeerService_IdentifyClient, error) - GetPeerInfo(ctx context.Context, in *GetPeerInfoRequest) (*GetPeerInfoResponse, error) -} - -type drpcPeerServiceClient struct { - cc drpc.Conn -} - -func NewDRPCPeerServiceClient(cc drpc.Conn) DRPCPeerServiceClient { - return &drpcPeerServiceClient{cc} -} - -func (c *drpcPeerServiceClient) DRPCConn() drpc.Conn { return c.cc } - -func (c *drpcPeerServiceClient) Identify(ctx context.Context, in *IdentifyRequest) (DRPCPeerService_IdentifyClient, error) { - stream, err := c.cc.NewStream(ctx, "/peer.api.PeerService/Identify", drpcEncoding_File_github_com_aperturerobotics_bifrost_peer_api_api_proto{}) - if err != nil { - return nil, err - } - x := &drpcPeerService_IdentifyClient{stream} - if err := x.MsgSend(in, drpcEncoding_File_github_com_aperturerobotics_bifrost_peer_api_api_proto{}); err != nil { - return nil, err - } - if err := x.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type DRPCPeerService_IdentifyClient interface { - drpc.Stream - Recv() (*IdentifyResponse, error) -} - -type drpcPeerService_IdentifyClient struct { - drpc.Stream -} - -func (x *drpcPeerService_IdentifyClient) GetStream() drpc.Stream { - return x.Stream -} - -func (x *drpcPeerService_IdentifyClient) Recv() (*IdentifyResponse, error) { - m := new(IdentifyResponse) - if err := x.MsgRecv(m, drpcEncoding_File_github_com_aperturerobotics_bifrost_peer_api_api_proto{}); err != nil { - return nil, err - } - return m, nil -} - -func (x *drpcPeerService_IdentifyClient) RecvMsg(m *IdentifyResponse) error { - return x.MsgRecv(m, drpcEncoding_File_github_com_aperturerobotics_bifrost_peer_api_api_proto{}) -} - -func (c *drpcPeerServiceClient) GetPeerInfo(ctx context.Context, in *GetPeerInfoRequest) (*GetPeerInfoResponse, error) { - out := new(GetPeerInfoResponse) - err := c.cc.Invoke(ctx, "/peer.api.PeerService/GetPeerInfo", drpcEncoding_File_github_com_aperturerobotics_bifrost_peer_api_api_proto{}, in, out) - if err != nil { - return nil, err - } - return out, nil -} - -type DRPCPeerServiceServer interface { - Identify(*IdentifyRequest, DRPCPeerService_IdentifyStream) error - GetPeerInfo(context.Context, *GetPeerInfoRequest) (*GetPeerInfoResponse, error) -} - -type DRPCPeerServiceUnimplementedServer struct{} - -func (s *DRPCPeerServiceUnimplementedServer) Identify(*IdentifyRequest, DRPCPeerService_IdentifyStream) error { - return drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) -} - -func (s *DRPCPeerServiceUnimplementedServer) GetPeerInfo(context.Context, *GetPeerInfoRequest) (*GetPeerInfoResponse, error) { - return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) -} - -type DRPCPeerServiceDescription struct{} - -func (DRPCPeerServiceDescription) NumMethods() int { return 2 } - -func (DRPCPeerServiceDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver, interface{}, bool) { - switch n { - case 0: - return "/peer.api.PeerService/Identify", drpcEncoding_File_github_com_aperturerobotics_bifrost_peer_api_api_proto{}, - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return nil, srv.(DRPCPeerServiceServer). - Identify( - in1.(*IdentifyRequest), - &drpcPeerService_IdentifyStream{in2.(drpc.Stream)}, - ) - }, DRPCPeerServiceServer.Identify, true - case 1: - return "/peer.api.PeerService/GetPeerInfo", drpcEncoding_File_github_com_aperturerobotics_bifrost_peer_api_api_proto{}, - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return srv.(DRPCPeerServiceServer). - GetPeerInfo( - ctx, - in1.(*GetPeerInfoRequest), - ) - }, DRPCPeerServiceServer.GetPeerInfo, true - default: - return "", nil, nil, nil, false - } -} - -func DRPCRegisterPeerService(mux drpc.Mux, impl DRPCPeerServiceServer) error { - return mux.Register(impl, DRPCPeerServiceDescription{}) -} - -type DRPCPeerService_IdentifyStream interface { - drpc.Stream - Send(*IdentifyResponse) error -} - -type drpcPeerService_IdentifyStream struct { - drpc.Stream -} - -func (x *drpcPeerService_IdentifyStream) Send(m *IdentifyResponse) error { - return x.MsgSend(m, drpcEncoding_File_github_com_aperturerobotics_bifrost_peer_api_api_proto{}) -} - -type DRPCPeerService_GetPeerInfoStream interface { - drpc.Stream - SendAndClose(*GetPeerInfoResponse) error -} - -type drpcPeerService_GetPeerInfoStream struct { - drpc.Stream -} - -func (x *drpcPeerService_GetPeerInfoStream) SendAndClose(m *GetPeerInfoResponse) error { - if err := x.MsgSend(m, drpcEncoding_File_github_com_aperturerobotics_bifrost_peer_api_api_proto{}); err != nil { - return err - } - return x.CloseSend() -} diff --git a/peer/api/api_pb.ts b/peer/api/api_pb.ts new file mode 100644 index 00000000..20be4e4b --- /dev/null +++ b/peer/api/api_pb.ts @@ -0,0 +1,291 @@ +// @generated by protoc-gen-es v1.8.0 with parameter "target=ts,ts_nocheck=false" +// @generated from file github.com/aperturerobotics/bifrost/peer/api/api.proto (package peer.api, syntax proto3) +/* eslint-disable */ + +import type { + BinaryReadOptions, + FieldList, + JsonReadOptions, + JsonValue, + PartialMessage, + PlainMessage, +} from '@bufbuild/protobuf' +import { Message, proto3 } from '@bufbuild/protobuf' +import { Config } from '../controller/config_pb.js' +import { ControllerStatus } from '../../../controllerbus/controller/exec/exec_pb.js' + +/** + * IdentifyRequest is a request to load an identity. + * + * @generated from message peer.api.IdentifyRequest + */ +export class IdentifyRequest extends Message { + /** + * Config is the request to configure the peer controller. + * + * @generated from field: peer.controller.Config config = 1; + */ + config?: Config + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'peer.api.IdentifyRequest' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: 'config', kind: 'message', T: Config }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): IdentifyRequest { + return new IdentifyRequest().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): IdentifyRequest { + return new IdentifyRequest().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): IdentifyRequest { + return new IdentifyRequest().fromJsonString(jsonString, options) + } + + static equals( + a: IdentifyRequest | PlainMessage | undefined, + b: IdentifyRequest | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(IdentifyRequest, a, b) + } +} + +/** + * IdentifyResponse is a response to an identify request. + * + * @generated from message peer.api.IdentifyResponse + */ +export class IdentifyResponse extends Message { + /** + * ControllerStatus is the status of the peer controller. + * + * @generated from field: controller.exec.ControllerStatus controller_status = 1; + */ + controllerStatus = ControllerStatus.ControllerStatus_UNKNOWN + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'peer.api.IdentifyResponse' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { + no: 1, + name: 'controller_status', + kind: 'enum', + T: proto3.getEnumType(ControllerStatus), + }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): IdentifyResponse { + return new IdentifyResponse().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): IdentifyResponse { + return new IdentifyResponse().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): IdentifyResponse { + return new IdentifyResponse().fromJsonString(jsonString, options) + } + + static equals( + a: IdentifyResponse | PlainMessage | undefined, + b: IdentifyResponse | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(IdentifyResponse, a, b) + } +} + +/** + * GetPeerInfoRequest is the request type for GetPeerInfo. + * + * @generated from message peer.api.GetPeerInfoRequest + */ +export class GetPeerInfoRequest extends Message { + /** + * PeerId restricts the response to a specific peer ID. + * + * @generated from field: string peer_id = 1; + */ + peerId = '' + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'peer.api.GetPeerInfoRequest' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: 'peer_id', kind: 'scalar', T: 9 /* ScalarType.STRING */ }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): GetPeerInfoRequest { + return new GetPeerInfoRequest().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): GetPeerInfoRequest { + return new GetPeerInfoRequest().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): GetPeerInfoRequest { + return new GetPeerInfoRequest().fromJsonString(jsonString, options) + } + + static equals( + a: GetPeerInfoRequest | PlainMessage | undefined, + b: GetPeerInfoRequest | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(GetPeerInfoRequest, a, b) + } +} + +/** + * PeerInfo is basic information about a peer. + * + * @generated from message peer.api.PeerInfo + */ +export class PeerInfo extends Message { + /** + * PeerId is the b58 peer ID. + * + * @generated from field: string peer_id = 1; + */ + peerId = '' + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'peer.api.PeerInfo' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: 'peer_id', kind: 'scalar', T: 9 /* ScalarType.STRING */ }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): PeerInfo { + return new PeerInfo().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): PeerInfo { + return new PeerInfo().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): PeerInfo { + return new PeerInfo().fromJsonString(jsonString, options) + } + + static equals( + a: PeerInfo | PlainMessage | undefined, + b: PeerInfo | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(PeerInfo, a, b) + } +} + +/** + * GetPeerInfoResponse is the response type for GetPeerInfo. + * + * @generated from message peer.api.GetPeerInfoResponse + */ +export class GetPeerInfoResponse extends Message { + /** + * LocalPeers is the set of peers loaded. + * + * @generated from field: repeated peer.api.PeerInfo local_peers = 1; + */ + localPeers: PeerInfo[] = [] + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'peer.api.GetPeerInfoResponse' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { + no: 1, + name: 'local_peers', + kind: 'message', + T: PeerInfo, + repeated: true, + }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): GetPeerInfoResponse { + return new GetPeerInfoResponse().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): GetPeerInfoResponse { + return new GetPeerInfoResponse().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): GetPeerInfoResponse { + return new GetPeerInfoResponse().fromJsonString(jsonString, options) + } + + static equals( + a: GetPeerInfoResponse | PlainMessage | undefined, + b: GetPeerInfoResponse | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(GetPeerInfoResponse, a, b) + } +} diff --git a/peer/api/api_srpc.pb.go b/peer/api/api_srpc.pb.go index 21e283c0..f487d2f9 100644 --- a/peer/api/api_srpc.pb.go +++ b/peer/api/api_srpc.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-srpc. DO NOT EDIT. -// protoc-gen-srpc version: v0.27.3 +// protoc-gen-srpc version: v0.31.2 // source: github.com/aperturerobotics/bifrost/peer/api/api.proto package peer_api diff --git a/peer/api/api_srpc.pb.ts b/peer/api/api_srpc.pb.ts new file mode 100644 index 00000000..ecd0aa59 --- /dev/null +++ b/peer/api/api_srpc.pb.ts @@ -0,0 +1,123 @@ +// @generated by protoc-gen-es-starpc none with parameter "target=ts,ts_nocheck=false" +// @generated from file github.com/aperturerobotics/bifrost/peer/api/api.proto (package peer.api, syntax proto3) +/* eslint-disable */ + +import { + GetPeerInfoRequest, + GetPeerInfoResponse, + IdentifyRequest, + IdentifyResponse, +} from './api_pb.js' +import type { PartialMessage } from '@bufbuild/protobuf' +import { MethodKind } from '@bufbuild/protobuf' +import { buildDecodeMessageTransform, MessageStream, ProtoRpc } from 'starpc' + +/** + * PeerService implements a bifrost peer service. + * + * @generated from service peer.api.PeerService + */ +export const PeerServiceDefinition = { + typeName: 'peer.api.PeerService', + methods: { + /** + * Identify loads and manages a private key identity. + * + * @generated from rpc peer.api.PeerService.Identify + */ + Identify: { + name: 'Identify', + I: IdentifyRequest, + O: IdentifyResponse, + kind: MethodKind.ServerStreaming, + }, + /** + * GetPeerInfo returns information about attached peers. + * + * @generated from rpc peer.api.PeerService.GetPeerInfo + */ + GetPeerInfo: { + name: 'GetPeerInfo', + I: GetPeerInfoRequest, + O: GetPeerInfoResponse, + kind: MethodKind.Unary, + }, + }, +} as const + +/** + * PeerService implements a bifrost peer service. + * + * @generated from service peer.api.PeerService + */ +export interface PeerService { + /** + * Identify loads and manages a private key identity. + * + * @generated from rpc peer.api.PeerService.Identify + */ + Identify( + request: PartialMessage, + abortSignal?: AbortSignal, + ): MessageStream + + /** + * GetPeerInfo returns information about attached peers. + * + * @generated from rpc peer.api.PeerService.GetPeerInfo + */ + GetPeerInfo( + request: PartialMessage, + abortSignal?: AbortSignal, + ): Promise> +} + +export const PeerServiceServiceName = PeerServiceDefinition.typeName + +export class PeerServiceClient implements PeerService { + private readonly rpc: ProtoRpc + private readonly service: string + constructor(rpc: ProtoRpc, opts?: { service?: string }) { + this.service = opts?.service || PeerServiceServiceName + this.rpc = rpc + this.Identify = this.Identify.bind(this) + this.GetPeerInfo = this.GetPeerInfo.bind(this) + } + /** + * Identify loads and manages a private key identity. + * + * @generated from rpc peer.api.PeerService.Identify + */ + Identify( + request: PartialMessage, + abortSignal?: AbortSignal, + ): MessageStream { + const requestMsg = new IdentifyRequest(request) + const result = this.rpc.serverStreamingRequest( + this.service, + PeerServiceDefinition.methods.Identify.name, + requestMsg.toBinary(), + abortSignal || undefined, + ) + return buildDecodeMessageTransform(IdentifyResponse)(result) + } + + /** + * GetPeerInfo returns information about attached peers. + * + * @generated from rpc peer.api.PeerService.GetPeerInfo + */ + async GetPeerInfo( + request: PartialMessage, + abortSignal?: AbortSignal, + ): Promise> { + const requestMsg = new GetPeerInfoRequest(request) + const result = await this.rpc.request( + this.service, + PeerServiceDefinition.methods.GetPeerInfo.name, + requestMsg.toBinary(), + abortSignal || undefined, + ) + return GetPeerInfoResponse.fromBinary(result) + } +} diff --git a/peer/api/api_vtproto.pb.go b/peer/api/api_vtproto.pb.go deleted file mode 100644 index a293231a..00000000 --- a/peer/api/api_vtproto.pb.go +++ /dev/null @@ -1,945 +0,0 @@ -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// protoc-gen-go-vtproto version: v0.6.0 -// source: github.com/aperturerobotics/bifrost/peer/api/api.proto - -package peer_api - -import ( - fmt "fmt" - io "io" - - controller "github.com/aperturerobotics/bifrost/peer/controller" - exec "github.com/aperturerobotics/controllerbus/controller/exec" - protohelpers "github.com/planetscale/vtprotobuf/protohelpers" - proto "google.golang.org/protobuf/proto" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) -) - -func (m *IdentifyRequest) CloneVT() *IdentifyRequest { - if m == nil { - return (*IdentifyRequest)(nil) - } - r := new(IdentifyRequest) - if rhs := m.Config; rhs != nil { - if vtpb, ok := interface{}(rhs).(interface{ CloneVT() *controller.Config }); ok { - r.Config = vtpb.CloneVT() - } else { - r.Config = proto.Clone(rhs).(*controller.Config) - } - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *IdentifyRequest) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *IdentifyResponse) CloneVT() *IdentifyResponse { - if m == nil { - return (*IdentifyResponse)(nil) - } - r := new(IdentifyResponse) - r.ControllerStatus = m.ControllerStatus - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *IdentifyResponse) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *GetPeerInfoRequest) CloneVT() *GetPeerInfoRequest { - if m == nil { - return (*GetPeerInfoRequest)(nil) - } - r := new(GetPeerInfoRequest) - r.PeerId = m.PeerId - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *GetPeerInfoRequest) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *PeerInfo) CloneVT() *PeerInfo { - if m == nil { - return (*PeerInfo)(nil) - } - r := new(PeerInfo) - r.PeerId = m.PeerId - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *PeerInfo) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *GetPeerInfoResponse) CloneVT() *GetPeerInfoResponse { - if m == nil { - return (*GetPeerInfoResponse)(nil) - } - r := new(GetPeerInfoResponse) - if rhs := m.LocalPeers; rhs != nil { - tmpContainer := make([]*PeerInfo, len(rhs)) - for k, v := range rhs { - tmpContainer[k] = v.CloneVT() - } - r.LocalPeers = tmpContainer - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *GetPeerInfoResponse) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (this *IdentifyRequest) EqualVT(that *IdentifyRequest) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if equal, ok := interface{}(this.Config).(interface{ EqualVT(*controller.Config) bool }); ok { - if !equal.EqualVT(that.Config) { - return false - } - } else if !proto.Equal(this.Config, that.Config) { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *IdentifyRequest) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*IdentifyRequest) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *IdentifyResponse) EqualVT(that *IdentifyResponse) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.ControllerStatus != that.ControllerStatus { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *IdentifyResponse) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*IdentifyResponse) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *GetPeerInfoRequest) EqualVT(that *GetPeerInfoRequest) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.PeerId != that.PeerId { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *GetPeerInfoRequest) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*GetPeerInfoRequest) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *PeerInfo) EqualVT(that *PeerInfo) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.PeerId != that.PeerId { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *PeerInfo) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*PeerInfo) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *GetPeerInfoResponse) EqualVT(that *GetPeerInfoResponse) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if len(this.LocalPeers) != len(that.LocalPeers) { - return false - } - for i, vx := range this.LocalPeers { - vy := that.LocalPeers[i] - if p, q := vx, vy; p != q { - if p == nil { - p = &PeerInfo{} - } - if q == nil { - q = &PeerInfo{} - } - if !p.EqualVT(q) { - return false - } - } - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *GetPeerInfoResponse) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*GetPeerInfoResponse) - if !ok { - return false - } - return this.EqualVT(that) -} -func (m *IdentifyRequest) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *IdentifyRequest) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *IdentifyRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Config != nil { - if vtmsg, ok := interface{}(m.Config).(interface { - MarshalToSizedBufferVT([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.Config) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *IdentifyResponse) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *IdentifyResponse) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *IdentifyResponse) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.ControllerStatus != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.ControllerStatus)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *GetPeerInfoRequest) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GetPeerInfoRequest) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *GetPeerInfoRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.PeerId) > 0 { - i -= len(m.PeerId) - copy(dAtA[i:], m.PeerId) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.PeerId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *PeerInfo) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PeerInfo) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *PeerInfo) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.PeerId) > 0 { - i -= len(m.PeerId) - copy(dAtA[i:], m.PeerId) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.PeerId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *GetPeerInfoResponse) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *GetPeerInfoResponse) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *GetPeerInfoResponse) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.LocalPeers) > 0 { - for iNdEx := len(m.LocalPeers) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.LocalPeers[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *IdentifyRequest) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Config != nil { - if size, ok := interface{}(m.Config).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.Config) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *IdentifyResponse) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ControllerStatus != 0 { - n += 1 + protohelpers.SizeOfVarint(uint64(m.ControllerStatus)) - } - n += len(m.unknownFields) - return n -} - -func (m *GetPeerInfoRequest) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.PeerId) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *PeerInfo) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.PeerId) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *GetPeerInfoResponse) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.LocalPeers) > 0 { - for _, e := range m.LocalPeers { - l = e.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - } - n += len(m.unknownFields) - return n -} - -func (m *IdentifyRequest) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: IdentifyRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: IdentifyRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Config", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Config == nil { - m.Config = &controller.Config{} - } - if unmarshal, ok := interface{}(m.Config).(interface { - UnmarshalVT([]byte) error - }); ok { - if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - } else { - if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.Config); err != nil { - return err - } - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *IdentifyResponse) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: IdentifyResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: IdentifyResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ControllerStatus", wireType) - } - m.ControllerStatus = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ControllerStatus |= exec.ControllerStatus(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GetPeerInfoRequest) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GetPeerInfoRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GetPeerInfoRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PeerId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PeerId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PeerInfo) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PeerInfo: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PeerInfo: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PeerId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PeerId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GetPeerInfoResponse) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GetPeerInfoResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GetPeerInfoResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LocalPeers", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.LocalPeers = append(m.LocalPeers, &PeerInfo{}) - if err := m.LocalPeers[len(m.LocalPeers)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} diff --git a/peer/controller/config.pb.go b/peer/controller/config.pb.go index 454590c6..ee5382f1 100644 --- a/peer/controller/config.pb.go +++ b/peer/controller/config.pb.go @@ -1,77 +1,39 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0-devel -// protoc v5.26.1 +// Code generated by protoc-gen-go-lite. DO NOT EDIT. +// protoc-gen-go-lite version: v0.4.5 // source: github.com/aperturerobotics/bifrost/peer/controller/config.proto package peer_controller import ( - reflect "reflect" - sync "sync" + io "io" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) + protobuf_go_lite "github.com/aperturerobotics/protobuf-go-lite" + json "github.com/aperturerobotics/protobuf-go-lite/json" + errors "github.com/pkg/errors" ) // Config is the peer controller config. type Config struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + unknownFields []byte // PrivKey is the peer private key in either b58 or PEM format. // See confparse.MarshalPrivateKey. // If not set, the peer private key will be unavailable. - PrivKey string `protobuf:"bytes,1,opt,name=priv_key,json=privKey,proto3" json:"priv_key,omitempty"` + PrivKey string `protobuf:"bytes,1,opt,name=priv_key,json=privKey,proto3" json:"privKey,omitempty"` // PubKey is the peer public key. // Ignored if priv_key is set. - PubKey string `protobuf:"bytes,2,opt,name=pub_key,json=pubKey,proto3" json:"pub_key,omitempty"` + PubKey string `protobuf:"bytes,2,opt,name=pub_key,json=pubKey,proto3" json:"pubKey,omitempty"` // PeerId is the peer identifier. // Ignored if priv_key or pub_key are set. // The peer ID should contain the public key. - PeerId string `protobuf:"bytes,3,opt,name=peer_id,json=peerId,proto3" json:"peer_id,omitempty"` + PeerId string `protobuf:"bytes,3,opt,name=peer_id,json=peerId,proto3" json:"peerId,omitempty"` } func (x *Config) Reset() { *x = Config{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_peer_controller_config_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Config) String() string { - return protoimpl.X.MessageStringOf(x) } func (*Config) ProtoMessage() {} -func (x *Config) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_peer_controller_config_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 Config.ProtoReflect.Descriptor instead. -func (*Config) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_peer_controller_config_proto_rawDescGZIP(), []int{0} -} - func (x *Config) GetPrivKey() string { if x != nil { return x.PrivKey @@ -93,82 +55,329 @@ func (x *Config) GetPeerId() string { return "" } -var File_github_com_aperturerobotics_bifrost_peer_controller_config_proto protoreflect.FileDescriptor +func (m *Config) CloneVT() *Config { + if m == nil { + return (*Config)(nil) + } + r := new(Config) + r.PrivKey = m.PrivKey + r.PubKey = m.PubKey + r.PeerId = m.PeerId + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} -var file_github_com_aperturerobotics_bifrost_peer_controller_config_proto_rawDesc = []byte{ - 0x0a, 0x40, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, - 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x62, 0x69, - 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2f, 0x70, 0x65, 0x65, 0x72, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x12, 0x0f, 0x70, 0x65, 0x65, 0x72, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, - 0x6c, 0x65, 0x72, 0x22, 0x55, 0x0a, 0x06, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x19, 0x0a, - 0x08, 0x70, 0x72, 0x69, 0x76, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x07, 0x70, 0x72, 0x69, 0x76, 0x4b, 0x65, 0x79, 0x12, 0x17, 0x0a, 0x07, 0x70, 0x75, 0x62, 0x5f, - 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x75, 0x62, 0x4b, 0x65, - 0x79, 0x12, 0x17, 0x0a, 0x07, 0x70, 0x65, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x06, 0x70, 0x65, 0x65, 0x72, 0x49, 0x64, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, +func (m *Config) CloneMessageVT() any { + return m.CloneVT() } -var ( - file_github_com_aperturerobotics_bifrost_peer_controller_config_proto_rawDescOnce sync.Once - file_github_com_aperturerobotics_bifrost_peer_controller_config_proto_rawDescData = file_github_com_aperturerobotics_bifrost_peer_controller_config_proto_rawDesc -) +func (this *Config) EqualVT(that *Config) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.PrivKey != that.PrivKey { + return false + } + if this.PubKey != that.PubKey { + return false + } + if this.PeerId != that.PeerId { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} -func file_github_com_aperturerobotics_bifrost_peer_controller_config_proto_rawDescGZIP() []byte { - file_github_com_aperturerobotics_bifrost_peer_controller_config_proto_rawDescOnce.Do(func() { - file_github_com_aperturerobotics_bifrost_peer_controller_config_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_aperturerobotics_bifrost_peer_controller_config_proto_rawDescData) - }) - return file_github_com_aperturerobotics_bifrost_peer_controller_config_proto_rawDescData +func (this *Config) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*Config) + if !ok { + return false + } + return this.EqualVT(that) } -var file_github_com_aperturerobotics_bifrost_peer_controller_config_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_github_com_aperturerobotics_bifrost_peer_controller_config_proto_goTypes = []interface{}{ - (*Config)(nil), // 0: peer.controller.Config +// MarshalProtoJSON marshals the Config message to JSON. +func (x *Config) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return + } + s.WriteObjectStart() + var wroteField bool + if x.PrivKey != "" || s.HasField("privKey") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("privKey") + s.WriteString(x.PrivKey) + } + if x.PubKey != "" || s.HasField("pubKey") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("pubKey") + s.WriteString(x.PubKey) + } + if x.PeerId != "" || s.HasField("peerId") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("peerId") + s.WriteString(x.PeerId) + } + s.WriteObjectEnd() } -var file_github_com_aperturerobotics_bifrost_peer_controller_config_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] 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 + +// MarshalJSON marshals the Config to JSON. +func (x *Config) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) } -func init() { file_github_com_aperturerobotics_bifrost_peer_controller_config_proto_init() } -func file_github_com_aperturerobotics_bifrost_peer_controller_config_proto_init() { - if File_github_com_aperturerobotics_bifrost_peer_controller_config_proto != nil { +// UnmarshalProtoJSON unmarshals the Config message from JSON. +func (x *Config) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { return } - if !protoimpl.UnsafeEnabled { - file_github_com_aperturerobotics_bifrost_peer_controller_config_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Config); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "priv_key", "privKey": + s.AddField("priv_key") + x.PrivKey = s.ReadString() + case "pub_key", "pubKey": + s.AddField("pub_key") + x.PubKey = s.ReadString() + case "peer_id", "peerId": + s.AddField("peer_id") + x.PeerId = s.ReadString() + } + }) +} + +// UnmarshalJSON unmarshals the Config from JSON. +func (x *Config) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +func (m *Config) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Config) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.PeerId) > 0 { + i -= len(m.PeerId) + copy(dAtA[i:], m.PeerId) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.PeerId))) + i-- + dAtA[i] = 0x1a + } + if len(m.PubKey) > 0 { + i -= len(m.PubKey) + copy(dAtA[i:], m.PubKey) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.PubKey))) + i-- + dAtA[i] = 0x12 + } + if len(m.PrivKey) > 0 { + i -= len(m.PrivKey) + copy(dAtA[i:], m.PrivKey) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.PrivKey))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Config) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.PrivKey) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + l = len(m.PubKey) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + l = len(m.PeerId) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *Config) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: Config: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: Config: illegal tag %d (wire type %d)", fieldNum, wire) } + switch fieldNum { + case 1: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field PrivKey", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PrivKey = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field PubKey", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PubKey = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field PeerId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PeerId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_github_com_aperturerobotics_bifrost_peer_controller_config_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_github_com_aperturerobotics_bifrost_peer_controller_config_proto_goTypes, - DependencyIndexes: file_github_com_aperturerobotics_bifrost_peer_controller_config_proto_depIdxs, - MessageInfos: file_github_com_aperturerobotics_bifrost_peer_controller_config_proto_msgTypes, - }.Build() - File_github_com_aperturerobotics_bifrost_peer_controller_config_proto = out.File - file_github_com_aperturerobotics_bifrost_peer_controller_config_proto_rawDesc = nil - file_github_com_aperturerobotics_bifrost_peer_controller_config_proto_goTypes = nil - file_github_com_aperturerobotics_bifrost_peer_controller_config_proto_depIdxs = nil + return nil } diff --git a/peer/controller/config.pb.ts b/peer/controller/config.pb.ts deleted file mode 100644 index 67f4d35b..00000000 --- a/peer/controller/config.pb.ts +++ /dev/null @@ -1,194 +0,0 @@ -/* eslint-disable */ -import Long from 'long' -import _m0 from 'protobufjs/minimal.js' - -export const protobufPackage = 'peer.controller' - -/** Config is the peer controller config. */ -export interface Config { - /** - * PrivKey is the peer private key in either b58 or PEM format. - * See confparse.MarshalPrivateKey. - * If not set, the peer private key will be unavailable. - */ - privKey: string - /** - * PubKey is the peer public key. - * Ignored if priv_key is set. - */ - pubKey: string - /** - * PeerId is the peer identifier. - * Ignored if priv_key or pub_key are set. - * The peer ID should contain the public key. - */ - peerId: string -} - -function createBaseConfig(): Config { - return { privKey: '', pubKey: '', peerId: '' } -} - -export const Config = { - encode( - message: Config, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.privKey !== '') { - writer.uint32(10).string(message.privKey) - } - if (message.pubKey !== '') { - writer.uint32(18).string(message.pubKey) - } - if (message.peerId !== '') { - writer.uint32(26).string(message.peerId) - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Config { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseConfig() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break - } - - message.privKey = reader.string() - continue - case 2: - if (tag !== 18) { - break - } - - message.pubKey = reader.string() - continue - case 3: - if (tag !== 26) { - break - } - - message.peerId = reader.string() - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: AsyncIterable | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config.encode(p).finish()] - } - } else { - yield* [Config.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config.decode(p)] - } - } else { - yield* [Config.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): Config { - return { - privKey: isSet(object.privKey) ? globalThis.String(object.privKey) : '', - pubKey: isSet(object.pubKey) ? globalThis.String(object.pubKey) : '', - peerId: isSet(object.peerId) ? globalThis.String(object.peerId) : '', - } - }, - - toJSON(message: Config): unknown { - const obj: any = {} - if (message.privKey !== '') { - obj.privKey = message.privKey - } - if (message.pubKey !== '') { - obj.pubKey = message.pubKey - } - if (message.peerId !== '') { - obj.peerId = message.peerId - } - return obj - }, - - create, I>>(base?: I): Config { - return Config.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>(object: I): Config { - const message = createBaseConfig() - message.privKey = object.privKey ?? '' - message.pubKey = object.pubKey ?? '' - message.peerId = object.peerId ?? '' - return message - }, -} - -type Builtin = - | Date - | Function - | Uint8Array - | string - | number - | boolean - | undefined - -export type DeepPartial = T extends Builtin - ? T - : T extends Long - ? string | number | Long - : T extends globalThis.Array - ? globalThis.Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends { $case: string } - ? { [K in keyof Omit]?: DeepPartial } & { - $case: T['$case'] - } - : T extends {} - ? { [K in keyof T]?: DeepPartial } - : Partial - -type KeysOfUnion = T extends T ? keyof T : never -export type Exact = P extends Builtin - ? P - : P & { [K in keyof P]: Exact } & { - [K in Exclude>]: never - } - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any - _m0.configure() -} - -function isSet(value: any): boolean { - return value !== null && value !== undefined -} diff --git a/peer/controller/config_pb.ts b/peer/controller/config_pb.ts new file mode 100644 index 00000000..e517efbd --- /dev/null +++ b/peer/controller/config_pb.ts @@ -0,0 +1,87 @@ +// @generated by protoc-gen-es v1.8.0 with parameter "target=ts,ts_nocheck=false" +// @generated from file github.com/aperturerobotics/bifrost/peer/controller/config.proto (package peer.controller, syntax proto3) +/* eslint-disable */ + +import type { + BinaryReadOptions, + FieldList, + JsonReadOptions, + JsonValue, + PartialMessage, + PlainMessage, +} from '@bufbuild/protobuf' +import { Message, proto3 } from '@bufbuild/protobuf' + +/** + * Config is the peer controller config. + * + * @generated from message peer.controller.Config + */ +export class Config extends Message { + /** + * PrivKey is the peer private key in either b58 or PEM format. + * See confparse.MarshalPrivateKey. + * If not set, the peer private key will be unavailable. + * + * @generated from field: string priv_key = 1; + */ + privKey = '' + + /** + * PubKey is the peer public key. + * Ignored if priv_key is set. + * + * @generated from field: string pub_key = 2; + */ + pubKey = '' + + /** + * PeerId is the peer identifier. + * Ignored if priv_key or pub_key are set. + * The peer ID should contain the public key. + * + * @generated from field: string peer_id = 3; + */ + peerId = '' + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'peer.controller.Config' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: 'priv_key', kind: 'scalar', T: 9 /* ScalarType.STRING */ }, + { no: 2, name: 'pub_key', kind: 'scalar', T: 9 /* ScalarType.STRING */ }, + { no: 3, name: 'peer_id', kind: 'scalar', T: 9 /* ScalarType.STRING */ }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): Config { + return new Config().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): Config { + return new Config().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): Config { + return new Config().fromJsonString(jsonString, options) + } + + static equals( + a: Config | PlainMessage | undefined, + b: Config | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(Config, a, b) + } +} diff --git a/peer/controller/config_vtproto.pb.go b/peer/controller/config_vtproto.pb.go deleted file mode 100644 index 7a6c8e6a..00000000 --- a/peer/controller/config_vtproto.pb.go +++ /dev/null @@ -1,289 +0,0 @@ -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// protoc-gen-go-vtproto version: v0.6.0 -// source: github.com/aperturerobotics/bifrost/peer/controller/config.proto - -package peer_controller - -import ( - fmt "fmt" - io "io" - - protohelpers "github.com/planetscale/vtprotobuf/protohelpers" - proto "google.golang.org/protobuf/proto" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) -) - -func (m *Config) CloneVT() *Config { - if m == nil { - return (*Config)(nil) - } - r := new(Config) - r.PrivKey = m.PrivKey - r.PubKey = m.PubKey - r.PeerId = m.PeerId - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Config) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (this *Config) EqualVT(that *Config) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.PrivKey != that.PrivKey { - return false - } - if this.PubKey != that.PubKey { - return false - } - if this.PeerId != that.PeerId { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Config) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Config) - if !ok { - return false - } - return this.EqualVT(that) -} -func (m *Config) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Config) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.PeerId) > 0 { - i -= len(m.PeerId) - copy(dAtA[i:], m.PeerId) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.PeerId))) - i-- - dAtA[i] = 0x1a - } - if len(m.PubKey) > 0 { - i -= len(m.PubKey) - copy(dAtA[i:], m.PubKey) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.PubKey))) - i-- - dAtA[i] = 0x12 - } - if len(m.PrivKey) > 0 { - i -= len(m.PrivKey) - copy(dAtA[i:], m.PrivKey) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.PrivKey))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Config) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.PrivKey) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - l = len(m.PubKey) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - l = len(m.PeerId) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *Config) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Config: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Config: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PrivKey", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PrivKey = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PubKey", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PubKey = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PeerId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PeerId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} diff --git a/peer/peer.pb.go b/peer/peer.pb.go index c3c57e04..6ca62011 100644 --- a/peer/peer.pb.go +++ b/peer/peer.pb.go @@ -1,76 +1,38 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0-devel -// protoc v5.26.1 +// Code generated by protoc-gen-go-lite. DO NOT EDIT. +// protoc-gen-go-lite version: v0.4.5 // source: github.com/aperturerobotics/bifrost/peer/peer.proto package peer import ( - reflect "reflect" - sync "sync" + io "io" hash "github.com/aperturerobotics/bifrost/hash" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) + protobuf_go_lite "github.com/aperturerobotics/protobuf-go-lite" + json "github.com/aperturerobotics/protobuf-go-lite/json" + errors "github.com/pkg/errors" ) // Signature contains a signature by a peer. type Signature struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + unknownFields []byte // PubKey is the public key of the peer. // May be empty if the public key is to be inferred from context. - PubKey []byte `protobuf:"bytes,1,opt,name=pub_key,json=pubKey,proto3" json:"pub_key,omitempty"` + PubKey []byte `protobuf:"bytes,1,opt,name=pub_key,json=pubKey,proto3" json:"pubKey,omitempty"` // HashType is the hash type used to hash the data. // The signature is then of the hash bytes (usually 32). - HashType hash.HashType `protobuf:"varint,2,opt,name=hash_type,json=hashType,proto3,enum=hash.HashType" json:"hash_type,omitempty"` + HashType hash.HashType `protobuf:"varint,2,opt,name=hash_type,json=hashType,proto3" json:"hashType,omitempty"` // SigData contains the signature data. // The format is defined by the key type. - SigData []byte `protobuf:"bytes,3,opt,name=sig_data,json=sigData,proto3" json:"sig_data,omitempty"` + SigData []byte `protobuf:"bytes,3,opt,name=sig_data,json=sigData,proto3" json:"sigData,omitempty"` } func (x *Signature) Reset() { *x = Signature{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_peer_peer_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Signature) String() string { - return protoimpl.X.MessageStringOf(x) } func (*Signature) ProtoMessage() {} -func (x *Signature) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_peer_peer_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 Signature.ProtoReflect.Descriptor instead. -func (*Signature) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_peer_peer_proto_rawDescGZIP(), []int{0} -} - func (x *Signature) GetPubKey() []byte { if x != nil { return x.PubKey @@ -94,12 +56,9 @@ func (x *Signature) GetSigData() []byte { // SignedMsg is a message from a peer with a signature. type SignedMsg struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + unknownFields []byte // FromPeerId is the peer identifier of the sender. - FromPeerId string `protobuf:"bytes,1,opt,name=from_peer_id,json=fromPeerId,proto3" json:"from_peer_id,omitempty"` + FromPeerId string `protobuf:"bytes,1,opt,name=from_peer_id,json=fromPeerId,proto3" json:"fromPeerId,omitempty"` // Signature is the sender signature. // Should not contain PubKey, which is inferred from peer id. Signature *Signature `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` @@ -109,36 +68,10 @@ type SignedMsg struct { func (x *SignedMsg) Reset() { *x = SignedMsg{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_peer_peer_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SignedMsg) String() string { - return protoimpl.X.MessageStringOf(x) } func (*SignedMsg) ProtoMessage() {} -func (x *SignedMsg) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_peer_peer_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 SignedMsg.ProtoReflect.Descriptor instead. -func (*SignedMsg) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_peer_peer_proto_rawDescGZIP(), []int{1} -} - func (x *SignedMsg) GetFromPeerId() string { if x != nil { return x.FromPeerId @@ -160,108 +93,667 @@ func (x *SignedMsg) GetData() []byte { return nil } -var File_github_com_aperturerobotics_bifrost_peer_peer_proto protoreflect.FileDescriptor - -var file_github_com_aperturerobotics_bifrost_peer_peer_proto_rawDesc = []byte{ - 0x0a, 0x33, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, - 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x62, 0x69, - 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2f, 0x70, 0x65, 0x65, 0x72, 0x2f, 0x70, 0x65, 0x65, 0x72, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x04, 0x70, 0x65, 0x65, 0x72, 0x1a, 0x33, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, - 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x62, 0x69, 0x66, 0x72, 0x6f, 0x73, 0x74, - 0x2f, 0x68, 0x61, 0x73, 0x68, 0x2f, 0x68, 0x61, 0x73, 0x68, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x22, 0x6c, 0x0a, 0x09, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x17, 0x0a, - 0x07, 0x70, 0x75, 0x62, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, - 0x70, 0x75, 0x62, 0x4b, 0x65, 0x79, 0x12, 0x2b, 0x0a, 0x09, 0x68, 0x61, 0x73, 0x68, 0x5f, 0x74, - 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0e, 0x2e, 0x68, 0x61, 0x73, 0x68, - 0x2e, 0x48, 0x61, 0x73, 0x68, 0x54, 0x79, 0x70, 0x65, 0x52, 0x08, 0x68, 0x61, 0x73, 0x68, 0x54, - 0x79, 0x70, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x69, 0x67, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x73, 0x69, 0x67, 0x44, 0x61, 0x74, 0x61, 0x22, 0x70, - 0x0a, 0x09, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x4d, 0x73, 0x67, 0x12, 0x20, 0x0a, 0x0c, 0x66, - 0x72, 0x6f, 0x6d, 0x5f, 0x70, 0x65, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0a, 0x66, 0x72, 0x6f, 0x6d, 0x50, 0x65, 0x65, 0x72, 0x49, 0x64, 0x12, 0x2d, 0x0a, - 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x0f, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, - 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x12, 0x0a, 0x04, - 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_github_com_aperturerobotics_bifrost_peer_peer_proto_rawDescOnce sync.Once - file_github_com_aperturerobotics_bifrost_peer_peer_proto_rawDescData = file_github_com_aperturerobotics_bifrost_peer_peer_proto_rawDesc -) +func (m *Signature) CloneVT() *Signature { + if m == nil { + return (*Signature)(nil) + } + r := new(Signature) + r.HashType = m.HashType + if rhs := m.PubKey; rhs != nil { + tmpBytes := make([]byte, len(rhs)) + copy(tmpBytes, rhs) + r.PubKey = tmpBytes + } + if rhs := m.SigData; rhs != nil { + tmpBytes := make([]byte, len(rhs)) + copy(tmpBytes, rhs) + r.SigData = tmpBytes + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *Signature) CloneMessageVT() any { + return m.CloneVT() +} + +func (m *SignedMsg) CloneVT() *SignedMsg { + if m == nil { + return (*SignedMsg)(nil) + } + r := new(SignedMsg) + r.FromPeerId = m.FromPeerId + r.Signature = m.Signature.CloneVT() + if rhs := m.Data; rhs != nil { + tmpBytes := make([]byte, len(rhs)) + copy(tmpBytes, rhs) + r.Data = tmpBytes + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *SignedMsg) CloneMessageVT() any { + return m.CloneVT() +} + +func (this *Signature) EqualVT(that *Signature) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if string(this.PubKey) != string(that.PubKey) { + return false + } + if this.HashType != that.HashType { + return false + } + if string(this.SigData) != string(that.SigData) { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *Signature) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*Signature) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *SignedMsg) EqualVT(that *SignedMsg) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.FromPeerId != that.FromPeerId { + return false + } + if !this.Signature.EqualVT(that.Signature) { + return false + } + if string(this.Data) != string(that.Data) { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *SignedMsg) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*SignedMsg) + if !ok { + return false + } + return this.EqualVT(that) +} + +// MarshalProtoJSON marshals the Signature message to JSON. +func (x *Signature) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return + } + s.WriteObjectStart() + var wroteField bool + if len(x.PubKey) > 0 || s.HasField("pubKey") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("pubKey") + s.WriteBytes(x.PubKey) + } + if x.HashType != 0 || s.HasField("hashType") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("hashType") + x.HashType.MarshalProtoJSON(s) + } + if len(x.SigData) > 0 || s.HasField("sigData") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("sigData") + s.WriteBytes(x.SigData) + } + s.WriteObjectEnd() +} -func file_github_com_aperturerobotics_bifrost_peer_peer_proto_rawDescGZIP() []byte { - file_github_com_aperturerobotics_bifrost_peer_peer_proto_rawDescOnce.Do(func() { - file_github_com_aperturerobotics_bifrost_peer_peer_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_aperturerobotics_bifrost_peer_peer_proto_rawDescData) +// MarshalJSON marshals the Signature to JSON. +func (x *Signature) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) +} + +// UnmarshalProtoJSON unmarshals the Signature message from JSON. +func (x *Signature) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { + return + } + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "pub_key", "pubKey": + s.AddField("pub_key") + x.PubKey = s.ReadBytes() + case "hash_type", "hashType": + s.AddField("hash_type") + x.HashType.UnmarshalProtoJSON(s) + case "sig_data", "sigData": + s.AddField("sig_data") + x.SigData = s.ReadBytes() + } }) - return file_github_com_aperturerobotics_bifrost_peer_peer_proto_rawDescData } -var file_github_com_aperturerobotics_bifrost_peer_peer_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_github_com_aperturerobotics_bifrost_peer_peer_proto_goTypes = []interface{}{ - (*Signature)(nil), // 0: peer.Signature - (*SignedMsg)(nil), // 1: peer.SignedMsg - (hash.HashType)(0), // 2: hash.HashType +// UnmarshalJSON unmarshals the Signature from JSON. +func (x *Signature) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) } -var file_github_com_aperturerobotics_bifrost_peer_peer_proto_depIdxs = []int32{ - 2, // 0: peer.Signature.hash_type:type_name -> hash.HashType - 0, // 1: peer.SignedMsg.signature:type_name -> peer.Signature - 2, // [2:2] is the sub-list for method output_type - 2, // [2:2] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name + +// MarshalProtoJSON marshals the SignedMsg message to JSON. +func (x *SignedMsg) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return + } + s.WriteObjectStart() + var wroteField bool + if x.FromPeerId != "" || s.HasField("fromPeerId") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("fromPeerId") + s.WriteString(x.FromPeerId) + } + if x.Signature != nil || s.HasField("signature") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("signature") + x.Signature.MarshalProtoJSON(s.WithField("signature")) + } + if len(x.Data) > 0 || s.HasField("data") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("data") + s.WriteBytes(x.Data) + } + s.WriteObjectEnd() } -func init() { file_github_com_aperturerobotics_bifrost_peer_peer_proto_init() } -func file_github_com_aperturerobotics_bifrost_peer_peer_proto_init() { - if File_github_com_aperturerobotics_bifrost_peer_peer_proto != nil { +// MarshalJSON marshals the SignedMsg to JSON. +func (x *SignedMsg) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) +} + +// UnmarshalProtoJSON unmarshals the SignedMsg message from JSON. +func (x *SignedMsg) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { return } - if !protoimpl.UnsafeEnabled { - file_github_com_aperturerobotics_bifrost_peer_peer_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Signature); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "from_peer_id", "fromPeerId": + s.AddField("from_peer_id") + x.FromPeerId = s.ReadString() + case "signature": + if s.ReadNil() { + x.Signature = nil + return + } + x.Signature = &Signature{} + x.Signature.UnmarshalProtoJSON(s.WithField("signature", true)) + case "data": + s.AddField("data") + x.Data = s.ReadBytes() + } + }) +} + +// UnmarshalJSON unmarshals the SignedMsg from JSON. +func (x *SignedMsg) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +func (m *Signature) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Signature) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *Signature) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.SigData) > 0 { + i -= len(m.SigData) + copy(dAtA[i:], m.SigData) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.SigData))) + i-- + dAtA[i] = 0x1a + } + if m.HashType != 0 { + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(m.HashType)) + i-- + dAtA[i] = 0x10 + } + if len(m.PubKey) > 0 { + i -= len(m.PubKey) + copy(dAtA[i:], m.PubKey) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.PubKey))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *SignedMsg) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SignedMsg) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *SignedMsg) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.Data) > 0 { + i -= len(m.Data) + copy(dAtA[i:], m.Data) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.Data))) + i-- + dAtA[i] = 0x1a + } + if m.Signature != nil { + size, err := m.Signature.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x12 + } + if len(m.FromPeerId) > 0 { + i -= len(m.FromPeerId) + copy(dAtA[i:], m.FromPeerId) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.FromPeerId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Signature) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.PubKey) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + if m.HashType != 0 { + n += 1 + protobuf_go_lite.SizeOfVarint(uint64(m.HashType)) + } + l = len(m.SigData) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *SignedMsg) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.FromPeerId) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + if m.Signature != nil { + l = m.Signature.SizeVT() + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + l = len(m.Data) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *Signature) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: Signature: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: Signature: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field PubKey", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PubKey = append(m.PubKey[:0], dAtA[iNdEx:postIndex]...) + if m.PubKey == nil { + m.PubKey = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return errors.Errorf("proto: wrong wireType = %d for field HashType", wireType) } + m.HashType = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.HashType |= hash.HashType(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field SigData", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SigData = append(m.SigData[:0], dAtA[iNdEx:postIndex]...) + if m.SigData == nil { + m.SigData = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SignedMsg) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: SignedMsg: wiretype end group for non-group") } - file_github_com_aperturerobotics_bifrost_peer_peer_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SignedMsg); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil + if fieldNum <= 0 { + return errors.Errorf("proto: SignedMsg: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field FromPeerId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FromPeerId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field Signature", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Signature == nil { + m.Signature = &Signature{} + } + if err := m.Signature.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) + if m.Data == nil { + m.Data = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy } } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_github_com_aperturerobotics_bifrost_peer_peer_proto_rawDesc, - NumEnums: 0, - NumMessages: 2, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_github_com_aperturerobotics_bifrost_peer_peer_proto_goTypes, - DependencyIndexes: file_github_com_aperturerobotics_bifrost_peer_peer_proto_depIdxs, - MessageInfos: file_github_com_aperturerobotics_bifrost_peer_peer_proto_msgTypes, - }.Build() - File_github_com_aperturerobotics_bifrost_peer_peer_proto = out.File - file_github_com_aperturerobotics_bifrost_peer_peer_proto_rawDesc = nil - file_github_com_aperturerobotics_bifrost_peer_peer_proto_goTypes = nil - file_github_com_aperturerobotics_bifrost_peer_peer_proto_depIdxs = nil + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil } diff --git a/peer/peer.pb.ts b/peer/peer.pb.ts deleted file mode 100644 index a32ef942..00000000 --- a/peer/peer.pb.ts +++ /dev/null @@ -1,379 +0,0 @@ -/* eslint-disable */ -import Long from 'long' -import _m0 from 'protobufjs/minimal.js' -import { HashType, hashTypeFromJSON, hashTypeToJSON } from '../hash/hash.pb.js' - -export const protobufPackage = 'peer' - -/** Signature contains a signature by a peer. */ -export interface Signature { - /** - * PubKey is the public key of the peer. - * May be empty if the public key is to be inferred from context. - */ - pubKey: Uint8Array - /** - * HashType is the hash type used to hash the data. - * The signature is then of the hash bytes (usually 32). - */ - hashType: HashType - /** - * SigData contains the signature data. - * The format is defined by the key type. - */ - sigData: Uint8Array -} - -/** SignedMsg is a message from a peer with a signature. */ -export interface SignedMsg { - /** FromPeerId is the peer identifier of the sender. */ - fromPeerId: string - /** - * Signature is the sender signature. - * Should not contain PubKey, which is inferred from peer id. - */ - signature: Signature | undefined - /** Data is the signed data. */ - data: Uint8Array -} - -function createBaseSignature(): Signature { - return { pubKey: new Uint8Array(0), hashType: 0, sigData: new Uint8Array(0) } -} - -export const Signature = { - encode( - message: Signature, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.pubKey.length !== 0) { - writer.uint32(10).bytes(message.pubKey) - } - if (message.hashType !== 0) { - writer.uint32(16).int32(message.hashType) - } - if (message.sigData.length !== 0) { - writer.uint32(26).bytes(message.sigData) - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Signature { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseSignature() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break - } - - message.pubKey = reader.bytes() - continue - case 2: - if (tag !== 16) { - break - } - - message.hashType = reader.int32() as any - continue - case 3: - if (tag !== 26) { - break - } - - message.sigData = reader.bytes() - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Signature.encode(p).finish()] - } - } else { - yield* [Signature.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Signature.decode(p)] - } - } else { - yield* [Signature.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): Signature { - return { - pubKey: isSet(object.pubKey) - ? bytesFromBase64(object.pubKey) - : new Uint8Array(0), - hashType: isSet(object.hashType) ? hashTypeFromJSON(object.hashType) : 0, - sigData: isSet(object.sigData) - ? bytesFromBase64(object.sigData) - : new Uint8Array(0), - } - }, - - toJSON(message: Signature): unknown { - const obj: any = {} - if (message.pubKey.length !== 0) { - obj.pubKey = base64FromBytes(message.pubKey) - } - if (message.hashType !== 0) { - obj.hashType = hashTypeToJSON(message.hashType) - } - if (message.sigData.length !== 0) { - obj.sigData = base64FromBytes(message.sigData) - } - return obj - }, - - create, I>>(base?: I): Signature { - return Signature.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>( - object: I, - ): Signature { - const message = createBaseSignature() - message.pubKey = object.pubKey ?? new Uint8Array(0) - message.hashType = object.hashType ?? 0 - message.sigData = object.sigData ?? new Uint8Array(0) - return message - }, -} - -function createBaseSignedMsg(): SignedMsg { - return { fromPeerId: '', signature: undefined, data: new Uint8Array(0) } -} - -export const SignedMsg = { - encode( - message: SignedMsg, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.fromPeerId !== '') { - writer.uint32(10).string(message.fromPeerId) - } - if (message.signature !== undefined) { - Signature.encode(message.signature, writer.uint32(18).fork()).ldelim() - } - if (message.data.length !== 0) { - writer.uint32(26).bytes(message.data) - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): SignedMsg { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseSignedMsg() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break - } - - message.fromPeerId = reader.string() - continue - case 2: - if (tag !== 18) { - break - } - - message.signature = Signature.decode(reader, reader.uint32()) - continue - case 3: - if (tag !== 26) { - break - } - - message.data = reader.bytes() - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [SignedMsg.encode(p).finish()] - } - } else { - yield* [SignedMsg.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [SignedMsg.decode(p)] - } - } else { - yield* [SignedMsg.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): SignedMsg { - return { - fromPeerId: isSet(object.fromPeerId) - ? globalThis.String(object.fromPeerId) - : '', - signature: isSet(object.signature) - ? Signature.fromJSON(object.signature) - : undefined, - data: isSet(object.data) - ? bytesFromBase64(object.data) - : new Uint8Array(0), - } - }, - - toJSON(message: SignedMsg): unknown { - const obj: any = {} - if (message.fromPeerId !== '') { - obj.fromPeerId = message.fromPeerId - } - if (message.signature !== undefined) { - obj.signature = Signature.toJSON(message.signature) - } - if (message.data.length !== 0) { - obj.data = base64FromBytes(message.data) - } - return obj - }, - - create, I>>(base?: I): SignedMsg { - return SignedMsg.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>( - object: I, - ): SignedMsg { - const message = createBaseSignedMsg() - message.fromPeerId = object.fromPeerId ?? '' - message.signature = - object.signature !== undefined && object.signature !== null - ? Signature.fromPartial(object.signature) - : undefined - message.data = object.data ?? new Uint8Array(0) - return message - }, -} - -function bytesFromBase64(b64: string): Uint8Array { - if ((globalThis as any).Buffer) { - return Uint8Array.from(globalThis.Buffer.from(b64, 'base64')) - } else { - const bin = globalThis.atob(b64) - const arr = new Uint8Array(bin.length) - for (let i = 0; i < bin.length; ++i) { - arr[i] = bin.charCodeAt(i) - } - return arr - } -} - -function base64FromBytes(arr: Uint8Array): string { - if ((globalThis as any).Buffer) { - return globalThis.Buffer.from(arr).toString('base64') - } else { - const bin: string[] = [] - arr.forEach((byte) => { - bin.push(globalThis.String.fromCharCode(byte)) - }) - return globalThis.btoa(bin.join('')) - } -} - -type Builtin = - | Date - | Function - | Uint8Array - | string - | number - | boolean - | undefined - -export type DeepPartial = T extends Builtin - ? T - : T extends Long - ? string | number | Long - : T extends globalThis.Array - ? globalThis.Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends { $case: string } - ? { [K in keyof Omit]?: DeepPartial } & { - $case: T['$case'] - } - : T extends {} - ? { [K in keyof T]?: DeepPartial } - : Partial - -type KeysOfUnion = T extends T ? keyof T : never -export type Exact = P extends Builtin - ? P - : P & { [K in keyof P]: Exact } & { - [K in Exclude>]: never - } - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any - _m0.configure() -} - -function isSet(value: any): boolean { - return value !== null && value !== undefined -} diff --git a/peer/peer_pb.ts b/peer/peer_pb.ts new file mode 100644 index 00000000..b7dd4c49 --- /dev/null +++ b/peer/peer_pb.ts @@ -0,0 +1,161 @@ +// @generated by protoc-gen-es v1.8.0 with parameter "target=ts,ts_nocheck=false" +// @generated from file github.com/aperturerobotics/bifrost/peer/peer.proto (package peer, syntax proto3) +/* eslint-disable */ + +import type { + BinaryReadOptions, + FieldList, + JsonReadOptions, + JsonValue, + PartialMessage, + PlainMessage, +} from '@bufbuild/protobuf' +import { Message, proto3 } from '@bufbuild/protobuf' +import { HashType } from '../hash/hash_pb.js' + +/** + * Signature contains a signature by a peer. + * + * @generated from message peer.Signature + */ +export class Signature extends Message { + /** + * PubKey is the public key of the peer. + * May be empty if the public key is to be inferred from context. + * + * @generated from field: bytes pub_key = 1; + */ + pubKey = new Uint8Array(0) + + /** + * HashType is the hash type used to hash the data. + * The signature is then of the hash bytes (usually 32). + * + * @generated from field: hash.HashType hash_type = 2; + */ + hashType = HashType.HashType_UNKNOWN + + /** + * SigData contains the signature data. + * The format is defined by the key type. + * + * @generated from field: bytes sig_data = 3; + */ + sigData = new Uint8Array(0) + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'peer.Signature' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: 'pub_key', kind: 'scalar', T: 12 /* ScalarType.BYTES */ }, + { no: 2, name: 'hash_type', kind: 'enum', T: proto3.getEnumType(HashType) }, + { no: 3, name: 'sig_data', kind: 'scalar', T: 12 /* ScalarType.BYTES */ }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): Signature { + return new Signature().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): Signature { + return new Signature().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): Signature { + return new Signature().fromJsonString(jsonString, options) + } + + static equals( + a: Signature | PlainMessage | undefined, + b: Signature | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(Signature, a, b) + } +} + +/** + * SignedMsg is a message from a peer with a signature. + * + * @generated from message peer.SignedMsg + */ +export class SignedMsg extends Message { + /** + * FromPeerId is the peer identifier of the sender. + * + * @generated from field: string from_peer_id = 1; + */ + fromPeerId = '' + + /** + * Signature is the sender signature. + * Should not contain PubKey, which is inferred from peer id. + * + * @generated from field: peer.Signature signature = 2; + */ + signature?: Signature + + /** + * Data is the signed data. + * + * @generated from field: bytes data = 3; + */ + data = new Uint8Array(0) + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'peer.SignedMsg' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { + no: 1, + name: 'from_peer_id', + kind: 'scalar', + T: 9 /* ScalarType.STRING */, + }, + { no: 2, name: 'signature', kind: 'message', T: Signature }, + { no: 3, name: 'data', kind: 'scalar', T: 12 /* ScalarType.BYTES */ }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): SignedMsg { + return new SignedMsg().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): SignedMsg { + return new SignedMsg().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): SignedMsg { + return new SignedMsg().fromJsonString(jsonString, options) + } + + static equals( + a: SignedMsg | PlainMessage | undefined, + b: SignedMsg | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(SignedMsg, a, b) + } +} diff --git a/peer/peer_vtproto.pb.go b/peer/peer_vtproto.pb.go deleted file mode 100644 index ca31361d..00000000 --- a/peer/peer_vtproto.pb.go +++ /dev/null @@ -1,566 +0,0 @@ -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// protoc-gen-go-vtproto version: v0.6.0 -// source: github.com/aperturerobotics/bifrost/peer/peer.proto - -package peer - -import ( - fmt "fmt" - io "io" - - hash "github.com/aperturerobotics/bifrost/hash" - protohelpers "github.com/planetscale/vtprotobuf/protohelpers" - proto "google.golang.org/protobuf/proto" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) -) - -func (m *Signature) CloneVT() *Signature { - if m == nil { - return (*Signature)(nil) - } - r := new(Signature) - r.HashType = m.HashType - if rhs := m.PubKey; rhs != nil { - tmpBytes := make([]byte, len(rhs)) - copy(tmpBytes, rhs) - r.PubKey = tmpBytes - } - if rhs := m.SigData; rhs != nil { - tmpBytes := make([]byte, len(rhs)) - copy(tmpBytes, rhs) - r.SigData = tmpBytes - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Signature) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *SignedMsg) CloneVT() *SignedMsg { - if m == nil { - return (*SignedMsg)(nil) - } - r := new(SignedMsg) - r.FromPeerId = m.FromPeerId - r.Signature = m.Signature.CloneVT() - if rhs := m.Data; rhs != nil { - tmpBytes := make([]byte, len(rhs)) - copy(tmpBytes, rhs) - r.Data = tmpBytes - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *SignedMsg) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (this *Signature) EqualVT(that *Signature) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if string(this.PubKey) != string(that.PubKey) { - return false - } - if this.HashType != that.HashType { - return false - } - if string(this.SigData) != string(that.SigData) { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Signature) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Signature) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *SignedMsg) EqualVT(that *SignedMsg) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.FromPeerId != that.FromPeerId { - return false - } - if !this.Signature.EqualVT(that.Signature) { - return false - } - if string(this.Data) != string(that.Data) { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *SignedMsg) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*SignedMsg) - if !ok { - return false - } - return this.EqualVT(that) -} -func (m *Signature) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Signature) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Signature) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.SigData) > 0 { - i -= len(m.SigData) - copy(dAtA[i:], m.SigData) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.SigData))) - i-- - dAtA[i] = 0x1a - } - if m.HashType != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.HashType)) - i-- - dAtA[i] = 0x10 - } - if len(m.PubKey) > 0 { - i -= len(m.PubKey) - copy(dAtA[i:], m.PubKey) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.PubKey))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *SignedMsg) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *SignedMsg) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *SignedMsg) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Data) > 0 { - i -= len(m.Data) - copy(dAtA[i:], m.Data) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Data))) - i-- - dAtA[i] = 0x1a - } - if m.Signature != nil { - size, err := m.Signature.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x12 - } - if len(m.FromPeerId) > 0 { - i -= len(m.FromPeerId) - copy(dAtA[i:], m.FromPeerId) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.FromPeerId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Signature) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.PubKey) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.HashType != 0 { - n += 1 + protohelpers.SizeOfVarint(uint64(m.HashType)) - } - l = len(m.SigData) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *SignedMsg) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.FromPeerId) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.Signature != nil { - l = m.Signature.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - l = len(m.Data) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *Signature) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Signature: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Signature: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PubKey", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PubKey = append(m.PubKey[:0], dAtA[iNdEx:postIndex]...) - if m.PubKey == nil { - m.PubKey = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field HashType", wireType) - } - m.HashType = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.HashType |= hash.HashType(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SigData", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SigData = append(m.SigData[:0], dAtA[iNdEx:postIndex]...) - if m.SigData == nil { - m.SigData = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SignedMsg) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: SignedMsg: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SignedMsg: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FromPeerId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.FromPeerId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Signature == nil { - m.Signature = &Signature{} - } - if err := m.Signature.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) - if m.Data == nil { - m.Data = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} diff --git a/peer/signed-msg.go b/peer/signed-msg.go index 4e5e4282..3040279c 100644 --- a/peer/signed-msg.go +++ b/peer/signed-msg.go @@ -8,7 +8,6 @@ import ( crypto "github.com/libp2p/go-libp2p/core/crypto" "github.com/pkg/errors" "github.com/zeebo/blake3" - "google.golang.org/protobuf/proto" ) // NewSignedMsg constructs/signs/encodes a new signed message. @@ -34,7 +33,7 @@ func NewSignedMsg( // UnmarshalSignedMsg parses a signed message. func UnmarshalSignedMsg(data []byte) (*SignedMsg, error) { m := &SignedMsg{} - err := proto.Unmarshal(data, m) + err := m.UnmarshalVT(data) if err == nil { err = m.Validate() } diff --git a/pubsub/api/api.go b/pubsub/api/api.go new file mode 100644 index 00000000..b10eb26e --- /dev/null +++ b/pubsub/api/api.go @@ -0,0 +1 @@ +package pubsub_api diff --git a/pubsub/api/api.pb.go b/pubsub/api/api.pb.go index d3294113..4f678b59 100644 --- a/pubsub/api/api.pb.go +++ b/pubsub/api/api.pb.go @@ -1,78 +1,40 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0-devel -// protoc v5.26.1 +// Code generated by protoc-gen-go-lite. DO NOT EDIT. +// protoc-gen-go-lite version: v0.4.5 // source: github.com/aperturerobotics/bifrost/pubsub/api/api.proto package pubsub_api import ( - reflect "reflect" - sync "sync" + io "io" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) + protobuf_go_lite "github.com/aperturerobotics/protobuf-go-lite" + json "github.com/aperturerobotics/protobuf-go-lite/json" + errors "github.com/pkg/errors" ) // SubcribeRequest is a pubsub subscription request message. type SubscribeRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + unknownFields []byte // ChannelId is the channel id to subscribe to. // Must be sent before / with publish. // Cannot change the channel ID after first transmission. - ChannelId string `protobuf:"bytes,1,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` + ChannelId string `protobuf:"bytes,1,opt,name=channel_id,json=channelId,proto3" json:"channelId,omitempty"` // PeerId is the peer identifier of the publisher/subscriber. // The peer ID will be used to acquire the peer private key. - PeerId string `protobuf:"bytes,2,opt,name=peer_id,json=peerId,proto3" json:"peer_id,omitempty"` + PeerId string `protobuf:"bytes,2,opt,name=peer_id,json=peerId,proto3" json:"peerId,omitempty"` // PrivKeyPem is an alternate to PeerId, specify private key inline. // Overrides PeerId if set. - PrivKeyPem string `protobuf:"bytes,3,opt,name=priv_key_pem,json=privKeyPem,proto3" json:"priv_key_pem,omitempty"` + PrivKeyPem string `protobuf:"bytes,3,opt,name=priv_key_pem,json=privKeyPem,proto3" json:"privKeyPem,omitempty"` // PublishRequest contains a publish message request. - PublishRequest *PublishRequest `protobuf:"bytes,4,opt,name=publish_request,json=publishRequest,proto3" json:"publish_request,omitempty"` + PublishRequest *PublishRequest `protobuf:"bytes,4,opt,name=publish_request,json=publishRequest,proto3" json:"publishRequest,omitempty"` } func (x *SubscribeRequest) Reset() { *x = SubscribeRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_pubsub_api_api_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_github_com_aperturerobotics_bifrost_pubsub_api_api_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_github_com_aperturerobotics_bifrost_pubsub_api_api_proto_rawDescGZIP(), []int{0} -} - func (x *SubscribeRequest) GetChannelId() string { if x != nil { return x.ChannelId @@ -103,10 +65,7 @@ func (x *SubscribeRequest) GetPublishRequest() *PublishRequest { // PublishRequest is a message published via the subscribe channel. type PublishRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + unknownFields []byte // Data is the published data. Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` // Identifier is a uint32 identifier to use for outgoing status. @@ -116,36 +75,10 @@ type PublishRequest struct { func (x *PublishRequest) Reset() { *x = PublishRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_pubsub_api_api_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PublishRequest) String() string { - return protoimpl.X.MessageStringOf(x) } func (*PublishRequest) ProtoMessage() {} -func (x *PublishRequest) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_pubsub_api_api_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 PublishRequest.ProtoReflect.Descriptor instead. -func (*PublishRequest) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_pubsub_api_api_proto_rawDescGZIP(), []int{1} -} - func (x *PublishRequest) GetData() []byte { if x != nil { return x.Data @@ -162,51 +95,22 @@ func (x *PublishRequest) GetIdentifier() uint32 { // SubcribeResponse is a pubsub subscription response message. type SubscribeResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + unknownFields []byte // IncomingMessage is an incoming message. - IncomingMessage *IncomingMessage `protobuf:"bytes,1,opt,name=incoming_message,json=incomingMessage,proto3" json:"incoming_message,omitempty"` + IncomingMessage *IncomingMessage `protobuf:"bytes,1,opt,name=incoming_message,json=incomingMessage,proto3" json:"incomingMessage,omitempty"` // OutgoingStatus is status of an outgoing message. // Sent when a Publish request finishes. - OutgoingStatus *OutgoingStatus `protobuf:"bytes,2,opt,name=outgoing_status,json=outgoingStatus,proto3" json:"outgoing_status,omitempty"` + OutgoingStatus *OutgoingStatus `protobuf:"bytes,2,opt,name=outgoing_status,json=outgoingStatus,proto3" json:"outgoingStatus,omitempty"` // SubscriptionStatus is the status of the subscription - SubscriptionStatus *SubscriptionStatus `protobuf:"bytes,3,opt,name=subscription_status,json=subscriptionStatus,proto3" json:"subscription_status,omitempty"` + SubscriptionStatus *SubscriptionStatus `protobuf:"bytes,3,opt,name=subscription_status,json=subscriptionStatus,proto3" json:"subscriptionStatus,omitempty"` } func (x *SubscribeResponse) Reset() { *x = SubscribeResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_pubsub_api_api_proto_msgTypes[2] - 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_github_com_aperturerobotics_bifrost_pubsub_api_api_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 SubscribeResponse.ProtoReflect.Descriptor instead. -func (*SubscribeResponse) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_pubsub_api_api_proto_rawDescGZIP(), []int{2} -} - func (x *SubscribeResponse) GetIncomingMessage() *IncomingMessage { if x != nil { return x.IncomingMessage @@ -230,46 +134,17 @@ func (x *SubscribeResponse) GetSubscriptionStatus() *SubscriptionStatus { // SubscripionStatus is the status of the subscription handle. type SubscriptionStatus struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + unknownFields []byte // Subscribed indicates the subscription is established. Subscribed bool `protobuf:"varint,1,opt,name=subscribed,proto3" json:"subscribed,omitempty"` } func (x *SubscriptionStatus) Reset() { *x = SubscriptionStatus{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_pubsub_api_api_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SubscriptionStatus) String() string { - return protoimpl.X.MessageStringOf(x) } func (*SubscriptionStatus) ProtoMessage() {} -func (x *SubscriptionStatus) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_pubsub_api_api_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 SubscriptionStatus.ProtoReflect.Descriptor instead. -func (*SubscriptionStatus) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_pubsub_api_api_proto_rawDescGZIP(), []int{3} -} - func (x *SubscriptionStatus) GetSubscribed() bool { if x != nil { return x.Subscribed @@ -279,10 +154,7 @@ func (x *SubscriptionStatus) GetSubscribed() bool { // OutgoingStatus is status of an outgoing message. type OutgoingStatus struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + unknownFields []byte // Identifier is the request-provided identifier for the message. Identifier uint32 `protobuf:"varint,1,opt,name=identifier,proto3" json:"identifier,omitempty"` // Sent indicates if the message was sent. @@ -291,36 +163,10 @@ type OutgoingStatus struct { func (x *OutgoingStatus) Reset() { *x = OutgoingStatus{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_pubsub_api_api_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *OutgoingStatus) String() string { - return protoimpl.X.MessageStringOf(x) } func (*OutgoingStatus) ProtoMessage() {} -func (x *OutgoingStatus) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_pubsub_api_api_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 OutgoingStatus.ProtoReflect.Descriptor instead. -func (*OutgoingStatus) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_pubsub_api_api_proto_rawDescGZIP(), []int{4} -} - func (x *OutgoingStatus) GetIdentifier() uint32 { if x != nil { return x.Identifier @@ -337,12 +183,9 @@ func (x *OutgoingStatus) GetSent() bool { // IncomingMessage implements Message with a proto object. type IncomingMessage struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + unknownFields []byte // FromPeerId is the peer identifier of the sender. - FromPeerId string `protobuf:"bytes,1,opt,name=from_peer_id,json=fromPeerId,proto3" json:"from_peer_id,omitempty"` + FromPeerId string `protobuf:"bytes,1,opt,name=from_peer_id,json=fromPeerId,proto3" json:"fromPeerId,omitempty"` // Authenticated indicates if the message is verified to be from the sender. Authenticated bool `protobuf:"varint,2,opt,name=authenticated,proto3" json:"authenticated,omitempty"` // Data is the inner data. @@ -351,36 +194,10 @@ type IncomingMessage struct { func (x *IncomingMessage) Reset() { *x = IncomingMessage{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_pubsub_api_api_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *IncomingMessage) String() string { - return protoimpl.X.MessageStringOf(x) } func (*IncomingMessage) ProtoMessage() {} -func (x *IncomingMessage) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_pubsub_api_api_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 IncomingMessage.ProtoReflect.Descriptor instead. -func (*IncomingMessage) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_pubsub_api_api_proto_rawDescGZIP(), []int{5} -} - func (x *IncomingMessage) GetFromPeerId() string { if x != nil { return x.FromPeerId @@ -402,198 +219,1783 @@ func (x *IncomingMessage) GetData() []byte { return nil } -var File_github_com_aperturerobotics_bifrost_pubsub_api_api_proto protoreflect.FileDescriptor - -var file_github_com_aperturerobotics_bifrost_pubsub_api_api_proto_rawDesc = []byte{ - 0x0a, 0x38, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, - 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x62, 0x69, - 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2f, 0x70, 0x75, 0x62, 0x73, 0x75, 0x62, 0x2f, 0x61, 0x70, 0x69, - 0x2f, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0a, 0x70, 0x75, 0x62, 0x73, - 0x75, 0x62, 0x2e, 0x61, 0x70, 0x69, 0x22, 0xb1, 0x01, 0x0a, 0x10, 0x53, 0x75, 0x62, 0x73, 0x63, - 0x72, 0x69, 0x62, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x63, - 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x09, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x70, 0x65, - 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x65, 0x65, - 0x72, 0x49, 0x64, 0x12, 0x20, 0x0a, 0x0c, 0x70, 0x72, 0x69, 0x76, 0x5f, 0x6b, 0x65, 0x79, 0x5f, - 0x70, 0x65, 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, 0x72, 0x69, 0x76, 0x4b, - 0x65, 0x79, 0x50, 0x65, 0x6d, 0x12, 0x43, 0x0a, 0x0f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, - 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, - 0x2e, 0x70, 0x75, 0x62, 0x73, 0x75, 0x62, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x50, 0x75, 0x62, 0x6c, - 0x69, 0x73, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x0e, 0x70, 0x75, 0x62, 0x6c, - 0x69, 0x73, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x44, 0x0a, 0x0e, 0x50, 0x75, - 0x62, 0x6c, 0x69, 0x73, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, - 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, - 0x12, 0x1e, 0x0a, 0x0a, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, - 0x22, 0xf1, 0x01, 0x0a, 0x11, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x46, 0x0a, 0x10, 0x69, 0x6e, 0x63, 0x6f, 0x6d, 0x69, - 0x6e, 0x67, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x1b, 0x2e, 0x70, 0x75, 0x62, 0x73, 0x75, 0x62, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x49, 0x6e, - 0x63, 0x6f, 0x6d, 0x69, 0x6e, 0x67, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x0f, 0x69, - 0x6e, 0x63, 0x6f, 0x6d, 0x69, 0x6e, 0x67, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x43, - 0x0a, 0x0f, 0x6f, 0x75, 0x74, 0x67, 0x6f, 0x69, 0x6e, 0x67, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x70, 0x75, 0x62, 0x73, 0x75, 0x62, - 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4f, 0x75, 0x74, 0x67, 0x6f, 0x69, 0x6e, 0x67, 0x53, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x52, 0x0e, 0x6f, 0x75, 0x74, 0x67, 0x6f, 0x69, 0x6e, 0x67, 0x53, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x12, 0x4f, 0x0a, 0x13, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x1e, 0x2e, 0x70, 0x75, 0x62, 0x73, 0x75, 0x62, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x53, 0x75, - 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, - 0x52, 0x12, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, - 0x61, 0x74, 0x75, 0x73, 0x22, 0x34, 0x0a, 0x12, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x75, - 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, - 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x64, 0x22, 0x44, 0x0a, 0x0e, 0x4f, 0x75, - 0x74, 0x67, 0x6f, 0x69, 0x6e, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1e, 0x0a, 0x0a, - 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, - 0x52, 0x0a, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, - 0x73, 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x73, 0x65, 0x6e, 0x74, - 0x22, 0x6d, 0x0a, 0x0f, 0x49, 0x6e, 0x63, 0x6f, 0x6d, 0x69, 0x6e, 0x67, 0x4d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x12, 0x20, 0x0a, 0x0c, 0x66, 0x72, 0x6f, 0x6d, 0x5f, 0x70, 0x65, 0x65, 0x72, - 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x66, 0x72, 0x6f, 0x6d, 0x50, - 0x65, 0x65, 0x72, 0x49, 0x64, 0x12, 0x24, 0x0a, 0x0d, 0x61, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, - 0x69, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x61, 0x75, - 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x64, - 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x32, - 0x5f, 0x0a, 0x0d, 0x50, 0x75, 0x62, 0x53, 0x75, 0x62, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x12, 0x4e, 0x0a, 0x09, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x12, 0x1c, 0x2e, - 0x70, 0x75, 0x62, 0x73, 0x75, 0x62, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, - 0x72, 0x69, 0x62, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x70, 0x75, - 0x62, 0x73, 0x75, 0x62, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, - 0x62, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x28, 0x01, 0x30, 0x01, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_github_com_aperturerobotics_bifrost_pubsub_api_api_proto_rawDescOnce sync.Once - file_github_com_aperturerobotics_bifrost_pubsub_api_api_proto_rawDescData = file_github_com_aperturerobotics_bifrost_pubsub_api_api_proto_rawDesc -) +func (m *SubscribeRequest) CloneVT() *SubscribeRequest { + if m == nil { + return (*SubscribeRequest)(nil) + } + r := new(SubscribeRequest) + r.ChannelId = m.ChannelId + r.PeerId = m.PeerId + r.PrivKeyPem = m.PrivKeyPem + r.PublishRequest = m.PublishRequest.CloneVT() + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *SubscribeRequest) CloneMessageVT() any { + return m.CloneVT() +} + +func (m *PublishRequest) CloneVT() *PublishRequest { + if m == nil { + return (*PublishRequest)(nil) + } + r := new(PublishRequest) + r.Identifier = m.Identifier + if rhs := m.Data; rhs != nil { + tmpBytes := make([]byte, len(rhs)) + copy(tmpBytes, rhs) + r.Data = tmpBytes + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *PublishRequest) CloneMessageVT() any { + return m.CloneVT() +} + +func (m *SubscribeResponse) CloneVT() *SubscribeResponse { + if m == nil { + return (*SubscribeResponse)(nil) + } + r := new(SubscribeResponse) + r.IncomingMessage = m.IncomingMessage.CloneVT() + r.OutgoingStatus = m.OutgoingStatus.CloneVT() + r.SubscriptionStatus = m.SubscriptionStatus.CloneVT() + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *SubscribeResponse) CloneMessageVT() any { + return m.CloneVT() +} + +func (m *SubscriptionStatus) CloneVT() *SubscriptionStatus { + if m == nil { + return (*SubscriptionStatus)(nil) + } + r := new(SubscriptionStatus) + r.Subscribed = m.Subscribed + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *SubscriptionStatus) CloneMessageVT() any { + return m.CloneVT() +} + +func (m *OutgoingStatus) CloneVT() *OutgoingStatus { + if m == nil { + return (*OutgoingStatus)(nil) + } + r := new(OutgoingStatus) + r.Identifier = m.Identifier + r.Sent = m.Sent + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *OutgoingStatus) CloneMessageVT() any { + return m.CloneVT() +} + +func (m *IncomingMessage) CloneVT() *IncomingMessage { + if m == nil { + return (*IncomingMessage)(nil) + } + r := new(IncomingMessage) + r.FromPeerId = m.FromPeerId + r.Authenticated = m.Authenticated + if rhs := m.Data; rhs != nil { + tmpBytes := make([]byte, len(rhs)) + copy(tmpBytes, rhs) + r.Data = tmpBytes + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *IncomingMessage) CloneMessageVT() any { + return m.CloneVT() +} + +func (this *SubscribeRequest) EqualVT(that *SubscribeRequest) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.ChannelId != that.ChannelId { + return false + } + if this.PeerId != that.PeerId { + return false + } + if this.PrivKeyPem != that.PrivKeyPem { + return false + } + if !this.PublishRequest.EqualVT(that.PublishRequest) { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *SubscribeRequest) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*SubscribeRequest) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *PublishRequest) EqualVT(that *PublishRequest) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if string(this.Data) != string(that.Data) { + return false + } + if this.Identifier != that.Identifier { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *PublishRequest) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*PublishRequest) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *SubscribeResponse) EqualVT(that *SubscribeResponse) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if !this.IncomingMessage.EqualVT(that.IncomingMessage) { + return false + } + if !this.OutgoingStatus.EqualVT(that.OutgoingStatus) { + return false + } + if !this.SubscriptionStatus.EqualVT(that.SubscriptionStatus) { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *SubscribeResponse) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*SubscribeResponse) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *SubscriptionStatus) EqualVT(that *SubscriptionStatus) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.Subscribed != that.Subscribed { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} -func file_github_com_aperturerobotics_bifrost_pubsub_api_api_proto_rawDescGZIP() []byte { - file_github_com_aperturerobotics_bifrost_pubsub_api_api_proto_rawDescOnce.Do(func() { - file_github_com_aperturerobotics_bifrost_pubsub_api_api_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_aperturerobotics_bifrost_pubsub_api_api_proto_rawDescData) +func (this *SubscriptionStatus) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*SubscriptionStatus) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *OutgoingStatus) EqualVT(that *OutgoingStatus) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.Identifier != that.Identifier { + return false + } + if this.Sent != that.Sent { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *OutgoingStatus) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*OutgoingStatus) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *IncomingMessage) EqualVT(that *IncomingMessage) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.FromPeerId != that.FromPeerId { + return false + } + if this.Authenticated != that.Authenticated { + return false + } + if string(this.Data) != string(that.Data) { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *IncomingMessage) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*IncomingMessage) + if !ok { + return false + } + return this.EqualVT(that) +} + +// MarshalProtoJSON marshals the SubscribeRequest message to JSON. +func (x *SubscribeRequest) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return + } + s.WriteObjectStart() + var wroteField bool + if x.ChannelId != "" || s.HasField("channelId") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("channelId") + s.WriteString(x.ChannelId) + } + if x.PeerId != "" || s.HasField("peerId") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("peerId") + s.WriteString(x.PeerId) + } + if x.PrivKeyPem != "" || s.HasField("privKeyPem") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("privKeyPem") + s.WriteString(x.PrivKeyPem) + } + if x.PublishRequest != nil || s.HasField("publishRequest") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("publishRequest") + x.PublishRequest.MarshalProtoJSON(s.WithField("publishRequest")) + } + s.WriteObjectEnd() +} + +// MarshalJSON marshals the SubscribeRequest to JSON. +func (x *SubscribeRequest) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) +} + +// UnmarshalProtoJSON unmarshals the SubscribeRequest message from JSON. +func (x *SubscribeRequest) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { + return + } + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "channel_id", "channelId": + s.AddField("channel_id") + x.ChannelId = s.ReadString() + case "peer_id", "peerId": + s.AddField("peer_id") + x.PeerId = s.ReadString() + case "priv_key_pem", "privKeyPem": + s.AddField("priv_key_pem") + x.PrivKeyPem = s.ReadString() + case "publish_request", "publishRequest": + if s.ReadNil() { + x.PublishRequest = nil + return + } + x.PublishRequest = &PublishRequest{} + x.PublishRequest.UnmarshalProtoJSON(s.WithField("publish_request", true)) + } + }) +} + +// UnmarshalJSON unmarshals the SubscribeRequest from JSON. +func (x *SubscribeRequest) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +// MarshalProtoJSON marshals the PublishRequest message to JSON. +func (x *PublishRequest) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return + } + s.WriteObjectStart() + var wroteField bool + if len(x.Data) > 0 || s.HasField("data") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("data") + s.WriteBytes(x.Data) + } + if x.Identifier != 0 || s.HasField("identifier") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("identifier") + s.WriteUint32(x.Identifier) + } + s.WriteObjectEnd() +} + +// MarshalJSON marshals the PublishRequest to JSON. +func (x *PublishRequest) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) +} + +// UnmarshalProtoJSON unmarshals the PublishRequest message from JSON. +func (x *PublishRequest) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { + return + } + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "data": + s.AddField("data") + x.Data = s.ReadBytes() + case "identifier": + s.AddField("identifier") + x.Identifier = s.ReadUint32() + } + }) +} + +// UnmarshalJSON unmarshals the PublishRequest from JSON. +func (x *PublishRequest) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +// MarshalProtoJSON marshals the SubscribeResponse message to JSON. +func (x *SubscribeResponse) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return + } + s.WriteObjectStart() + var wroteField bool + if x.IncomingMessage != nil || s.HasField("incomingMessage") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("incomingMessage") + x.IncomingMessage.MarshalProtoJSON(s.WithField("incomingMessage")) + } + if x.OutgoingStatus != nil || s.HasField("outgoingStatus") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("outgoingStatus") + x.OutgoingStatus.MarshalProtoJSON(s.WithField("outgoingStatus")) + } + if x.SubscriptionStatus != nil || s.HasField("subscriptionStatus") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("subscriptionStatus") + x.SubscriptionStatus.MarshalProtoJSON(s.WithField("subscriptionStatus")) + } + s.WriteObjectEnd() +} + +// MarshalJSON marshals the SubscribeResponse to JSON. +func (x *SubscribeResponse) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) +} + +// UnmarshalProtoJSON unmarshals the SubscribeResponse message from JSON. +func (x *SubscribeResponse) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { + return + } + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "incoming_message", "incomingMessage": + if s.ReadNil() { + x.IncomingMessage = nil + return + } + x.IncomingMessage = &IncomingMessage{} + x.IncomingMessage.UnmarshalProtoJSON(s.WithField("incoming_message", true)) + case "outgoing_status", "outgoingStatus": + if s.ReadNil() { + x.OutgoingStatus = nil + return + } + x.OutgoingStatus = &OutgoingStatus{} + x.OutgoingStatus.UnmarshalProtoJSON(s.WithField("outgoing_status", true)) + case "subscription_status", "subscriptionStatus": + if s.ReadNil() { + x.SubscriptionStatus = nil + return + } + x.SubscriptionStatus = &SubscriptionStatus{} + x.SubscriptionStatus.UnmarshalProtoJSON(s.WithField("subscription_status", true)) + } + }) +} + +// UnmarshalJSON unmarshals the SubscribeResponse from JSON. +func (x *SubscribeResponse) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +// MarshalProtoJSON marshals the SubscriptionStatus message to JSON. +func (x *SubscriptionStatus) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return + } + s.WriteObjectStart() + var wroteField bool + if x.Subscribed || s.HasField("subscribed") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("subscribed") + s.WriteBool(x.Subscribed) + } + s.WriteObjectEnd() +} + +// MarshalJSON marshals the SubscriptionStatus to JSON. +func (x *SubscriptionStatus) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) +} + +// UnmarshalProtoJSON unmarshals the SubscriptionStatus message from JSON. +func (x *SubscriptionStatus) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { + return + } + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "subscribed": + s.AddField("subscribed") + x.Subscribed = s.ReadBool() + } + }) +} + +// UnmarshalJSON unmarshals the SubscriptionStatus from JSON. +func (x *SubscriptionStatus) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +// MarshalProtoJSON marshals the OutgoingStatus message to JSON. +func (x *OutgoingStatus) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return + } + s.WriteObjectStart() + var wroteField bool + if x.Identifier != 0 || s.HasField("identifier") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("identifier") + s.WriteUint32(x.Identifier) + } + if x.Sent || s.HasField("sent") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("sent") + s.WriteBool(x.Sent) + } + s.WriteObjectEnd() +} + +// MarshalJSON marshals the OutgoingStatus to JSON. +func (x *OutgoingStatus) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) +} + +// UnmarshalProtoJSON unmarshals the OutgoingStatus message from JSON. +func (x *OutgoingStatus) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { + return + } + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "identifier": + s.AddField("identifier") + x.Identifier = s.ReadUint32() + case "sent": + s.AddField("sent") + x.Sent = s.ReadBool() + } }) - return file_github_com_aperturerobotics_bifrost_pubsub_api_api_proto_rawDescData -} - -var file_github_com_aperturerobotics_bifrost_pubsub_api_api_proto_msgTypes = make([]protoimpl.MessageInfo, 6) -var file_github_com_aperturerobotics_bifrost_pubsub_api_api_proto_goTypes = []interface{}{ - (*SubscribeRequest)(nil), // 0: pubsub.api.SubscribeRequest - (*PublishRequest)(nil), // 1: pubsub.api.PublishRequest - (*SubscribeResponse)(nil), // 2: pubsub.api.SubscribeResponse - (*SubscriptionStatus)(nil), // 3: pubsub.api.SubscriptionStatus - (*OutgoingStatus)(nil), // 4: pubsub.api.OutgoingStatus - (*IncomingMessage)(nil), // 5: pubsub.api.IncomingMessage -} -var file_github_com_aperturerobotics_bifrost_pubsub_api_api_proto_depIdxs = []int32{ - 1, // 0: pubsub.api.SubscribeRequest.publish_request:type_name -> pubsub.api.PublishRequest - 5, // 1: pubsub.api.SubscribeResponse.incoming_message:type_name -> pubsub.api.IncomingMessage - 4, // 2: pubsub.api.SubscribeResponse.outgoing_status:type_name -> pubsub.api.OutgoingStatus - 3, // 3: pubsub.api.SubscribeResponse.subscription_status:type_name -> pubsub.api.SubscriptionStatus - 0, // 4: pubsub.api.PubSubService.Subscribe:input_type -> pubsub.api.SubscribeRequest - 2, // 5: pubsub.api.PubSubService.Subscribe:output_type -> pubsub.api.SubscribeResponse - 5, // [5:6] is the sub-list for method output_type - 4, // [4:5] is the sub-list for method input_type - 4, // [4:4] is the sub-list for extension type_name - 4, // [4:4] is the sub-list for extension extendee - 0, // [0:4] is the sub-list for field type_name -} - -func init() { file_github_com_aperturerobotics_bifrost_pubsub_api_api_proto_init() } -func file_github_com_aperturerobotics_bifrost_pubsub_api_api_proto_init() { - if File_github_com_aperturerobotics_bifrost_pubsub_api_api_proto != nil { +} + +// UnmarshalJSON unmarshals the OutgoingStatus from JSON. +func (x *OutgoingStatus) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +// MarshalProtoJSON marshals the IncomingMessage message to JSON. +func (x *IncomingMessage) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return + } + s.WriteObjectStart() + var wroteField bool + if x.FromPeerId != "" || s.HasField("fromPeerId") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("fromPeerId") + s.WriteString(x.FromPeerId) + } + if x.Authenticated || s.HasField("authenticated") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("authenticated") + s.WriteBool(x.Authenticated) + } + if len(x.Data) > 0 || s.HasField("data") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("data") + s.WriteBytes(x.Data) + } + s.WriteObjectEnd() +} + +// MarshalJSON marshals the IncomingMessage to JSON. +func (x *IncomingMessage) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) +} + +// UnmarshalProtoJSON unmarshals the IncomingMessage message from JSON. +func (x *IncomingMessage) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { return } - if !protoimpl.UnsafeEnabled { - file_github_com_aperturerobotics_bifrost_pubsub_api_api_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_github_com_aperturerobotics_bifrost_pubsub_api_api_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PublishRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_github_com_aperturerobotics_bifrost_pubsub_api_api_proto_msgTypes[2].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 - } - } - file_github_com_aperturerobotics_bifrost_pubsub_api_api_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SubscriptionStatus); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_github_com_aperturerobotics_bifrost_pubsub_api_api_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*OutgoingStatus); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_github_com_aperturerobotics_bifrost_pubsub_api_api_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*IncomingMessage); 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_github_com_aperturerobotics_bifrost_pubsub_api_api_proto_rawDesc, - NumEnums: 0, - NumMessages: 6, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_github_com_aperturerobotics_bifrost_pubsub_api_api_proto_goTypes, - DependencyIndexes: file_github_com_aperturerobotics_bifrost_pubsub_api_api_proto_depIdxs, - MessageInfos: file_github_com_aperturerobotics_bifrost_pubsub_api_api_proto_msgTypes, - }.Build() - File_github_com_aperturerobotics_bifrost_pubsub_api_api_proto = out.File - file_github_com_aperturerobotics_bifrost_pubsub_api_api_proto_rawDesc = nil - file_github_com_aperturerobotics_bifrost_pubsub_api_api_proto_goTypes = nil - file_github_com_aperturerobotics_bifrost_pubsub_api_api_proto_depIdxs = nil + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "from_peer_id", "fromPeerId": + s.AddField("from_peer_id") + x.FromPeerId = s.ReadString() + case "authenticated": + s.AddField("authenticated") + x.Authenticated = s.ReadBool() + case "data": + s.AddField("data") + x.Data = s.ReadBytes() + } + }) +} + +// UnmarshalJSON unmarshals the IncomingMessage from JSON. +func (x *IncomingMessage) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +func (m *SubscribeRequest) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SubscribeRequest) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *SubscribeRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.PublishRequest != nil { + size, err := m.PublishRequest.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x22 + } + if len(m.PrivKeyPem) > 0 { + i -= len(m.PrivKeyPem) + copy(dAtA[i:], m.PrivKeyPem) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.PrivKeyPem))) + i-- + dAtA[i] = 0x1a + } + if len(m.PeerId) > 0 { + i -= len(m.PeerId) + copy(dAtA[i:], m.PeerId) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.PeerId))) + i-- + dAtA[i] = 0x12 + } + if len(m.ChannelId) > 0 { + i -= len(m.ChannelId) + copy(dAtA[i:], m.ChannelId) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.ChannelId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *PublishRequest) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PublishRequest) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *PublishRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.Identifier != 0 { + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(m.Identifier)) + i-- + dAtA[i] = 0x10 + } + if len(m.Data) > 0 { + i -= len(m.Data) + copy(dAtA[i:], m.Data) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.Data))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *SubscribeResponse) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SubscribeResponse) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *SubscribeResponse) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.SubscriptionStatus != nil { + size, err := m.SubscriptionStatus.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x1a + } + if m.OutgoingStatus != nil { + size, err := m.OutgoingStatus.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x12 + } + if m.IncomingMessage != nil { + size, err := m.IncomingMessage.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *SubscriptionStatus) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SubscriptionStatus) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *SubscriptionStatus) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.Subscribed { + i-- + if m.Subscribed { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *OutgoingStatus) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *OutgoingStatus) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *OutgoingStatus) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.Sent { + i-- + if m.Sent { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x10 + } + if m.Identifier != 0 { + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(m.Identifier)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *IncomingMessage) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *IncomingMessage) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *IncomingMessage) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.Data) > 0 { + i -= len(m.Data) + copy(dAtA[i:], m.Data) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.Data))) + i-- + dAtA[i] = 0x1a + } + if m.Authenticated { + i-- + if m.Authenticated { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x10 + } + if len(m.FromPeerId) > 0 { + i -= len(m.FromPeerId) + copy(dAtA[i:], m.FromPeerId) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.FromPeerId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *SubscribeRequest) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ChannelId) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + l = len(m.PeerId) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + l = len(m.PrivKeyPem) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + if m.PublishRequest != nil { + l = m.PublishRequest.SizeVT() + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *PublishRequest) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Data) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + if m.Identifier != 0 { + n += 1 + protobuf_go_lite.SizeOfVarint(uint64(m.Identifier)) + } + n += len(m.unknownFields) + return n +} + +func (m *SubscribeResponse) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.IncomingMessage != nil { + l = m.IncomingMessage.SizeVT() + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + if m.OutgoingStatus != nil { + l = m.OutgoingStatus.SizeVT() + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + if m.SubscriptionStatus != nil { + l = m.SubscriptionStatus.SizeVT() + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *SubscriptionStatus) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Subscribed { + n += 2 + } + n += len(m.unknownFields) + return n +} + +func (m *OutgoingStatus) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Identifier != 0 { + n += 1 + protobuf_go_lite.SizeOfVarint(uint64(m.Identifier)) + } + if m.Sent { + n += 2 + } + n += len(m.unknownFields) + return n +} + +func (m *IncomingMessage) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.FromPeerId) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + if m.Authenticated { + n += 2 + } + l = len(m.Data) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *SubscribeRequest) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: SubscribeRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: SubscribeRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field ChannelId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ChannelId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field PeerId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PeerId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field PrivKeyPem", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PrivKeyPem = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field PublishRequest", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.PublishRequest == nil { + m.PublishRequest = &PublishRequest{} + } + if err := m.PublishRequest.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PublishRequest) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: PublishRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: PublishRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) + if m.Data == nil { + m.Data = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return errors.Errorf("proto: wrong wireType = %d for field Identifier", wireType) + } + m.Identifier = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Identifier |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SubscribeResponse) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: SubscribeResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: SubscribeResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field IncomingMessage", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.IncomingMessage == nil { + m.IncomingMessage = &IncomingMessage{} + } + if err := m.IncomingMessage.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field OutgoingStatus", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.OutgoingStatus == nil { + m.OutgoingStatus = &OutgoingStatus{} + } + if err := m.OutgoingStatus.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field SubscriptionStatus", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.SubscriptionStatus == nil { + m.SubscriptionStatus = &SubscriptionStatus{} + } + if err := m.SubscriptionStatus.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SubscriptionStatus) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: SubscriptionStatus: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: SubscriptionStatus: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return errors.Errorf("proto: wrong wireType = %d for field Subscribed", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Subscribed = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *OutgoingStatus) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: OutgoingStatus: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: OutgoingStatus: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return errors.Errorf("proto: wrong wireType = %d for field Identifier", wireType) + } + m.Identifier = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Identifier |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return errors.Errorf("proto: wrong wireType = %d for field Sent", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Sent = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *IncomingMessage) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: IncomingMessage: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: IncomingMessage: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field FromPeerId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FromPeerId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return errors.Errorf("proto: wrong wireType = %d for field Authenticated", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Authenticated = bool(v != 0) + case 3: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) + if m.Data == nil { + m.Data = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil } diff --git a/pubsub/api/api.pb.ts b/pubsub/api/api.pb.ts deleted file mode 100644 index 0f0a282c..00000000 --- a/pubsub/api/api.pb.ts +++ /dev/null @@ -1,1052 +0,0 @@ -/* eslint-disable */ -import Long from 'long' -import _m0 from 'protobufjs/minimal.js' - -export const protobufPackage = 'pubsub.api' - -/** SubcribeRequest is a pubsub subscription request message. */ -export interface SubscribeRequest { - /** - * ChannelId is the channel id to subscribe to. - * Must be sent before / with publish. - * Cannot change the channel ID after first transmission. - */ - channelId: string - /** - * PeerId is the peer identifier of the publisher/subscriber. - * The peer ID will be used to acquire the peer private key. - */ - peerId: string - /** - * PrivKeyPem is an alternate to PeerId, specify private key inline. - * Overrides PeerId if set. - */ - privKeyPem: string - /** PublishRequest contains a publish message request. */ - publishRequest: PublishRequest | undefined -} - -/** PublishRequest is a message published via the subscribe channel. */ -export interface PublishRequest { - /** Data is the published data. */ - data: Uint8Array - /** - * Identifier is a uint32 identifier to use for outgoing status. - * If zero, no outgoing status response will be sent. - */ - identifier: number -} - -/** SubcribeResponse is a pubsub subscription response message. */ -export interface SubscribeResponse { - /** IncomingMessage is an incoming message. */ - incomingMessage: IncomingMessage | undefined - /** - * OutgoingStatus is status of an outgoing message. - * Sent when a Publish request finishes. - */ - outgoingStatus: OutgoingStatus | undefined - /** SubscriptionStatus is the status of the subscription */ - subscriptionStatus: SubscriptionStatus | undefined -} - -/** SubscripionStatus is the status of the subscription handle. */ -export interface SubscriptionStatus { - /** Subscribed indicates the subscription is established. */ - subscribed: boolean -} - -/** OutgoingStatus is status of an outgoing message. */ -export interface OutgoingStatus { - /** Identifier is the request-provided identifier for the message. */ - identifier: number - /** Sent indicates if the message was sent. */ - sent: boolean -} - -/** IncomingMessage implements Message with a proto object. */ -export interface IncomingMessage { - /** FromPeerId is the peer identifier of the sender. */ - fromPeerId: string - /** Authenticated indicates if the message is verified to be from the sender. */ - authenticated: boolean - /** Data is the inner data. */ - data: Uint8Array -} - -function createBaseSubscribeRequest(): SubscribeRequest { - return { - channelId: '', - peerId: '', - privKeyPem: '', - publishRequest: undefined, - } -} - -export const SubscribeRequest = { - encode( - message: SubscribeRequest, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.channelId !== '') { - writer.uint32(10).string(message.channelId) - } - if (message.peerId !== '') { - writer.uint32(18).string(message.peerId) - } - if (message.privKeyPem !== '') { - writer.uint32(26).string(message.privKeyPem) - } - if (message.publishRequest !== undefined) { - PublishRequest.encode( - message.publishRequest, - writer.uint32(34).fork(), - ).ldelim() - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): SubscribeRequest { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseSubscribeRequest() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break - } - - message.channelId = reader.string() - continue - case 2: - if (tag !== 18) { - break - } - - message.peerId = reader.string() - continue - case 3: - if (tag !== 26) { - break - } - - message.privKeyPem = reader.string() - continue - case 4: - if (tag !== 34) { - break - } - - message.publishRequest = PublishRequest.decode( - reader, - reader.uint32(), - ) - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [SubscribeRequest.encode(p).finish()] - } - } else { - yield* [SubscribeRequest.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [SubscribeRequest.decode(p)] - } - } else { - yield* [SubscribeRequest.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): SubscribeRequest { - return { - channelId: isSet(object.channelId) - ? globalThis.String(object.channelId) - : '', - peerId: isSet(object.peerId) ? globalThis.String(object.peerId) : '', - privKeyPem: isSet(object.privKeyPem) - ? globalThis.String(object.privKeyPem) - : '', - publishRequest: isSet(object.publishRequest) - ? PublishRequest.fromJSON(object.publishRequest) - : undefined, - } - }, - - toJSON(message: SubscribeRequest): unknown { - const obj: any = {} - if (message.channelId !== '') { - obj.channelId = message.channelId - } - if (message.peerId !== '') { - obj.peerId = message.peerId - } - if (message.privKeyPem !== '') { - obj.privKeyPem = message.privKeyPem - } - if (message.publishRequest !== undefined) { - obj.publishRequest = PublishRequest.toJSON(message.publishRequest) - } - return obj - }, - - create, I>>( - base?: I, - ): SubscribeRequest { - return SubscribeRequest.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>( - object: I, - ): SubscribeRequest { - const message = createBaseSubscribeRequest() - message.channelId = object.channelId ?? '' - message.peerId = object.peerId ?? '' - message.privKeyPem = object.privKeyPem ?? '' - message.publishRequest = - object.publishRequest !== undefined && object.publishRequest !== null - ? PublishRequest.fromPartial(object.publishRequest) - : undefined - return message - }, -} - -function createBasePublishRequest(): PublishRequest { - return { data: new Uint8Array(0), identifier: 0 } -} - -export const PublishRequest = { - encode( - message: PublishRequest, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.data.length !== 0) { - writer.uint32(10).bytes(message.data) - } - if (message.identifier !== 0) { - writer.uint32(16).uint32(message.identifier) - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): PublishRequest { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBasePublishRequest() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break - } - - message.data = reader.bytes() - continue - case 2: - if (tag !== 16) { - break - } - - message.identifier = reader.uint32() - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [PublishRequest.encode(p).finish()] - } - } else { - yield* [PublishRequest.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [PublishRequest.decode(p)] - } - } else { - yield* [PublishRequest.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): PublishRequest { - return { - data: isSet(object.data) - ? bytesFromBase64(object.data) - : new Uint8Array(0), - identifier: isSet(object.identifier) - ? globalThis.Number(object.identifier) - : 0, - } - }, - - toJSON(message: PublishRequest): unknown { - const obj: any = {} - if (message.data.length !== 0) { - obj.data = base64FromBytes(message.data) - } - if (message.identifier !== 0) { - obj.identifier = Math.round(message.identifier) - } - return obj - }, - - create, I>>( - base?: I, - ): PublishRequest { - return PublishRequest.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>( - object: I, - ): PublishRequest { - const message = createBasePublishRequest() - message.data = object.data ?? new Uint8Array(0) - message.identifier = object.identifier ?? 0 - return message - }, -} - -function createBaseSubscribeResponse(): SubscribeResponse { - return { - incomingMessage: undefined, - outgoingStatus: undefined, - subscriptionStatus: undefined, - } -} - -export const SubscribeResponse = { - encode( - message: SubscribeResponse, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.incomingMessage !== undefined) { - IncomingMessage.encode( - message.incomingMessage, - writer.uint32(10).fork(), - ).ldelim() - } - if (message.outgoingStatus !== undefined) { - OutgoingStatus.encode( - message.outgoingStatus, - writer.uint32(18).fork(), - ).ldelim() - } - if (message.subscriptionStatus !== undefined) { - SubscriptionStatus.encode( - message.subscriptionStatus, - writer.uint32(26).fork(), - ).ldelim() - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): SubscribeResponse { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseSubscribeResponse() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break - } - - message.incomingMessage = IncomingMessage.decode( - reader, - reader.uint32(), - ) - continue - case 2: - if (tag !== 18) { - break - } - - message.outgoingStatus = OutgoingStatus.decode( - reader, - reader.uint32(), - ) - continue - case 3: - if (tag !== 26) { - break - } - - message.subscriptionStatus = SubscriptionStatus.decode( - reader, - reader.uint32(), - ) - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [SubscribeResponse.encode(p).finish()] - } - } else { - yield* [SubscribeResponse.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [SubscribeResponse.decode(p)] - } - } else { - yield* [SubscribeResponse.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): SubscribeResponse { - return { - incomingMessage: isSet(object.incomingMessage) - ? IncomingMessage.fromJSON(object.incomingMessage) - : undefined, - outgoingStatus: isSet(object.outgoingStatus) - ? OutgoingStatus.fromJSON(object.outgoingStatus) - : undefined, - subscriptionStatus: isSet(object.subscriptionStatus) - ? SubscriptionStatus.fromJSON(object.subscriptionStatus) - : undefined, - } - }, - - toJSON(message: SubscribeResponse): unknown { - const obj: any = {} - if (message.incomingMessage !== undefined) { - obj.incomingMessage = IncomingMessage.toJSON(message.incomingMessage) - } - if (message.outgoingStatus !== undefined) { - obj.outgoingStatus = OutgoingStatus.toJSON(message.outgoingStatus) - } - if (message.subscriptionStatus !== undefined) { - obj.subscriptionStatus = SubscriptionStatus.toJSON( - message.subscriptionStatus, - ) - } - return obj - }, - - create, I>>( - base?: I, - ): SubscribeResponse { - return SubscribeResponse.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>( - object: I, - ): SubscribeResponse { - const message = createBaseSubscribeResponse() - message.incomingMessage = - object.incomingMessage !== undefined && object.incomingMessage !== null - ? IncomingMessage.fromPartial(object.incomingMessage) - : undefined - message.outgoingStatus = - object.outgoingStatus !== undefined && object.outgoingStatus !== null - ? OutgoingStatus.fromPartial(object.outgoingStatus) - : undefined - message.subscriptionStatus = - object.subscriptionStatus !== undefined && - object.subscriptionStatus !== null - ? SubscriptionStatus.fromPartial(object.subscriptionStatus) - : undefined - return message - }, -} - -function createBaseSubscriptionStatus(): SubscriptionStatus { - return { subscribed: false } -} - -export const SubscriptionStatus = { - encode( - message: SubscriptionStatus, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.subscribed !== false) { - writer.uint32(8).bool(message.subscribed) - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): SubscriptionStatus { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseSubscriptionStatus() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 8) { - break - } - - message.subscribed = reader.bool() - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [SubscriptionStatus.encode(p).finish()] - } - } else { - yield* [SubscriptionStatus.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [SubscriptionStatus.decode(p)] - } - } else { - yield* [SubscriptionStatus.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): SubscriptionStatus { - return { - subscribed: isSet(object.subscribed) - ? globalThis.Boolean(object.subscribed) - : false, - } - }, - - toJSON(message: SubscriptionStatus): unknown { - const obj: any = {} - if (message.subscribed !== false) { - obj.subscribed = message.subscribed - } - return obj - }, - - create, I>>( - base?: I, - ): SubscriptionStatus { - return SubscriptionStatus.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>( - object: I, - ): SubscriptionStatus { - const message = createBaseSubscriptionStatus() - message.subscribed = object.subscribed ?? false - return message - }, -} - -function createBaseOutgoingStatus(): OutgoingStatus { - return { identifier: 0, sent: false } -} - -export const OutgoingStatus = { - encode( - message: OutgoingStatus, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.identifier !== 0) { - writer.uint32(8).uint32(message.identifier) - } - if (message.sent !== false) { - writer.uint32(16).bool(message.sent) - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): OutgoingStatus { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseOutgoingStatus() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 8) { - break - } - - message.identifier = reader.uint32() - continue - case 2: - if (tag !== 16) { - break - } - - message.sent = reader.bool() - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [OutgoingStatus.encode(p).finish()] - } - } else { - yield* [OutgoingStatus.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [OutgoingStatus.decode(p)] - } - } else { - yield* [OutgoingStatus.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): OutgoingStatus { - return { - identifier: isSet(object.identifier) - ? globalThis.Number(object.identifier) - : 0, - sent: isSet(object.sent) ? globalThis.Boolean(object.sent) : false, - } - }, - - toJSON(message: OutgoingStatus): unknown { - const obj: any = {} - if (message.identifier !== 0) { - obj.identifier = Math.round(message.identifier) - } - if (message.sent !== false) { - obj.sent = message.sent - } - return obj - }, - - create, I>>( - base?: I, - ): OutgoingStatus { - return OutgoingStatus.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>( - object: I, - ): OutgoingStatus { - const message = createBaseOutgoingStatus() - message.identifier = object.identifier ?? 0 - message.sent = object.sent ?? false - return message - }, -} - -function createBaseIncomingMessage(): IncomingMessage { - return { fromPeerId: '', authenticated: false, data: new Uint8Array(0) } -} - -export const IncomingMessage = { - encode( - message: IncomingMessage, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.fromPeerId !== '') { - writer.uint32(10).string(message.fromPeerId) - } - if (message.authenticated !== false) { - writer.uint32(16).bool(message.authenticated) - } - if (message.data.length !== 0) { - writer.uint32(26).bytes(message.data) - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): IncomingMessage { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseIncomingMessage() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break - } - - message.fromPeerId = reader.string() - continue - case 2: - if (tag !== 16) { - break - } - - message.authenticated = reader.bool() - continue - case 3: - if (tag !== 26) { - break - } - - message.data = reader.bytes() - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [IncomingMessage.encode(p).finish()] - } - } else { - yield* [IncomingMessage.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [IncomingMessage.decode(p)] - } - } else { - yield* [IncomingMessage.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): IncomingMessage { - return { - fromPeerId: isSet(object.fromPeerId) - ? globalThis.String(object.fromPeerId) - : '', - authenticated: isSet(object.authenticated) - ? globalThis.Boolean(object.authenticated) - : false, - data: isSet(object.data) - ? bytesFromBase64(object.data) - : new Uint8Array(0), - } - }, - - toJSON(message: IncomingMessage): unknown { - const obj: any = {} - if (message.fromPeerId !== '') { - obj.fromPeerId = message.fromPeerId - } - if (message.authenticated !== false) { - obj.authenticated = message.authenticated - } - if (message.data.length !== 0) { - obj.data = base64FromBytes(message.data) - } - return obj - }, - - create, I>>( - base?: I, - ): IncomingMessage { - return IncomingMessage.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>( - object: I, - ): IncomingMessage { - const message = createBaseIncomingMessage() - message.fromPeerId = object.fromPeerId ?? '' - message.authenticated = object.authenticated ?? false - message.data = object.data ?? new Uint8Array(0) - return message - }, -} - -/** PubSubService is the bifrost pubsub service. */ -export interface PubSubService { - /** - * Subscribe subscribes to a channel, allowing the subscriber to publish - * messages over the same channel. - */ - Subscribe( - request: AsyncIterable, - abortSignal?: AbortSignal, - ): AsyncIterable -} - -export const PubSubServiceServiceName = 'pubsub.api.PubSubService' -export class PubSubServiceClientImpl implements PubSubService { - private readonly rpc: Rpc - private readonly service: string - constructor(rpc: Rpc, opts?: { service?: string }) { - this.service = opts?.service || PubSubServiceServiceName - this.rpc = rpc - this.Subscribe = this.Subscribe.bind(this) - } - Subscribe( - request: AsyncIterable, - abortSignal?: AbortSignal, - ): AsyncIterable { - const data = SubscribeRequest.encodeTransform(request) - const result = this.rpc.bidirectionalStreamingRequest( - this.service, - 'Subscribe', - data, - abortSignal || undefined, - ) - return SubscribeResponse.decodeTransform(result) - } -} - -/** PubSubService is the bifrost pubsub service. */ -export type PubSubServiceDefinition = typeof PubSubServiceDefinition -export const PubSubServiceDefinition = { - name: 'PubSubService', - fullName: 'pubsub.api.PubSubService', - methods: { - /** - * Subscribe subscribes to a channel, allowing the subscriber to publish - * messages over the same channel. - */ - subscribe: { - name: 'Subscribe', - requestType: SubscribeRequest, - requestStream: true, - responseType: SubscribeResponse, - responseStream: true, - options: {}, - }, - }, -} as const - -interface Rpc { - request( - service: string, - method: string, - data: Uint8Array, - abortSignal?: AbortSignal, - ): Promise - clientStreamingRequest( - service: string, - method: string, - data: AsyncIterable, - abortSignal?: AbortSignal, - ): Promise - serverStreamingRequest( - service: string, - method: string, - data: Uint8Array, - abortSignal?: AbortSignal, - ): AsyncIterable - bidirectionalStreamingRequest( - service: string, - method: string, - data: AsyncIterable, - abortSignal?: AbortSignal, - ): AsyncIterable -} - -function bytesFromBase64(b64: string): Uint8Array { - if ((globalThis as any).Buffer) { - return Uint8Array.from(globalThis.Buffer.from(b64, 'base64')) - } else { - const bin = globalThis.atob(b64) - const arr = new Uint8Array(bin.length) - for (let i = 0; i < bin.length; ++i) { - arr[i] = bin.charCodeAt(i) - } - return arr - } -} - -function base64FromBytes(arr: Uint8Array): string { - if ((globalThis as any).Buffer) { - return globalThis.Buffer.from(arr).toString('base64') - } else { - const bin: string[] = [] - arr.forEach((byte) => { - bin.push(globalThis.String.fromCharCode(byte)) - }) - return globalThis.btoa(bin.join('')) - } -} - -type Builtin = - | Date - | Function - | Uint8Array - | string - | number - | boolean - | undefined - -export type DeepPartial = T extends Builtin - ? T - : T extends Long - ? string | number | Long - : T extends globalThis.Array - ? globalThis.Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends { $case: string } - ? { [K in keyof Omit]?: DeepPartial } & { - $case: T['$case'] - } - : T extends {} - ? { [K in keyof T]?: DeepPartial } - : Partial - -type KeysOfUnion = T extends T ? keyof T : never -export type Exact = P extends Builtin - ? P - : P & { [K in keyof P]: Exact } & { - [K in Exclude>]: never - } - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any - _m0.configure() -} - -function isSet(value: any): boolean { - return value !== null && value !== undefined -} diff --git a/pubsub/api/api_drpc.pb.go b/pubsub/api/api_drpc.pb.go deleted file mode 100644 index 226412e3..00000000 --- a/pubsub/api/api_drpc.pb.go +++ /dev/null @@ -1,138 +0,0 @@ -// Code generated by protoc-gen-go-drpc. DO NOT EDIT. -// protoc-gen-go-drpc version: v0.0.34 -// source: github.com/aperturerobotics/bifrost/pubsub/api/api.proto - -package pubsub_api - -import ( - context "context" - errors "errors" - - drpc1 "github.com/planetscale/vtprotobuf/codec/drpc" - drpc "storj.io/drpc" - drpcerr "storj.io/drpc/drpcerr" -) - -type drpcEncoding_File_github_com_aperturerobotics_bifrost_pubsub_api_api_proto struct{} - -func (drpcEncoding_File_github_com_aperturerobotics_bifrost_pubsub_api_api_proto) Marshal(msg drpc.Message) ([]byte, error) { - return drpc1.Marshal(msg) -} - -func (drpcEncoding_File_github_com_aperturerobotics_bifrost_pubsub_api_api_proto) Unmarshal(buf []byte, msg drpc.Message) error { - return drpc1.Unmarshal(buf, msg) -} - -type DRPCPubSubServiceClient interface { - DRPCConn() drpc.Conn - - Subscribe(ctx context.Context) (DRPCPubSubService_SubscribeClient, error) -} - -type drpcPubSubServiceClient struct { - cc drpc.Conn -} - -func NewDRPCPubSubServiceClient(cc drpc.Conn) DRPCPubSubServiceClient { - return &drpcPubSubServiceClient{cc} -} - -func (c *drpcPubSubServiceClient) DRPCConn() drpc.Conn { return c.cc } - -func (c *drpcPubSubServiceClient) Subscribe(ctx context.Context) (DRPCPubSubService_SubscribeClient, error) { - stream, err := c.cc.NewStream(ctx, "/pubsub.api.PubSubService/Subscribe", drpcEncoding_File_github_com_aperturerobotics_bifrost_pubsub_api_api_proto{}) - if err != nil { - return nil, err - } - x := &drpcPubSubService_SubscribeClient{stream} - return x, nil -} - -type DRPCPubSubService_SubscribeClient interface { - drpc.Stream - Send(*SubscribeRequest) error - Recv() (*SubscribeResponse, error) -} - -type drpcPubSubService_SubscribeClient struct { - drpc.Stream -} - -func (x *drpcPubSubService_SubscribeClient) GetStream() drpc.Stream { - return x.Stream -} - -func (x *drpcPubSubService_SubscribeClient) Send(m *SubscribeRequest) error { - return x.MsgSend(m, drpcEncoding_File_github_com_aperturerobotics_bifrost_pubsub_api_api_proto{}) -} - -func (x *drpcPubSubService_SubscribeClient) Recv() (*SubscribeResponse, error) { - m := new(SubscribeResponse) - if err := x.MsgRecv(m, drpcEncoding_File_github_com_aperturerobotics_bifrost_pubsub_api_api_proto{}); err != nil { - return nil, err - } - return m, nil -} - -func (x *drpcPubSubService_SubscribeClient) RecvMsg(m *SubscribeResponse) error { - return x.MsgRecv(m, drpcEncoding_File_github_com_aperturerobotics_bifrost_pubsub_api_api_proto{}) -} - -type DRPCPubSubServiceServer interface { - Subscribe(DRPCPubSubService_SubscribeStream) error -} - -type DRPCPubSubServiceUnimplementedServer struct{} - -func (s *DRPCPubSubServiceUnimplementedServer) Subscribe(DRPCPubSubService_SubscribeStream) error { - return drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) -} - -type DRPCPubSubServiceDescription struct{} - -func (DRPCPubSubServiceDescription) NumMethods() int { return 1 } - -func (DRPCPubSubServiceDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver, interface{}, bool) { - switch n { - case 0: - return "/pubsub.api.PubSubService/Subscribe", drpcEncoding_File_github_com_aperturerobotics_bifrost_pubsub_api_api_proto{}, - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return nil, srv.(DRPCPubSubServiceServer). - Subscribe( - &drpcPubSubService_SubscribeStream{in1.(drpc.Stream)}, - ) - }, DRPCPubSubServiceServer.Subscribe, true - default: - return "", nil, nil, nil, false - } -} - -func DRPCRegisterPubSubService(mux drpc.Mux, impl DRPCPubSubServiceServer) error { - return mux.Register(impl, DRPCPubSubServiceDescription{}) -} - -type DRPCPubSubService_SubscribeStream interface { - drpc.Stream - Send(*SubscribeResponse) error - Recv() (*SubscribeRequest, error) -} - -type drpcPubSubService_SubscribeStream struct { - drpc.Stream -} - -func (x *drpcPubSubService_SubscribeStream) Send(m *SubscribeResponse) error { - return x.MsgSend(m, drpcEncoding_File_github_com_aperturerobotics_bifrost_pubsub_api_api_proto{}) -} - -func (x *drpcPubSubService_SubscribeStream) Recv() (*SubscribeRequest, error) { - m := new(SubscribeRequest) - if err := x.MsgRecv(m, drpcEncoding_File_github_com_aperturerobotics_bifrost_pubsub_api_api_proto{}); err != nil { - return nil, err - } - return m, nil -} - -func (x *drpcPubSubService_SubscribeStream) RecvMsg(m *SubscribeRequest) error { - return x.MsgRecv(m, drpcEncoding_File_github_com_aperturerobotics_bifrost_pubsub_api_api_proto{}) -} diff --git a/pubsub/api/api_pb.ts b/pubsub/api/api_pb.ts new file mode 100644 index 00000000..fc53f2f9 --- /dev/null +++ b/pubsub/api/api_pb.ts @@ -0,0 +1,439 @@ +// @generated by protoc-gen-es v1.8.0 with parameter "target=ts,ts_nocheck=false" +// @generated from file github.com/aperturerobotics/bifrost/pubsub/api/api.proto (package pubsub.api, syntax proto3) +/* eslint-disable */ + +import type { + BinaryReadOptions, + FieldList, + JsonReadOptions, + JsonValue, + PartialMessage, + PlainMessage, +} from '@bufbuild/protobuf' +import { Message, proto3 } from '@bufbuild/protobuf' + +/** + * SubcribeRequest is a pubsub subscription request message. + * + * @generated from message pubsub.api.SubscribeRequest + */ +export class SubscribeRequest extends Message { + /** + * ChannelId is the channel id to subscribe to. + * Must be sent before / with publish. + * Cannot change the channel ID after first transmission. + * + * @generated from field: string channel_id = 1; + */ + channelId = '' + + /** + * PeerId is the peer identifier of the publisher/subscriber. + * The peer ID will be used to acquire the peer private key. + * + * @generated from field: string peer_id = 2; + */ + peerId = '' + + /** + * PrivKeyPem is an alternate to PeerId, specify private key inline. + * Overrides PeerId if set. + * + * @generated from field: string priv_key_pem = 3; + */ + privKeyPem = '' + + /** + * PublishRequest contains a publish message request. + * + * @generated from field: pubsub.api.PublishRequest publish_request = 4; + */ + publishRequest?: PublishRequest + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'pubsub.api.SubscribeRequest' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: 'channel_id', kind: 'scalar', T: 9 /* ScalarType.STRING */ }, + { no: 2, name: 'peer_id', kind: 'scalar', T: 9 /* ScalarType.STRING */ }, + { + no: 3, + name: 'priv_key_pem', + kind: 'scalar', + T: 9 /* ScalarType.STRING */, + }, + { no: 4, name: 'publish_request', kind: 'message', T: PublishRequest }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): SubscribeRequest { + return new SubscribeRequest().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): SubscribeRequest { + return new SubscribeRequest().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): SubscribeRequest { + return new SubscribeRequest().fromJsonString(jsonString, options) + } + + static equals( + a: SubscribeRequest | PlainMessage | undefined, + b: SubscribeRequest | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(SubscribeRequest, a, b) + } +} + +/** + * PublishRequest is a message published via the subscribe channel. + * + * @generated from message pubsub.api.PublishRequest + */ +export class PublishRequest extends Message { + /** + * Data is the published data. + * + * @generated from field: bytes data = 1; + */ + data = new Uint8Array(0) + + /** + * Identifier is a uint32 identifier to use for outgoing status. + * If zero, no outgoing status response will be sent. + * + * @generated from field: uint32 identifier = 2; + */ + identifier = 0 + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'pubsub.api.PublishRequest' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: 'data', kind: 'scalar', T: 12 /* ScalarType.BYTES */ }, + { + no: 2, + name: 'identifier', + kind: 'scalar', + T: 13 /* ScalarType.UINT32 */, + }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): PublishRequest { + return new PublishRequest().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): PublishRequest { + return new PublishRequest().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): PublishRequest { + return new PublishRequest().fromJsonString(jsonString, options) + } + + static equals( + a: PublishRequest | PlainMessage | undefined, + b: PublishRequest | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(PublishRequest, a, b) + } +} + +/** + * SubcribeResponse is a pubsub subscription response message. + * + * @generated from message pubsub.api.SubscribeResponse + */ +export class SubscribeResponse extends Message { + /** + * IncomingMessage is an incoming message. + * + * @generated from field: pubsub.api.IncomingMessage incoming_message = 1; + */ + incomingMessage?: IncomingMessage + + /** + * OutgoingStatus is status of an outgoing message. + * Sent when a Publish request finishes. + * + * @generated from field: pubsub.api.OutgoingStatus outgoing_status = 2; + */ + outgoingStatus?: OutgoingStatus + + /** + * SubscriptionStatus is the status of the subscription + * + * @generated from field: pubsub.api.SubscriptionStatus subscription_status = 3; + */ + subscriptionStatus?: SubscriptionStatus + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'pubsub.api.SubscribeResponse' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: 'incoming_message', kind: 'message', T: IncomingMessage }, + { no: 2, name: 'outgoing_status', kind: 'message', T: OutgoingStatus }, + { + no: 3, + name: 'subscription_status', + kind: 'message', + T: SubscriptionStatus, + }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): SubscribeResponse { + return new SubscribeResponse().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): SubscribeResponse { + return new SubscribeResponse().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): SubscribeResponse { + return new SubscribeResponse().fromJsonString(jsonString, options) + } + + static equals( + a: SubscribeResponse | PlainMessage | undefined, + b: SubscribeResponse | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(SubscribeResponse, a, b) + } +} + +/** + * SubscripionStatus is the status of the subscription handle. + * + * @generated from message pubsub.api.SubscriptionStatus + */ +export class SubscriptionStatus extends Message { + /** + * Subscribed indicates the subscription is established. + * + * @generated from field: bool subscribed = 1; + */ + subscribed = false + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'pubsub.api.SubscriptionStatus' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: 'subscribed', kind: 'scalar', T: 8 /* ScalarType.BOOL */ }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): SubscriptionStatus { + return new SubscriptionStatus().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): SubscriptionStatus { + return new SubscriptionStatus().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): SubscriptionStatus { + return new SubscriptionStatus().fromJsonString(jsonString, options) + } + + static equals( + a: SubscriptionStatus | PlainMessage | undefined, + b: SubscriptionStatus | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(SubscriptionStatus, a, b) + } +} + +/** + * OutgoingStatus is status of an outgoing message. + * + * @generated from message pubsub.api.OutgoingStatus + */ +export class OutgoingStatus extends Message { + /** + * Identifier is the request-provided identifier for the message. + * + * @generated from field: uint32 identifier = 1; + */ + identifier = 0 + + /** + * Sent indicates if the message was sent. + * + * @generated from field: bool sent = 2; + */ + sent = false + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'pubsub.api.OutgoingStatus' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { + no: 1, + name: 'identifier', + kind: 'scalar', + T: 13 /* ScalarType.UINT32 */, + }, + { no: 2, name: 'sent', kind: 'scalar', T: 8 /* ScalarType.BOOL */ }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): OutgoingStatus { + return new OutgoingStatus().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): OutgoingStatus { + return new OutgoingStatus().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): OutgoingStatus { + return new OutgoingStatus().fromJsonString(jsonString, options) + } + + static equals( + a: OutgoingStatus | PlainMessage | undefined, + b: OutgoingStatus | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(OutgoingStatus, a, b) + } +} + +/** + * IncomingMessage implements Message with a proto object. + * + * @generated from message pubsub.api.IncomingMessage + */ +export class IncomingMessage extends Message { + /** + * FromPeerId is the peer identifier of the sender. + * + * @generated from field: string from_peer_id = 1; + */ + fromPeerId = '' + + /** + * Authenticated indicates if the message is verified to be from the sender. + * + * @generated from field: bool authenticated = 2; + */ + authenticated = false + + /** + * Data is the inner data. + * + * @generated from field: bytes data = 3; + */ + data = new Uint8Array(0) + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'pubsub.api.IncomingMessage' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { + no: 1, + name: 'from_peer_id', + kind: 'scalar', + T: 9 /* ScalarType.STRING */, + }, + { + no: 2, + name: 'authenticated', + kind: 'scalar', + T: 8 /* ScalarType.BOOL */, + }, + { no: 3, name: 'data', kind: 'scalar', T: 12 /* ScalarType.BYTES */ }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): IncomingMessage { + return new IncomingMessage().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): IncomingMessage { + return new IncomingMessage().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): IncomingMessage { + return new IncomingMessage().fromJsonString(jsonString, options) + } + + static equals( + a: IncomingMessage | PlainMessage | undefined, + b: IncomingMessage | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(IncomingMessage, a, b) + } +} diff --git a/pubsub/api/api_srpc.pb.go b/pubsub/api/api_srpc.pb.go index e22a6a05..069e2485 100644 --- a/pubsub/api/api_srpc.pb.go +++ b/pubsub/api/api_srpc.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-srpc. DO NOT EDIT. -// protoc-gen-srpc version: v0.27.3 +// protoc-gen-srpc version: v0.31.2 // source: github.com/aperturerobotics/bifrost/pubsub/api/api.proto package pubsub_api diff --git a/pubsub/api/api_srpc.pb.ts b/pubsub/api/api_srpc.pb.ts new file mode 100644 index 00000000..b1080a68 --- /dev/null +++ b/pubsub/api/api_srpc.pb.ts @@ -0,0 +1,83 @@ +// @generated by protoc-gen-es-starpc none with parameter "target=ts,ts_nocheck=false" +// @generated from file github.com/aperturerobotics/bifrost/pubsub/api/api.proto (package pubsub.api, syntax proto3) +/* eslint-disable */ + +import { SubscribeRequest, SubscribeResponse } from './api_pb.js' +import { MethodKind } from '@bufbuild/protobuf' +import { + buildDecodeMessageTransform, + buildEncodeMessageTransform, + MessageStream, + ProtoRpc, +} from 'starpc' + +/** + * PubSubService is the bifrost pubsub service. + * + * @generated from service pubsub.api.PubSubService + */ +export const PubSubServiceDefinition = { + typeName: 'pubsub.api.PubSubService', + methods: { + /** + * Subscribe subscribes to a channel, allowing the subscriber to publish + * messages over the same channel. + * + * @generated from rpc pubsub.api.PubSubService.Subscribe + */ + Subscribe: { + name: 'Subscribe', + I: SubscribeRequest, + O: SubscribeResponse, + kind: MethodKind.BiDiStreaming, + }, + }, +} as const + +/** + * PubSubService is the bifrost pubsub service. + * + * @generated from service pubsub.api.PubSubService + */ +export interface PubSubService { + /** + * Subscribe subscribes to a channel, allowing the subscriber to publish + * messages over the same channel. + * + * @generated from rpc pubsub.api.PubSubService.Subscribe + */ + Subscribe( + request: MessageStream, + abortSignal?: AbortSignal, + ): MessageStream +} + +export const PubSubServiceServiceName = PubSubServiceDefinition.typeName + +export class PubSubServiceClient implements PubSubService { + private readonly rpc: ProtoRpc + private readonly service: string + constructor(rpc: ProtoRpc, opts?: { service?: string }) { + this.service = opts?.service || PubSubServiceServiceName + this.rpc = rpc + this.Subscribe = this.Subscribe.bind(this) + } + /** + * Subscribe subscribes to a channel, allowing the subscriber to publish + * messages over the same channel. + * + * @generated from rpc pubsub.api.PubSubService.Subscribe + */ + Subscribe( + request: MessageStream, + abortSignal?: AbortSignal, + ): MessageStream { + const result = this.rpc.bidirectionalStreamingRequest( + this.service, + PubSubServiceDefinition.methods.Subscribe.name, + buildEncodeMessageTransform(SubscribeRequest)(request), + abortSignal || undefined, + ) + return buildDecodeMessageTransform(SubscribeResponse)(result) + } +} diff --git a/pubsub/api/api_vtproto.pb.go b/pubsub/api/api_vtproto.pb.go deleted file mode 100644 index dd98f45f..00000000 --- a/pubsub/api/api_vtproto.pb.go +++ /dev/null @@ -1,1461 +0,0 @@ -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// protoc-gen-go-vtproto version: v0.6.0 -// source: github.com/aperturerobotics/bifrost/pubsub/api/api.proto - -package pubsub_api - -import ( - fmt "fmt" - io "io" - - protohelpers "github.com/planetscale/vtprotobuf/protohelpers" - proto "google.golang.org/protobuf/proto" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) -) - -func (m *SubscribeRequest) CloneVT() *SubscribeRequest { - if m == nil { - return (*SubscribeRequest)(nil) - } - r := new(SubscribeRequest) - r.ChannelId = m.ChannelId - r.PeerId = m.PeerId - r.PrivKeyPem = m.PrivKeyPem - r.PublishRequest = m.PublishRequest.CloneVT() - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *SubscribeRequest) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *PublishRequest) CloneVT() *PublishRequest { - if m == nil { - return (*PublishRequest)(nil) - } - r := new(PublishRequest) - r.Identifier = m.Identifier - if rhs := m.Data; rhs != nil { - tmpBytes := make([]byte, len(rhs)) - copy(tmpBytes, rhs) - r.Data = tmpBytes - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *PublishRequest) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *SubscribeResponse) CloneVT() *SubscribeResponse { - if m == nil { - return (*SubscribeResponse)(nil) - } - r := new(SubscribeResponse) - r.IncomingMessage = m.IncomingMessage.CloneVT() - r.OutgoingStatus = m.OutgoingStatus.CloneVT() - r.SubscriptionStatus = m.SubscriptionStatus.CloneVT() - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *SubscribeResponse) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *SubscriptionStatus) CloneVT() *SubscriptionStatus { - if m == nil { - return (*SubscriptionStatus)(nil) - } - r := new(SubscriptionStatus) - r.Subscribed = m.Subscribed - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *SubscriptionStatus) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *OutgoingStatus) CloneVT() *OutgoingStatus { - if m == nil { - return (*OutgoingStatus)(nil) - } - r := new(OutgoingStatus) - r.Identifier = m.Identifier - r.Sent = m.Sent - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *OutgoingStatus) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *IncomingMessage) CloneVT() *IncomingMessage { - if m == nil { - return (*IncomingMessage)(nil) - } - r := new(IncomingMessage) - r.FromPeerId = m.FromPeerId - r.Authenticated = m.Authenticated - if rhs := m.Data; rhs != nil { - tmpBytes := make([]byte, len(rhs)) - copy(tmpBytes, rhs) - r.Data = tmpBytes - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *IncomingMessage) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (this *SubscribeRequest) EqualVT(that *SubscribeRequest) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.ChannelId != that.ChannelId { - return false - } - if this.PeerId != that.PeerId { - return false - } - if this.PrivKeyPem != that.PrivKeyPem { - return false - } - if !this.PublishRequest.EqualVT(that.PublishRequest) { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *SubscribeRequest) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*SubscribeRequest) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *PublishRequest) EqualVT(that *PublishRequest) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if string(this.Data) != string(that.Data) { - return false - } - if this.Identifier != that.Identifier { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *PublishRequest) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*PublishRequest) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *SubscribeResponse) EqualVT(that *SubscribeResponse) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if !this.IncomingMessage.EqualVT(that.IncomingMessage) { - return false - } - if !this.OutgoingStatus.EqualVT(that.OutgoingStatus) { - return false - } - if !this.SubscriptionStatus.EqualVT(that.SubscriptionStatus) { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *SubscribeResponse) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*SubscribeResponse) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *SubscriptionStatus) EqualVT(that *SubscriptionStatus) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.Subscribed != that.Subscribed { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *SubscriptionStatus) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*SubscriptionStatus) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *OutgoingStatus) EqualVT(that *OutgoingStatus) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.Identifier != that.Identifier { - return false - } - if this.Sent != that.Sent { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *OutgoingStatus) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*OutgoingStatus) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *IncomingMessage) EqualVT(that *IncomingMessage) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.FromPeerId != that.FromPeerId { - return false - } - if this.Authenticated != that.Authenticated { - return false - } - if string(this.Data) != string(that.Data) { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *IncomingMessage) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*IncomingMessage) - if !ok { - return false - } - return this.EqualVT(that) -} -func (m *SubscribeRequest) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *SubscribeRequest) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *SubscribeRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.PublishRequest != nil { - size, err := m.PublishRequest.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x22 - } - if len(m.PrivKeyPem) > 0 { - i -= len(m.PrivKeyPem) - copy(dAtA[i:], m.PrivKeyPem) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.PrivKeyPem))) - i-- - dAtA[i] = 0x1a - } - if len(m.PeerId) > 0 { - i -= len(m.PeerId) - copy(dAtA[i:], m.PeerId) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.PeerId))) - i-- - dAtA[i] = 0x12 - } - if len(m.ChannelId) > 0 { - i -= len(m.ChannelId) - copy(dAtA[i:], m.ChannelId) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.ChannelId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *PublishRequest) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PublishRequest) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *PublishRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Identifier != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Identifier)) - i-- - dAtA[i] = 0x10 - } - if len(m.Data) > 0 { - i -= len(m.Data) - copy(dAtA[i:], m.Data) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Data))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *SubscribeResponse) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *SubscribeResponse) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *SubscribeResponse) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.SubscriptionStatus != nil { - size, err := m.SubscriptionStatus.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x1a - } - if m.OutgoingStatus != nil { - size, err := m.OutgoingStatus.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x12 - } - if m.IncomingMessage != nil { - size, err := m.IncomingMessage.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *SubscriptionStatus) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *SubscriptionStatus) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *SubscriptionStatus) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Subscribed { - i-- - if m.Subscribed { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *OutgoingStatus) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *OutgoingStatus) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *OutgoingStatus) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Sent { - i-- - if m.Sent { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x10 - } - if m.Identifier != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Identifier)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *IncomingMessage) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *IncomingMessage) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *IncomingMessage) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Data) > 0 { - i -= len(m.Data) - copy(dAtA[i:], m.Data) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Data))) - i-- - dAtA[i] = 0x1a - } - if m.Authenticated { - i-- - if m.Authenticated { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x10 - } - if len(m.FromPeerId) > 0 { - i -= len(m.FromPeerId) - copy(dAtA[i:], m.FromPeerId) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.FromPeerId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *SubscribeRequest) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ChannelId) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - l = len(m.PeerId) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - l = len(m.PrivKeyPem) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.PublishRequest != nil { - l = m.PublishRequest.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *PublishRequest) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Data) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.Identifier != 0 { - n += 1 + protohelpers.SizeOfVarint(uint64(m.Identifier)) - } - n += len(m.unknownFields) - return n -} - -func (m *SubscribeResponse) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.IncomingMessage != nil { - l = m.IncomingMessage.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.OutgoingStatus != nil { - l = m.OutgoingStatus.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.SubscriptionStatus != nil { - l = m.SubscriptionStatus.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *SubscriptionStatus) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Subscribed { - n += 2 - } - n += len(m.unknownFields) - return n -} - -func (m *OutgoingStatus) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Identifier != 0 { - n += 1 + protohelpers.SizeOfVarint(uint64(m.Identifier)) - } - if m.Sent { - n += 2 - } - n += len(m.unknownFields) - return n -} - -func (m *IncomingMessage) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.FromPeerId) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.Authenticated { - n += 2 - } - l = len(m.Data) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *SubscribeRequest) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: SubscribeRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SubscribeRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChannelId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ChannelId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PeerId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PeerId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PrivKeyPem", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PrivKeyPem = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PublishRequest", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.PublishRequest == nil { - m.PublishRequest = &PublishRequest{} - } - if err := m.PublishRequest.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PublishRequest) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PublishRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PublishRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) - if m.Data == nil { - m.Data = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Identifier", wireType) - } - m.Identifier = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Identifier |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SubscribeResponse) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: SubscribeResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SubscribeResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field IncomingMessage", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.IncomingMessage == nil { - m.IncomingMessage = &IncomingMessage{} - } - if err := m.IncomingMessage.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OutgoingStatus", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.OutgoingStatus == nil { - m.OutgoingStatus = &OutgoingStatus{} - } - if err := m.OutgoingStatus.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SubscriptionStatus", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.SubscriptionStatus == nil { - m.SubscriptionStatus = &SubscriptionStatus{} - } - if err := m.SubscriptionStatus.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SubscriptionStatus) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: SubscriptionStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SubscriptionStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Subscribed", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Subscribed = bool(v != 0) - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *OutgoingStatus) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: OutgoingStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: OutgoingStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Identifier", wireType) - } - m.Identifier = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Identifier |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Sent", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Sent = bool(v != 0) - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *IncomingMessage) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: IncomingMessage: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: IncomingMessage: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FromPeerId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.FromPeerId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Authenticated", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Authenticated = bool(v != 0) - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) - if m.Data == nil { - m.Data = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} diff --git a/pubsub/floodsub/controller/config.pb.go b/pubsub/floodsub/controller/config.pb.go index c511994c..c481b119 100644 --- a/pubsub/floodsub/controller/config.pb.go +++ b/pubsub/floodsub/controller/config.pb.go @@ -1,158 +1,264 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0-devel -// protoc v5.26.1 +// Code generated by protoc-gen-go-lite. DO NOT EDIT. +// protoc-gen-go-lite version: v0.4.5 // source: github.com/aperturerobotics/bifrost/pubsub/floodsub/controller/config.proto package floodsub_controller import ( - reflect "reflect" - sync "sync" + io "io" floodsub "github.com/aperturerobotics/bifrost/pubsub/floodsub" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) + protobuf_go_lite "github.com/aperturerobotics/protobuf-go-lite" + json "github.com/aperturerobotics/protobuf-go-lite/json" + errors "github.com/pkg/errors" ) // Config is the floodsub controller config. type Config struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + unknownFields []byte // FloodsubConfig are pubsub provider specific configuration variables. - FloodsubConfig *floodsub.Config `protobuf:"bytes,1,opt,name=floodsub_config,json=floodsubConfig,proto3" json:"floodsub_config,omitempty"` + FloodsubConfig *floodsub.Config `protobuf:"bytes,1,opt,name=floodsub_config,json=floodsubConfig,proto3" json:"floodsubConfig,omitempty"` } func (x *Config) Reset() { *x = Config{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_pubsub_floodsub_controller_config_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) +} + +func (*Config) ProtoMessage() {} + +func (x *Config) GetFloodsubConfig() *floodsub.Config { + if x != nil { + return x.FloodsubConfig } + return nil } -func (x *Config) String() string { - return protoimpl.X.MessageStringOf(x) +func (m *Config) CloneVT() *Config { + if m == nil { + return (*Config)(nil) + } + r := new(Config) + if rhs := m.FloodsubConfig; rhs != nil { + r.FloodsubConfig = rhs.CloneVT() + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r } -func (*Config) ProtoMessage() {} +func (m *Config) CloneMessageVT() any { + return m.CloneVT() +} -func (x *Config) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_pubsub_floodsub_controller_config_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms +func (this *Config) EqualVT(that *Config) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if !this.FloodsubConfig.EqualVT(that.FloodsubConfig) { + return false } - return mi.MessageOf(x) + return string(this.unknownFields) == string(that.unknownFields) } -// Deprecated: Use Config.ProtoReflect.Descriptor instead. -func (*Config) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_pubsub_floodsub_controller_config_proto_rawDescGZIP(), []int{0} +func (this *Config) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*Config) + if !ok { + return false + } + return this.EqualVT(that) } -func (x *Config) GetFloodsubConfig() *floodsub.Config { - if x != nil { - return x.FloodsubConfig +// MarshalProtoJSON marshals the Config message to JSON. +func (x *Config) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return } - return nil + s.WriteObjectStart() + var wroteField bool + if x.FloodsubConfig != nil || s.HasField("floodsubConfig") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("floodsubConfig") + x.FloodsubConfig.MarshalProtoJSON(s.WithField("floodsubConfig")) + } + s.WriteObjectEnd() } -var File_github_com_aperturerobotics_bifrost_pubsub_floodsub_controller_config_proto protoreflect.FileDescriptor - -var file_github_com_aperturerobotics_bifrost_pubsub_floodsub_controller_config_proto_rawDesc = []byte{ - 0x0a, 0x4b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, - 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x62, 0x69, - 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2f, 0x70, 0x75, 0x62, 0x73, 0x75, 0x62, 0x2f, 0x66, 0x6c, 0x6f, - 0x6f, 0x64, 0x73, 0x75, 0x62, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, - 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x13, 0x66, - 0x6c, 0x6f, 0x6f, 0x64, 0x73, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, - 0x65, 0x72, 0x1a, 0x42, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, - 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, - 0x62, 0x69, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2f, 0x70, 0x75, 0x62, 0x73, 0x75, 0x62, 0x2f, 0x66, - 0x6c, 0x6f, 0x6f, 0x64, 0x73, 0x75, 0x62, 0x2f, 0x66, 0x6c, 0x6f, 0x6f, 0x64, 0x73, 0x75, 0x62, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x43, 0x0a, 0x06, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x12, 0x39, 0x0a, 0x0f, 0x66, 0x6c, 0x6f, 0x6f, 0x64, 0x73, 0x75, 0x62, 0x5f, 0x63, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x66, 0x6c, 0x6f, 0x6f, - 0x64, 0x73, 0x75, 0x62, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x0e, 0x66, 0x6c, 0x6f, - 0x6f, 0x64, 0x73, 0x75, 0x62, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, -} - -var ( - file_github_com_aperturerobotics_bifrost_pubsub_floodsub_controller_config_proto_rawDescOnce sync.Once - file_github_com_aperturerobotics_bifrost_pubsub_floodsub_controller_config_proto_rawDescData = file_github_com_aperturerobotics_bifrost_pubsub_floodsub_controller_config_proto_rawDesc -) +// MarshalJSON marshals the Config to JSON. +func (x *Config) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) +} -func file_github_com_aperturerobotics_bifrost_pubsub_floodsub_controller_config_proto_rawDescGZIP() []byte { - file_github_com_aperturerobotics_bifrost_pubsub_floodsub_controller_config_proto_rawDescOnce.Do(func() { - file_github_com_aperturerobotics_bifrost_pubsub_floodsub_controller_config_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_aperturerobotics_bifrost_pubsub_floodsub_controller_config_proto_rawDescData) +// UnmarshalProtoJSON unmarshals the Config message from JSON. +func (x *Config) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { + return + } + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "floodsub_config", "floodsubConfig": + if s.ReadNil() { + x.FloodsubConfig = nil + return + } + x.FloodsubConfig = &floodsub.Config{} + x.FloodsubConfig.UnmarshalProtoJSON(s.WithField("floodsub_config", true)) + } }) - return file_github_com_aperturerobotics_bifrost_pubsub_floodsub_controller_config_proto_rawDescData } -var file_github_com_aperturerobotics_bifrost_pubsub_floodsub_controller_config_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_github_com_aperturerobotics_bifrost_pubsub_floodsub_controller_config_proto_goTypes = []interface{}{ - (*Config)(nil), // 0: floodsub.controller.Config - (*floodsub.Config)(nil), // 1: floodsub.Config +// UnmarshalJSON unmarshals the Config from JSON. +func (x *Config) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +func (m *Config) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil } -var file_github_com_aperturerobotics_bifrost_pubsub_floodsub_controller_config_proto_depIdxs = []int32{ - 1, // 0: floodsub.controller.Config.floodsub_config:type_name -> floodsub.Config - 1, // [1:1] is the sub-list for method output_type - 1, // [1:1] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name + +func (m *Config) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) } -func init() { file_github_com_aperturerobotics_bifrost_pubsub_floodsub_controller_config_proto_init() } -func file_github_com_aperturerobotics_bifrost_pubsub_floodsub_controller_config_proto_init() { - if File_github_com_aperturerobotics_bifrost_pubsub_floodsub_controller_config_proto != nil { - return +func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.FloodsubConfig != nil { + size, err := m.FloodsubConfig.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0xa } - if !protoimpl.UnsafeEnabled { - file_github_com_aperturerobotics_bifrost_pubsub_floodsub_controller_config_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Config); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil + return len(dAtA) - i, nil +} + +func (m *Config) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.FloodsubConfig != nil { + l = m.FloodsubConfig.SizeVT() + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *Config) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break } } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: Config: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: Config: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field FloodsubConfig", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.FloodsubConfig == nil { + m.FloodsubConfig = &floodsub.Config{} + } + if err := m.FloodsubConfig.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_github_com_aperturerobotics_bifrost_pubsub_floodsub_controller_config_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_github_com_aperturerobotics_bifrost_pubsub_floodsub_controller_config_proto_goTypes, - DependencyIndexes: file_github_com_aperturerobotics_bifrost_pubsub_floodsub_controller_config_proto_depIdxs, - MessageInfos: file_github_com_aperturerobotics_bifrost_pubsub_floodsub_controller_config_proto_msgTypes, - }.Build() - File_github_com_aperturerobotics_bifrost_pubsub_floodsub_controller_config_proto = out.File - file_github_com_aperturerobotics_bifrost_pubsub_floodsub_controller_config_proto_rawDesc = nil - file_github_com_aperturerobotics_bifrost_pubsub_floodsub_controller_config_proto_goTypes = nil - file_github_com_aperturerobotics_bifrost_pubsub_floodsub_controller_config_proto_depIdxs = nil + return nil } diff --git a/pubsub/floodsub/controller/config.pb.ts b/pubsub/floodsub/controller/config.pb.ts deleted file mode 100644 index 4d3f3836..00000000 --- a/pubsub/floodsub/controller/config.pb.ts +++ /dev/null @@ -1,155 +0,0 @@ -/* eslint-disable */ -import Long from 'long' -import _m0 from 'protobufjs/minimal.js' -import { Config as Config1 } from '../floodsub.pb.js' - -export const protobufPackage = 'floodsub.controller' - -/** Config is the floodsub controller config. */ -export interface Config { - /** FloodsubConfig are pubsub provider specific configuration variables. */ - floodsubConfig: Config1 | undefined -} - -function createBaseConfig(): Config { - return { floodsubConfig: undefined } -} - -export const Config = { - encode( - message: Config, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.floodsubConfig !== undefined) { - Config1.encode(message.floodsubConfig, writer.uint32(10).fork()).ldelim() - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Config { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseConfig() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break - } - - message.floodsubConfig = Config1.decode(reader, reader.uint32()) - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: AsyncIterable | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config.encode(p).finish()] - } - } else { - yield* [Config.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config.decode(p)] - } - } else { - yield* [Config.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): Config { - return { - floodsubConfig: isSet(object.floodsubConfig) - ? Config1.fromJSON(object.floodsubConfig) - : undefined, - } - }, - - toJSON(message: Config): unknown { - const obj: any = {} - if (message.floodsubConfig !== undefined) { - obj.floodsubConfig = Config1.toJSON(message.floodsubConfig) - } - return obj - }, - - create, I>>(base?: I): Config { - return Config.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>(object: I): Config { - const message = createBaseConfig() - message.floodsubConfig = - object.floodsubConfig !== undefined && object.floodsubConfig !== null - ? Config1.fromPartial(object.floodsubConfig) - : undefined - return message - }, -} - -type Builtin = - | Date - | Function - | Uint8Array - | string - | number - | boolean - | undefined - -export type DeepPartial = T extends Builtin - ? T - : T extends Long - ? string | number | Long - : T extends globalThis.Array - ? globalThis.Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends { $case: string } - ? { [K in keyof Omit]?: DeepPartial } & { - $case: T['$case'] - } - : T extends {} - ? { [K in keyof T]?: DeepPartial } - : Partial - -type KeysOfUnion = T extends T ? keyof T : never -export type Exact = P extends Builtin - ? P - : P & { [K in keyof P]: Exact } & { - [K in Exclude>]: never - } - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any - _m0.configure() -} - -function isSet(value: any): boolean { - return value !== null && value !== undefined -} diff --git a/pubsub/floodsub/controller/config_pb.ts b/pubsub/floodsub/controller/config_pb.ts new file mode 100644 index 00000000..b3905292 --- /dev/null +++ b/pubsub/floodsub/controller/config_pb.ts @@ -0,0 +1,67 @@ +// @generated by protoc-gen-es v1.8.0 with parameter "target=ts,ts_nocheck=false" +// @generated from file github.com/aperturerobotics/bifrost/pubsub/floodsub/controller/config.proto (package floodsub.controller, syntax proto3) +/* eslint-disable */ + +import type { + BinaryReadOptions, + FieldList, + JsonReadOptions, + JsonValue, + PartialMessage, + PlainMessage, +} from '@bufbuild/protobuf' +import { Message, proto3 } from '@bufbuild/protobuf' +import { Config as Config$1 } from '../floodsub_pb.js' + +/** + * Config is the floodsub controller config. + * + * @generated from message floodsub.controller.Config + */ +export class Config extends Message { + /** + * FloodsubConfig are pubsub provider specific configuration variables. + * + * @generated from field: floodsub.Config floodsub_config = 1; + */ + floodsubConfig?: Config$1 + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'floodsub.controller.Config' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: 'floodsub_config', kind: 'message', T: Config$1 }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): Config { + return new Config().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): Config { + return new Config().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): Config { + return new Config().fromJsonString(jsonString, options) + } + + static equals( + a: Config | PlainMessage | undefined, + b: Config | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(Config, a, b) + } +} diff --git a/pubsub/floodsub/controller/config_vtproto.pb.go b/pubsub/floodsub/controller/config_vtproto.pb.go deleted file mode 100644 index 1b917b88..00000000 --- a/pubsub/floodsub/controller/config_vtproto.pb.go +++ /dev/null @@ -1,239 +0,0 @@ -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// protoc-gen-go-vtproto version: v0.6.0 -// source: github.com/aperturerobotics/bifrost/pubsub/floodsub/controller/config.proto - -package floodsub_controller - -import ( - fmt "fmt" - io "io" - - floodsub "github.com/aperturerobotics/bifrost/pubsub/floodsub" - protohelpers "github.com/planetscale/vtprotobuf/protohelpers" - proto "google.golang.org/protobuf/proto" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) -) - -func (m *Config) CloneVT() *Config { - if m == nil { - return (*Config)(nil) - } - r := new(Config) - if rhs := m.FloodsubConfig; rhs != nil { - if vtpb, ok := interface{}(rhs).(interface{ CloneVT() *floodsub.Config }); ok { - r.FloodsubConfig = vtpb.CloneVT() - } else { - r.FloodsubConfig = proto.Clone(rhs).(*floodsub.Config) - } - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Config) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (this *Config) EqualVT(that *Config) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if equal, ok := interface{}(this.FloodsubConfig).(interface{ EqualVT(*floodsub.Config) bool }); ok { - if !equal.EqualVT(that.FloodsubConfig) { - return false - } - } else if !proto.Equal(this.FloodsubConfig, that.FloodsubConfig) { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Config) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Config) - if !ok { - return false - } - return this.EqualVT(that) -} -func (m *Config) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Config) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.FloodsubConfig != nil { - if vtmsg, ok := interface{}(m.FloodsubConfig).(interface { - MarshalToSizedBufferVT([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.FloodsubConfig) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Config) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.FloodsubConfig != nil { - if size, ok := interface{}(m.FloodsubConfig).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.FloodsubConfig) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *Config) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Config: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Config: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FloodsubConfig", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.FloodsubConfig == nil { - m.FloodsubConfig = &floodsub.Config{} - } - if unmarshal, ok := interface{}(m.FloodsubConfig).(interface { - UnmarshalVT([]byte) error - }); ok { - if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - } else { - if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.FloodsubConfig); err != nil { - return err - } - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} diff --git a/pubsub/floodsub/floodsub.pb.go b/pubsub/floodsub/floodsub.pb.go index 51f22153..186dab06 100644 --- a/pubsub/floodsub/floodsub.pb.go +++ b/pubsub/floodsub/floodsub.pb.go @@ -1,71 +1,33 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0-devel -// protoc v5.26.1 +// Code generated by protoc-gen-go-lite. DO NOT EDIT. +// protoc-gen-go-lite version: v0.4.5 // source: github.com/aperturerobotics/bifrost/pubsub/floodsub/floodsub.proto package floodsub import ( - reflect "reflect" - sync "sync" + io "io" hash "github.com/aperturerobotics/bifrost/hash" peer "github.com/aperturerobotics/bifrost/peer" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) + protobuf_go_lite "github.com/aperturerobotics/protobuf-go-lite" + json "github.com/aperturerobotics/protobuf-go-lite/json" + errors "github.com/pkg/errors" ) // Config configures the floodsub router. type Config struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + unknownFields []byte // PublishHashType is the hash type to use when signing published messages. // Defaults to sha256 - PublishHashType hash.HashType `protobuf:"varint,1,opt,name=publish_hash_type,json=publishHashType,proto3,enum=hash.HashType" json:"publish_hash_type,omitempty"` + PublishHashType hash.HashType `protobuf:"varint,1,opt,name=publish_hash_type,json=publishHashType,proto3" json:"publishHashType,omitempty"` } func (x *Config) Reset() { *x = Config{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_pubsub_floodsub_floodsub_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Config) String() string { - return protoimpl.X.MessageStringOf(x) } func (*Config) ProtoMessage() {} -func (x *Config) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_pubsub_floodsub_floodsub_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 Config.ProtoReflect.Descriptor instead. -func (*Config) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_pubsub_floodsub_floodsub_proto_rawDescGZIP(), []int{0} -} - func (x *Config) GetPublishHashType() hash.HashType { if x != nil { return x.PublishHashType @@ -75,10 +37,7 @@ func (x *Config) GetPublishHashType() hash.HashType { // Packet is the floodsub packet. type Packet struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + unknownFields []byte // Subscriptions contains any new subscription changes. Subscriptions []*SubscriptionOpts `protobuf:"bytes,1,rep,name=subscriptions,proto3" json:"subscriptions,omitempty"` // Publish contains messages we are publishing. @@ -87,36 +46,10 @@ type Packet struct { func (x *Packet) Reset() { *x = Packet{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_pubsub_floodsub_floodsub_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Packet) String() string { - return protoimpl.X.MessageStringOf(x) } func (*Packet) ProtoMessage() {} -func (x *Packet) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_pubsub_floodsub_floodsub_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 Packet.ProtoReflect.Descriptor instead. -func (*Packet) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_pubsub_floodsub_floodsub_proto_rawDescGZIP(), []int{1} -} - func (x *Packet) GetSubscriptions() []*SubscriptionOpts { if x != nil { return x.Subscriptions @@ -133,48 +66,19 @@ func (x *Packet) GetPublish() []*peer.SignedMsg { // SubscriptionOpts are subscription options. type SubscriptionOpts struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + unknownFields []byte // Subscribe indicates if we are subscribing to this channel ID. Subscribe bool `protobuf:"varint,1,opt,name=subscribe,proto3" json:"subscribe,omitempty"` // ChannelId is the channel to subscribe to. - ChannelId string `protobuf:"bytes,2,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` + ChannelId string `protobuf:"bytes,2,opt,name=channel_id,json=channelId,proto3" json:"channelId,omitempty"` } func (x *SubscriptionOpts) Reset() { *x = SubscriptionOpts{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_pubsub_floodsub_floodsub_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SubscriptionOpts) String() string { - return protoimpl.X.MessageStringOf(x) } func (*SubscriptionOpts) ProtoMessage() {} -func (x *SubscriptionOpts) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_pubsub_floodsub_floodsub_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 SubscriptionOpts.ProtoReflect.Descriptor instead. -func (*SubscriptionOpts) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_pubsub_floodsub_floodsub_proto_rawDescGZIP(), []int{2} -} - func (x *SubscriptionOpts) GetSubscribe() bool { if x != nil { return x.Subscribe @@ -189,130 +93,833 @@ func (x *SubscriptionOpts) GetChannelId() string { return "" } -var File_github_com_aperturerobotics_bifrost_pubsub_floodsub_floodsub_proto protoreflect.FileDescriptor - -var file_github_com_aperturerobotics_bifrost_pubsub_floodsub_floodsub_proto_rawDesc = []byte{ - 0x0a, 0x42, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, - 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x62, 0x69, - 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2f, 0x70, 0x75, 0x62, 0x73, 0x75, 0x62, 0x2f, 0x66, 0x6c, 0x6f, - 0x6f, 0x64, 0x73, 0x75, 0x62, 0x2f, 0x66, 0x6c, 0x6f, 0x6f, 0x64, 0x73, 0x75, 0x62, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x08, 0x66, 0x6c, 0x6f, 0x6f, 0x64, 0x73, 0x75, 0x62, 0x1a, 0x33, - 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, 0x72, 0x74, - 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x62, 0x69, 0x66, 0x72, - 0x6f, 0x73, 0x74, 0x2f, 0x70, 0x65, 0x65, 0x72, 0x2f, 0x70, 0x65, 0x65, 0x72, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x1a, 0x33, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, - 0x61, 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, - 0x2f, 0x62, 0x69, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2f, 0x68, 0x61, 0x73, 0x68, 0x2f, 0x68, 0x61, - 0x73, 0x68, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x44, 0x0a, 0x06, 0x43, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x12, 0x3a, 0x0a, 0x11, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x5f, 0x68, 0x61, - 0x73, 0x68, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0e, 0x2e, - 0x68, 0x61, 0x73, 0x68, 0x2e, 0x48, 0x61, 0x73, 0x68, 0x54, 0x79, 0x70, 0x65, 0x52, 0x0f, 0x70, - 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x48, 0x61, 0x73, 0x68, 0x54, 0x79, 0x70, 0x65, 0x22, 0x75, - 0x0a, 0x06, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x12, 0x40, 0x0a, 0x0d, 0x73, 0x75, 0x62, 0x73, - 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x1a, 0x2e, 0x66, 0x6c, 0x6f, 0x6f, 0x64, 0x73, 0x75, 0x62, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, - 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x4f, 0x70, 0x74, 0x73, 0x52, 0x0d, 0x73, 0x75, 0x62, - 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x29, 0x0a, 0x07, 0x70, 0x75, - 0x62, 0x6c, 0x69, 0x73, 0x68, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x70, 0x65, - 0x65, 0x72, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x4d, 0x73, 0x67, 0x52, 0x07, 0x70, 0x75, - 0x62, 0x6c, 0x69, 0x73, 0x68, 0x22, 0x4f, 0x0a, 0x10, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x4f, 0x70, 0x74, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x75, 0x62, - 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x73, 0x75, - 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x68, 0x61, 0x6e, 0x6e, - 0x65, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x68, 0x61, - 0x6e, 0x6e, 0x65, 0x6c, 0x49, 0x64, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_github_com_aperturerobotics_bifrost_pubsub_floodsub_floodsub_proto_rawDescOnce sync.Once - file_github_com_aperturerobotics_bifrost_pubsub_floodsub_floodsub_proto_rawDescData = file_github_com_aperturerobotics_bifrost_pubsub_floodsub_floodsub_proto_rawDesc -) +func (m *Config) CloneVT() *Config { + if m == nil { + return (*Config)(nil) + } + r := new(Config) + r.PublishHashType = m.PublishHashType + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *Config) CloneMessageVT() any { + return m.CloneVT() +} + +func (m *Packet) CloneVT() *Packet { + if m == nil { + return (*Packet)(nil) + } + r := new(Packet) + if rhs := m.Subscriptions; rhs != nil { + tmpContainer := make([]*SubscriptionOpts, len(rhs)) + for k, v := range rhs { + tmpContainer[k] = v.CloneVT() + } + r.Subscriptions = tmpContainer + } + if rhs := m.Publish; rhs != nil { + tmpContainer := make([]*peer.SignedMsg, len(rhs)) + for k, v := range rhs { + tmpContainer[k] = v.CloneVT() + } + r.Publish = tmpContainer + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *Packet) CloneMessageVT() any { + return m.CloneVT() +} + +func (m *SubscriptionOpts) CloneVT() *SubscriptionOpts { + if m == nil { + return (*SubscriptionOpts)(nil) + } + r := new(SubscriptionOpts) + r.Subscribe = m.Subscribe + r.ChannelId = m.ChannelId + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *SubscriptionOpts) CloneMessageVT() any { + return m.CloneVT() +} + +func (this *Config) EqualVT(that *Config) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.PublishHashType != that.PublishHashType { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *Config) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*Config) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *Packet) EqualVT(that *Packet) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if len(this.Subscriptions) != len(that.Subscriptions) { + return false + } + for i, vx := range this.Subscriptions { + vy := that.Subscriptions[i] + if p, q := vx, vy; p != q { + if p == nil { + p = &SubscriptionOpts{} + } + if q == nil { + q = &SubscriptionOpts{} + } + if !p.EqualVT(q) { + return false + } + } + } + if len(this.Publish) != len(that.Publish) { + return false + } + for i, vx := range this.Publish { + vy := that.Publish[i] + if p, q := vx, vy; p != q { + if p == nil { + p = &peer.SignedMsg{} + } + if q == nil { + q = &peer.SignedMsg{} + } + if !p.EqualVT(q) { + return false + } + } + } + return string(this.unknownFields) == string(that.unknownFields) +} -func file_github_com_aperturerobotics_bifrost_pubsub_floodsub_floodsub_proto_rawDescGZIP() []byte { - file_github_com_aperturerobotics_bifrost_pubsub_floodsub_floodsub_proto_rawDescOnce.Do(func() { - file_github_com_aperturerobotics_bifrost_pubsub_floodsub_floodsub_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_aperturerobotics_bifrost_pubsub_floodsub_floodsub_proto_rawDescData) +func (this *Packet) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*Packet) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *SubscriptionOpts) EqualVT(that *SubscriptionOpts) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.Subscribe != that.Subscribe { + return false + } + if this.ChannelId != that.ChannelId { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *SubscriptionOpts) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*SubscriptionOpts) + if !ok { + return false + } + return this.EqualVT(that) +} + +// MarshalProtoJSON marshals the Config message to JSON. +func (x *Config) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return + } + s.WriteObjectStart() + var wroteField bool + if x.PublishHashType != 0 || s.HasField("publishHashType") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("publishHashType") + x.PublishHashType.MarshalProtoJSON(s) + } + s.WriteObjectEnd() +} + +// MarshalJSON marshals the Config to JSON. +func (x *Config) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) +} + +// UnmarshalProtoJSON unmarshals the Config message from JSON. +func (x *Config) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { + return + } + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "publish_hash_type", "publishHashType": + s.AddField("publish_hash_type") + x.PublishHashType.UnmarshalProtoJSON(s) + } }) - return file_github_com_aperturerobotics_bifrost_pubsub_floodsub_floodsub_proto_rawDescData -} - -var file_github_com_aperturerobotics_bifrost_pubsub_floodsub_floodsub_proto_msgTypes = make([]protoimpl.MessageInfo, 3) -var file_github_com_aperturerobotics_bifrost_pubsub_floodsub_floodsub_proto_goTypes = []interface{}{ - (*Config)(nil), // 0: floodsub.Config - (*Packet)(nil), // 1: floodsub.Packet - (*SubscriptionOpts)(nil), // 2: floodsub.SubscriptionOpts - (hash.HashType)(0), // 3: hash.HashType - (*peer.SignedMsg)(nil), // 4: peer.SignedMsg -} -var file_github_com_aperturerobotics_bifrost_pubsub_floodsub_floodsub_proto_depIdxs = []int32{ - 3, // 0: floodsub.Config.publish_hash_type:type_name -> hash.HashType - 2, // 1: floodsub.Packet.subscriptions:type_name -> floodsub.SubscriptionOpts - 4, // 2: floodsub.Packet.publish:type_name -> peer.SignedMsg - 3, // [3:3] is the sub-list for method output_type - 3, // [3:3] is the sub-list for method input_type - 3, // [3:3] is the sub-list for extension type_name - 3, // [3:3] is the sub-list for extension extendee - 0, // [0:3] is the sub-list for field type_name -} - -func init() { file_github_com_aperturerobotics_bifrost_pubsub_floodsub_floodsub_proto_init() } -func file_github_com_aperturerobotics_bifrost_pubsub_floodsub_floodsub_proto_init() { - if File_github_com_aperturerobotics_bifrost_pubsub_floodsub_floodsub_proto != nil { +} + +// UnmarshalJSON unmarshals the Config from JSON. +func (x *Config) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +// MarshalProtoJSON marshals the Packet message to JSON. +func (x *Packet) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return + } + s.WriteObjectStart() + var wroteField bool + if len(x.Subscriptions) > 0 || s.HasField("subscriptions") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("subscriptions") + s.WriteArrayStart() + var wroteElement bool + for _, element := range x.Subscriptions { + s.WriteMoreIf(&wroteElement) + element.MarshalProtoJSON(s.WithField("subscriptions")) + } + s.WriteArrayEnd() + } + if len(x.Publish) > 0 || s.HasField("publish") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("publish") + s.WriteArrayStart() + var wroteElement bool + for _, element := range x.Publish { + s.WriteMoreIf(&wroteElement) + element.MarshalProtoJSON(s.WithField("publish")) + } + s.WriteArrayEnd() + } + s.WriteObjectEnd() +} + +// MarshalJSON marshals the Packet to JSON. +func (x *Packet) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) +} + +// UnmarshalProtoJSON unmarshals the Packet message from JSON. +func (x *Packet) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { return } - if !protoimpl.UnsafeEnabled { - file_github_com_aperturerobotics_bifrost_pubsub_floodsub_floodsub_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Config); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "subscriptions": + s.AddField("subscriptions") + if s.ReadNil() { + x.Subscriptions = nil + return } + s.ReadArray(func() { + if s.ReadNil() { + x.Subscriptions = append(x.Subscriptions, nil) + return + } + v := &SubscriptionOpts{} + v.UnmarshalProtoJSON(s.WithField("subscriptions", false)) + if s.Err() != nil { + return + } + x.Subscriptions = append(x.Subscriptions, v) + }) + case "publish": + s.AddField("publish") + if s.ReadNil() { + x.Publish = nil + return + } + s.ReadArray(func() { + if s.ReadNil() { + x.Publish = append(x.Publish, nil) + return + } + v := &peer.SignedMsg{} + v.UnmarshalProtoJSON(s.WithField("publish", false)) + if s.Err() != nil { + return + } + x.Publish = append(x.Publish, v) + }) } - file_github_com_aperturerobotics_bifrost_pubsub_floodsub_floodsub_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Packet); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil + }) +} + +// UnmarshalJSON unmarshals the Packet from JSON. +func (x *Packet) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +// MarshalProtoJSON marshals the SubscriptionOpts message to JSON. +func (x *SubscriptionOpts) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return + } + s.WriteObjectStart() + var wroteField bool + if x.Subscribe || s.HasField("subscribe") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("subscribe") + s.WriteBool(x.Subscribe) + } + if x.ChannelId != "" || s.HasField("channelId") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("channelId") + s.WriteString(x.ChannelId) + } + s.WriteObjectEnd() +} + +// MarshalJSON marshals the SubscriptionOpts to JSON. +func (x *SubscriptionOpts) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) +} + +// UnmarshalProtoJSON unmarshals the SubscriptionOpts message from JSON. +func (x *SubscriptionOpts) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { + return + } + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "subscribe": + s.AddField("subscribe") + x.Subscribe = s.ReadBool() + case "channel_id", "channelId": + s.AddField("channel_id") + x.ChannelId = s.ReadString() + } + }) +} + +// UnmarshalJSON unmarshals the SubscriptionOpts from JSON. +func (x *SubscriptionOpts) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +func (m *Config) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Config) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.PublishHashType != 0 { + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(m.PublishHashType)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *Packet) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Packet) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *Packet) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.Publish) > 0 { + for iNdEx := len(m.Publish) - 1; iNdEx >= 0; iNdEx-- { + size, err := m.Publish[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err } + i -= size + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x12 } - file_github_com_aperturerobotics_bifrost_pubsub_floodsub_floodsub_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SubscriptionOpts); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil + } + if len(m.Subscriptions) > 0 { + for iNdEx := len(m.Subscriptions) - 1; iNdEx >= 0; iNdEx-- { + size, err := m.Subscriptions[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err } + i -= size + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *SubscriptionOpts) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SubscriptionOpts) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *SubscriptionOpts) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.ChannelId) > 0 { + i -= len(m.ChannelId) + copy(dAtA[i:], m.ChannelId) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.ChannelId))) + i-- + dAtA[i] = 0x12 + } + if m.Subscribe { + i-- + if m.Subscribe { + dAtA[i] = 1 + } else { + dAtA[i] = 0 } + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *Config) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.PublishHashType != 0 { + n += 1 + protobuf_go_lite.SizeOfVarint(uint64(m.PublishHashType)) + } + n += len(m.unknownFields) + return n +} + +func (m *Packet) SizeVT() (n int) { + if m == nil { + return 0 } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_github_com_aperturerobotics_bifrost_pubsub_floodsub_floodsub_proto_rawDesc, - NumEnums: 0, - NumMessages: 3, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_github_com_aperturerobotics_bifrost_pubsub_floodsub_floodsub_proto_goTypes, - DependencyIndexes: file_github_com_aperturerobotics_bifrost_pubsub_floodsub_floodsub_proto_depIdxs, - MessageInfos: file_github_com_aperturerobotics_bifrost_pubsub_floodsub_floodsub_proto_msgTypes, - }.Build() - File_github_com_aperturerobotics_bifrost_pubsub_floodsub_floodsub_proto = out.File - file_github_com_aperturerobotics_bifrost_pubsub_floodsub_floodsub_proto_rawDesc = nil - file_github_com_aperturerobotics_bifrost_pubsub_floodsub_floodsub_proto_goTypes = nil - file_github_com_aperturerobotics_bifrost_pubsub_floodsub_floodsub_proto_depIdxs = nil + var l int + _ = l + if len(m.Subscriptions) > 0 { + for _, e := range m.Subscriptions { + l = e.SizeVT() + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + } + if len(m.Publish) > 0 { + for _, e := range m.Publish { + l = e.SizeVT() + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + } + n += len(m.unknownFields) + return n +} + +func (m *SubscriptionOpts) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Subscribe { + n += 2 + } + l = len(m.ChannelId) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *Config) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: Config: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: Config: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return errors.Errorf("proto: wrong wireType = %d for field PublishHashType", wireType) + } + m.PublishHashType = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PublishHashType |= hash.HashType(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Packet) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: Packet: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: Packet: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field Subscriptions", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Subscriptions = append(m.Subscriptions, &SubscriptionOpts{}) + if err := m.Subscriptions[len(m.Subscriptions)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field Publish", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Publish = append(m.Publish, &peer.SignedMsg{}) + if err := m.Publish[len(m.Publish)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SubscriptionOpts) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: SubscriptionOpts: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: SubscriptionOpts: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return errors.Errorf("proto: wrong wireType = %d for field Subscribe", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Subscribe = bool(v != 0) + case 2: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field ChannelId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ChannelId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil } diff --git a/pubsub/floodsub/floodsub.pb.ts b/pubsub/floodsub/floodsub.pb.ts deleted file mode 100644 index 06985b46..00000000 --- a/pubsub/floodsub/floodsub.pb.ts +++ /dev/null @@ -1,419 +0,0 @@ -/* eslint-disable */ -import Long from 'long' -import _m0 from 'protobufjs/minimal.js' -import { - HashType, - hashTypeFromJSON, - hashTypeToJSON, -} from '../../hash/hash.pb.js' -import { SignedMsg } from '../../peer/peer.pb.js' - -export const protobufPackage = 'floodsub' - -/** Config configures the floodsub router. */ -export interface Config { - /** - * PublishHashType is the hash type to use when signing published messages. - * Defaults to sha256 - */ - publishHashType: HashType -} - -/** Packet is the floodsub packet. */ -export interface Packet { - /** Subscriptions contains any new subscription changes. */ - subscriptions: SubscriptionOpts[] - /** Publish contains messages we are publishing. */ - publish: SignedMsg[] -} - -/** SubscriptionOpts are subscription options. */ -export interface SubscriptionOpts { - /** Subscribe indicates if we are subscribing to this channel ID. */ - subscribe: boolean - /** ChannelId is the channel to subscribe to. */ - channelId: string -} - -function createBaseConfig(): Config { - return { publishHashType: 0 } -} - -export const Config = { - encode( - message: Config, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.publishHashType !== 0) { - writer.uint32(8).int32(message.publishHashType) - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Config { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseConfig() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 8) { - break - } - - message.publishHashType = reader.int32() as any - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: AsyncIterable | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config.encode(p).finish()] - } - } else { - yield* [Config.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config.decode(p)] - } - } else { - yield* [Config.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): Config { - return { - publishHashType: isSet(object.publishHashType) - ? hashTypeFromJSON(object.publishHashType) - : 0, - } - }, - - toJSON(message: Config): unknown { - const obj: any = {} - if (message.publishHashType !== 0) { - obj.publishHashType = hashTypeToJSON(message.publishHashType) - } - return obj - }, - - create, I>>(base?: I): Config { - return Config.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>(object: I): Config { - const message = createBaseConfig() - message.publishHashType = object.publishHashType ?? 0 - return message - }, -} - -function createBasePacket(): Packet { - return { subscriptions: [], publish: [] } -} - -export const Packet = { - encode( - message: Packet, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - for (const v of message.subscriptions) { - SubscriptionOpts.encode(v!, writer.uint32(10).fork()).ldelim() - } - for (const v of message.publish) { - SignedMsg.encode(v!, writer.uint32(18).fork()).ldelim() - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Packet { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBasePacket() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break - } - - message.subscriptions.push( - SubscriptionOpts.decode(reader, reader.uint32()), - ) - continue - case 2: - if (tag !== 18) { - break - } - - message.publish.push(SignedMsg.decode(reader, reader.uint32())) - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: AsyncIterable | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Packet.encode(p).finish()] - } - } else { - yield* [Packet.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Packet.decode(p)] - } - } else { - yield* [Packet.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): Packet { - return { - subscriptions: globalThis.Array.isArray(object?.subscriptions) - ? object.subscriptions.map((e: any) => SubscriptionOpts.fromJSON(e)) - : [], - publish: globalThis.Array.isArray(object?.publish) - ? object.publish.map((e: any) => SignedMsg.fromJSON(e)) - : [], - } - }, - - toJSON(message: Packet): unknown { - const obj: any = {} - if (message.subscriptions?.length) { - obj.subscriptions = message.subscriptions.map((e) => - SubscriptionOpts.toJSON(e), - ) - } - if (message.publish?.length) { - obj.publish = message.publish.map((e) => SignedMsg.toJSON(e)) - } - return obj - }, - - create, I>>(base?: I): Packet { - return Packet.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>(object: I): Packet { - const message = createBasePacket() - message.subscriptions = - object.subscriptions?.map((e) => SubscriptionOpts.fromPartial(e)) || [] - message.publish = object.publish?.map((e) => SignedMsg.fromPartial(e)) || [] - return message - }, -} - -function createBaseSubscriptionOpts(): SubscriptionOpts { - return { subscribe: false, channelId: '' } -} - -export const SubscriptionOpts = { - encode( - message: SubscriptionOpts, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.subscribe !== false) { - writer.uint32(8).bool(message.subscribe) - } - if (message.channelId !== '') { - writer.uint32(18).string(message.channelId) - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): SubscriptionOpts { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseSubscriptionOpts() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 8) { - break - } - - message.subscribe = reader.bool() - continue - case 2: - if (tag !== 18) { - break - } - - message.channelId = reader.string() - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [SubscriptionOpts.encode(p).finish()] - } - } else { - yield* [SubscriptionOpts.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [SubscriptionOpts.decode(p)] - } - } else { - yield* [SubscriptionOpts.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): SubscriptionOpts { - return { - subscribe: isSet(object.subscribe) - ? globalThis.Boolean(object.subscribe) - : false, - channelId: isSet(object.channelId) - ? globalThis.String(object.channelId) - : '', - } - }, - - toJSON(message: SubscriptionOpts): unknown { - const obj: any = {} - if (message.subscribe !== false) { - obj.subscribe = message.subscribe - } - if (message.channelId !== '') { - obj.channelId = message.channelId - } - return obj - }, - - create, I>>( - base?: I, - ): SubscriptionOpts { - return SubscriptionOpts.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>( - object: I, - ): SubscriptionOpts { - const message = createBaseSubscriptionOpts() - message.subscribe = object.subscribe ?? false - message.channelId = object.channelId ?? '' - return message - }, -} - -type Builtin = - | Date - | Function - | Uint8Array - | string - | number - | boolean - | undefined - -export type DeepPartial = T extends Builtin - ? T - : T extends Long - ? string | number | Long - : T extends globalThis.Array - ? globalThis.Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends { $case: string } - ? { [K in keyof Omit]?: DeepPartial } & { - $case: T['$case'] - } - : T extends {} - ? { [K in keyof T]?: DeepPartial } - : Partial - -type KeysOfUnion = T extends T ? keyof T : never -export type Exact = P extends Builtin - ? P - : P & { [K in keyof P]: Exact } & { - [K in Exclude>]: never - } - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any - _m0.configure() -} - -function isSet(value: any): boolean { - return value !== null && value !== undefined -} diff --git a/pubsub/floodsub/floodsub_pb.ts b/pubsub/floodsub/floodsub_pb.ts new file mode 100644 index 00000000..9cb6768d --- /dev/null +++ b/pubsub/floodsub/floodsub_pb.ts @@ -0,0 +1,202 @@ +// @generated by protoc-gen-es v1.8.0 with parameter "target=ts,ts_nocheck=false" +// @generated from file github.com/aperturerobotics/bifrost/pubsub/floodsub/floodsub.proto (package floodsub, syntax proto3) +/* eslint-disable */ + +import type { + BinaryReadOptions, + FieldList, + JsonReadOptions, + JsonValue, + PartialMessage, + PlainMessage, +} from '@bufbuild/protobuf' +import { Message, proto3 } from '@bufbuild/protobuf' +import { HashType } from '../../hash/hash_pb.js' +import { SignedMsg } from '../../peer/peer_pb.js' + +/** + * Config configures the floodsub router. + * + * @generated from message floodsub.Config + */ +export class Config extends Message { + /** + * PublishHashType is the hash type to use when signing published messages. + * Defaults to sha256 + * + * @generated from field: hash.HashType publish_hash_type = 1; + */ + publishHashType = HashType.HashType_UNKNOWN + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'floodsub.Config' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { + no: 1, + name: 'publish_hash_type', + kind: 'enum', + T: proto3.getEnumType(HashType), + }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): Config { + return new Config().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): Config { + return new Config().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): Config { + return new Config().fromJsonString(jsonString, options) + } + + static equals( + a: Config | PlainMessage | undefined, + b: Config | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(Config, a, b) + } +} + +/** + * Packet is the floodsub packet. + * + * @generated from message floodsub.Packet + */ +export class Packet extends Message { + /** + * Subscriptions contains any new subscription changes. + * + * @generated from field: repeated floodsub.SubscriptionOpts subscriptions = 1; + */ + subscriptions: SubscriptionOpts[] = [] + + /** + * Publish contains messages we are publishing. + * + * @generated from field: repeated peer.SignedMsg publish = 2; + */ + publish: SignedMsg[] = [] + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'floodsub.Packet' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { + no: 1, + name: 'subscriptions', + kind: 'message', + T: SubscriptionOpts, + repeated: true, + }, + { no: 2, name: 'publish', kind: 'message', T: SignedMsg, repeated: true }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): Packet { + return new Packet().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): Packet { + return new Packet().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): Packet { + return new Packet().fromJsonString(jsonString, options) + } + + static equals( + a: Packet | PlainMessage | undefined, + b: Packet | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(Packet, a, b) + } +} + +/** + * SubscriptionOpts are subscription options. + * + * @generated from message floodsub.SubscriptionOpts + */ +export class SubscriptionOpts extends Message { + /** + * Subscribe indicates if we are subscribing to this channel ID. + * + * @generated from field: bool subscribe = 1; + */ + subscribe = false + + /** + * ChannelId is the channel to subscribe to. + * + * @generated from field: string channel_id = 2; + */ + channelId = '' + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'floodsub.SubscriptionOpts' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: 'subscribe', kind: 'scalar', T: 8 /* ScalarType.BOOL */ }, + { no: 2, name: 'channel_id', kind: 'scalar', T: 9 /* ScalarType.STRING */ }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): SubscriptionOpts { + return new SubscriptionOpts().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): SubscriptionOpts { + return new SubscriptionOpts().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): SubscriptionOpts { + return new SubscriptionOpts().fromJsonString(jsonString, options) + } + + static equals( + a: SubscriptionOpts | PlainMessage | undefined, + b: SubscriptionOpts | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(SubscriptionOpts, a, b) + } +} diff --git a/pubsub/floodsub/floodsub_vtproto.pb.go b/pubsub/floodsub/floodsub_vtproto.pb.go deleted file mode 100644 index cc1defcd..00000000 --- a/pubsub/floodsub/floodsub_vtproto.pb.go +++ /dev/null @@ -1,703 +0,0 @@ -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// protoc-gen-go-vtproto version: v0.6.0 -// source: github.com/aperturerobotics/bifrost/pubsub/floodsub/floodsub.proto - -package floodsub - -import ( - fmt "fmt" - io "io" - - hash "github.com/aperturerobotics/bifrost/hash" - peer "github.com/aperturerobotics/bifrost/peer" - protohelpers "github.com/planetscale/vtprotobuf/protohelpers" - proto "google.golang.org/protobuf/proto" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) -) - -func (m *Config) CloneVT() *Config { - if m == nil { - return (*Config)(nil) - } - r := new(Config) - r.PublishHashType = m.PublishHashType - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Config) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *Packet) CloneVT() *Packet { - if m == nil { - return (*Packet)(nil) - } - r := new(Packet) - if rhs := m.Subscriptions; rhs != nil { - tmpContainer := make([]*SubscriptionOpts, len(rhs)) - for k, v := range rhs { - tmpContainer[k] = v.CloneVT() - } - r.Subscriptions = tmpContainer - } - if rhs := m.Publish; rhs != nil { - tmpContainer := make([]*peer.SignedMsg, len(rhs)) - for k, v := range rhs { - if vtpb, ok := interface{}(v).(interface{ CloneVT() *peer.SignedMsg }); ok { - tmpContainer[k] = vtpb.CloneVT() - } else { - tmpContainer[k] = proto.Clone(v).(*peer.SignedMsg) - } - } - r.Publish = tmpContainer - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Packet) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *SubscriptionOpts) CloneVT() *SubscriptionOpts { - if m == nil { - return (*SubscriptionOpts)(nil) - } - r := new(SubscriptionOpts) - r.Subscribe = m.Subscribe - r.ChannelId = m.ChannelId - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *SubscriptionOpts) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (this *Config) EqualVT(that *Config) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.PublishHashType != that.PublishHashType { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Config) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Config) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *Packet) EqualVT(that *Packet) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if len(this.Subscriptions) != len(that.Subscriptions) { - return false - } - for i, vx := range this.Subscriptions { - vy := that.Subscriptions[i] - if p, q := vx, vy; p != q { - if p == nil { - p = &SubscriptionOpts{} - } - if q == nil { - q = &SubscriptionOpts{} - } - if !p.EqualVT(q) { - return false - } - } - } - if len(this.Publish) != len(that.Publish) { - return false - } - for i, vx := range this.Publish { - vy := that.Publish[i] - if p, q := vx, vy; p != q { - if p == nil { - p = &peer.SignedMsg{} - } - if q == nil { - q = &peer.SignedMsg{} - } - if equal, ok := interface{}(p).(interface{ EqualVT(*peer.SignedMsg) bool }); ok { - if !equal.EqualVT(q) { - return false - } - } else if !proto.Equal(p, q) { - return false - } - } - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Packet) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Packet) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *SubscriptionOpts) EqualVT(that *SubscriptionOpts) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.Subscribe != that.Subscribe { - return false - } - if this.ChannelId != that.ChannelId { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *SubscriptionOpts) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*SubscriptionOpts) - if !ok { - return false - } - return this.EqualVT(that) -} -func (m *Config) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Config) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.PublishHashType != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.PublishHashType)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *Packet) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Packet) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Packet) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Publish) > 0 { - for iNdEx := len(m.Publish) - 1; iNdEx >= 0; iNdEx-- { - if vtmsg, ok := interface{}(m.Publish[iNdEx]).(interface { - MarshalToSizedBufferVT([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.Publish[iNdEx]) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0x12 - } - } - if len(m.Subscriptions) > 0 { - for iNdEx := len(m.Subscriptions) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.Subscriptions[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *SubscriptionOpts) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *SubscriptionOpts) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *SubscriptionOpts) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.ChannelId) > 0 { - i -= len(m.ChannelId) - copy(dAtA[i:], m.ChannelId) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.ChannelId))) - i-- - dAtA[i] = 0x12 - } - if m.Subscribe { - i-- - if m.Subscribe { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *Config) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.PublishHashType != 0 { - n += 1 + protohelpers.SizeOfVarint(uint64(m.PublishHashType)) - } - n += len(m.unknownFields) - return n -} - -func (m *Packet) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Subscriptions) > 0 { - for _, e := range m.Subscriptions { - l = e.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - } - if len(m.Publish) > 0 { - for _, e := range m.Publish { - if size, ok := interface{}(e).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(e) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - } - n += len(m.unknownFields) - return n -} - -func (m *SubscriptionOpts) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Subscribe { - n += 2 - } - l = len(m.ChannelId) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *Config) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Config: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Config: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field PublishHashType", wireType) - } - m.PublishHashType = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.PublishHashType |= hash.HashType(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Packet) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Packet: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Packet: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Subscriptions", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Subscriptions = append(m.Subscriptions, &SubscriptionOpts{}) - if err := m.Subscriptions[len(m.Subscriptions)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Publish", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Publish = append(m.Publish, &peer.SignedMsg{}) - if unmarshal, ok := interface{}(m.Publish[len(m.Publish)-1]).(interface { - UnmarshalVT([]byte) error - }); ok { - if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - } else { - if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.Publish[len(m.Publish)-1]); err != nil { - return err - } - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SubscriptionOpts) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: SubscriptionOpts: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SubscriptionOpts: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Subscribe", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Subscribe = bool(v != 0) - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChannelId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ChannelId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} diff --git a/pubsub/nats/controller/config.pb.go b/pubsub/nats/controller/config.pb.go index fa57f7f5..29ac112b 100644 --- a/pubsub/nats/controller/config.pb.go +++ b/pubsub/nats/controller/config.pb.go @@ -1,73 +1,35 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0-devel -// protoc v5.26.1 +// Code generated by protoc-gen-go-lite. DO NOT EDIT. +// protoc-gen-go-lite version: v0.4.5 // source: github.com/aperturerobotics/bifrost/pubsub/nats/controller/config.proto package nats_controller import ( - reflect "reflect" - sync "sync" + io "io" nats "github.com/aperturerobotics/bifrost/pubsub/nats" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) + protobuf_go_lite "github.com/aperturerobotics/protobuf-go-lite" + json "github.com/aperturerobotics/protobuf-go-lite/json" + errors "github.com/pkg/errors" ) // Config is the nats controller config. type Config struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + unknownFields []byte // PeerID sets the peer ID to attach the server to. // Must be set. // If set to special value: "any" - binds to any peer. - PeerId string `protobuf:"bytes,1,opt,name=peer_id,json=peerId,proto3" json:"peer_id,omitempty"` + PeerId string `protobuf:"bytes,1,opt,name=peer_id,json=peerId,proto3" json:"peerId,omitempty"` // NatsConfig configures nats. - NatsConfig *nats.Config `protobuf:"bytes,2,opt,name=nats_config,json=natsConfig,proto3" json:"nats_config,omitempty"` + NatsConfig *nats.Config `protobuf:"bytes,2,opt,name=nats_config,json=natsConfig,proto3" json:"natsConfig,omitempty"` } func (x *Config) Reset() { *x = Config{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_pubsub_nats_controller_config_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Config) String() string { - return protoimpl.X.MessageStringOf(x) } func (*Config) ProtoMessage() {} -func (x *Config) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_pubsub_nats_controller_config_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 Config.ProtoReflect.Descriptor instead. -func (*Config) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_pubsub_nats_controller_config_proto_rawDescGZIP(), []int{0} -} - func (x *Config) GetPeerId() string { if x != nil { return x.PeerId @@ -82,87 +44,287 @@ func (x *Config) GetNatsConfig() *nats.Config { return nil } -var File_github_com_aperturerobotics_bifrost_pubsub_nats_controller_config_proto protoreflect.FileDescriptor - -var file_github_com_aperturerobotics_bifrost_pubsub_nats_controller_config_proto_rawDesc = []byte{ - 0x0a, 0x47, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, - 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x62, 0x69, - 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2f, 0x70, 0x75, 0x62, 0x73, 0x75, 0x62, 0x2f, 0x6e, 0x61, 0x74, - 0x73, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x63, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0f, 0x6e, 0x61, 0x74, 0x73, 0x2e, - 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x1a, 0x3a, 0x67, 0x69, 0x74, 0x68, - 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, - 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x62, 0x69, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2f, - 0x70, 0x75, 0x62, 0x73, 0x75, 0x62, 0x2f, 0x6e, 0x61, 0x74, 0x73, 0x2f, 0x6e, 0x61, 0x74, 0x73, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x50, 0x0a, 0x06, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x12, 0x17, 0x0a, 0x07, 0x70, 0x65, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x06, 0x70, 0x65, 0x65, 0x72, 0x49, 0x64, 0x12, 0x2d, 0x0a, 0x0b, 0x6e, 0x61, 0x74, - 0x73, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, - 0x2e, 0x6e, 0x61, 0x74, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x0a, 0x6e, 0x61, - 0x74, 0x73, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_github_com_aperturerobotics_bifrost_pubsub_nats_controller_config_proto_rawDescOnce sync.Once - file_github_com_aperturerobotics_bifrost_pubsub_nats_controller_config_proto_rawDescData = file_github_com_aperturerobotics_bifrost_pubsub_nats_controller_config_proto_rawDesc -) +func (m *Config) CloneVT() *Config { + if m == nil { + return (*Config)(nil) + } + r := new(Config) + r.PeerId = m.PeerId + if rhs := m.NatsConfig; rhs != nil { + r.NatsConfig = rhs.CloneVT() + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} -func file_github_com_aperturerobotics_bifrost_pubsub_nats_controller_config_proto_rawDescGZIP() []byte { - file_github_com_aperturerobotics_bifrost_pubsub_nats_controller_config_proto_rawDescOnce.Do(func() { - file_github_com_aperturerobotics_bifrost_pubsub_nats_controller_config_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_aperturerobotics_bifrost_pubsub_nats_controller_config_proto_rawDescData) - }) - return file_github_com_aperturerobotics_bifrost_pubsub_nats_controller_config_proto_rawDescData +func (m *Config) CloneMessageVT() any { + return m.CloneVT() +} + +func (this *Config) EqualVT(that *Config) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.PeerId != that.PeerId { + return false + } + if !this.NatsConfig.EqualVT(that.NatsConfig) { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *Config) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*Config) + if !ok { + return false + } + return this.EqualVT(that) } -var file_github_com_aperturerobotics_bifrost_pubsub_nats_controller_config_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_github_com_aperturerobotics_bifrost_pubsub_nats_controller_config_proto_goTypes = []interface{}{ - (*Config)(nil), // 0: nats.controller.Config - (*nats.Config)(nil), // 1: nats.Config +// MarshalProtoJSON marshals the Config message to JSON. +func (x *Config) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return + } + s.WriteObjectStart() + var wroteField bool + if x.PeerId != "" || s.HasField("peerId") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("peerId") + s.WriteString(x.PeerId) + } + if x.NatsConfig != nil || s.HasField("natsConfig") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("natsConfig") + x.NatsConfig.MarshalProtoJSON(s.WithField("natsConfig")) + } + s.WriteObjectEnd() } -var file_github_com_aperturerobotics_bifrost_pubsub_nats_controller_config_proto_depIdxs = []int32{ - 1, // 0: nats.controller.Config.nats_config:type_name -> nats.Config - 1, // [1:1] is the sub-list for method output_type - 1, // [1:1] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name + +// MarshalJSON marshals the Config to JSON. +func (x *Config) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) } -func init() { file_github_com_aperturerobotics_bifrost_pubsub_nats_controller_config_proto_init() } -func file_github_com_aperturerobotics_bifrost_pubsub_nats_controller_config_proto_init() { - if File_github_com_aperturerobotics_bifrost_pubsub_nats_controller_config_proto != nil { +// UnmarshalProtoJSON unmarshals the Config message from JSON. +func (x *Config) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { return } - if !protoimpl.UnsafeEnabled { - file_github_com_aperturerobotics_bifrost_pubsub_nats_controller_config_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Config); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "peer_id", "peerId": + s.AddField("peer_id") + x.PeerId = s.ReadString() + case "nats_config", "natsConfig": + if s.ReadNil() { + x.NatsConfig = nil + return } + x.NatsConfig = &nats.Config{} + x.NatsConfig.UnmarshalProtoJSON(s.WithField("nats_config", true)) } + }) +} + +// UnmarshalJSON unmarshals the Config from JSON. +func (x *Config) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +func (m *Config) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_github_com_aperturerobotics_bifrost_pubsub_nats_controller_config_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_github_com_aperturerobotics_bifrost_pubsub_nats_controller_config_proto_goTypes, - DependencyIndexes: file_github_com_aperturerobotics_bifrost_pubsub_nats_controller_config_proto_depIdxs, - MessageInfos: file_github_com_aperturerobotics_bifrost_pubsub_nats_controller_config_proto_msgTypes, - }.Build() - File_github_com_aperturerobotics_bifrost_pubsub_nats_controller_config_proto = out.File - file_github_com_aperturerobotics_bifrost_pubsub_nats_controller_config_proto_rawDesc = nil - file_github_com_aperturerobotics_bifrost_pubsub_nats_controller_config_proto_goTypes = nil - file_github_com_aperturerobotics_bifrost_pubsub_nats_controller_config_proto_depIdxs = nil + return dAtA[:n], nil +} + +func (m *Config) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.NatsConfig != nil { + size, err := m.NatsConfig.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x12 + } + if len(m.PeerId) > 0 { + i -= len(m.PeerId) + copy(dAtA[i:], m.PeerId) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.PeerId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Config) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.PeerId) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + if m.NatsConfig != nil { + l = m.NatsConfig.SizeVT() + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *Config) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: Config: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: Config: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field PeerId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PeerId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field NatsConfig", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.NatsConfig == nil { + m.NatsConfig = &nats.Config{} + } + if err := m.NatsConfig.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil } diff --git a/pubsub/nats/controller/config.pb.ts b/pubsub/nats/controller/config.pb.ts deleted file mode 100644 index c3d6ba15..00000000 --- a/pubsub/nats/controller/config.pb.ts +++ /dev/null @@ -1,176 +0,0 @@ -/* eslint-disable */ -import Long from 'long' -import _m0 from 'protobufjs/minimal.js' -import { Config as Config1 } from '../nats.pb.js' - -export const protobufPackage = 'nats.controller' - -/** Config is the nats controller config. */ -export interface Config { - /** - * PeerID sets the peer ID to attach the server to. - * Must be set. - * If set to special value: "any" - binds to any peer. - */ - peerId: string - /** NatsConfig configures nats. */ - natsConfig: Config1 | undefined -} - -function createBaseConfig(): Config { - return { peerId: '', natsConfig: undefined } -} - -export const Config = { - encode( - message: Config, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.peerId !== '') { - writer.uint32(10).string(message.peerId) - } - if (message.natsConfig !== undefined) { - Config1.encode(message.natsConfig, writer.uint32(18).fork()).ldelim() - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Config { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseConfig() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break - } - - message.peerId = reader.string() - continue - case 2: - if (tag !== 18) { - break - } - - message.natsConfig = Config1.decode(reader, reader.uint32()) - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: AsyncIterable | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config.encode(p).finish()] - } - } else { - yield* [Config.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config.decode(p)] - } - } else { - yield* [Config.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): Config { - return { - peerId: isSet(object.peerId) ? globalThis.String(object.peerId) : '', - natsConfig: isSet(object.natsConfig) - ? Config1.fromJSON(object.natsConfig) - : undefined, - } - }, - - toJSON(message: Config): unknown { - const obj: any = {} - if (message.peerId !== '') { - obj.peerId = message.peerId - } - if (message.natsConfig !== undefined) { - obj.natsConfig = Config1.toJSON(message.natsConfig) - } - return obj - }, - - create, I>>(base?: I): Config { - return Config.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>(object: I): Config { - const message = createBaseConfig() - message.peerId = object.peerId ?? '' - message.natsConfig = - object.natsConfig !== undefined && object.natsConfig !== null - ? Config1.fromPartial(object.natsConfig) - : undefined - return message - }, -} - -type Builtin = - | Date - | Function - | Uint8Array - | string - | number - | boolean - | undefined - -export type DeepPartial = T extends Builtin - ? T - : T extends Long - ? string | number | Long - : T extends globalThis.Array - ? globalThis.Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends { $case: string } - ? { [K in keyof Omit]?: DeepPartial } & { - $case: T['$case'] - } - : T extends {} - ? { [K in keyof T]?: DeepPartial } - : Partial - -type KeysOfUnion = T extends T ? keyof T : never -export type Exact = P extends Builtin - ? P - : P & { [K in keyof P]: Exact } & { - [K in Exclude>]: never - } - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any - _m0.configure() -} - -function isSet(value: any): boolean { - return value !== null && value !== undefined -} diff --git a/pubsub/nats/controller/config_pb.ts b/pubsub/nats/controller/config_pb.ts new file mode 100644 index 00000000..b154828d --- /dev/null +++ b/pubsub/nats/controller/config_pb.ts @@ -0,0 +1,77 @@ +// @generated by protoc-gen-es v1.8.0 with parameter "target=ts,ts_nocheck=false" +// @generated from file github.com/aperturerobotics/bifrost/pubsub/nats/controller/config.proto (package nats.controller, syntax proto3) +/* eslint-disable */ + +import type { + BinaryReadOptions, + FieldList, + JsonReadOptions, + JsonValue, + PartialMessage, + PlainMessage, +} from '@bufbuild/protobuf' +import { Message, proto3 } from '@bufbuild/protobuf' +import { Config as Config$1 } from '../nats_pb.js' + +/** + * Config is the nats controller config. + * + * @generated from message nats.controller.Config + */ +export class Config extends Message { + /** + * PeerID sets the peer ID to attach the server to. + * Must be set. + * If set to special value: "any" - binds to any peer. + * + * @generated from field: string peer_id = 1; + */ + peerId = '' + + /** + * NatsConfig configures nats. + * + * @generated from field: nats.Config nats_config = 2; + */ + natsConfig?: Config$1 + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'nats.controller.Config' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: 'peer_id', kind: 'scalar', T: 9 /* ScalarType.STRING */ }, + { no: 2, name: 'nats_config', kind: 'message', T: Config$1 }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): Config { + return new Config().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): Config { + return new Config().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): Config { + return new Config().fromJsonString(jsonString, options) + } + + static equals( + a: Config | PlainMessage | undefined, + b: Config | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(Config, a, b) + } +} diff --git a/pubsub/nats/controller/config_vtproto.pb.go b/pubsub/nats/controller/config_vtproto.pb.go deleted file mode 100644 index f970f1d7..00000000 --- a/pubsub/nats/controller/config_vtproto.pb.go +++ /dev/null @@ -1,286 +0,0 @@ -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// protoc-gen-go-vtproto version: v0.6.0 -// source: github.com/aperturerobotics/bifrost/pubsub/nats/controller/config.proto - -package nats_controller - -import ( - fmt "fmt" - io "io" - - nats "github.com/aperturerobotics/bifrost/pubsub/nats" - protohelpers "github.com/planetscale/vtprotobuf/protohelpers" - proto "google.golang.org/protobuf/proto" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) -) - -func (m *Config) CloneVT() *Config { - if m == nil { - return (*Config)(nil) - } - r := new(Config) - r.PeerId = m.PeerId - if rhs := m.NatsConfig; rhs != nil { - if vtpb, ok := interface{}(rhs).(interface{ CloneVT() *nats.Config }); ok { - r.NatsConfig = vtpb.CloneVT() - } else { - r.NatsConfig = proto.Clone(rhs).(*nats.Config) - } - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Config) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (this *Config) EqualVT(that *Config) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.PeerId != that.PeerId { - return false - } - if equal, ok := interface{}(this.NatsConfig).(interface{ EqualVT(*nats.Config) bool }); ok { - if !equal.EqualVT(that.NatsConfig) { - return false - } - } else if !proto.Equal(this.NatsConfig, that.NatsConfig) { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Config) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Config) - if !ok { - return false - } - return this.EqualVT(that) -} -func (m *Config) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Config) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.NatsConfig != nil { - if vtmsg, ok := interface{}(m.NatsConfig).(interface { - MarshalToSizedBufferVT([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.NatsConfig) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0x12 - } - if len(m.PeerId) > 0 { - i -= len(m.PeerId) - copy(dAtA[i:], m.PeerId) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.PeerId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Config) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.PeerId) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.NatsConfig != nil { - if size, ok := interface{}(m.NatsConfig).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.NatsConfig) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *Config) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Config: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Config: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PeerId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PeerId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NatsConfig", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.NatsConfig == nil { - m.NatsConfig = &nats.Config{} - } - if unmarshal, ok := interface{}(m.NatsConfig).(interface { - UnmarshalVT([]byte) error - }); ok { - if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - } else { - if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.NatsConfig); err != nil { - return err - } - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} diff --git a/pubsub/nats/nats.pb.go b/pubsub/nats/nats.pb.go index 7d9c9b56..aa027993 100644 --- a/pubsub/nats/nats.pb.go +++ b/pubsub/nats/nats.pb.go @@ -1,25 +1,17 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0-devel -// protoc v5.26.1 +// Code generated by protoc-gen-go-lite. DO NOT EDIT. +// protoc-gen-go-lite version: v0.4.5 // source: github.com/aperturerobotics/bifrost/pubsub/nats/nats.proto package nats import ( - reflect "reflect" - sync "sync" + io "io" + strconv "strconv" hash "github.com/aperturerobotics/bifrost/hash" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) + protobuf_go_lite "github.com/aperturerobotics/protobuf-go-lite" + json "github.com/aperturerobotics/protobuf-go-lite/json" + errors "github.com/pkg/errors" ) // NatsConnType indicates the type of nats conn a stream represents. @@ -55,82 +47,40 @@ func (x NatsConnType) Enum() *NatsConnType { } func (x NatsConnType) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (NatsConnType) Descriptor() protoreflect.EnumDescriptor { - return file_github_com_aperturerobotics_bifrost_pubsub_nats_nats_proto_enumTypes[0].Descriptor() -} - -func (NatsConnType) Type() protoreflect.EnumType { - return &file_github_com_aperturerobotics_bifrost_pubsub_nats_nats_proto_enumTypes[0] -} - -func (x NatsConnType) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use NatsConnType.Descriptor instead. -func (NatsConnType) EnumDescriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_pubsub_nats_nats_proto_rawDescGZIP(), []int{0} + name, valid := NatsConnType_name[int32(x)] + if valid { + return name + } + return strconv.Itoa(int(x)) } // Config configures the nats router, hosting a nats.io routing node. // This uses nats 2.0 accounts - an Account maps to a Peer. type Config struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + unknownFields []byte // ClusterName is the cluster ID string to use. // This must be the same on all nodes. // If unset, uses the protocol ID. - ClusterName string `protobuf:"bytes,1,opt,name=cluster_name,json=clusterName,proto3" json:"cluster_name,omitempty"` + ClusterName string `protobuf:"bytes,1,opt,name=cluster_name,json=clusterName,proto3" json:"clusterName,omitempty"` // PublishHashType is the hash type to use when signing published messages. // Defaults to sha256 - PublishHashType hash.HashType `protobuf:"varint,2,opt,name=publish_hash_type,json=publishHashType,proto3,enum=hash.HashType" json:"publish_hash_type,omitempty"` + PublishHashType hash.HashType `protobuf:"varint,2,opt,name=publish_hash_type,json=publishHashType,proto3" json:"publishHashType,omitempty"` // LogDebug turns on extended debugging logging. - LogDebug bool `protobuf:"varint,3,opt,name=log_debug,json=logDebug,proto3" json:"log_debug,omitempty"` + LogDebug bool `protobuf:"varint,3,opt,name=log_debug,json=logDebug,proto3" json:"logDebug,omitempty"` // LogTrace turns on tracing logging. // implies log_debug. - LogTrace bool `protobuf:"varint,4,opt,name=log_trace,json=logTrace,proto3" json:"log_trace,omitempty"` + LogTrace bool `protobuf:"varint,4,opt,name=log_trace,json=logTrace,proto3" json:"logTrace,omitempty"` // LogTraceVrebose turns on verbose tracing logging. // Implies log_trace and log_debug. - LogTraceVerbose bool `protobuf:"varint,5,opt,name=log_trace_verbose,json=logTraceVerbose,proto3" json:"log_trace_verbose,omitempty"` + LogTraceVerbose bool `protobuf:"varint,5,opt,name=log_trace_verbose,json=logTraceVerbose,proto3" json:"logTraceVerbose,omitempty"` } func (x *Config) Reset() { *x = Config{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_pubsub_nats_nats_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Config) String() string { - return protoimpl.X.MessageStringOf(x) } func (*Config) ProtoMessage() {} -func (x *Config) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_pubsub_nats_nats_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 Config.ProtoReflect.Descriptor instead. -func (*Config) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_pubsub_nats_nats_proto_rawDescGZIP(), []int{0} -} - func (x *Config) GetClusterName() string { if x != nil { return x.ClusterName @@ -166,102 +116,433 @@ func (x *Config) GetLogTraceVerbose() bool { return false } -var File_github_com_aperturerobotics_bifrost_pubsub_nats_nats_proto protoreflect.FileDescriptor - -var file_github_com_aperturerobotics_bifrost_pubsub_nats_nats_proto_rawDesc = []byte{ - 0x0a, 0x3a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, - 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x62, 0x69, - 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2f, 0x70, 0x75, 0x62, 0x73, 0x75, 0x62, 0x2f, 0x6e, 0x61, 0x74, - 0x73, 0x2f, 0x6e, 0x61, 0x74, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x04, 0x6e, 0x61, - 0x74, 0x73, 0x1a, 0x33, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, - 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, - 0x62, 0x69, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2f, 0x68, 0x61, 0x73, 0x68, 0x2f, 0x68, 0x61, 0x73, - 0x68, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xcd, 0x01, 0x0a, 0x06, 0x43, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x6e, 0x61, - 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, - 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x3a, 0x0a, 0x11, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, - 0x5f, 0x68, 0x61, 0x73, 0x68, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, - 0x32, 0x0e, 0x2e, 0x68, 0x61, 0x73, 0x68, 0x2e, 0x48, 0x61, 0x73, 0x68, 0x54, 0x79, 0x70, 0x65, - 0x52, 0x0f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x48, 0x61, 0x73, 0x68, 0x54, 0x79, 0x70, - 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x6c, 0x6f, 0x67, 0x5f, 0x64, 0x65, 0x62, 0x75, 0x67, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x6c, 0x6f, 0x67, 0x44, 0x65, 0x62, 0x75, 0x67, 0x12, 0x1b, - 0x0a, 0x09, 0x6c, 0x6f, 0x67, 0x5f, 0x74, 0x72, 0x61, 0x63, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x08, 0x6c, 0x6f, 0x67, 0x54, 0x72, 0x61, 0x63, 0x65, 0x12, 0x2a, 0x0a, 0x11, 0x6c, - 0x6f, 0x67, 0x5f, 0x74, 0x72, 0x61, 0x63, 0x65, 0x5f, 0x76, 0x65, 0x72, 0x62, 0x6f, 0x73, 0x65, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x6c, 0x6f, 0x67, 0x54, 0x72, 0x61, 0x63, 0x65, - 0x56, 0x65, 0x72, 0x62, 0x6f, 0x73, 0x65, 0x2a, 0x5a, 0x0a, 0x0c, 0x4e, 0x61, 0x74, 0x73, 0x43, - 0x6f, 0x6e, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x14, 0x4e, 0x61, 0x74, 0x73, 0x43, - 0x6f, 0x6e, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, - 0x00, 0x12, 0x17, 0x0a, 0x13, 0x4e, 0x61, 0x74, 0x73, 0x43, 0x6f, 0x6e, 0x6e, 0x54, 0x79, 0x70, - 0x65, 0x5f, 0x43, 0x4c, 0x49, 0x45, 0x4e, 0x54, 0x10, 0x01, 0x12, 0x17, 0x0a, 0x13, 0x4e, 0x61, - 0x74, 0x73, 0x43, 0x6f, 0x6e, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x52, 0x4f, 0x55, 0x54, 0x45, - 0x52, 0x10, 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +func (m *Config) CloneVT() *Config { + if m == nil { + return (*Config)(nil) + } + r := new(Config) + r.ClusterName = m.ClusterName + r.PublishHashType = m.PublishHashType + r.LogDebug = m.LogDebug + r.LogTrace = m.LogTrace + r.LogTraceVerbose = m.LogTraceVerbose + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r } -var ( - file_github_com_aperturerobotics_bifrost_pubsub_nats_nats_proto_rawDescOnce sync.Once - file_github_com_aperturerobotics_bifrost_pubsub_nats_nats_proto_rawDescData = file_github_com_aperturerobotics_bifrost_pubsub_nats_nats_proto_rawDesc -) +func (m *Config) CloneMessageVT() any { + return m.CloneVT() +} -func file_github_com_aperturerobotics_bifrost_pubsub_nats_nats_proto_rawDescGZIP() []byte { - file_github_com_aperturerobotics_bifrost_pubsub_nats_nats_proto_rawDescOnce.Do(func() { - file_github_com_aperturerobotics_bifrost_pubsub_nats_nats_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_aperturerobotics_bifrost_pubsub_nats_nats_proto_rawDescData) - }) - return file_github_com_aperturerobotics_bifrost_pubsub_nats_nats_proto_rawDescData +func (this *Config) EqualVT(that *Config) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.ClusterName != that.ClusterName { + return false + } + if this.PublishHashType != that.PublishHashType { + return false + } + if this.LogDebug != that.LogDebug { + return false + } + if this.LogTrace != that.LogTrace { + return false + } + if this.LogTraceVerbose != that.LogTraceVerbose { + return false + } + return string(this.unknownFields) == string(that.unknownFields) } -var file_github_com_aperturerobotics_bifrost_pubsub_nats_nats_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_github_com_aperturerobotics_bifrost_pubsub_nats_nats_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_github_com_aperturerobotics_bifrost_pubsub_nats_nats_proto_goTypes = []interface{}{ - (NatsConnType)(0), // 0: nats.NatsConnType - (*Config)(nil), // 1: nats.Config - (hash.HashType)(0), // 2: hash.HashType +func (this *Config) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*Config) + if !ok { + return false + } + return this.EqualVT(that) } -var file_github_com_aperturerobotics_bifrost_pubsub_nats_nats_proto_depIdxs = []int32{ - 2, // 0: nats.Config.publish_hash_type:type_name -> hash.HashType - 1, // [1:1] is the sub-list for method output_type - 1, // [1:1] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name + +// MarshalProtoJSON marshals the NatsConnType to JSON. +func (x NatsConnType) MarshalProtoJSON(s *json.MarshalState) { + s.WriteEnumString(int32(x), NatsConnType_name) } -func init() { file_github_com_aperturerobotics_bifrost_pubsub_nats_nats_proto_init() } -func file_github_com_aperturerobotics_bifrost_pubsub_nats_nats_proto_init() { - if File_github_com_aperturerobotics_bifrost_pubsub_nats_nats_proto != nil { +// MarshalText marshals the NatsConnType to text. +func (x NatsConnType) MarshalText() ([]byte, error) { + return []byte(json.GetEnumString(int32(x), NatsConnType_name)), nil +} + +// MarshalJSON marshals the NatsConnType to JSON. +func (x NatsConnType) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) +} + +// UnmarshalProtoJSON unmarshals the NatsConnType from JSON. +func (x *NatsConnType) UnmarshalProtoJSON(s *json.UnmarshalState) { + v := s.ReadEnum(NatsConnType_value) + if err := s.Err(); err != nil { + s.SetErrorf("could not read NatsConnType enum: %v", err) return } - if !protoimpl.UnsafeEnabled { - file_github_com_aperturerobotics_bifrost_pubsub_nats_nats_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Config); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil + *x = NatsConnType(v) +} + +// UnmarshalText unmarshals the NatsConnType from text. +func (x *NatsConnType) UnmarshalText(b []byte) error { + i, err := json.ParseEnumString(string(b), NatsConnType_value) + if err != nil { + return err + } + *x = NatsConnType(i) + return nil +} + +// UnmarshalJSON unmarshals the NatsConnType from JSON. +func (x *NatsConnType) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +// MarshalProtoJSON marshals the Config message to JSON. +func (x *Config) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return + } + s.WriteObjectStart() + var wroteField bool + if x.ClusterName != "" || s.HasField("clusterName") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("clusterName") + s.WriteString(x.ClusterName) + } + if x.PublishHashType != 0 || s.HasField("publishHashType") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("publishHashType") + x.PublishHashType.MarshalProtoJSON(s) + } + if x.LogDebug || s.HasField("logDebug") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("logDebug") + s.WriteBool(x.LogDebug) + } + if x.LogTrace || s.HasField("logTrace") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("logTrace") + s.WriteBool(x.LogTrace) + } + if x.LogTraceVerbose || s.HasField("logTraceVerbose") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("logTraceVerbose") + s.WriteBool(x.LogTraceVerbose) + } + s.WriteObjectEnd() +} + +// MarshalJSON marshals the Config to JSON. +func (x *Config) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) +} + +// UnmarshalProtoJSON unmarshals the Config message from JSON. +func (x *Config) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { + return + } + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "cluster_name", "clusterName": + s.AddField("cluster_name") + x.ClusterName = s.ReadString() + case "publish_hash_type", "publishHashType": + s.AddField("publish_hash_type") + x.PublishHashType.UnmarshalProtoJSON(s) + case "log_debug", "logDebug": + s.AddField("log_debug") + x.LogDebug = s.ReadBool() + case "log_trace", "logTrace": + s.AddField("log_trace") + x.LogTrace = s.ReadBool() + case "log_trace_verbose", "logTraceVerbose": + s.AddField("log_trace_verbose") + x.LogTraceVerbose = s.ReadBool() + } + }) +} + +// UnmarshalJSON unmarshals the Config from JSON. +func (x *Config) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +func (m *Config) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Config) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.LogTraceVerbose { + i-- + if m.LogTraceVerbose { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x28 + } + if m.LogTrace { + i-- + if m.LogTrace { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x20 + } + if m.LogDebug { + i-- + if m.LogDebug { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x18 + } + if m.PublishHashType != 0 { + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(m.PublishHashType)) + i-- + dAtA[i] = 0x10 + } + if len(m.ClusterName) > 0 { + i -= len(m.ClusterName) + copy(dAtA[i:], m.ClusterName) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.ClusterName))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Config) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ClusterName) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + if m.PublishHashType != 0 { + n += 1 + protobuf_go_lite.SizeOfVarint(uint64(m.PublishHashType)) + } + if m.LogDebug { + n += 2 + } + if m.LogTrace { + n += 2 + } + if m.LogTraceVerbose { + n += 2 + } + n += len(m.unknownFields) + return n +} + +func (m *Config) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: Config: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: Config: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field ClusterName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ClusterName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return errors.Errorf("proto: wrong wireType = %d for field PublishHashType", wireType) + } + m.PublishHashType = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PublishHashType |= hash.HashType(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return errors.Errorf("proto: wrong wireType = %d for field LogDebug", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.LogDebug = bool(v != 0) + case 4: + if wireType != 0 { + return errors.Errorf("proto: wrong wireType = %d for field LogTrace", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.LogTrace = bool(v != 0) + case 5: + if wireType != 0 { + return errors.Errorf("proto: wrong wireType = %d for field LogTraceVerbose", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.LogTraceVerbose = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy } } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_github_com_aperturerobotics_bifrost_pubsub_nats_nats_proto_rawDesc, - NumEnums: 1, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_github_com_aperturerobotics_bifrost_pubsub_nats_nats_proto_goTypes, - DependencyIndexes: file_github_com_aperturerobotics_bifrost_pubsub_nats_nats_proto_depIdxs, - EnumInfos: file_github_com_aperturerobotics_bifrost_pubsub_nats_nats_proto_enumTypes, - MessageInfos: file_github_com_aperturerobotics_bifrost_pubsub_nats_nats_proto_msgTypes, - }.Build() - File_github_com_aperturerobotics_bifrost_pubsub_nats_nats_proto = out.File - file_github_com_aperturerobotics_bifrost_pubsub_nats_nats_proto_rawDesc = nil - file_github_com_aperturerobotics_bifrost_pubsub_nats_nats_proto_goTypes = nil - file_github_com_aperturerobotics_bifrost_pubsub_nats_nats_proto_depIdxs = nil + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil } diff --git a/pubsub/nats/nats.pb.ts b/pubsub/nats/nats.pb.ts deleted file mode 100644 index 1999b5d2..00000000 --- a/pubsub/nats/nats.pb.ts +++ /dev/null @@ -1,297 +0,0 @@ -/* eslint-disable */ -import Long from 'long' -import _m0 from 'protobufjs/minimal.js' -import { - HashType, - hashTypeFromJSON, - hashTypeToJSON, -} from '../../hash/hash.pb.js' - -export const protobufPackage = 'nats' - -/** NatsConnType indicates the type of nats conn a stream represents. */ -export enum NatsConnType { - /** NatsConnType_UNKNOWN - NatsConnType_UNKNOWN is the unknown type. */ - NatsConnType_UNKNOWN = 0, - /** NatsConnType_CLIENT - NatsConnType_CLIENT is the client connection type. */ - NatsConnType_CLIENT = 1, - /** NatsConnType_ROUTER - NatsConnType_ROUTER is the router-router connection type. */ - NatsConnType_ROUTER = 2, - UNRECOGNIZED = -1, -} - -export function natsConnTypeFromJSON(object: any): NatsConnType { - switch (object) { - case 0: - case 'NatsConnType_UNKNOWN': - return NatsConnType.NatsConnType_UNKNOWN - case 1: - case 'NatsConnType_CLIENT': - return NatsConnType.NatsConnType_CLIENT - case 2: - case 'NatsConnType_ROUTER': - return NatsConnType.NatsConnType_ROUTER - case -1: - case 'UNRECOGNIZED': - default: - return NatsConnType.UNRECOGNIZED - } -} - -export function natsConnTypeToJSON(object: NatsConnType): string { - switch (object) { - case NatsConnType.NatsConnType_UNKNOWN: - return 'NatsConnType_UNKNOWN' - case NatsConnType.NatsConnType_CLIENT: - return 'NatsConnType_CLIENT' - case NatsConnType.NatsConnType_ROUTER: - return 'NatsConnType_ROUTER' - case NatsConnType.UNRECOGNIZED: - default: - return 'UNRECOGNIZED' - } -} - -/** - * Config configures the nats router, hosting a nats.io routing node. - * This uses nats 2.0 accounts - an Account maps to a Peer. - */ -export interface Config { - /** - * ClusterName is the cluster ID string to use. - * This must be the same on all nodes. - * If unset, uses the protocol ID. - */ - clusterName: string - /** - * PublishHashType is the hash type to use when signing published messages. - * Defaults to sha256 - */ - publishHashType: HashType - /** LogDebug turns on extended debugging logging. */ - logDebug: boolean - /** - * LogTrace turns on tracing logging. - * implies log_debug. - */ - logTrace: boolean - /** - * LogTraceVrebose turns on verbose tracing logging. - * Implies log_trace and log_debug. - */ - logTraceVerbose: boolean -} - -function createBaseConfig(): Config { - return { - clusterName: '', - publishHashType: 0, - logDebug: false, - logTrace: false, - logTraceVerbose: false, - } -} - -export const Config = { - encode( - message: Config, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.clusterName !== '') { - writer.uint32(10).string(message.clusterName) - } - if (message.publishHashType !== 0) { - writer.uint32(16).int32(message.publishHashType) - } - if (message.logDebug !== false) { - writer.uint32(24).bool(message.logDebug) - } - if (message.logTrace !== false) { - writer.uint32(32).bool(message.logTrace) - } - if (message.logTraceVerbose !== false) { - writer.uint32(40).bool(message.logTraceVerbose) - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Config { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseConfig() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break - } - - message.clusterName = reader.string() - continue - case 2: - if (tag !== 16) { - break - } - - message.publishHashType = reader.int32() as any - continue - case 3: - if (tag !== 24) { - break - } - - message.logDebug = reader.bool() - continue - case 4: - if (tag !== 32) { - break - } - - message.logTrace = reader.bool() - continue - case 5: - if (tag !== 40) { - break - } - - message.logTraceVerbose = reader.bool() - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: AsyncIterable | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config.encode(p).finish()] - } - } else { - yield* [Config.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config.decode(p)] - } - } else { - yield* [Config.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): Config { - return { - clusterName: isSet(object.clusterName) - ? globalThis.String(object.clusterName) - : '', - publishHashType: isSet(object.publishHashType) - ? hashTypeFromJSON(object.publishHashType) - : 0, - logDebug: isSet(object.logDebug) - ? globalThis.Boolean(object.logDebug) - : false, - logTrace: isSet(object.logTrace) - ? globalThis.Boolean(object.logTrace) - : false, - logTraceVerbose: isSet(object.logTraceVerbose) - ? globalThis.Boolean(object.logTraceVerbose) - : false, - } - }, - - toJSON(message: Config): unknown { - const obj: any = {} - if (message.clusterName !== '') { - obj.clusterName = message.clusterName - } - if (message.publishHashType !== 0) { - obj.publishHashType = hashTypeToJSON(message.publishHashType) - } - if (message.logDebug !== false) { - obj.logDebug = message.logDebug - } - if (message.logTrace !== false) { - obj.logTrace = message.logTrace - } - if (message.logTraceVerbose !== false) { - obj.logTraceVerbose = message.logTraceVerbose - } - return obj - }, - - create, I>>(base?: I): Config { - return Config.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>(object: I): Config { - const message = createBaseConfig() - message.clusterName = object.clusterName ?? '' - message.publishHashType = object.publishHashType ?? 0 - message.logDebug = object.logDebug ?? false - message.logTrace = object.logTrace ?? false - message.logTraceVerbose = object.logTraceVerbose ?? false - return message - }, -} - -type Builtin = - | Date - | Function - | Uint8Array - | string - | number - | boolean - | undefined - -export type DeepPartial = T extends Builtin - ? T - : T extends Long - ? string | number | Long - : T extends globalThis.Array - ? globalThis.Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends { $case: string } - ? { [K in keyof Omit]?: DeepPartial } & { - $case: T['$case'] - } - : T extends {} - ? { [K in keyof T]?: DeepPartial } - : Partial - -type KeysOfUnion = T extends T ? keyof T : never -export type Exact = P extends Builtin - ? P - : P & { [K in keyof P]: Exact } & { - [K in Exclude>]: never - } - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any - _m0.configure() -} - -function isSet(value: any): boolean { - return value !== null && value !== undefined -} diff --git a/pubsub/nats/nats_pb.ts b/pubsub/nats/nats_pb.ts new file mode 100644 index 00000000..9c40276d --- /dev/null +++ b/pubsub/nats/nats_pb.ts @@ -0,0 +1,156 @@ +// @generated by protoc-gen-es v1.8.0 with parameter "target=ts,ts_nocheck=false" +// @generated from file github.com/aperturerobotics/bifrost/pubsub/nats/nats.proto (package nats, syntax proto3) +/* eslint-disable */ + +import type { + BinaryReadOptions, + FieldList, + JsonReadOptions, + JsonValue, + PartialMessage, + PlainMessage, +} from '@bufbuild/protobuf' +import { Message, proto3 } from '@bufbuild/protobuf' +import { HashType } from '../../hash/hash_pb.js' + +/** + * NatsConnType indicates the type of nats conn a stream represents. + * + * @generated from enum nats.NatsConnType + */ +export enum NatsConnType { + /** + * NatsConnType_UNKNOWN is the unknown type. + * + * @generated from enum value: NatsConnType_UNKNOWN = 0; + */ + NatsConnType_UNKNOWN = 0, + + /** + * NatsConnType_CLIENT is the client connection type. + * + * @generated from enum value: NatsConnType_CLIENT = 1; + */ + NatsConnType_CLIENT = 1, + + /** + * NatsConnType_ROUTER is the router-router connection type. + * + * TODO other types + * + * @generated from enum value: NatsConnType_ROUTER = 2; + */ + NatsConnType_ROUTER = 2, +} +// Retrieve enum metadata with: proto3.getEnumType(NatsConnType) +proto3.util.setEnumType(NatsConnType, 'nats.NatsConnType', [ + { no: 0, name: 'NatsConnType_UNKNOWN' }, + { no: 1, name: 'NatsConnType_CLIENT' }, + { no: 2, name: 'NatsConnType_ROUTER' }, +]) + +/** + * Config configures the nats router, hosting a nats.io routing node. + * This uses nats 2.0 accounts - an Account maps to a Peer. + * + * @generated from message nats.Config + */ +export class Config extends Message { + /** + * ClusterName is the cluster ID string to use. + * This must be the same on all nodes. + * If unset, uses the protocol ID. + * + * @generated from field: string cluster_name = 1; + */ + clusterName = '' + + /** + * PublishHashType is the hash type to use when signing published messages. + * Defaults to sha256 + * + * @generated from field: hash.HashType publish_hash_type = 2; + */ + publishHashType = HashType.HashType_UNKNOWN + + /** + * LogDebug turns on extended debugging logging. + * + * @generated from field: bool log_debug = 3; + */ + logDebug = false + + /** + * LogTrace turns on tracing logging. + * implies log_debug. + * + * @generated from field: bool log_trace = 4; + */ + logTrace = false + + /** + * LogTraceVrebose turns on verbose tracing logging. + * Implies log_trace and log_debug. + * + * @generated from field: bool log_trace_verbose = 5; + */ + logTraceVerbose = false + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'nats.Config' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { + no: 1, + name: 'cluster_name', + kind: 'scalar', + T: 9 /* ScalarType.STRING */, + }, + { + no: 2, + name: 'publish_hash_type', + kind: 'enum', + T: proto3.getEnumType(HashType), + }, + { no: 3, name: 'log_debug', kind: 'scalar', T: 8 /* ScalarType.BOOL */ }, + { no: 4, name: 'log_trace', kind: 'scalar', T: 8 /* ScalarType.BOOL */ }, + { + no: 5, + name: 'log_trace_verbose', + kind: 'scalar', + T: 8 /* ScalarType.BOOL */, + }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): Config { + return new Config().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): Config { + return new Config().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): Config { + return new Config().fromJsonString(jsonString, options) + } + + static equals( + a: Config | PlainMessage | undefined, + b: Config | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(Config, a, b) + } +} diff --git a/pubsub/nats/nats_vtproto.pb.go b/pubsub/nats/nats_vtproto.pb.go deleted file mode 100644 index 9dc111cf..00000000 --- a/pubsub/nats/nats_vtproto.pb.go +++ /dev/null @@ -1,338 +0,0 @@ -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// protoc-gen-go-vtproto version: v0.6.0 -// source: github.com/aperturerobotics/bifrost/pubsub/nats/nats.proto - -package nats - -import ( - fmt "fmt" - io "io" - - hash "github.com/aperturerobotics/bifrost/hash" - protohelpers "github.com/planetscale/vtprotobuf/protohelpers" - proto "google.golang.org/protobuf/proto" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) -) - -func (m *Config) CloneVT() *Config { - if m == nil { - return (*Config)(nil) - } - r := new(Config) - r.ClusterName = m.ClusterName - r.PublishHashType = m.PublishHashType - r.LogDebug = m.LogDebug - r.LogTrace = m.LogTrace - r.LogTraceVerbose = m.LogTraceVerbose - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Config) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (this *Config) EqualVT(that *Config) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.ClusterName != that.ClusterName { - return false - } - if this.PublishHashType != that.PublishHashType { - return false - } - if this.LogDebug != that.LogDebug { - return false - } - if this.LogTrace != that.LogTrace { - return false - } - if this.LogTraceVerbose != that.LogTraceVerbose { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Config) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Config) - if !ok { - return false - } - return this.EqualVT(that) -} -func (m *Config) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Config) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.LogTraceVerbose { - i-- - if m.LogTraceVerbose { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x28 - } - if m.LogTrace { - i-- - if m.LogTrace { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x20 - } - if m.LogDebug { - i-- - if m.LogDebug { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x18 - } - if m.PublishHashType != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.PublishHashType)) - i-- - dAtA[i] = 0x10 - } - if len(m.ClusterName) > 0 { - i -= len(m.ClusterName) - copy(dAtA[i:], m.ClusterName) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.ClusterName))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Config) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ClusterName) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.PublishHashType != 0 { - n += 1 + protohelpers.SizeOfVarint(uint64(m.PublishHashType)) - } - if m.LogDebug { - n += 2 - } - if m.LogTrace { - n += 2 - } - if m.LogTraceVerbose { - n += 2 - } - n += len(m.unknownFields) - return n -} - -func (m *Config) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Config: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Config: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClusterName", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClusterName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field PublishHashType", wireType) - } - m.PublishHashType = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.PublishHashType |= hash.HashType(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field LogDebug", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.LogDebug = bool(v != 0) - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field LogTrace", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.LogTrace = bool(v != 0) - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field LogTraceVerbose", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.LogTraceVerbose = bool(v != 0) - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} diff --git a/pubsub/nats/subscription.go b/pubsub/nats/subscription.go index 49fad0ea..56cfbf35 100644 --- a/pubsub/nats/subscription.go +++ b/pubsub/nats/subscription.go @@ -13,7 +13,6 @@ import ( "github.com/nats-io/nats.go" "github.com/pkg/errors" "github.com/sirupsen/logrus" - "google.golang.org/protobuf/proto" ) // subscription implements the pubsub subscription handle. @@ -89,7 +88,7 @@ func (s *subscription) Publish(data []byte) error { return err } - enc, err := proto.Marshal(msg) + enc, err := msg.MarshalVT() if err != nil { return err } diff --git a/pubsub/relay/config.pb.go b/pubsub/relay/config.pb.go index a5e8ee0b..9719afda 100644 --- a/pubsub/relay/config.pb.go +++ b/pubsub/relay/config.pb.go @@ -1,71 +1,33 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0-devel -// protoc v5.26.1 +// Code generated by protoc-gen-go-lite. DO NOT EDIT. +// protoc-gen-go-lite version: v0.4.5 // source: github.com/aperturerobotics/bifrost/pubsub/relay/config.proto package pubsub_relay import ( - reflect "reflect" - sync "sync" + io "io" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) + protobuf_go_lite "github.com/aperturerobotics/protobuf-go-lite" + json "github.com/aperturerobotics/protobuf-go-lite/json" + errors "github.com/pkg/errors" ) // Config is the pubsub relay configuration. // The relay controller subscribes to a pubsub topic to ensure the peer relays messages. type Config struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + unknownFields []byte // PeerId is the peer ID to look up and use private key for. - PeerId string `protobuf:"bytes,1,opt,name=peer_id,json=peerId,proto3" json:"peer_id,omitempty"` + PeerId string `protobuf:"bytes,1,opt,name=peer_id,json=peerId,proto3" json:"peerId,omitempty"` // TopicIds are the list of topic IDs to subscribe to. - TopicIds []string `protobuf:"bytes,2,rep,name=topic_ids,json=topicIds,proto3" json:"topic_ids,omitempty"` + TopicIds []string `protobuf:"bytes,2,rep,name=topic_ids,json=topicIds,proto3" json:"topicIds,omitempty"` } func (x *Config) Reset() { *x = Config{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_pubsub_relay_config_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Config) String() string { - return protoimpl.X.MessageStringOf(x) } func (*Config) ProtoMessage() {} -func (x *Config) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_pubsub_relay_config_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 Config.ProtoReflect.Descriptor instead. -func (*Config) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_pubsub_relay_config_proto_rawDescGZIP(), []int{0} -} - func (x *Config) GetPeerId() string { if x != nil { return x.PeerId @@ -80,80 +42,292 @@ func (x *Config) GetTopicIds() []string { return nil } -var File_github_com_aperturerobotics_bifrost_pubsub_relay_config_proto protoreflect.FileDescriptor +func (m *Config) CloneVT() *Config { + if m == nil { + return (*Config)(nil) + } + r := new(Config) + r.PeerId = m.PeerId + if rhs := m.TopicIds; rhs != nil { + tmpContainer := make([]string, len(rhs)) + copy(tmpContainer, rhs) + r.TopicIds = tmpContainer + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} -var file_github_com_aperturerobotics_bifrost_pubsub_relay_config_proto_rawDesc = []byte{ - 0x0a, 0x3d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, - 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x62, 0x69, - 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2f, 0x70, 0x75, 0x62, 0x73, 0x75, 0x62, 0x2f, 0x72, 0x65, 0x6c, - 0x61, 0x79, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, - 0x0c, 0x70, 0x75, 0x62, 0x73, 0x75, 0x62, 0x2e, 0x72, 0x65, 0x6c, 0x61, 0x79, 0x22, 0x3e, 0x0a, - 0x06, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x17, 0x0a, 0x07, 0x70, 0x65, 0x65, 0x72, 0x5f, - 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x65, 0x65, 0x72, 0x49, 0x64, - 0x12, 0x1b, 0x0a, 0x09, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x02, 0x20, - 0x03, 0x28, 0x09, 0x52, 0x08, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x49, 0x64, 0x73, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, +func (m *Config) CloneMessageVT() any { + return m.CloneVT() } -var ( - file_github_com_aperturerobotics_bifrost_pubsub_relay_config_proto_rawDescOnce sync.Once - file_github_com_aperturerobotics_bifrost_pubsub_relay_config_proto_rawDescData = file_github_com_aperturerobotics_bifrost_pubsub_relay_config_proto_rawDesc -) +func (this *Config) EqualVT(that *Config) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.PeerId != that.PeerId { + return false + } + if len(this.TopicIds) != len(that.TopicIds) { + return false + } + for i, vx := range this.TopicIds { + vy := that.TopicIds[i] + if vx != vy { + return false + } + } + return string(this.unknownFields) == string(that.unknownFields) +} -func file_github_com_aperturerobotics_bifrost_pubsub_relay_config_proto_rawDescGZIP() []byte { - file_github_com_aperturerobotics_bifrost_pubsub_relay_config_proto_rawDescOnce.Do(func() { - file_github_com_aperturerobotics_bifrost_pubsub_relay_config_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_aperturerobotics_bifrost_pubsub_relay_config_proto_rawDescData) - }) - return file_github_com_aperturerobotics_bifrost_pubsub_relay_config_proto_rawDescData +func (this *Config) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*Config) + if !ok { + return false + } + return this.EqualVT(that) } -var file_github_com_aperturerobotics_bifrost_pubsub_relay_config_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_github_com_aperturerobotics_bifrost_pubsub_relay_config_proto_goTypes = []interface{}{ - (*Config)(nil), // 0: pubsub.relay.Config +// MarshalProtoJSON marshals the Config message to JSON. +func (x *Config) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return + } + s.WriteObjectStart() + var wroteField bool + if x.PeerId != "" || s.HasField("peerId") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("peerId") + s.WriteString(x.PeerId) + } + if len(x.TopicIds) > 0 || s.HasField("topicIds") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("topicIds") + s.WriteStringArray(x.TopicIds) + } + s.WriteObjectEnd() } -var file_github_com_aperturerobotics_bifrost_pubsub_relay_config_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] 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 + +// MarshalJSON marshals the Config to JSON. +func (x *Config) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) } -func init() { file_github_com_aperturerobotics_bifrost_pubsub_relay_config_proto_init() } -func file_github_com_aperturerobotics_bifrost_pubsub_relay_config_proto_init() { - if File_github_com_aperturerobotics_bifrost_pubsub_relay_config_proto != nil { +// UnmarshalProtoJSON unmarshals the Config message from JSON. +func (x *Config) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { return } - if !protoimpl.UnsafeEnabled { - file_github_com_aperturerobotics_bifrost_pubsub_relay_config_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Config); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "peer_id", "peerId": + s.AddField("peer_id") + x.PeerId = s.ReadString() + case "topic_ids", "topicIds": + s.AddField("topic_ids") + if s.ReadNil() { + x.TopicIds = nil + return } + x.TopicIds = s.ReadStringArray() } + }) +} + +// UnmarshalJSON unmarshals the Config from JSON. +func (x *Config) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +func (m *Config) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_github_com_aperturerobotics_bifrost_pubsub_relay_config_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_github_com_aperturerobotics_bifrost_pubsub_relay_config_proto_goTypes, - DependencyIndexes: file_github_com_aperturerobotics_bifrost_pubsub_relay_config_proto_depIdxs, - MessageInfos: file_github_com_aperturerobotics_bifrost_pubsub_relay_config_proto_msgTypes, - }.Build() - File_github_com_aperturerobotics_bifrost_pubsub_relay_config_proto = out.File - file_github_com_aperturerobotics_bifrost_pubsub_relay_config_proto_rawDesc = nil - file_github_com_aperturerobotics_bifrost_pubsub_relay_config_proto_goTypes = nil - file_github_com_aperturerobotics_bifrost_pubsub_relay_config_proto_depIdxs = nil + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Config) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.TopicIds) > 0 { + for iNdEx := len(m.TopicIds) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.TopicIds[iNdEx]) + copy(dAtA[i:], m.TopicIds[iNdEx]) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.TopicIds[iNdEx]))) + i-- + dAtA[i] = 0x12 + } + } + if len(m.PeerId) > 0 { + i -= len(m.PeerId) + copy(dAtA[i:], m.PeerId) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.PeerId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Config) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.PeerId) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + if len(m.TopicIds) > 0 { + for _, s := range m.TopicIds { + l = len(s) + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + } + n += len(m.unknownFields) + return n +} + +func (m *Config) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: Config: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: Config: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field PeerId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PeerId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field TopicIds", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TopicIds = append(m.TopicIds, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil } diff --git a/pubsub/relay/config.pb.ts b/pubsub/relay/config.pb.ts deleted file mode 100644 index ea858c23..00000000 --- a/pubsub/relay/config.pb.ts +++ /dev/null @@ -1,171 +0,0 @@ -/* eslint-disable */ -import Long from 'long' -import _m0 from 'protobufjs/minimal.js' - -export const protobufPackage = 'pubsub.relay' - -/** - * Config is the pubsub relay configuration. - * The relay controller subscribes to a pubsub topic to ensure the peer relays messages. - */ -export interface Config { - /** PeerId is the peer ID to look up and use private key for. */ - peerId: string - /** TopicIds are the list of topic IDs to subscribe to. */ - topicIds: string[] -} - -function createBaseConfig(): Config { - return { peerId: '', topicIds: [] } -} - -export const Config = { - encode( - message: Config, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.peerId !== '') { - writer.uint32(10).string(message.peerId) - } - for (const v of message.topicIds) { - writer.uint32(18).string(v!) - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Config { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseConfig() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break - } - - message.peerId = reader.string() - continue - case 2: - if (tag !== 18) { - break - } - - message.topicIds.push(reader.string()) - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: AsyncIterable | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config.encode(p).finish()] - } - } else { - yield* [Config.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config.decode(p)] - } - } else { - yield* [Config.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): Config { - return { - peerId: isSet(object.peerId) ? globalThis.String(object.peerId) : '', - topicIds: globalThis.Array.isArray(object?.topicIds) - ? object.topicIds.map((e: any) => globalThis.String(e)) - : [], - } - }, - - toJSON(message: Config): unknown { - const obj: any = {} - if (message.peerId !== '') { - obj.peerId = message.peerId - } - if (message.topicIds?.length) { - obj.topicIds = message.topicIds - } - return obj - }, - - create, I>>(base?: I): Config { - return Config.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>(object: I): Config { - const message = createBaseConfig() - message.peerId = object.peerId ?? '' - message.topicIds = object.topicIds?.map((e) => e) || [] - return message - }, -} - -type Builtin = - | Date - | Function - | Uint8Array - | string - | number - | boolean - | undefined - -export type DeepPartial = T extends Builtin - ? T - : T extends Long - ? string | number | Long - : T extends globalThis.Array - ? globalThis.Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends { $case: string } - ? { [K in keyof Omit]?: DeepPartial } & { - $case: T['$case'] - } - : T extends {} - ? { [K in keyof T]?: DeepPartial } - : Partial - -type KeysOfUnion = T extends T ? keyof T : never -export type Exact = P extends Builtin - ? P - : P & { [K in keyof P]: Exact } & { - [K in Exclude>]: never - } - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any - _m0.configure() -} - -function isSet(value: any): boolean { - return value !== null && value !== undefined -} diff --git a/pubsub/relay/config_pb.ts b/pubsub/relay/config_pb.ts new file mode 100644 index 00000000..c02c356a --- /dev/null +++ b/pubsub/relay/config_pb.ts @@ -0,0 +1,81 @@ +// @generated by protoc-gen-es v1.8.0 with parameter "target=ts,ts_nocheck=false" +// @generated from file github.com/aperturerobotics/bifrost/pubsub/relay/config.proto (package pubsub.relay, syntax proto3) +/* eslint-disable */ + +import type { + BinaryReadOptions, + FieldList, + JsonReadOptions, + JsonValue, + PartialMessage, + PlainMessage, +} from '@bufbuild/protobuf' +import { Message, proto3 } from '@bufbuild/protobuf' + +/** + * Config is the pubsub relay configuration. + * The relay controller subscribes to a pubsub topic to ensure the peer relays messages. + * + * @generated from message pubsub.relay.Config + */ +export class Config extends Message { + /** + * PeerId is the peer ID to look up and use private key for. + * + * @generated from field: string peer_id = 1; + */ + peerId = '' + + /** + * TopicIds are the list of topic IDs to subscribe to. + * + * @generated from field: repeated string topic_ids = 2; + */ + topicIds: string[] = [] + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'pubsub.relay.Config' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: 'peer_id', kind: 'scalar', T: 9 /* ScalarType.STRING */ }, + { + no: 2, + name: 'topic_ids', + kind: 'scalar', + T: 9 /* ScalarType.STRING */, + repeated: true, + }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): Config { + return new Config().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): Config { + return new Config().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): Config { + return new Config().fromJsonString(jsonString, options) + } + + static equals( + a: Config | PlainMessage | undefined, + b: Config | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(Config, a, b) + } +} diff --git a/pubsub/relay/config_vtproto.pb.go b/pubsub/relay/config_vtproto.pb.go deleted file mode 100644 index 62c74157..00000000 --- a/pubsub/relay/config_vtproto.pb.go +++ /dev/null @@ -1,256 +0,0 @@ -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// protoc-gen-go-vtproto version: v0.6.0 -// source: github.com/aperturerobotics/bifrost/pubsub/relay/config.proto - -package pubsub_relay - -import ( - fmt "fmt" - io "io" - - protohelpers "github.com/planetscale/vtprotobuf/protohelpers" - proto "google.golang.org/protobuf/proto" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) -) - -func (m *Config) CloneVT() *Config { - if m == nil { - return (*Config)(nil) - } - r := new(Config) - r.PeerId = m.PeerId - if rhs := m.TopicIds; rhs != nil { - tmpContainer := make([]string, len(rhs)) - copy(tmpContainer, rhs) - r.TopicIds = tmpContainer - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Config) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (this *Config) EqualVT(that *Config) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.PeerId != that.PeerId { - return false - } - if len(this.TopicIds) != len(that.TopicIds) { - return false - } - for i, vx := range this.TopicIds { - vy := that.TopicIds[i] - if vx != vy { - return false - } - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Config) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Config) - if !ok { - return false - } - return this.EqualVT(that) -} -func (m *Config) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Config) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.TopicIds) > 0 { - for iNdEx := len(m.TopicIds) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.TopicIds[iNdEx]) - copy(dAtA[i:], m.TopicIds[iNdEx]) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.TopicIds[iNdEx]))) - i-- - dAtA[i] = 0x12 - } - } - if len(m.PeerId) > 0 { - i -= len(m.PeerId) - copy(dAtA[i:], m.PeerId) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.PeerId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Config) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.PeerId) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if len(m.TopicIds) > 0 { - for _, s := range m.TopicIds { - l = len(s) - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - } - n += len(m.unknownFields) - return n -} - -func (m *Config) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Config: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Config: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PeerId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PeerId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TopicIds", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TopicIds = append(m.TopicIds, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} diff --git a/pubsub/util/pubmessage/pubmessage.go b/pubsub/util/pubmessage/pubmessage.go index ea3243a8..6f103f32 100644 --- a/pubsub/util/pubmessage/pubmessage.go +++ b/pubsub/util/pubmessage/pubmessage.go @@ -3,12 +3,8 @@ package pubmessage import ( "github.com/aperturerobotics/bifrost/hash" "github.com/aperturerobotics/bifrost/peer" + timestamp "github.com/aperturerobotics/protobuf-go-lite/types/known/timestamppb" crypto "github.com/libp2p/go-libp2p/core/crypto" - proto "google.golang.org/protobuf/proto" - timestamp "google.golang.org/protobuf/types/known/timestamppb" - - // _ ensures the typescript version of google/protobuf/timestamp exists in vendor/. - _ "github.com/aperturerobotics/ts-proto-common-types/google/protobuf" ) // NewPubMessage constructs/signs/encodes a new pub-message and inner message. @@ -25,7 +21,7 @@ func NewPubMessage( Channel: channelID, Timestamp: timestamp.Now(), } - innerData, err := proto.Marshal(inner) + innerData, err := inner.MarshalVT() if err != nil { return nil, inner, err } @@ -42,7 +38,7 @@ func ExtractAndVerify(msg *peer.SignedMsg) (*PubMessageInner, crypto.PubKey, pee } data := msg.GetData() out := &PubMessageInner{} - err = proto.Unmarshal(data, out) + err = out.UnmarshalVT(data) if err == nil { err = out.Validate() } diff --git a/pubsub/util/pubmessage/pubmessage.pb.go b/pubsub/util/pubmessage/pubmessage.pb.go index b3de819c..82e6f1d4 100644 --- a/pubsub/util/pubmessage/pubmessage.pb.go +++ b/pubsub/util/pubmessage/pubmessage.pb.go @@ -1,33 +1,21 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0-devel -// protoc v5.26.1 +// Code generated by protoc-gen-go-lite. DO NOT EDIT. +// protoc-gen-go-lite version: v0.4.5 // source: github.com/aperturerobotics/bifrost/pubsub/util/pubmessage/pubmessage.proto package pubmessage import ( - reflect "reflect" - sync "sync" + io "io" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - timestamppb "google.golang.org/protobuf/types/known/timestamppb" -) - -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) + protobuf_go_lite "github.com/aperturerobotics/protobuf-go-lite" + json "github.com/aperturerobotics/protobuf-go-lite/json" + timestamppb "github.com/aperturerobotics/protobuf-go-lite/types/known/timestamppb" + errors "github.com/pkg/errors" ) // PubMessageInner is the signed inner portion of the message. type PubMessageInner struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + unknownFields []byte // Data is the message data. Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` // Channel is the channel. @@ -38,36 +26,10 @@ type PubMessageInner struct { func (x *PubMessageInner) Reset() { *x = PubMessageInner{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_pubsub_util_pubmessage_pubmessage_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PubMessageInner) String() string { - return protoimpl.X.MessageStringOf(x) } func (*PubMessageInner) ProtoMessage() {} -func (x *PubMessageInner) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_pubsub_util_pubmessage_pubmessage_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 PubMessageInner.ProtoReflect.Descriptor instead. -func (*PubMessageInner) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_pubsub_util_pubmessage_pubmessage_proto_rawDescGZIP(), []int{0} -} - func (x *PubMessageInner) GetData() []byte { if x != nil { return x.Data @@ -89,88 +51,348 @@ func (x *PubMessageInner) GetTimestamp() *timestamppb.Timestamp { return nil } -var File_github_com_aperturerobotics_bifrost_pubsub_util_pubmessage_pubmessage_proto protoreflect.FileDescriptor - -var file_github_com_aperturerobotics_bifrost_pubsub_util_pubmessage_pubmessage_proto_rawDesc = []byte{ - 0x0a, 0x4b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, - 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x62, 0x69, - 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2f, 0x70, 0x75, 0x62, 0x73, 0x75, 0x62, 0x2f, 0x75, 0x74, 0x69, - 0x6c, 0x2f, 0x70, 0x75, 0x62, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2f, 0x70, 0x75, 0x62, - 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0a, 0x70, - 0x75, 0x62, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, - 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, - 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x79, 0x0a, 0x0f, 0x50, 0x75, - 0x62, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x49, 0x6e, 0x6e, 0x65, 0x72, 0x12, 0x12, 0x0a, - 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, - 0x61, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x38, 0x0a, 0x09, 0x74, - 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, - 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, - 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, - 0x73, 0x74, 0x61, 0x6d, 0x70, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_github_com_aperturerobotics_bifrost_pubsub_util_pubmessage_pubmessage_proto_rawDescOnce sync.Once - file_github_com_aperturerobotics_bifrost_pubsub_util_pubmessage_pubmessage_proto_rawDescData = file_github_com_aperturerobotics_bifrost_pubsub_util_pubmessage_pubmessage_proto_rawDesc -) +func (m *PubMessageInner) CloneVT() *PubMessageInner { + if m == nil { + return (*PubMessageInner)(nil) + } + r := new(PubMessageInner) + r.Channel = m.Channel + if rhs := m.Data; rhs != nil { + tmpBytes := make([]byte, len(rhs)) + copy(tmpBytes, rhs) + r.Data = tmpBytes + } + if rhs := m.Timestamp; rhs != nil { + r.Timestamp = rhs.CloneVT() + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} -func file_github_com_aperturerobotics_bifrost_pubsub_util_pubmessage_pubmessage_proto_rawDescGZIP() []byte { - file_github_com_aperturerobotics_bifrost_pubsub_util_pubmessage_pubmessage_proto_rawDescOnce.Do(func() { - file_github_com_aperturerobotics_bifrost_pubsub_util_pubmessage_pubmessage_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_aperturerobotics_bifrost_pubsub_util_pubmessage_pubmessage_proto_rawDescData) - }) - return file_github_com_aperturerobotics_bifrost_pubsub_util_pubmessage_pubmessage_proto_rawDescData +func (m *PubMessageInner) CloneMessageVT() any { + return m.CloneVT() } -var file_github_com_aperturerobotics_bifrost_pubsub_util_pubmessage_pubmessage_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_github_com_aperturerobotics_bifrost_pubsub_util_pubmessage_pubmessage_proto_goTypes = []interface{}{ - (*PubMessageInner)(nil), // 0: pubmessage.PubMessageInner - (*timestamppb.Timestamp)(nil), // 1: google.protobuf.Timestamp +func (this *PubMessageInner) EqualVT(that *PubMessageInner) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if string(this.Data) != string(that.Data) { + return false + } + if this.Channel != that.Channel { + return false + } + if !this.Timestamp.EqualVT(that.Timestamp) { + return false + } + return string(this.unknownFields) == string(that.unknownFields) } -var file_github_com_aperturerobotics_bifrost_pubsub_util_pubmessage_pubmessage_proto_depIdxs = []int32{ - 1, // 0: pubmessage.PubMessageInner.timestamp:type_name -> google.protobuf.Timestamp - 1, // [1:1] is the sub-list for method output_type - 1, // [1:1] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name + +func (this *PubMessageInner) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*PubMessageInner) + if !ok { + return false + } + return this.EqualVT(that) +} + +// MarshalProtoJSON marshals the PubMessageInner message to JSON. +func (x *PubMessageInner) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return + } + s.WriteObjectStart() + var wroteField bool + if len(x.Data) > 0 || s.HasField("data") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("data") + s.WriteBytes(x.Data) + } + if x.Channel != "" || s.HasField("channel") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("channel") + s.WriteString(x.Channel) + } + if x.Timestamp != nil || s.HasField("timestamp") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("timestamp") + x.Timestamp.MarshalProtoJSON(s.WithField("timestamp")) + } + s.WriteObjectEnd() +} + +// MarshalJSON marshals the PubMessageInner to JSON. +func (x *PubMessageInner) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) } -func init() { file_github_com_aperturerobotics_bifrost_pubsub_util_pubmessage_pubmessage_proto_init() } -func file_github_com_aperturerobotics_bifrost_pubsub_util_pubmessage_pubmessage_proto_init() { - if File_github_com_aperturerobotics_bifrost_pubsub_util_pubmessage_pubmessage_proto != nil { +// UnmarshalProtoJSON unmarshals the PubMessageInner message from JSON. +func (x *PubMessageInner) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { return } - if !protoimpl.UnsafeEnabled { - file_github_com_aperturerobotics_bifrost_pubsub_util_pubmessage_pubmessage_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PubMessageInner); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "data": + s.AddField("data") + x.Data = s.ReadBytes() + case "channel": + s.AddField("channel") + x.Channel = s.ReadString() + case "timestamp": + if s.ReadNil() { + x.Timestamp = nil + return + } + x.Timestamp = ×tamppb.Timestamp{} + x.Timestamp.UnmarshalProtoJSON(s.WithField("timestamp", true)) + } + }) +} + +// UnmarshalJSON unmarshals the PubMessageInner from JSON. +func (x *PubMessageInner) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +func (m *PubMessageInner) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PubMessageInner) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *PubMessageInner) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.Timestamp != nil { + size, err := m.Timestamp.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x1a + } + if len(m.Channel) > 0 { + i -= len(m.Channel) + copy(dAtA[i:], m.Channel) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.Channel))) + i-- + dAtA[i] = 0x12 + } + if len(m.Data) > 0 { + i -= len(m.Data) + copy(dAtA[i:], m.Data) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.Data))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *PubMessageInner) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Data) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + l = len(m.Channel) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + if m.Timestamp != nil { + l = m.Timestamp.SizeVT() + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *PubMessageInner) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break } } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: PubMessageInner: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: PubMessageInner: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) + if m.Data == nil { + m.Data = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field Channel", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Channel = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Timestamp == nil { + m.Timestamp = ×tamppb.Timestamp{} + } + if err := m.Timestamp.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_github_com_aperturerobotics_bifrost_pubsub_util_pubmessage_pubmessage_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_github_com_aperturerobotics_bifrost_pubsub_util_pubmessage_pubmessage_proto_goTypes, - DependencyIndexes: file_github_com_aperturerobotics_bifrost_pubsub_util_pubmessage_pubmessage_proto_depIdxs, - MessageInfos: file_github_com_aperturerobotics_bifrost_pubsub_util_pubmessage_pubmessage_proto_msgTypes, - }.Build() - File_github_com_aperturerobotics_bifrost_pubsub_util_pubmessage_pubmessage_proto = out.File - file_github_com_aperturerobotics_bifrost_pubsub_util_pubmessage_pubmessage_proto_rawDesc = nil - file_github_com_aperturerobotics_bifrost_pubsub_util_pubmessage_pubmessage_proto_goTypes = nil - file_github_com_aperturerobotics_bifrost_pubsub_util_pubmessage_pubmessage_proto_depIdxs = nil + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil } diff --git a/pubsub/util/pubmessage/pubmessage.pb.ts b/pubsub/util/pubmessage/pubmessage.pb.ts deleted file mode 100644 index 6715239c..00000000 --- a/pubsub/util/pubmessage/pubmessage.pb.ts +++ /dev/null @@ -1,250 +0,0 @@ -/* eslint-disable */ -import { Timestamp } from '@aperturerobotics/ts-proto-common-types/google/protobuf/timestamp.pb.js' -import Long from 'long' -import _m0 from 'protobufjs/minimal.js' - -export const protobufPackage = 'pubmessage' - -/** PubMessageInner is the signed inner portion of the message. */ -export interface PubMessageInner { - /** Data is the message data. */ - data: Uint8Array - /** Channel is the channel. */ - channel: string - /** Timestamp is the message timestamp. */ - timestamp: Date | undefined -} - -function createBasePubMessageInner(): PubMessageInner { - return { data: new Uint8Array(0), channel: '', timestamp: undefined } -} - -export const PubMessageInner = { - encode( - message: PubMessageInner, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.data.length !== 0) { - writer.uint32(10).bytes(message.data) - } - if (message.channel !== '') { - writer.uint32(18).string(message.channel) - } - if (message.timestamp !== undefined) { - Timestamp.encode( - toTimestamp(message.timestamp), - writer.uint32(26).fork(), - ).ldelim() - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): PubMessageInner { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBasePubMessageInner() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break - } - - message.data = reader.bytes() - continue - case 2: - if (tag !== 18) { - break - } - - message.channel = reader.string() - continue - case 3: - if (tag !== 26) { - break - } - - message.timestamp = fromTimestamp( - Timestamp.decode(reader, reader.uint32()), - ) - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [PubMessageInner.encode(p).finish()] - } - } else { - yield* [PubMessageInner.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [PubMessageInner.decode(p)] - } - } else { - yield* [PubMessageInner.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): PubMessageInner { - return { - data: isSet(object.data) - ? bytesFromBase64(object.data) - : new Uint8Array(0), - channel: isSet(object.channel) ? globalThis.String(object.channel) : '', - timestamp: isSet(object.timestamp) - ? fromJsonTimestamp(object.timestamp) - : undefined, - } - }, - - toJSON(message: PubMessageInner): unknown { - const obj: any = {} - if (message.data.length !== 0) { - obj.data = base64FromBytes(message.data) - } - if (message.channel !== '') { - obj.channel = message.channel - } - if (message.timestamp !== undefined) { - obj.timestamp = message.timestamp.toISOString() - } - return obj - }, - - create, I>>( - base?: I, - ): PubMessageInner { - return PubMessageInner.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>( - object: I, - ): PubMessageInner { - const message = createBasePubMessageInner() - message.data = object.data ?? new Uint8Array(0) - message.channel = object.channel ?? '' - message.timestamp = object.timestamp ?? undefined - return message - }, -} - -function bytesFromBase64(b64: string): Uint8Array { - if ((globalThis as any).Buffer) { - return Uint8Array.from(globalThis.Buffer.from(b64, 'base64')) - } else { - const bin = globalThis.atob(b64) - const arr = new Uint8Array(bin.length) - for (let i = 0; i < bin.length; ++i) { - arr[i] = bin.charCodeAt(i) - } - return arr - } -} - -function base64FromBytes(arr: Uint8Array): string { - if ((globalThis as any).Buffer) { - return globalThis.Buffer.from(arr).toString('base64') - } else { - const bin: string[] = [] - arr.forEach((byte) => { - bin.push(globalThis.String.fromCharCode(byte)) - }) - return globalThis.btoa(bin.join('')) - } -} - -type Builtin = - | Date - | Function - | Uint8Array - | string - | number - | boolean - | undefined - -export type DeepPartial = T extends Builtin - ? T - : T extends Long - ? string | number | Long - : T extends globalThis.Array - ? globalThis.Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends { $case: string } - ? { [K in keyof Omit]?: DeepPartial } & { - $case: T['$case'] - } - : T extends {} - ? { [K in keyof T]?: DeepPartial } - : Partial - -type KeysOfUnion = T extends T ? keyof T : never -export type Exact = P extends Builtin - ? P - : P & { [K in keyof P]: Exact } & { - [K in Exclude>]: never - } - -function toTimestamp(date: Date): Timestamp { - const seconds = numberToLong(Math.trunc(date.getTime() / 1_000)) - const nanos = (date.getTime() % 1_000) * 1_000_000 - return { seconds, nanos } -} - -function fromTimestamp(t: Timestamp): Date { - let millis = (t.seconds.toNumber() || 0) * 1_000 - millis += (t.nanos || 0) / 1_000_000 - return new globalThis.Date(millis) -} - -function fromJsonTimestamp(o: any): Date { - if (o instanceof globalThis.Date) { - return o - } else if (typeof o === 'string') { - return new globalThis.Date(o) - } else { - return fromTimestamp(Timestamp.fromJSON(o)) - } -} - -function numberToLong(number: number) { - return Long.fromNumber(number) -} - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any - _m0.configure() -} - -function isSet(value: any): boolean { - return value !== null && value !== undefined -} diff --git a/pubsub/util/pubmessage/pubmessage_pb.ts b/pubsub/util/pubmessage/pubmessage_pb.ts new file mode 100644 index 00000000..d0fcb35d --- /dev/null +++ b/pubsub/util/pubmessage/pubmessage_pb.ts @@ -0,0 +1,82 @@ +// @generated by protoc-gen-es v1.8.0 with parameter "target=ts,ts_nocheck=false" +// @generated from file github.com/aperturerobotics/bifrost/pubsub/util/pubmessage/pubmessage.proto (package pubmessage, syntax proto3) +/* eslint-disable */ + +import type { + BinaryReadOptions, + FieldList, + JsonReadOptions, + JsonValue, + PartialMessage, + PlainMessage, +} from '@bufbuild/protobuf' +import { Message, proto3, Timestamp } from '@bufbuild/protobuf' + +/** + * PubMessageInner is the signed inner portion of the message. + * + * @generated from message pubmessage.PubMessageInner + */ +export class PubMessageInner extends Message { + /** + * Data is the message data. + * + * @generated from field: bytes data = 1; + */ + data = new Uint8Array(0) + + /** + * Channel is the channel. + * + * @generated from field: string channel = 2; + */ + channel = '' + + /** + * Timestamp is the message timestamp. + * + * @generated from field: google.protobuf.Timestamp timestamp = 3; + */ + timestamp?: Timestamp + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'pubmessage.PubMessageInner' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: 'data', kind: 'scalar', T: 12 /* ScalarType.BYTES */ }, + { no: 2, name: 'channel', kind: 'scalar', T: 9 /* ScalarType.STRING */ }, + { no: 3, name: 'timestamp', kind: 'message', T: Timestamp }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): PubMessageInner { + return new PubMessageInner().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): PubMessageInner { + return new PubMessageInner().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): PubMessageInner { + return new PubMessageInner().fromJsonString(jsonString, options) + } + + static equals( + a: PubMessageInner | PlainMessage | undefined, + b: PubMessageInner | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(PubMessageInner, a, b) + } +} diff --git a/pubsub/util/pubmessage/pubmessage_vtproto.pb.go b/pubsub/util/pubmessage/pubmessage_vtproto.pb.go deleted file mode 100644 index ca76ddea..00000000 --- a/pubsub/util/pubmessage/pubmessage_vtproto.pb.go +++ /dev/null @@ -1,304 +0,0 @@ -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// protoc-gen-go-vtproto version: v0.6.0 -// source: github.com/aperturerobotics/bifrost/pubsub/util/pubmessage/pubmessage.proto - -package pubmessage - -import ( - fmt "fmt" - io "io" - - protohelpers "github.com/planetscale/vtprotobuf/protohelpers" - timestamppb1 "github.com/planetscale/vtprotobuf/types/known/timestamppb" - proto "google.golang.org/protobuf/proto" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - timestamppb "google.golang.org/protobuf/types/known/timestamppb" -) - -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) -) - -func (m *PubMessageInner) CloneVT() *PubMessageInner { - if m == nil { - return (*PubMessageInner)(nil) - } - r := new(PubMessageInner) - r.Channel = m.Channel - r.Timestamp = (*timestamppb.Timestamp)((*timestamppb1.Timestamp)(m.Timestamp).CloneVT()) - if rhs := m.Data; rhs != nil { - tmpBytes := make([]byte, len(rhs)) - copy(tmpBytes, rhs) - r.Data = tmpBytes - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *PubMessageInner) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (this *PubMessageInner) EqualVT(that *PubMessageInner) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if string(this.Data) != string(that.Data) { - return false - } - if this.Channel != that.Channel { - return false - } - if !(*timestamppb1.Timestamp)(this.Timestamp).EqualVT((*timestamppb1.Timestamp)(that.Timestamp)) { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *PubMessageInner) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*PubMessageInner) - if !ok { - return false - } - return this.EqualVT(that) -} -func (m *PubMessageInner) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PubMessageInner) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *PubMessageInner) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Timestamp != nil { - size, err := (*timestamppb1.Timestamp)(m.Timestamp).MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x1a - } - if len(m.Channel) > 0 { - i -= len(m.Channel) - copy(dAtA[i:], m.Channel) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Channel))) - i-- - dAtA[i] = 0x12 - } - if len(m.Data) > 0 { - i -= len(m.Data) - copy(dAtA[i:], m.Data) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Data))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *PubMessageInner) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Data) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - l = len(m.Channel) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.Timestamp != nil { - l = (*timestamppb1.Timestamp)(m.Timestamp).SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *PubMessageInner) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PubMessageInner: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PubMessageInner: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) - if m.Data == nil { - m.Data = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Channel", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Channel = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Timestamp == nil { - m.Timestamp = ×tamppb.Timestamp{} - } - if err := (*timestamppb1.Timestamp)(m.Timestamp).UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} diff --git a/rpc/access/access.pb.go b/rpc/access/access.pb.go index a2a6e48a..f5862d77 100644 --- a/rpc/access/access.pb.go +++ b/rpc/access/access.pb.go @@ -1,72 +1,34 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0-devel -// protoc v5.26.1 +// Code generated by protoc-gen-go-lite. DO NOT EDIT. +// protoc-gen-go-lite version: v0.4.5 // source: github.com/aperturerobotics/bifrost/rpc/access/access.proto package bifrost_rpc_access import ( - reflect "reflect" - sync "sync" + io "io" - rpcstream "github.com/aperturerobotics/starpc/rpcstream" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) + protobuf_go_lite "github.com/aperturerobotics/protobuf-go-lite" + json "github.com/aperturerobotics/protobuf-go-lite/json" + _ "github.com/aperturerobotics/starpc/rpcstream" + errors "github.com/pkg/errors" ) // LookupRpcServiceRequest is a request to lookup an rpc service. type LookupRpcServiceRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + unknownFields []byte // ServiceId is the service identifier. - ServiceId string `protobuf:"bytes,1,opt,name=service_id,json=serviceId,proto3" json:"service_id,omitempty"` + ServiceId string `protobuf:"bytes,1,opt,name=service_id,json=serviceId,proto3" json:"serviceId,omitempty"` // ServerId is the identifier of the server requesting the service. // Can be empty. - ServerId string `protobuf:"bytes,2,opt,name=server_id,json=serverId,proto3" json:"server_id,omitempty"` + ServerId string `protobuf:"bytes,2,opt,name=server_id,json=serverId,proto3" json:"serverId,omitempty"` } func (x *LookupRpcServiceRequest) Reset() { *x = LookupRpcServiceRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_rpc_access_access_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *LookupRpcServiceRequest) String() string { - return protoimpl.X.MessageStringOf(x) } func (*LookupRpcServiceRequest) ProtoMessage() {} -func (x *LookupRpcServiceRequest) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_rpc_access_access_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 LookupRpcServiceRequest.ProtoReflect.Descriptor instead. -func (*LookupRpcServiceRequest) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_rpc_access_access_proto_rawDescGZIP(), []int{0} -} - func (x *LookupRpcServiceRequest) GetServiceId() string { if x != nil { return x.ServiceId @@ -83,10 +45,7 @@ func (x *LookupRpcServiceRequest) GetServerId() string { // LookupRpcServiceResponse is a response to LookupRpcService type LookupRpcServiceResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + unknownFields []byte // Idle indicates the directive is now idle. Idle bool `protobuf:"varint,1,opt,name=idle,proto3" json:"idle,omitempty"` // Exists indicates we found the service on the remote. @@ -97,36 +56,10 @@ type LookupRpcServiceResponse struct { func (x *LookupRpcServiceResponse) Reset() { *x = LookupRpcServiceResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_rpc_access_access_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *LookupRpcServiceResponse) String() string { - return protoimpl.X.MessageStringOf(x) } func (*LookupRpcServiceResponse) ProtoMessage() {} -func (x *LookupRpcServiceResponse) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_rpc_access_access_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 LookupRpcServiceResponse.ProtoReflect.Descriptor instead. -func (*LookupRpcServiceResponse) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_rpc_access_access_proto_rawDescGZIP(), []int{1} -} - func (x *LookupRpcServiceResponse) GetIdle() bool { if x != nil { return x.Idle @@ -148,123 +81,569 @@ func (x *LookupRpcServiceResponse) GetRemoved() bool { return false } -var File_github_com_aperturerobotics_bifrost_rpc_access_access_proto protoreflect.FileDescriptor - -var file_github_com_aperturerobotics_bifrost_rpc_access_access_proto_rawDesc = []byte{ - 0x0a, 0x3b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, - 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x62, 0x69, - 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2f, 0x72, 0x70, 0x63, 0x2f, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, - 0x2f, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x62, - 0x69, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x61, 0x63, 0x63, 0x65, 0x73, - 0x73, 0x1a, 0x3c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, - 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x73, - 0x74, 0x61, 0x72, 0x70, 0x63, 0x2f, 0x72, 0x70, 0x63, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2f, - 0x72, 0x70, 0x63, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, - 0x55, 0x0a, 0x17, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x52, 0x70, 0x63, 0x53, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, - 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x73, 0x65, 0x72, - 0x76, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x65, - 0x72, 0x76, 0x65, 0x72, 0x49, 0x64, 0x22, 0x60, 0x0a, 0x18, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, - 0x52, 0x70, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x64, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x04, 0x69, 0x64, 0x6c, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x65, 0x78, 0x69, 0x73, 0x74, 0x73, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x65, 0x78, 0x69, 0x73, 0x74, 0x73, 0x12, 0x18, - 0x0a, 0x07, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x07, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x32, 0xd1, 0x01, 0x0a, 0x10, 0x41, 0x63, 0x63, - 0x65, 0x73, 0x73, 0x52, 0x70, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x6f, 0x0a, - 0x10, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x52, 0x70, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x12, 0x2b, 0x2e, 0x62, 0x69, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2e, 0x72, 0x70, 0x63, 0x2e, - 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x2e, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x52, 0x70, 0x63, - 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, - 0x2e, 0x62, 0x69, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x61, 0x63, 0x63, - 0x65, 0x73, 0x73, 0x2e, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x52, 0x70, 0x63, 0x53, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x4c, - 0x0a, 0x0e, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x70, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x12, 0x1a, 0x2e, 0x72, 0x70, 0x63, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x52, 0x70, 0x63, - 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x1a, 0x1a, 0x2e, 0x72, - 0x70, 0x63, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x52, 0x70, 0x63, 0x53, 0x74, 0x72, 0x65, - 0x61, 0x6d, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x28, 0x01, 0x30, 0x01, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_github_com_aperturerobotics_bifrost_rpc_access_access_proto_rawDescOnce sync.Once - file_github_com_aperturerobotics_bifrost_rpc_access_access_proto_rawDescData = file_github_com_aperturerobotics_bifrost_rpc_access_access_proto_rawDesc -) +func (m *LookupRpcServiceRequest) CloneVT() *LookupRpcServiceRequest { + if m == nil { + return (*LookupRpcServiceRequest)(nil) + } + r := new(LookupRpcServiceRequest) + r.ServiceId = m.ServiceId + r.ServerId = m.ServerId + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *LookupRpcServiceRequest) CloneMessageVT() any { + return m.CloneVT() +} + +func (m *LookupRpcServiceResponse) CloneVT() *LookupRpcServiceResponse { + if m == nil { + return (*LookupRpcServiceResponse)(nil) + } + r := new(LookupRpcServiceResponse) + r.Idle = m.Idle + r.Exists = m.Exists + r.Removed = m.Removed + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *LookupRpcServiceResponse) CloneMessageVT() any { + return m.CloneVT() +} + +func (this *LookupRpcServiceRequest) EqualVT(that *LookupRpcServiceRequest) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.ServiceId != that.ServiceId { + return false + } + if this.ServerId != that.ServerId { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} -func file_github_com_aperturerobotics_bifrost_rpc_access_access_proto_rawDescGZIP() []byte { - file_github_com_aperturerobotics_bifrost_rpc_access_access_proto_rawDescOnce.Do(func() { - file_github_com_aperturerobotics_bifrost_rpc_access_access_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_aperturerobotics_bifrost_rpc_access_access_proto_rawDescData) +func (this *LookupRpcServiceRequest) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*LookupRpcServiceRequest) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *LookupRpcServiceResponse) EqualVT(that *LookupRpcServiceResponse) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.Idle != that.Idle { + return false + } + if this.Exists != that.Exists { + return false + } + if this.Removed != that.Removed { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *LookupRpcServiceResponse) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*LookupRpcServiceResponse) + if !ok { + return false + } + return this.EqualVT(that) +} + +// MarshalProtoJSON marshals the LookupRpcServiceRequest message to JSON. +func (x *LookupRpcServiceRequest) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return + } + s.WriteObjectStart() + var wroteField bool + if x.ServiceId != "" || s.HasField("serviceId") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("serviceId") + s.WriteString(x.ServiceId) + } + if x.ServerId != "" || s.HasField("serverId") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("serverId") + s.WriteString(x.ServerId) + } + s.WriteObjectEnd() +} + +// MarshalJSON marshals the LookupRpcServiceRequest to JSON. +func (x *LookupRpcServiceRequest) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) +} + +// UnmarshalProtoJSON unmarshals the LookupRpcServiceRequest message from JSON. +func (x *LookupRpcServiceRequest) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { + return + } + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "service_id", "serviceId": + s.AddField("service_id") + x.ServiceId = s.ReadString() + case "server_id", "serverId": + s.AddField("server_id") + x.ServerId = s.ReadString() + } }) - return file_github_com_aperturerobotics_bifrost_rpc_access_access_proto_rawDescData -} - -var file_github_com_aperturerobotics_bifrost_rpc_access_access_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_github_com_aperturerobotics_bifrost_rpc_access_access_proto_goTypes = []interface{}{ - (*LookupRpcServiceRequest)(nil), // 0: bifrost.rpc.access.LookupRpcServiceRequest - (*LookupRpcServiceResponse)(nil), // 1: bifrost.rpc.access.LookupRpcServiceResponse - (*rpcstream.RpcStreamPacket)(nil), // 2: rpcstream.RpcStreamPacket -} -var file_github_com_aperturerobotics_bifrost_rpc_access_access_proto_depIdxs = []int32{ - 0, // 0: bifrost.rpc.access.AccessRpcService.LookupRpcService:input_type -> bifrost.rpc.access.LookupRpcServiceRequest - 2, // 1: bifrost.rpc.access.AccessRpcService.CallRpcService:input_type -> rpcstream.RpcStreamPacket - 1, // 2: bifrost.rpc.access.AccessRpcService.LookupRpcService:output_type -> bifrost.rpc.access.LookupRpcServiceResponse - 2, // 3: bifrost.rpc.access.AccessRpcService.CallRpcService:output_type -> rpcstream.RpcStreamPacket - 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_github_com_aperturerobotics_bifrost_rpc_access_access_proto_init() } -func file_github_com_aperturerobotics_bifrost_rpc_access_access_proto_init() { - if File_github_com_aperturerobotics_bifrost_rpc_access_access_proto != nil { +} + +// UnmarshalJSON unmarshals the LookupRpcServiceRequest from JSON. +func (x *LookupRpcServiceRequest) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +// MarshalProtoJSON marshals the LookupRpcServiceResponse message to JSON. +func (x *LookupRpcServiceResponse) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() return } - if !protoimpl.UnsafeEnabled { - file_github_com_aperturerobotics_bifrost_rpc_access_access_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*LookupRpcServiceRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil + s.WriteObjectStart() + var wroteField bool + if x.Idle || s.HasField("idle") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("idle") + s.WriteBool(x.Idle) + } + if x.Exists || s.HasField("exists") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("exists") + s.WriteBool(x.Exists) + } + if x.Removed || s.HasField("removed") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("removed") + s.WriteBool(x.Removed) + } + s.WriteObjectEnd() +} + +// MarshalJSON marshals the LookupRpcServiceResponse to JSON. +func (x *LookupRpcServiceResponse) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) +} + +// UnmarshalProtoJSON unmarshals the LookupRpcServiceResponse message from JSON. +func (x *LookupRpcServiceResponse) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { + return + } + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "idle": + s.AddField("idle") + x.Idle = s.ReadBool() + case "exists": + s.AddField("exists") + x.Exists = s.ReadBool() + case "removed": + s.AddField("removed") + x.Removed = s.ReadBool() + } + }) +} + +// UnmarshalJSON unmarshals the LookupRpcServiceResponse from JSON. +func (x *LookupRpcServiceResponse) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +func (m *LookupRpcServiceRequest) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *LookupRpcServiceRequest) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *LookupRpcServiceRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.ServerId) > 0 { + i -= len(m.ServerId) + copy(dAtA[i:], m.ServerId) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.ServerId))) + i-- + dAtA[i] = 0x12 + } + if len(m.ServiceId) > 0 { + i -= len(m.ServiceId) + copy(dAtA[i:], m.ServiceId) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.ServiceId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *LookupRpcServiceResponse) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *LookupRpcServiceResponse) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *LookupRpcServiceResponse) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.Removed { + i-- + if m.Removed { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x18 + } + if m.Exists { + i-- + if m.Exists { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x10 + } + if m.Idle { + i-- + if m.Idle { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *LookupRpcServiceRequest) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ServiceId) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + l = len(m.ServerId) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *LookupRpcServiceResponse) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Idle { + n += 2 + } + if m.Exists { + n += 2 + } + if m.Removed { + n += 2 + } + n += len(m.unknownFields) + return n +} + +func (m *LookupRpcServiceRequest) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break } } - file_github_com_aperturerobotics_bifrost_rpc_access_access_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*LookupRpcServiceResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: LookupRpcServiceRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: LookupRpcServiceRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field ServiceId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ServiceId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field ServerId", wireType) } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ServerId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy } } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_github_com_aperturerobotics_bifrost_rpc_access_access_proto_rawDesc, - NumEnums: 0, - NumMessages: 2, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_github_com_aperturerobotics_bifrost_rpc_access_access_proto_goTypes, - DependencyIndexes: file_github_com_aperturerobotics_bifrost_rpc_access_access_proto_depIdxs, - MessageInfos: file_github_com_aperturerobotics_bifrost_rpc_access_access_proto_msgTypes, - }.Build() - File_github_com_aperturerobotics_bifrost_rpc_access_access_proto = out.File - file_github_com_aperturerobotics_bifrost_rpc_access_access_proto_rawDesc = nil - file_github_com_aperturerobotics_bifrost_rpc_access_access_proto_goTypes = nil - file_github_com_aperturerobotics_bifrost_rpc_access_access_proto_depIdxs = nil + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *LookupRpcServiceResponse) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: LookupRpcServiceResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: LookupRpcServiceResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return errors.Errorf("proto: wrong wireType = %d for field Idle", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Idle = bool(v != 0) + case 2: + if wireType != 0 { + return errors.Errorf("proto: wrong wireType = %d for field Exists", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Exists = bool(v != 0) + case 3: + if wireType != 0 { + return errors.Errorf("proto: wrong wireType = %d for field Removed", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Removed = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil } diff --git a/rpc/access/access.pb.ts b/rpc/access/access.pb.ts deleted file mode 100644 index bde09321..00000000 --- a/rpc/access/access.pb.ts +++ /dev/null @@ -1,452 +0,0 @@ -/* eslint-disable */ -import { RpcStreamPacket } from '@go/github.com/aperturerobotics/starpc/rpcstream/rpcstream.pb.js' -import Long from 'long' -import _m0 from 'protobufjs/minimal.js' - -export const protobufPackage = 'bifrost.rpc.access' - -/** LookupRpcServiceRequest is a request to lookup an rpc service. */ -export interface LookupRpcServiceRequest { - /** ServiceId is the service identifier. */ - serviceId: string - /** - * ServerId is the identifier of the server requesting the service. - * Can be empty. - */ - serverId: string -} - -/** LookupRpcServiceResponse is a response to LookupRpcService */ -export interface LookupRpcServiceResponse { - /** Idle indicates the directive is now idle. */ - idle: boolean - /** Exists indicates we found the service on the remote. */ - exists: boolean - /** Removed indicates the value no longer exists. */ - removed: boolean -} - -function createBaseLookupRpcServiceRequest(): LookupRpcServiceRequest { - return { serviceId: '', serverId: '' } -} - -export const LookupRpcServiceRequest = { - encode( - message: LookupRpcServiceRequest, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.serviceId !== '') { - writer.uint32(10).string(message.serviceId) - } - if (message.serverId !== '') { - writer.uint32(18).string(message.serverId) - } - return writer - }, - - decode( - input: _m0.Reader | Uint8Array, - length?: number, - ): LookupRpcServiceRequest { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseLookupRpcServiceRequest() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break - } - - message.serviceId = reader.string() - continue - case 2: - if (tag !== 18) { - break - } - - message.serverId = reader.string() - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [LookupRpcServiceRequest.encode(p).finish()] - } - } else { - yield* [LookupRpcServiceRequest.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [LookupRpcServiceRequest.decode(p)] - } - } else { - yield* [LookupRpcServiceRequest.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): LookupRpcServiceRequest { - return { - serviceId: isSet(object.serviceId) - ? globalThis.String(object.serviceId) - : '', - serverId: isSet(object.serverId) - ? globalThis.String(object.serverId) - : '', - } - }, - - toJSON(message: LookupRpcServiceRequest): unknown { - const obj: any = {} - if (message.serviceId !== '') { - obj.serviceId = message.serviceId - } - if (message.serverId !== '') { - obj.serverId = message.serverId - } - return obj - }, - - create, I>>( - base?: I, - ): LookupRpcServiceRequest { - return LookupRpcServiceRequest.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>( - object: I, - ): LookupRpcServiceRequest { - const message = createBaseLookupRpcServiceRequest() - message.serviceId = object.serviceId ?? '' - message.serverId = object.serverId ?? '' - return message - }, -} - -function createBaseLookupRpcServiceResponse(): LookupRpcServiceResponse { - return { idle: false, exists: false, removed: false } -} - -export const LookupRpcServiceResponse = { - encode( - message: LookupRpcServiceResponse, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.idle !== false) { - writer.uint32(8).bool(message.idle) - } - if (message.exists !== false) { - writer.uint32(16).bool(message.exists) - } - if (message.removed !== false) { - writer.uint32(24).bool(message.removed) - } - return writer - }, - - decode( - input: _m0.Reader | Uint8Array, - length?: number, - ): LookupRpcServiceResponse { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseLookupRpcServiceResponse() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 8) { - break - } - - message.idle = reader.bool() - continue - case 2: - if (tag !== 16) { - break - } - - message.exists = reader.bool() - continue - case 3: - if (tag !== 24) { - break - } - - message.removed = reader.bool() - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [LookupRpcServiceResponse.encode(p).finish()] - } - } else { - yield* [LookupRpcServiceResponse.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [LookupRpcServiceResponse.decode(p)] - } - } else { - yield* [LookupRpcServiceResponse.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): LookupRpcServiceResponse { - return { - idle: isSet(object.idle) ? globalThis.Boolean(object.idle) : false, - exists: isSet(object.exists) ? globalThis.Boolean(object.exists) : false, - removed: isSet(object.removed) - ? globalThis.Boolean(object.removed) - : false, - } - }, - - toJSON(message: LookupRpcServiceResponse): unknown { - const obj: any = {} - if (message.idle !== false) { - obj.idle = message.idle - } - if (message.exists !== false) { - obj.exists = message.exists - } - if (message.removed !== false) { - obj.removed = message.removed - } - return obj - }, - - create, I>>( - base?: I, - ): LookupRpcServiceResponse { - return LookupRpcServiceResponse.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>( - object: I, - ): LookupRpcServiceResponse { - const message = createBaseLookupRpcServiceResponse() - message.idle = object.idle ?? false - message.exists = object.exists ?? false - message.removed = object.removed ?? false - return message - }, -} - -/** AccessRpcService exposes services with LookupRpcService via RPC. */ -export interface AccessRpcService { - /** - * LookupRpcService checks if a RPC service exists with the given info. - * Usually translates to accessing the LookupRpcService directive. - * If the service was not found (directive is idle) returns empty. - */ - LookupRpcService( - request: LookupRpcServiceRequest, - abortSignal?: AbortSignal, - ): AsyncIterable - /** - * CallRpcService forwards an RPC call to the service with the component ID. - * Component ID: json encoded LookupRpcServiceRequest. - */ - CallRpcService( - request: AsyncIterable, - abortSignal?: AbortSignal, - ): AsyncIterable -} - -export const AccessRpcServiceServiceName = 'bifrost.rpc.access.AccessRpcService' -export class AccessRpcServiceClientImpl implements AccessRpcService { - private readonly rpc: Rpc - private readonly service: string - constructor(rpc: Rpc, opts?: { service?: string }) { - this.service = opts?.service || AccessRpcServiceServiceName - this.rpc = rpc - this.LookupRpcService = this.LookupRpcService.bind(this) - this.CallRpcService = this.CallRpcService.bind(this) - } - LookupRpcService( - request: LookupRpcServiceRequest, - abortSignal?: AbortSignal, - ): AsyncIterable { - const data = LookupRpcServiceRequest.encode(request).finish() - const result = this.rpc.serverStreamingRequest( - this.service, - 'LookupRpcService', - data, - abortSignal || undefined, - ) - return LookupRpcServiceResponse.decodeTransform(result) - } - - CallRpcService( - request: AsyncIterable, - abortSignal?: AbortSignal, - ): AsyncIterable { - const data = RpcStreamPacket.encodeTransform(request) - const result = this.rpc.bidirectionalStreamingRequest( - this.service, - 'CallRpcService', - data, - abortSignal || undefined, - ) - return RpcStreamPacket.decodeTransform(result) - } -} - -/** AccessRpcService exposes services with LookupRpcService via RPC. */ -export type AccessRpcServiceDefinition = typeof AccessRpcServiceDefinition -export const AccessRpcServiceDefinition = { - name: 'AccessRpcService', - fullName: 'bifrost.rpc.access.AccessRpcService', - methods: { - /** - * LookupRpcService checks if a RPC service exists with the given info. - * Usually translates to accessing the LookupRpcService directive. - * If the service was not found (directive is idle) returns empty. - */ - lookupRpcService: { - name: 'LookupRpcService', - requestType: LookupRpcServiceRequest, - requestStream: false, - responseType: LookupRpcServiceResponse, - responseStream: true, - options: {}, - }, - /** - * CallRpcService forwards an RPC call to the service with the component ID. - * Component ID: json encoded LookupRpcServiceRequest. - */ - callRpcService: { - name: 'CallRpcService', - requestType: RpcStreamPacket, - requestStream: true, - responseType: RpcStreamPacket, - responseStream: true, - options: {}, - }, - }, -} as const - -interface Rpc { - request( - service: string, - method: string, - data: Uint8Array, - abortSignal?: AbortSignal, - ): Promise - clientStreamingRequest( - service: string, - method: string, - data: AsyncIterable, - abortSignal?: AbortSignal, - ): Promise - serverStreamingRequest( - service: string, - method: string, - data: Uint8Array, - abortSignal?: AbortSignal, - ): AsyncIterable - bidirectionalStreamingRequest( - service: string, - method: string, - data: AsyncIterable, - abortSignal?: AbortSignal, - ): AsyncIterable -} - -type Builtin = - | Date - | Function - | Uint8Array - | string - | number - | boolean - | undefined - -export type DeepPartial = T extends Builtin - ? T - : T extends Long - ? string | number | Long - : T extends globalThis.Array - ? globalThis.Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends { $case: string } - ? { [K in keyof Omit]?: DeepPartial } & { - $case: T['$case'] - } - : T extends {} - ? { [K in keyof T]?: DeepPartial } - : Partial - -type KeysOfUnion = T extends T ? keyof T : never -export type Exact = P extends Builtin - ? P - : P & { [K in keyof P]: Exact } & { - [K in Exclude>]: never - } - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any - _m0.configure() -} - -function isSet(value: any): boolean { - return value !== null && value !== undefined -} diff --git a/rpc/access/access_drpc.pb.go b/rpc/access/access_drpc.pb.go deleted file mode 100644 index a8320452..00000000 --- a/rpc/access/access_drpc.pb.go +++ /dev/null @@ -1,207 +0,0 @@ -// Code generated by protoc-gen-go-drpc. DO NOT EDIT. -// protoc-gen-go-drpc version: v0.0.34 -// source: github.com/aperturerobotics/bifrost/rpc/access/access.proto - -package bifrost_rpc_access - -import ( - context "context" - errors "errors" - - rpcstream "github.com/aperturerobotics/starpc/rpcstream" - drpc1 "github.com/planetscale/vtprotobuf/codec/drpc" - drpc "storj.io/drpc" - drpcerr "storj.io/drpc/drpcerr" -) - -type drpcEncoding_File_github_com_aperturerobotics_bifrost_rpc_access_access_proto struct{} - -func (drpcEncoding_File_github_com_aperturerobotics_bifrost_rpc_access_access_proto) Marshal(msg drpc.Message) ([]byte, error) { - return drpc1.Marshal(msg) -} - -func (drpcEncoding_File_github_com_aperturerobotics_bifrost_rpc_access_access_proto) Unmarshal(buf []byte, msg drpc.Message) error { - return drpc1.Unmarshal(buf, msg) -} - -type DRPCAccessRpcServiceClient interface { - DRPCConn() drpc.Conn - - LookupRpcService(ctx context.Context, in *LookupRpcServiceRequest) (DRPCAccessRpcService_LookupRpcServiceClient, error) - CallRpcService(ctx context.Context) (DRPCAccessRpcService_CallRpcServiceClient, error) -} - -type drpcAccessRpcServiceClient struct { - cc drpc.Conn -} - -func NewDRPCAccessRpcServiceClient(cc drpc.Conn) DRPCAccessRpcServiceClient { - return &drpcAccessRpcServiceClient{cc} -} - -func (c *drpcAccessRpcServiceClient) DRPCConn() drpc.Conn { return c.cc } - -func (c *drpcAccessRpcServiceClient) LookupRpcService(ctx context.Context, in *LookupRpcServiceRequest) (DRPCAccessRpcService_LookupRpcServiceClient, error) { - stream, err := c.cc.NewStream(ctx, "/bifrost.rpc.access.AccessRpcService/LookupRpcService", drpcEncoding_File_github_com_aperturerobotics_bifrost_rpc_access_access_proto{}) - if err != nil { - return nil, err - } - x := &drpcAccessRpcService_LookupRpcServiceClient{stream} - if err := x.MsgSend(in, drpcEncoding_File_github_com_aperturerobotics_bifrost_rpc_access_access_proto{}); err != nil { - return nil, err - } - if err := x.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type DRPCAccessRpcService_LookupRpcServiceClient interface { - drpc.Stream - Recv() (*LookupRpcServiceResponse, error) -} - -type drpcAccessRpcService_LookupRpcServiceClient struct { - drpc.Stream -} - -func (x *drpcAccessRpcService_LookupRpcServiceClient) GetStream() drpc.Stream { - return x.Stream -} - -func (x *drpcAccessRpcService_LookupRpcServiceClient) Recv() (*LookupRpcServiceResponse, error) { - m := new(LookupRpcServiceResponse) - if err := x.MsgRecv(m, drpcEncoding_File_github_com_aperturerobotics_bifrost_rpc_access_access_proto{}); err != nil { - return nil, err - } - return m, nil -} - -func (x *drpcAccessRpcService_LookupRpcServiceClient) RecvMsg(m *LookupRpcServiceResponse) error { - return x.MsgRecv(m, drpcEncoding_File_github_com_aperturerobotics_bifrost_rpc_access_access_proto{}) -} - -func (c *drpcAccessRpcServiceClient) CallRpcService(ctx context.Context) (DRPCAccessRpcService_CallRpcServiceClient, error) { - stream, err := c.cc.NewStream(ctx, "/bifrost.rpc.access.AccessRpcService/CallRpcService", drpcEncoding_File_github_com_aperturerobotics_bifrost_rpc_access_access_proto{}) - if err != nil { - return nil, err - } - x := &drpcAccessRpcService_CallRpcServiceClient{stream} - return x, nil -} - -type DRPCAccessRpcService_CallRpcServiceClient interface { - drpc.Stream - Send(*rpcstream.RpcStreamPacket) error - Recv() (*rpcstream.RpcStreamPacket, error) -} - -type drpcAccessRpcService_CallRpcServiceClient struct { - drpc.Stream -} - -func (x *drpcAccessRpcService_CallRpcServiceClient) GetStream() drpc.Stream { - return x.Stream -} - -func (x *drpcAccessRpcService_CallRpcServiceClient) Send(m *rpcstream.RpcStreamPacket) error { - return x.MsgSend(m, drpcEncoding_File_github_com_aperturerobotics_bifrost_rpc_access_access_proto{}) -} - -func (x *drpcAccessRpcService_CallRpcServiceClient) Recv() (*rpcstream.RpcStreamPacket, error) { - m := new(rpcstream.RpcStreamPacket) - if err := x.MsgRecv(m, drpcEncoding_File_github_com_aperturerobotics_bifrost_rpc_access_access_proto{}); err != nil { - return nil, err - } - return m, nil -} - -func (x *drpcAccessRpcService_CallRpcServiceClient) RecvMsg(m *rpcstream.RpcStreamPacket) error { - return x.MsgRecv(m, drpcEncoding_File_github_com_aperturerobotics_bifrost_rpc_access_access_proto{}) -} - -type DRPCAccessRpcServiceServer interface { - LookupRpcService(*LookupRpcServiceRequest, DRPCAccessRpcService_LookupRpcServiceStream) error - CallRpcService(DRPCAccessRpcService_CallRpcServiceStream) error -} - -type DRPCAccessRpcServiceUnimplementedServer struct{} - -func (s *DRPCAccessRpcServiceUnimplementedServer) LookupRpcService(*LookupRpcServiceRequest, DRPCAccessRpcService_LookupRpcServiceStream) error { - return drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) -} - -func (s *DRPCAccessRpcServiceUnimplementedServer) CallRpcService(DRPCAccessRpcService_CallRpcServiceStream) error { - return drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) -} - -type DRPCAccessRpcServiceDescription struct{} - -func (DRPCAccessRpcServiceDescription) NumMethods() int { return 2 } - -func (DRPCAccessRpcServiceDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver, interface{}, bool) { - switch n { - case 0: - return "/bifrost.rpc.access.AccessRpcService/LookupRpcService", drpcEncoding_File_github_com_aperturerobotics_bifrost_rpc_access_access_proto{}, - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return nil, srv.(DRPCAccessRpcServiceServer). - LookupRpcService( - in1.(*LookupRpcServiceRequest), - &drpcAccessRpcService_LookupRpcServiceStream{in2.(drpc.Stream)}, - ) - }, DRPCAccessRpcServiceServer.LookupRpcService, true - case 1: - return "/bifrost.rpc.access.AccessRpcService/CallRpcService", drpcEncoding_File_github_com_aperturerobotics_bifrost_rpc_access_access_proto{}, - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return nil, srv.(DRPCAccessRpcServiceServer). - CallRpcService( - &drpcAccessRpcService_CallRpcServiceStream{in1.(drpc.Stream)}, - ) - }, DRPCAccessRpcServiceServer.CallRpcService, true - default: - return "", nil, nil, nil, false - } -} - -func DRPCRegisterAccessRpcService(mux drpc.Mux, impl DRPCAccessRpcServiceServer) error { - return mux.Register(impl, DRPCAccessRpcServiceDescription{}) -} - -type DRPCAccessRpcService_LookupRpcServiceStream interface { - drpc.Stream - Send(*LookupRpcServiceResponse) error -} - -type drpcAccessRpcService_LookupRpcServiceStream struct { - drpc.Stream -} - -func (x *drpcAccessRpcService_LookupRpcServiceStream) Send(m *LookupRpcServiceResponse) error { - return x.MsgSend(m, drpcEncoding_File_github_com_aperturerobotics_bifrost_rpc_access_access_proto{}) -} - -type DRPCAccessRpcService_CallRpcServiceStream interface { - drpc.Stream - Send(*rpcstream.RpcStreamPacket) error - Recv() (*rpcstream.RpcStreamPacket, error) -} - -type drpcAccessRpcService_CallRpcServiceStream struct { - drpc.Stream -} - -func (x *drpcAccessRpcService_CallRpcServiceStream) Send(m *rpcstream.RpcStreamPacket) error { - return x.MsgSend(m, drpcEncoding_File_github_com_aperturerobotics_bifrost_rpc_access_access_proto{}) -} - -func (x *drpcAccessRpcService_CallRpcServiceStream) Recv() (*rpcstream.RpcStreamPacket, error) { - m := new(rpcstream.RpcStreamPacket) - if err := x.MsgRecv(m, drpcEncoding_File_github_com_aperturerobotics_bifrost_rpc_access_access_proto{}); err != nil { - return nil, err - } - return m, nil -} - -func (x *drpcAccessRpcService_CallRpcServiceStream) RecvMsg(m *rpcstream.RpcStreamPacket) error { - return x.MsgRecv(m, drpcEncoding_File_github_com_aperturerobotics_bifrost_rpc_access_access_proto{}) -} diff --git a/rpc/access/access_pb.ts b/rpc/access/access_pb.ts new file mode 100644 index 00000000..346c3567 --- /dev/null +++ b/rpc/access/access_pb.ts @@ -0,0 +1,156 @@ +// @generated by protoc-gen-es v1.8.0 with parameter "target=ts,ts_nocheck=false" +// @generated from file github.com/aperturerobotics/bifrost/rpc/access/access.proto (package bifrost.rpc.access, syntax proto3) +/* eslint-disable */ + +import type { + BinaryReadOptions, + FieldList, + JsonReadOptions, + JsonValue, + PartialMessage, + PlainMessage, +} from '@bufbuild/protobuf' +import { Message, proto3 } from '@bufbuild/protobuf' + +/** + * LookupRpcServiceRequest is a request to lookup an rpc service. + * + * @generated from message bifrost.rpc.access.LookupRpcServiceRequest + */ +export class LookupRpcServiceRequest extends Message { + /** + * ServiceId is the service identifier. + * + * @generated from field: string service_id = 1; + */ + serviceId = '' + + /** + * ServerId is the identifier of the server requesting the service. + * Can be empty. + * + * @generated from field: string server_id = 2; + */ + serverId = '' + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'bifrost.rpc.access.LookupRpcServiceRequest' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: 'service_id', kind: 'scalar', T: 9 /* ScalarType.STRING */ }, + { no: 2, name: 'server_id', kind: 'scalar', T: 9 /* ScalarType.STRING */ }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): LookupRpcServiceRequest { + return new LookupRpcServiceRequest().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): LookupRpcServiceRequest { + return new LookupRpcServiceRequest().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): LookupRpcServiceRequest { + return new LookupRpcServiceRequest().fromJsonString(jsonString, options) + } + + static equals( + a: + | LookupRpcServiceRequest + | PlainMessage + | undefined, + b: + | LookupRpcServiceRequest + | PlainMessage + | undefined, + ): boolean { + return proto3.util.equals(LookupRpcServiceRequest, a, b) + } +} + +/** + * LookupRpcServiceResponse is a response to LookupRpcService + * + * @generated from message bifrost.rpc.access.LookupRpcServiceResponse + */ +export class LookupRpcServiceResponse extends Message { + /** + * Idle indicates the directive is now idle. + * + * @generated from field: bool idle = 1; + */ + idle = false + + /** + * Exists indicates we found the service on the remote. + * + * @generated from field: bool exists = 2; + */ + exists = false + + /** + * Removed indicates the value no longer exists. + * + * @generated from field: bool removed = 3; + */ + removed = false + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'bifrost.rpc.access.LookupRpcServiceResponse' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: 'idle', kind: 'scalar', T: 8 /* ScalarType.BOOL */ }, + { no: 2, name: 'exists', kind: 'scalar', T: 8 /* ScalarType.BOOL */ }, + { no: 3, name: 'removed', kind: 'scalar', T: 8 /* ScalarType.BOOL */ }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): LookupRpcServiceResponse { + return new LookupRpcServiceResponse().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): LookupRpcServiceResponse { + return new LookupRpcServiceResponse().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): LookupRpcServiceResponse { + return new LookupRpcServiceResponse().fromJsonString(jsonString, options) + } + + static equals( + a: + | LookupRpcServiceResponse + | PlainMessage + | undefined, + b: + | LookupRpcServiceResponse + | PlainMessage + | undefined, + ): boolean { + return proto3.util.equals(LookupRpcServiceResponse, a, b) + } +} diff --git a/rpc/access/access_srpc.pb.go b/rpc/access/access_srpc.pb.go index db4d5620..75ffcd72 100644 --- a/rpc/access/access_srpc.pb.go +++ b/rpc/access/access_srpc.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-srpc. DO NOT EDIT. -// protoc-gen-srpc version: v0.27.3 +// protoc-gen-srpc version: v0.31.2 // source: github.com/aperturerobotics/bifrost/rpc/access/access.proto package bifrost_rpc_access diff --git a/rpc/access/access_srpc.pb.ts b/rpc/access/access_srpc.pb.ts new file mode 100644 index 00000000..91279e50 --- /dev/null +++ b/rpc/access/access_srpc.pb.ts @@ -0,0 +1,135 @@ +// @generated by protoc-gen-es-starpc none with parameter "target=ts,ts_nocheck=false" +// @generated from file github.com/aperturerobotics/bifrost/rpc/access/access.proto (package bifrost.rpc.access, syntax proto3) +/* eslint-disable */ + +import { + LookupRpcServiceRequest, + LookupRpcServiceResponse, +} from './access_pb.js' +import type { PartialMessage } from '@bufbuild/protobuf' +import { MethodKind } from '@bufbuild/protobuf' +import { RpcStreamPacket } from '../../../starpc/rpcstream/rpcstream_pb.js' +import { + buildDecodeMessageTransform, + buildEncodeMessageTransform, + MessageStream, + ProtoRpc, +} from 'starpc' + +/** + * AccessRpcService exposes services with LookupRpcService via RPC. + * + * @generated from service bifrost.rpc.access.AccessRpcService + */ +export const AccessRpcServiceDefinition = { + typeName: 'bifrost.rpc.access.AccessRpcService', + methods: { + /** + * LookupRpcService checks if a RPC service exists with the given info. + * Usually translates to accessing the LookupRpcService directive. + * If the service was not found (directive is idle) returns empty. + * + * @generated from rpc bifrost.rpc.access.AccessRpcService.LookupRpcService + */ + LookupRpcService: { + name: 'LookupRpcService', + I: LookupRpcServiceRequest, + O: LookupRpcServiceResponse, + kind: MethodKind.ServerStreaming, + }, + /** + * CallRpcService forwards an RPC call to the service with the component ID. + * Component ID: json encoded LookupRpcServiceRequest. + * + * @generated from rpc bifrost.rpc.access.AccessRpcService.CallRpcService + */ + CallRpcService: { + name: 'CallRpcService', + I: RpcStreamPacket, + O: RpcStreamPacket, + kind: MethodKind.BiDiStreaming, + }, + }, +} as const + +/** + * AccessRpcService exposes services with LookupRpcService via RPC. + * + * @generated from service bifrost.rpc.access.AccessRpcService + */ +export interface AccessRpcService { + /** + * LookupRpcService checks if a RPC service exists with the given info. + * Usually translates to accessing the LookupRpcService directive. + * If the service was not found (directive is idle) returns empty. + * + * @generated from rpc bifrost.rpc.access.AccessRpcService.LookupRpcService + */ + LookupRpcService( + request: PartialMessage, + abortSignal?: AbortSignal, + ): MessageStream + + /** + * CallRpcService forwards an RPC call to the service with the component ID. + * Component ID: json encoded LookupRpcServiceRequest. + * + * @generated from rpc bifrost.rpc.access.AccessRpcService.CallRpcService + */ + CallRpcService( + request: MessageStream, + abortSignal?: AbortSignal, + ): MessageStream +} + +export const AccessRpcServiceServiceName = AccessRpcServiceDefinition.typeName + +export class AccessRpcServiceClient implements AccessRpcService { + private readonly rpc: ProtoRpc + private readonly service: string + constructor(rpc: ProtoRpc, opts?: { service?: string }) { + this.service = opts?.service || AccessRpcServiceServiceName + this.rpc = rpc + this.LookupRpcService = this.LookupRpcService.bind(this) + this.CallRpcService = this.CallRpcService.bind(this) + } + /** + * LookupRpcService checks if a RPC service exists with the given info. + * Usually translates to accessing the LookupRpcService directive. + * If the service was not found (directive is idle) returns empty. + * + * @generated from rpc bifrost.rpc.access.AccessRpcService.LookupRpcService + */ + LookupRpcService( + request: PartialMessage, + abortSignal?: AbortSignal, + ): MessageStream { + const requestMsg = new LookupRpcServiceRequest(request) + const result = this.rpc.serverStreamingRequest( + this.service, + AccessRpcServiceDefinition.methods.LookupRpcService.name, + requestMsg.toBinary(), + abortSignal || undefined, + ) + return buildDecodeMessageTransform(LookupRpcServiceResponse)(result) + } + + /** + * CallRpcService forwards an RPC call to the service with the component ID. + * Component ID: json encoded LookupRpcServiceRequest. + * + * @generated from rpc bifrost.rpc.access.AccessRpcService.CallRpcService + */ + CallRpcService( + request: MessageStream, + abortSignal?: AbortSignal, + ): MessageStream { + const result = this.rpc.bidirectionalStreamingRequest( + this.service, + AccessRpcServiceDefinition.methods.CallRpcService.name, + buildEncodeMessageTransform(RpcStreamPacket)(request), + abortSignal || undefined, + ) + return buildDecodeMessageTransform(RpcStreamPacket)(result) + } +} diff --git a/rpc/access/access_vtproto.pb.go b/rpc/access/access_vtproto.pb.go deleted file mode 100644 index b7f7fd3c..00000000 --- a/rpc/access/access_vtproto.pb.go +++ /dev/null @@ -1,479 +0,0 @@ -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// protoc-gen-go-vtproto version: v0.6.0 -// source: github.com/aperturerobotics/bifrost/rpc/access/access.proto - -package bifrost_rpc_access - -import ( - fmt "fmt" - io "io" - - protohelpers "github.com/planetscale/vtprotobuf/protohelpers" - proto "google.golang.org/protobuf/proto" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) -) - -func (m *LookupRpcServiceRequest) CloneVT() *LookupRpcServiceRequest { - if m == nil { - return (*LookupRpcServiceRequest)(nil) - } - r := new(LookupRpcServiceRequest) - r.ServiceId = m.ServiceId - r.ServerId = m.ServerId - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *LookupRpcServiceRequest) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *LookupRpcServiceResponse) CloneVT() *LookupRpcServiceResponse { - if m == nil { - return (*LookupRpcServiceResponse)(nil) - } - r := new(LookupRpcServiceResponse) - r.Idle = m.Idle - r.Exists = m.Exists - r.Removed = m.Removed - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *LookupRpcServiceResponse) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (this *LookupRpcServiceRequest) EqualVT(that *LookupRpcServiceRequest) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.ServiceId != that.ServiceId { - return false - } - if this.ServerId != that.ServerId { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *LookupRpcServiceRequest) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*LookupRpcServiceRequest) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *LookupRpcServiceResponse) EqualVT(that *LookupRpcServiceResponse) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.Idle != that.Idle { - return false - } - if this.Exists != that.Exists { - return false - } - if this.Removed != that.Removed { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *LookupRpcServiceResponse) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*LookupRpcServiceResponse) - if !ok { - return false - } - return this.EqualVT(that) -} -func (m *LookupRpcServiceRequest) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *LookupRpcServiceRequest) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *LookupRpcServiceRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.ServerId) > 0 { - i -= len(m.ServerId) - copy(dAtA[i:], m.ServerId) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.ServerId))) - i-- - dAtA[i] = 0x12 - } - if len(m.ServiceId) > 0 { - i -= len(m.ServiceId) - copy(dAtA[i:], m.ServiceId) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.ServiceId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *LookupRpcServiceResponse) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *LookupRpcServiceResponse) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *LookupRpcServiceResponse) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Removed { - i-- - if m.Removed { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x18 - } - if m.Exists { - i-- - if m.Exists { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x10 - } - if m.Idle { - i-- - if m.Idle { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *LookupRpcServiceRequest) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ServiceId) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - l = len(m.ServerId) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *LookupRpcServiceResponse) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Idle { - n += 2 - } - if m.Exists { - n += 2 - } - if m.Removed { - n += 2 - } - n += len(m.unknownFields) - return n -} - -func (m *LookupRpcServiceRequest) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: LookupRpcServiceRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: LookupRpcServiceRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ServiceId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ServiceId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ServerId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ServerId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *LookupRpcServiceResponse) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: LookupRpcServiceResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: LookupRpcServiceResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Idle", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Idle = bool(v != 0) - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Exists", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Exists = bool(v != 0) - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Removed", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Removed = bool(v != 0) - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} diff --git a/signaling/echo/echo.pb.go b/signaling/echo/echo.pb.go index e62e9113..bb1990e7 100644 --- a/signaling/echo/echo.pb.go +++ b/signaling/echo/echo.pb.go @@ -1,149 +1,251 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0-devel -// protoc v5.26.1 +// Code generated by protoc-gen-go-lite. DO NOT EDIT. +// protoc-gen-go-lite version: v0.4.5 // source: github.com/aperturerobotics/bifrost/signaling/echo/echo.proto package signaling_echo import ( - reflect "reflect" - sync "sync" + io "io" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) + protobuf_go_lite "github.com/aperturerobotics/protobuf-go-lite" + json "github.com/aperturerobotics/protobuf-go-lite/json" + errors "github.com/pkg/errors" ) // Config configures the echo controller. type Config struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + unknownFields []byte // SignalingId is the incoming signaling ID to handle and echo messages. // Cannot be empty. - SignalingId string `protobuf:"bytes,1,opt,name=signaling_id,json=signalingId,proto3" json:"signaling_id,omitempty"` + SignalingId string `protobuf:"bytes,1,opt,name=signaling_id,json=signalingId,proto3" json:"signalingId,omitempty"` } func (x *Config) Reset() { *x = Config{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_signaling_echo_echo_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) +} + +func (*Config) ProtoMessage() {} + +func (x *Config) GetSignalingId() string { + if x != nil { + return x.SignalingId } + return "" } -func (x *Config) String() string { - return protoimpl.X.MessageStringOf(x) +func (m *Config) CloneVT() *Config { + if m == nil { + return (*Config)(nil) + } + r := new(Config) + r.SignalingId = m.SignalingId + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r } -func (*Config) ProtoMessage() {} +func (m *Config) CloneMessageVT() any { + return m.CloneVT() +} -func (x *Config) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_signaling_echo_echo_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms +func (this *Config) EqualVT(that *Config) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.SignalingId != that.SignalingId { + return false } - return mi.MessageOf(x) + return string(this.unknownFields) == string(that.unknownFields) } -// Deprecated: Use Config.ProtoReflect.Descriptor instead. -func (*Config) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_signaling_echo_echo_proto_rawDescGZIP(), []int{0} +func (this *Config) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*Config) + if !ok { + return false + } + return this.EqualVT(that) } -func (x *Config) GetSignalingId() string { - if x != nil { - return x.SignalingId +// MarshalProtoJSON marshals the Config message to JSON. +func (x *Config) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return } - return "" + s.WriteObjectStart() + var wroteField bool + if x.SignalingId != "" || s.HasField("signalingId") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("signalingId") + s.WriteString(x.SignalingId) + } + s.WriteObjectEnd() } -var File_github_com_aperturerobotics_bifrost_signaling_echo_echo_proto protoreflect.FileDescriptor +// MarshalJSON marshals the Config to JSON. +func (x *Config) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) +} -var file_github_com_aperturerobotics_bifrost_signaling_echo_echo_proto_rawDesc = []byte{ - 0x0a, 0x3d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, - 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x62, 0x69, - 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x69, 0x6e, 0x67, 0x2f, - 0x65, 0x63, 0x68, 0x6f, 0x2f, 0x65, 0x63, 0x68, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, - 0x0e, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x69, 0x6e, 0x67, 0x2e, 0x65, 0x63, 0x68, 0x6f, 0x22, - 0x2b, 0x0a, 0x06, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x69, 0x67, - 0x6e, 0x61, 0x6c, 0x69, 0x6e, 0x67, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x0b, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x69, 0x6e, 0x67, 0x49, 0x64, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, +// UnmarshalProtoJSON unmarshals the Config message from JSON. +func (x *Config) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { + return + } + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "signaling_id", "signalingId": + s.AddField("signaling_id") + x.SignalingId = s.ReadString() + } + }) } -var ( - file_github_com_aperturerobotics_bifrost_signaling_echo_echo_proto_rawDescOnce sync.Once - file_github_com_aperturerobotics_bifrost_signaling_echo_echo_proto_rawDescData = file_github_com_aperturerobotics_bifrost_signaling_echo_echo_proto_rawDesc -) +// UnmarshalJSON unmarshals the Config from JSON. +func (x *Config) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} -func file_github_com_aperturerobotics_bifrost_signaling_echo_echo_proto_rawDescGZIP() []byte { - file_github_com_aperturerobotics_bifrost_signaling_echo_echo_proto_rawDescOnce.Do(func() { - file_github_com_aperturerobotics_bifrost_signaling_echo_echo_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_aperturerobotics_bifrost_signaling_echo_echo_proto_rawDescData) - }) - return file_github_com_aperturerobotics_bifrost_signaling_echo_echo_proto_rawDescData +func (m *Config) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil } -var file_github_com_aperturerobotics_bifrost_signaling_echo_echo_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_github_com_aperturerobotics_bifrost_signaling_echo_echo_proto_goTypes = []interface{}{ - (*Config)(nil), // 0: signaling.echo.Config +func (m *Config) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) } -var file_github_com_aperturerobotics_bifrost_signaling_echo_echo_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] 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 (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.SignalingId) > 0 { + i -= len(m.SignalingId) + copy(dAtA[i:], m.SignalingId) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.SignalingId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } -func init() { file_github_com_aperturerobotics_bifrost_signaling_echo_echo_proto_init() } -func file_github_com_aperturerobotics_bifrost_signaling_echo_echo_proto_init() { - if File_github_com_aperturerobotics_bifrost_signaling_echo_echo_proto != nil { - return +func (m *Config) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.SignalingId) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) } - if !protoimpl.UnsafeEnabled { - file_github_com_aperturerobotics_bifrost_signaling_echo_echo_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Config); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil + n += len(m.unknownFields) + return n +} + +func (m *Config) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: Config: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: Config: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field SignalingId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SignalingId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy } } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_github_com_aperturerobotics_bifrost_signaling_echo_echo_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_github_com_aperturerobotics_bifrost_signaling_echo_echo_proto_goTypes, - DependencyIndexes: file_github_com_aperturerobotics_bifrost_signaling_echo_echo_proto_depIdxs, - MessageInfos: file_github_com_aperturerobotics_bifrost_signaling_echo_echo_proto_msgTypes, - }.Build() - File_github_com_aperturerobotics_bifrost_signaling_echo_echo_proto = out.File - file_github_com_aperturerobotics_bifrost_signaling_echo_echo_proto_rawDesc = nil - file_github_com_aperturerobotics_bifrost_signaling_echo_echo_proto_goTypes = nil - file_github_com_aperturerobotics_bifrost_signaling_echo_echo_proto_depIdxs = nil + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil } diff --git a/signaling/echo/echo.pb.ts b/signaling/echo/echo.pb.ts deleted file mode 100644 index 85e85872..00000000 --- a/signaling/echo/echo.pb.ts +++ /dev/null @@ -1,154 +0,0 @@ -/* eslint-disable */ -import Long from 'long' -import _m0 from 'protobufjs/minimal.js' - -export const protobufPackage = 'signaling.echo' - -/** Config configures the echo controller. */ -export interface Config { - /** - * SignalingId is the incoming signaling ID to handle and echo messages. - * Cannot be empty. - */ - signalingId: string -} - -function createBaseConfig(): Config { - return { signalingId: '' } -} - -export const Config = { - encode( - message: Config, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.signalingId !== '') { - writer.uint32(10).string(message.signalingId) - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Config { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseConfig() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break - } - - message.signalingId = reader.string() - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: AsyncIterable | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config.encode(p).finish()] - } - } else { - yield* [Config.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config.decode(p)] - } - } else { - yield* [Config.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): Config { - return { - signalingId: isSet(object.signalingId) - ? globalThis.String(object.signalingId) - : '', - } - }, - - toJSON(message: Config): unknown { - const obj: any = {} - if (message.signalingId !== '') { - obj.signalingId = message.signalingId - } - return obj - }, - - create, I>>(base?: I): Config { - return Config.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>(object: I): Config { - const message = createBaseConfig() - message.signalingId = object.signalingId ?? '' - return message - }, -} - -type Builtin = - | Date - | Function - | Uint8Array - | string - | number - | boolean - | undefined - -export type DeepPartial = T extends Builtin - ? T - : T extends Long - ? string | number | Long - : T extends globalThis.Array - ? globalThis.Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends { $case: string } - ? { [K in keyof Omit]?: DeepPartial } & { - $case: T['$case'] - } - : T extends {} - ? { [K in keyof T]?: DeepPartial } - : Partial - -type KeysOfUnion = T extends T ? keyof T : never -export type Exact = P extends Builtin - ? P - : P & { [K in keyof P]: Exact } & { - [K in Exclude>]: never - } - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any - _m0.configure() -} - -function isSet(value: any): boolean { - return value !== null && value !== undefined -} diff --git a/signaling/echo/echo_pb.ts b/signaling/echo/echo_pb.ts new file mode 100644 index 00000000..6408b1c3 --- /dev/null +++ b/signaling/echo/echo_pb.ts @@ -0,0 +1,72 @@ +// @generated by protoc-gen-es v1.8.0 with parameter "target=ts,ts_nocheck=false" +// @generated from file github.com/aperturerobotics/bifrost/signaling/echo/echo.proto (package signaling.echo, syntax proto3) +/* eslint-disable */ + +import type { + BinaryReadOptions, + FieldList, + JsonReadOptions, + JsonValue, + PartialMessage, + PlainMessage, +} from '@bufbuild/protobuf' +import { Message, proto3 } from '@bufbuild/protobuf' + +/** + * Config configures the echo controller. + * + * @generated from message signaling.echo.Config + */ +export class Config extends Message { + /** + * SignalingId is the incoming signaling ID to handle and echo messages. + * Cannot be empty. + * + * @generated from field: string signaling_id = 1; + */ + signalingId = '' + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'signaling.echo.Config' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { + no: 1, + name: 'signaling_id', + kind: 'scalar', + T: 9 /* ScalarType.STRING */, + }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): Config { + return new Config().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): Config { + return new Config().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): Config { + return new Config().fromJsonString(jsonString, options) + } + + static equals( + a: Config | PlainMessage | undefined, + b: Config | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(Config, a, b) + } +} diff --git a/signaling/echo/echo_vtproto.pb.go b/signaling/echo/echo_vtproto.pb.go deleted file mode 100644 index a9d73237..00000000 --- a/signaling/echo/echo_vtproto.pb.go +++ /dev/null @@ -1,195 +0,0 @@ -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// protoc-gen-go-vtproto version: v0.6.0 -// source: github.com/aperturerobotics/bifrost/signaling/echo/echo.proto - -package signaling_echo - -import ( - fmt "fmt" - io "io" - - protohelpers "github.com/planetscale/vtprotobuf/protohelpers" - proto "google.golang.org/protobuf/proto" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) -) - -func (m *Config) CloneVT() *Config { - if m == nil { - return (*Config)(nil) - } - r := new(Config) - r.SignalingId = m.SignalingId - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Config) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (this *Config) EqualVT(that *Config) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.SignalingId != that.SignalingId { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Config) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Config) - if !ok { - return false - } - return this.EqualVT(that) -} -func (m *Config) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Config) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.SignalingId) > 0 { - i -= len(m.SignalingId) - copy(dAtA[i:], m.SignalingId) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.SignalingId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Config) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.SignalingId) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *Config) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Config: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Config: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SignalingId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SignalingId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} diff --git a/signaling/rpc/client/config.pb.go b/signaling/rpc/client/config.pb.go index 14f04a54..6de1dc9e 100644 --- a/signaling/rpc/client/config.pb.go +++ b/signaling/rpc/client/config.pb.go @@ -1,90 +1,52 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0-devel -// protoc v5.26.1 +// Code generated by protoc-gen-go-lite. DO NOT EDIT. +// protoc-gen-go-lite version: v0.4.5 // source: github.com/aperturerobotics/bifrost/signaling/rpc/client/config.proto package signaling_rpc_client import ( - reflect "reflect" - sync "sync" + io "io" client "github.com/aperturerobotics/bifrost/stream/srpc/client" + protobuf_go_lite "github.com/aperturerobotics/protobuf-go-lite" + json "github.com/aperturerobotics/protobuf-go-lite/json" backoff "github.com/aperturerobotics/util/backoff" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) + errors "github.com/pkg/errors" ) // Config configures a client for the Signaling SRPC service. type Config struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + unknownFields []byte // SignalingId is the signaling channel ID. // Filters which SignalPeer directives will be handled. - SignalingId string `protobuf:"bytes,1,opt,name=signaling_id,json=signalingId,proto3" json:"signaling_id,omitempty"` + SignalingId string `protobuf:"bytes,1,opt,name=signaling_id,json=signalingId,proto3" json:"signalingId,omitempty"` // PeerId is the local peer id to use for the client. // Can be empty to use any local peer. - PeerId string `protobuf:"bytes,2,opt,name=peer_id,json=peerId,proto3" json:"peer_id,omitempty"` + PeerId string `protobuf:"bytes,2,opt,name=peer_id,json=peerId,proto3" json:"peerId,omitempty"` // Client contains srpc.client configuration for the signaling RPC client. // The local peer ID is overridden with the peer ID of the looked-up peer. Client *client.Config `protobuf:"bytes,3,opt,name=client,proto3" json:"client,omitempty"` // ProtocolId overrides the default protocol id for the signaling client. // Default: bifrost/signaling - ProtocolId string `protobuf:"bytes,4,opt,name=protocol_id,json=protocolId,proto3" json:"protocol_id,omitempty"` + ProtocolId string `protobuf:"bytes,4,opt,name=protocol_id,json=protocolId,proto3" json:"protocolId,omitempty"` // ServiceId overrides the default service id for the signaling client. // Default: signaling.rpc.Signaling - ServiceId string `protobuf:"bytes,5,opt,name=service_id,json=serviceId,proto3" json:"service_id,omitempty"` + ServiceId string `protobuf:"bytes,5,opt,name=service_id,json=serviceId,proto3" json:"serviceId,omitempty"` // Backoff is the backoff config for connecting to the service. // If unset, defaults to reasonable defaults. Backoff *backoff.Backoff `protobuf:"bytes,6,opt,name=backoff,proto3" json:"backoff,omitempty"` // DisableListen disables listening for incoming sessions. // If set, we will only call out, not accept incoming sessions. // If false, client will emit HandleSignalPeer directives for incoming sessions. - DisableListen bool `protobuf:"varint,7,opt,name=disable_listen,json=disableListen,proto3" json:"disable_listen,omitempty"` + DisableListen bool `protobuf:"varint,7,opt,name=disable_listen,json=disableListen,proto3" json:"disableListen,omitempty"` } func (x *Config) Reset() { *x = Config{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_signaling_rpc_client_config_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Config) String() string { - return protoimpl.X.MessageStringOf(x) } func (*Config) ProtoMessage() {} -func (x *Config) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_signaling_rpc_client_config_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 Config.ProtoReflect.Descriptor instead. -func (*Config) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_signaling_rpc_client_config_proto_rawDescGZIP(), []int{0} -} - func (x *Config) GetSignalingId() string { if x != nil { return x.SignalingId @@ -134,105 +96,565 @@ func (x *Config) GetDisableListen() bool { return false } -var File_github_com_aperturerobotics_bifrost_signaling_rpc_client_config_proto protoreflect.FileDescriptor - -var file_github_com_aperturerobotics_bifrost_signaling_rpc_client_config_proto_rawDesc = []byte{ - 0x0a, 0x45, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, - 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x62, 0x69, - 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x69, 0x6e, 0x67, 0x2f, - 0x72, 0x70, 0x63, 0x2f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, - 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x14, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x69, - 0x6e, 0x67, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x1a, 0x43, 0x67, - 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, 0x72, 0x74, 0x75, - 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x62, 0x69, 0x66, 0x72, 0x6f, - 0x73, 0x74, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2f, 0x73, 0x72, 0x70, 0x63, 0x2f, 0x63, - 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x1a, 0x36, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, - 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, - 0x75, 0x74, 0x69, 0x6c, 0x2f, 0x62, 0x61, 0x63, 0x6b, 0x6f, 0x66, 0x66, 0x2f, 0x62, 0x61, 0x63, - 0x6b, 0x6f, 0x66, 0x66, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x8b, 0x02, 0x0a, 0x06, 0x43, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x69, - 0x6e, 0x67, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x69, 0x67, - 0x6e, 0x61, 0x6c, 0x69, 0x6e, 0x67, 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x70, 0x65, 0x65, 0x72, - 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x65, 0x65, 0x72, 0x49, - 0x64, 0x12, 0x32, 0x0a, 0x06, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x1a, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x73, 0x72, 0x70, 0x63, 0x2e, - 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x06, 0x63, - 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, - 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x63, 0x6f, 0x6c, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x2a, 0x0a, 0x07, 0x62, 0x61, 0x63, 0x6b, 0x6f, 0x66, 0x66, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x62, 0x61, 0x63, 0x6b, 0x6f, 0x66, 0x66, - 0x2e, 0x42, 0x61, 0x63, 0x6b, 0x6f, 0x66, 0x66, 0x52, 0x07, 0x62, 0x61, 0x63, 0x6b, 0x6f, 0x66, - 0x66, 0x12, 0x25, 0x0a, 0x0e, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x6c, 0x69, 0x73, - 0x74, 0x65, 0x6e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x64, 0x69, 0x73, 0x61, 0x62, - 0x6c, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_github_com_aperturerobotics_bifrost_signaling_rpc_client_config_proto_rawDescOnce sync.Once - file_github_com_aperturerobotics_bifrost_signaling_rpc_client_config_proto_rawDescData = file_github_com_aperturerobotics_bifrost_signaling_rpc_client_config_proto_rawDesc -) +func (m *Config) CloneVT() *Config { + if m == nil { + return (*Config)(nil) + } + r := new(Config) + r.SignalingId = m.SignalingId + r.PeerId = m.PeerId + r.ProtocolId = m.ProtocolId + r.ServiceId = m.ServiceId + r.DisableListen = m.DisableListen + if rhs := m.Client; rhs != nil { + r.Client = rhs.CloneVT() + } + if rhs := m.Backoff; rhs != nil { + r.Backoff = rhs.CloneVT() + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} -func file_github_com_aperturerobotics_bifrost_signaling_rpc_client_config_proto_rawDescGZIP() []byte { - file_github_com_aperturerobotics_bifrost_signaling_rpc_client_config_proto_rawDescOnce.Do(func() { - file_github_com_aperturerobotics_bifrost_signaling_rpc_client_config_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_aperturerobotics_bifrost_signaling_rpc_client_config_proto_rawDescData) - }) - return file_github_com_aperturerobotics_bifrost_signaling_rpc_client_config_proto_rawDescData +func (m *Config) CloneMessageVT() any { + return m.CloneVT() +} + +func (this *Config) EqualVT(that *Config) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.SignalingId != that.SignalingId { + return false + } + if this.PeerId != that.PeerId { + return false + } + if !this.Client.EqualVT(that.Client) { + return false + } + if this.ProtocolId != that.ProtocolId { + return false + } + if this.ServiceId != that.ServiceId { + return false + } + if !this.Backoff.EqualVT(that.Backoff) { + return false + } + if this.DisableListen != that.DisableListen { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *Config) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*Config) + if !ok { + return false + } + return this.EqualVT(that) } -var file_github_com_aperturerobotics_bifrost_signaling_rpc_client_config_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_github_com_aperturerobotics_bifrost_signaling_rpc_client_config_proto_goTypes = []interface{}{ - (*Config)(nil), // 0: signaling.rpc.client.Config - (*client.Config)(nil), // 1: stream.srpc.client.Config - (*backoff.Backoff)(nil), // 2: backoff.Backoff +// MarshalProtoJSON marshals the Config message to JSON. +func (x *Config) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return + } + s.WriteObjectStart() + var wroteField bool + if x.SignalingId != "" || s.HasField("signalingId") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("signalingId") + s.WriteString(x.SignalingId) + } + if x.PeerId != "" || s.HasField("peerId") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("peerId") + s.WriteString(x.PeerId) + } + if x.Client != nil || s.HasField("client") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("client") + x.Client.MarshalProtoJSON(s.WithField("client")) + } + if x.ProtocolId != "" || s.HasField("protocolId") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("protocolId") + s.WriteString(x.ProtocolId) + } + if x.ServiceId != "" || s.HasField("serviceId") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("serviceId") + s.WriteString(x.ServiceId) + } + if x.Backoff != nil || s.HasField("backoff") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("backoff") + x.Backoff.MarshalProtoJSON(s.WithField("backoff")) + } + if x.DisableListen || s.HasField("disableListen") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("disableListen") + s.WriteBool(x.DisableListen) + } + s.WriteObjectEnd() } -var file_github_com_aperturerobotics_bifrost_signaling_rpc_client_config_proto_depIdxs = []int32{ - 1, // 0: signaling.rpc.client.Config.client:type_name -> stream.srpc.client.Config - 2, // 1: signaling.rpc.client.Config.backoff:type_name -> backoff.Backoff - 2, // [2:2] is the sub-list for method output_type - 2, // [2:2] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name + +// MarshalJSON marshals the Config to JSON. +func (x *Config) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) } -func init() { file_github_com_aperturerobotics_bifrost_signaling_rpc_client_config_proto_init() } -func file_github_com_aperturerobotics_bifrost_signaling_rpc_client_config_proto_init() { - if File_github_com_aperturerobotics_bifrost_signaling_rpc_client_config_proto != nil { +// UnmarshalProtoJSON unmarshals the Config message from JSON. +func (x *Config) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { return } - if !protoimpl.UnsafeEnabled { - file_github_com_aperturerobotics_bifrost_signaling_rpc_client_config_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Config); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "signaling_id", "signalingId": + s.AddField("signaling_id") + x.SignalingId = s.ReadString() + case "peer_id", "peerId": + s.AddField("peer_id") + x.PeerId = s.ReadString() + case "client": + if s.ReadNil() { + x.Client = nil + return } + x.Client = &client.Config{} + x.Client.UnmarshalProtoJSON(s.WithField("client", true)) + case "protocol_id", "protocolId": + s.AddField("protocol_id") + x.ProtocolId = s.ReadString() + case "service_id", "serviceId": + s.AddField("service_id") + x.ServiceId = s.ReadString() + case "backoff": + if s.ReadNil() { + x.Backoff = nil + return + } + x.Backoff = &backoff.Backoff{} + x.Backoff.UnmarshalProtoJSON(s.WithField("backoff", true)) + case "disable_listen", "disableListen": + s.AddField("disable_listen") + x.DisableListen = s.ReadBool() + } + }) +} + +// UnmarshalJSON unmarshals the Config from JSON. +func (x *Config) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +func (m *Config) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Config) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.DisableListen { + i-- + if m.DisableListen { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x38 + } + if m.Backoff != nil { + size, err := m.Backoff.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x32 + } + if len(m.ServiceId) > 0 { + i -= len(m.ServiceId) + copy(dAtA[i:], m.ServiceId) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.ServiceId))) + i-- + dAtA[i] = 0x2a + } + if len(m.ProtocolId) > 0 { + i -= len(m.ProtocolId) + copy(dAtA[i:], m.ProtocolId) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.ProtocolId))) + i-- + dAtA[i] = 0x22 + } + if m.Client != nil { + size, err := m.Client.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err } + i -= size + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x1a + } + if len(m.PeerId) > 0 { + i -= len(m.PeerId) + copy(dAtA[i:], m.PeerId) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.PeerId))) + i-- + dAtA[i] = 0x12 } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_github_com_aperturerobotics_bifrost_signaling_rpc_client_config_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_github_com_aperturerobotics_bifrost_signaling_rpc_client_config_proto_goTypes, - DependencyIndexes: file_github_com_aperturerobotics_bifrost_signaling_rpc_client_config_proto_depIdxs, - MessageInfos: file_github_com_aperturerobotics_bifrost_signaling_rpc_client_config_proto_msgTypes, - }.Build() - File_github_com_aperturerobotics_bifrost_signaling_rpc_client_config_proto = out.File - file_github_com_aperturerobotics_bifrost_signaling_rpc_client_config_proto_rawDesc = nil - file_github_com_aperturerobotics_bifrost_signaling_rpc_client_config_proto_goTypes = nil - file_github_com_aperturerobotics_bifrost_signaling_rpc_client_config_proto_depIdxs = nil + if len(m.SignalingId) > 0 { + i -= len(m.SignalingId) + copy(dAtA[i:], m.SignalingId) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.SignalingId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Config) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.SignalingId) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + l = len(m.PeerId) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + if m.Client != nil { + l = m.Client.SizeVT() + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + l = len(m.ProtocolId) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + l = len(m.ServiceId) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + if m.Backoff != nil { + l = m.Backoff.SizeVT() + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + if m.DisableListen { + n += 2 + } + n += len(m.unknownFields) + return n +} + +func (m *Config) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: Config: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: Config: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field SignalingId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SignalingId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field PeerId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PeerId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field Client", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Client == nil { + m.Client = &client.Config{} + } + if err := m.Client.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field ProtocolId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ProtocolId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field ServiceId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ServiceId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field Backoff", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Backoff == nil { + m.Backoff = &backoff.Backoff{} + } + if err := m.Backoff.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 0 { + return errors.Errorf("proto: wrong wireType = %d for field DisableListen", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.DisableListen = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil } diff --git a/signaling/rpc/client/config.pb.ts b/signaling/rpc/client/config.pb.ts deleted file mode 100644 index bc3a9ca2..00000000 --- a/signaling/rpc/client/config.pb.ts +++ /dev/null @@ -1,301 +0,0 @@ -/* eslint-disable */ -import { Backoff } from '@go/github.com/aperturerobotics/util/backoff/backoff.pb.js' -import Long from 'long' -import _m0 from 'protobufjs/minimal.js' -import { Config as Config1 } from '../../../stream/srpc/client/client.pb.js' - -export const protobufPackage = 'signaling.rpc.client' - -/** Config configures a client for the Signaling SRPC service. */ -export interface Config { - /** - * SignalingId is the signaling channel ID. - * Filters which SignalPeer directives will be handled. - */ - signalingId: string - /** - * PeerId is the local peer id to use for the client. - * Can be empty to use any local peer. - */ - peerId: string - /** - * Client contains srpc.client configuration for the signaling RPC client. - * The local peer ID is overridden with the peer ID of the looked-up peer. - */ - client: Config1 | undefined - /** - * ProtocolId overrides the default protocol id for the signaling client. - * Default: bifrost/signaling - */ - protocolId: string - /** - * ServiceId overrides the default service id for the signaling client. - * Default: signaling.rpc.Signaling - */ - serviceId: string - /** - * Backoff is the backoff config for connecting to the service. - * If unset, defaults to reasonable defaults. - */ - backoff: Backoff | undefined - /** - * DisableListen disables listening for incoming sessions. - * If set, we will only call out, not accept incoming sessions. - * If false, client will emit HandleSignalPeer directives for incoming sessions. - */ - disableListen: boolean -} - -function createBaseConfig(): Config { - return { - signalingId: '', - peerId: '', - client: undefined, - protocolId: '', - serviceId: '', - backoff: undefined, - disableListen: false, - } -} - -export const Config = { - encode( - message: Config, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.signalingId !== '') { - writer.uint32(10).string(message.signalingId) - } - if (message.peerId !== '') { - writer.uint32(18).string(message.peerId) - } - if (message.client !== undefined) { - Config1.encode(message.client, writer.uint32(26).fork()).ldelim() - } - if (message.protocolId !== '') { - writer.uint32(34).string(message.protocolId) - } - if (message.serviceId !== '') { - writer.uint32(42).string(message.serviceId) - } - if (message.backoff !== undefined) { - Backoff.encode(message.backoff, writer.uint32(50).fork()).ldelim() - } - if (message.disableListen !== false) { - writer.uint32(56).bool(message.disableListen) - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Config { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseConfig() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break - } - - message.signalingId = reader.string() - continue - case 2: - if (tag !== 18) { - break - } - - message.peerId = reader.string() - continue - case 3: - if (tag !== 26) { - break - } - - message.client = Config1.decode(reader, reader.uint32()) - continue - case 4: - if (tag !== 34) { - break - } - - message.protocolId = reader.string() - continue - case 5: - if (tag !== 42) { - break - } - - message.serviceId = reader.string() - continue - case 6: - if (tag !== 50) { - break - } - - message.backoff = Backoff.decode(reader, reader.uint32()) - continue - case 7: - if (tag !== 56) { - break - } - - message.disableListen = reader.bool() - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: AsyncIterable | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config.encode(p).finish()] - } - } else { - yield* [Config.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config.decode(p)] - } - } else { - yield* [Config.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): Config { - return { - signalingId: isSet(object.signalingId) - ? globalThis.String(object.signalingId) - : '', - peerId: isSet(object.peerId) ? globalThis.String(object.peerId) : '', - client: isSet(object.client) - ? Config1.fromJSON(object.client) - : undefined, - protocolId: isSet(object.protocolId) - ? globalThis.String(object.protocolId) - : '', - serviceId: isSet(object.serviceId) - ? globalThis.String(object.serviceId) - : '', - backoff: isSet(object.backoff) - ? Backoff.fromJSON(object.backoff) - : undefined, - disableListen: isSet(object.disableListen) - ? globalThis.Boolean(object.disableListen) - : false, - } - }, - - toJSON(message: Config): unknown { - const obj: any = {} - if (message.signalingId !== '') { - obj.signalingId = message.signalingId - } - if (message.peerId !== '') { - obj.peerId = message.peerId - } - if (message.client !== undefined) { - obj.client = Config1.toJSON(message.client) - } - if (message.protocolId !== '') { - obj.protocolId = message.protocolId - } - if (message.serviceId !== '') { - obj.serviceId = message.serviceId - } - if (message.backoff !== undefined) { - obj.backoff = Backoff.toJSON(message.backoff) - } - if (message.disableListen !== false) { - obj.disableListen = message.disableListen - } - return obj - }, - - create, I>>(base?: I): Config { - return Config.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>(object: I): Config { - const message = createBaseConfig() - message.signalingId = object.signalingId ?? '' - message.peerId = object.peerId ?? '' - message.client = - object.client !== undefined && object.client !== null - ? Config1.fromPartial(object.client) - : undefined - message.protocolId = object.protocolId ?? '' - message.serviceId = object.serviceId ?? '' - message.backoff = - object.backoff !== undefined && object.backoff !== null - ? Backoff.fromPartial(object.backoff) - : undefined - message.disableListen = object.disableListen ?? false - return message - }, -} - -type Builtin = - | Date - | Function - | Uint8Array - | string - | number - | boolean - | undefined - -export type DeepPartial = T extends Builtin - ? T - : T extends Long - ? string | number | Long - : T extends globalThis.Array - ? globalThis.Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends { $case: string } - ? { [K in keyof Omit]?: DeepPartial } & { - $case: T['$case'] - } - : T extends {} - ? { [K in keyof T]?: DeepPartial } - : Partial - -type KeysOfUnion = T extends T ? keyof T : never -export type Exact = P extends Builtin - ? P - : P & { [K in keyof P]: Exact } & { - [K in Exclude>]: never - } - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any - _m0.configure() -} - -function isSet(value: any): boolean { - return value !== null && value !== undefined -} diff --git a/signaling/rpc/client/config_pb.ts b/signaling/rpc/client/config_pb.ts new file mode 100644 index 00000000..de9d8c0d --- /dev/null +++ b/signaling/rpc/client/config_pb.ts @@ -0,0 +1,139 @@ +// @generated by protoc-gen-es v1.8.0 with parameter "target=ts,ts_nocheck=false" +// @generated from file github.com/aperturerobotics/bifrost/signaling/rpc/client/config.proto (package signaling.rpc.client, syntax proto3) +/* eslint-disable */ + +import type { + BinaryReadOptions, + FieldList, + JsonReadOptions, + JsonValue, + PartialMessage, + PlainMessage, +} from '@bufbuild/protobuf' +import { Message, proto3 } from '@bufbuild/protobuf' +import { Config as Config$1 } from '../../../stream/srpc/client/client_pb.js' +import { Backoff } from '../../../../util/backoff/backoff_pb.js' + +/** + * Config configures a client for the Signaling SRPC service. + * + * @generated from message signaling.rpc.client.Config + */ +export class Config extends Message { + /** + * SignalingId is the signaling channel ID. + * Filters which SignalPeer directives will be handled. + * + * @generated from field: string signaling_id = 1; + */ + signalingId = '' + + /** + * PeerId is the local peer id to use for the client. + * Can be empty to use any local peer. + * + * @generated from field: string peer_id = 2; + */ + peerId = '' + + /** + * Client contains srpc.client configuration for the signaling RPC client. + * The local peer ID is overridden with the peer ID of the looked-up peer. + * + * @generated from field: stream.srpc.client.Config client = 3; + */ + client?: Config$1 + + /** + * ProtocolId overrides the default protocol id for the signaling client. + * Default: bifrost/signaling + * + * @generated from field: string protocol_id = 4; + */ + protocolId = '' + + /** + * ServiceId overrides the default service id for the signaling client. + * Default: signaling.rpc.Signaling + * + * @generated from field: string service_id = 5; + */ + serviceId = '' + + /** + * Backoff is the backoff config for connecting to the service. + * If unset, defaults to reasonable defaults. + * + * @generated from field: backoff.Backoff backoff = 6; + */ + backoff?: Backoff + + /** + * DisableListen disables listening for incoming sessions. + * If set, we will only call out, not accept incoming sessions. + * If false, client will emit HandleSignalPeer directives for incoming sessions. + * + * @generated from field: bool disable_listen = 7; + */ + disableListen = false + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'signaling.rpc.client.Config' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { + no: 1, + name: 'signaling_id', + kind: 'scalar', + T: 9 /* ScalarType.STRING */, + }, + { no: 2, name: 'peer_id', kind: 'scalar', T: 9 /* ScalarType.STRING */ }, + { no: 3, name: 'client', kind: 'message', T: Config$1 }, + { + no: 4, + name: 'protocol_id', + kind: 'scalar', + T: 9 /* ScalarType.STRING */, + }, + { no: 5, name: 'service_id', kind: 'scalar', T: 9 /* ScalarType.STRING */ }, + { no: 6, name: 'backoff', kind: 'message', T: Backoff }, + { + no: 7, + name: 'disable_listen', + kind: 'scalar', + T: 8 /* ScalarType.BOOL */, + }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): Config { + return new Config().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): Config { + return new Config().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): Config { + return new Config().fromJsonString(jsonString, options) + } + + static equals( + a: Config | PlainMessage | undefined, + b: Config | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(Config, a, b) + } +} diff --git a/signaling/rpc/client/config_vtproto.pb.go b/signaling/rpc/client/config_vtproto.pb.go deleted file mode 100644 index 853ce469..00000000 --- a/signaling/rpc/client/config_vtproto.pb.go +++ /dev/null @@ -1,555 +0,0 @@ -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// protoc-gen-go-vtproto version: v0.6.0 -// source: github.com/aperturerobotics/bifrost/signaling/rpc/client/config.proto - -package signaling_rpc_client - -import ( - fmt "fmt" - io "io" - - client "github.com/aperturerobotics/bifrost/stream/srpc/client" - backoff "github.com/aperturerobotics/util/backoff" - protohelpers "github.com/planetscale/vtprotobuf/protohelpers" - proto "google.golang.org/protobuf/proto" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) -) - -func (m *Config) CloneVT() *Config { - if m == nil { - return (*Config)(nil) - } - r := new(Config) - r.SignalingId = m.SignalingId - r.PeerId = m.PeerId - r.ProtocolId = m.ProtocolId - r.ServiceId = m.ServiceId - r.DisableListen = m.DisableListen - if rhs := m.Client; rhs != nil { - if vtpb, ok := interface{}(rhs).(interface{ CloneVT() *client.Config }); ok { - r.Client = vtpb.CloneVT() - } else { - r.Client = proto.Clone(rhs).(*client.Config) - } - } - if rhs := m.Backoff; rhs != nil { - if vtpb, ok := interface{}(rhs).(interface{ CloneVT() *backoff.Backoff }); ok { - r.Backoff = vtpb.CloneVT() - } else { - r.Backoff = proto.Clone(rhs).(*backoff.Backoff) - } - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Config) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (this *Config) EqualVT(that *Config) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.SignalingId != that.SignalingId { - return false - } - if this.PeerId != that.PeerId { - return false - } - if equal, ok := interface{}(this.Client).(interface{ EqualVT(*client.Config) bool }); ok { - if !equal.EqualVT(that.Client) { - return false - } - } else if !proto.Equal(this.Client, that.Client) { - return false - } - if this.ProtocolId != that.ProtocolId { - return false - } - if this.ServiceId != that.ServiceId { - return false - } - if equal, ok := interface{}(this.Backoff).(interface{ EqualVT(*backoff.Backoff) bool }); ok { - if !equal.EqualVT(that.Backoff) { - return false - } - } else if !proto.Equal(this.Backoff, that.Backoff) { - return false - } - if this.DisableListen != that.DisableListen { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Config) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Config) - if !ok { - return false - } - return this.EqualVT(that) -} -func (m *Config) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Config) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.DisableListen { - i-- - if m.DisableListen { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x38 - } - if m.Backoff != nil { - if vtmsg, ok := interface{}(m.Backoff).(interface { - MarshalToSizedBufferVT([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.Backoff) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0x32 - } - if len(m.ServiceId) > 0 { - i -= len(m.ServiceId) - copy(dAtA[i:], m.ServiceId) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.ServiceId))) - i-- - dAtA[i] = 0x2a - } - if len(m.ProtocolId) > 0 { - i -= len(m.ProtocolId) - copy(dAtA[i:], m.ProtocolId) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.ProtocolId))) - i-- - dAtA[i] = 0x22 - } - if m.Client != nil { - if vtmsg, ok := interface{}(m.Client).(interface { - MarshalToSizedBufferVT([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.Client) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0x1a - } - if len(m.PeerId) > 0 { - i -= len(m.PeerId) - copy(dAtA[i:], m.PeerId) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.PeerId))) - i-- - dAtA[i] = 0x12 - } - if len(m.SignalingId) > 0 { - i -= len(m.SignalingId) - copy(dAtA[i:], m.SignalingId) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.SignalingId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Config) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.SignalingId) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - l = len(m.PeerId) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.Client != nil { - if size, ok := interface{}(m.Client).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.Client) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - l = len(m.ProtocolId) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - l = len(m.ServiceId) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.Backoff != nil { - if size, ok := interface{}(m.Backoff).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.Backoff) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.DisableListen { - n += 2 - } - n += len(m.unknownFields) - return n -} - -func (m *Config) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Config: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Config: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SignalingId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SignalingId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PeerId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PeerId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Client", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Client == nil { - m.Client = &client.Config{} - } - if unmarshal, ok := interface{}(m.Client).(interface { - UnmarshalVT([]byte) error - }); ok { - if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - } else { - if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.Client); err != nil { - return err - } - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ProtocolId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ProtocolId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ServiceId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ServiceId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Backoff", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Backoff == nil { - m.Backoff = &backoff.Backoff{} - } - if unmarshal, ok := interface{}(m.Backoff).(interface { - UnmarshalVT([]byte) error - }); ok { - if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - } else { - if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.Backoff); err != nil { - return err - } - } - iNdEx = postIndex - case 7: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field DisableListen", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.DisableListen = bool(v != 0) - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} diff --git a/signaling/rpc/server/server.pb.go b/signaling/rpc/server/server.pb.go index a0cde805..23f4d73b 100644 --- a/signaling/rpc/server/server.pb.go +++ b/signaling/rpc/server/server.pb.go @@ -1,157 +1,264 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0-devel -// protoc v5.26.1 +// Code generated by protoc-gen-go-lite. DO NOT EDIT. +// protoc-gen-go-lite version: v0.4.5 // source: github.com/aperturerobotics/bifrost/signaling/rpc/server/server.proto package signaling_rpc_server import ( - reflect "reflect" - sync "sync" + io "io" server "github.com/aperturerobotics/bifrost/stream/srpc/server" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) + protobuf_go_lite "github.com/aperturerobotics/protobuf-go-lite" + json "github.com/aperturerobotics/protobuf-go-lite/json" + errors "github.com/pkg/errors" ) // Config is the configuration for the Signaling RPC server. type Config struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + unknownFields []byte // Server configures the peer ids and protocol ids to listen on. Server *server.Config `protobuf:"bytes,1,opt,name=server,proto3" json:"server,omitempty"` } func (x *Config) Reset() { *x = Config{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_signaling_rpc_server_server_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) +} + +func (*Config) ProtoMessage() {} + +func (x *Config) GetServer() *server.Config { + if x != nil { + return x.Server } + return nil } -func (x *Config) String() string { - return protoimpl.X.MessageStringOf(x) +func (m *Config) CloneVT() *Config { + if m == nil { + return (*Config)(nil) + } + r := new(Config) + if rhs := m.Server; rhs != nil { + r.Server = rhs.CloneVT() + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r } -func (*Config) ProtoMessage() {} +func (m *Config) CloneMessageVT() any { + return m.CloneVT() +} -func (x *Config) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_signaling_rpc_server_server_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms +func (this *Config) EqualVT(that *Config) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if !this.Server.EqualVT(that.Server) { + return false } - return mi.MessageOf(x) + return string(this.unknownFields) == string(that.unknownFields) } -// Deprecated: Use Config.ProtoReflect.Descriptor instead. -func (*Config) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_signaling_rpc_server_server_proto_rawDescGZIP(), []int{0} +func (this *Config) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*Config) + if !ok { + return false + } + return this.EqualVT(that) } -func (x *Config) GetServer() *server.Config { - if x != nil { - return x.Server +// MarshalProtoJSON marshals the Config message to JSON. +func (x *Config) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return } - return nil + s.WriteObjectStart() + var wroteField bool + if x.Server != nil || s.HasField("server") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("server") + x.Server.MarshalProtoJSON(s.WithField("server")) + } + s.WriteObjectEnd() } -var File_github_com_aperturerobotics_bifrost_signaling_rpc_server_server_proto protoreflect.FileDescriptor - -var file_github_com_aperturerobotics_bifrost_signaling_rpc_server_server_proto_rawDesc = []byte{ - 0x0a, 0x45, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, - 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x62, 0x69, - 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x69, 0x6e, 0x67, 0x2f, - 0x72, 0x70, 0x63, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x65, - 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x14, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x69, - 0x6e, 0x67, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x1a, 0x43, 0x67, - 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, 0x72, 0x74, 0x75, - 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x62, 0x69, 0x66, 0x72, 0x6f, - 0x73, 0x74, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2f, 0x73, 0x72, 0x70, 0x63, 0x2f, 0x73, - 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x22, 0x3c, 0x0a, 0x06, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x32, 0x0a, 0x06, - 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x73, - 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x73, 0x72, 0x70, 0x63, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, - 0x72, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x06, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_github_com_aperturerobotics_bifrost_signaling_rpc_server_server_proto_rawDescOnce sync.Once - file_github_com_aperturerobotics_bifrost_signaling_rpc_server_server_proto_rawDescData = file_github_com_aperturerobotics_bifrost_signaling_rpc_server_server_proto_rawDesc -) +// MarshalJSON marshals the Config to JSON. +func (x *Config) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) +} -func file_github_com_aperturerobotics_bifrost_signaling_rpc_server_server_proto_rawDescGZIP() []byte { - file_github_com_aperturerobotics_bifrost_signaling_rpc_server_server_proto_rawDescOnce.Do(func() { - file_github_com_aperturerobotics_bifrost_signaling_rpc_server_server_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_aperturerobotics_bifrost_signaling_rpc_server_server_proto_rawDescData) +// UnmarshalProtoJSON unmarshals the Config message from JSON. +func (x *Config) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { + return + } + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "server": + if s.ReadNil() { + x.Server = nil + return + } + x.Server = &server.Config{} + x.Server.UnmarshalProtoJSON(s.WithField("server", true)) + } }) - return file_github_com_aperturerobotics_bifrost_signaling_rpc_server_server_proto_rawDescData } -var file_github_com_aperturerobotics_bifrost_signaling_rpc_server_server_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_github_com_aperturerobotics_bifrost_signaling_rpc_server_server_proto_goTypes = []interface{}{ - (*Config)(nil), // 0: signaling.rpc.server.Config - (*server.Config)(nil), // 1: stream.srpc.server.Config +// UnmarshalJSON unmarshals the Config from JSON. +func (x *Config) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +func (m *Config) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil } -var file_github_com_aperturerobotics_bifrost_signaling_rpc_server_server_proto_depIdxs = []int32{ - 1, // 0: signaling.rpc.server.Config.server:type_name -> stream.srpc.server.Config - 1, // [1:1] is the sub-list for method output_type - 1, // [1:1] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name + +func (m *Config) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) } -func init() { file_github_com_aperturerobotics_bifrost_signaling_rpc_server_server_proto_init() } -func file_github_com_aperturerobotics_bifrost_signaling_rpc_server_server_proto_init() { - if File_github_com_aperturerobotics_bifrost_signaling_rpc_server_server_proto != nil { - return +func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.Server != nil { + size, err := m.Server.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0xa } - if !protoimpl.UnsafeEnabled { - file_github_com_aperturerobotics_bifrost_signaling_rpc_server_server_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Config); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil + return len(dAtA) - i, nil +} + +func (m *Config) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Server != nil { + l = m.Server.SizeVT() + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *Config) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break } } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: Config: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: Config: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field Server", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Server == nil { + m.Server = &server.Config{} + } + if err := m.Server.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_github_com_aperturerobotics_bifrost_signaling_rpc_server_server_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_github_com_aperturerobotics_bifrost_signaling_rpc_server_server_proto_goTypes, - DependencyIndexes: file_github_com_aperturerobotics_bifrost_signaling_rpc_server_server_proto_depIdxs, - MessageInfos: file_github_com_aperturerobotics_bifrost_signaling_rpc_server_server_proto_msgTypes, - }.Build() - File_github_com_aperturerobotics_bifrost_signaling_rpc_server_server_proto = out.File - file_github_com_aperturerobotics_bifrost_signaling_rpc_server_server_proto_rawDesc = nil - file_github_com_aperturerobotics_bifrost_signaling_rpc_server_server_proto_goTypes = nil - file_github_com_aperturerobotics_bifrost_signaling_rpc_server_server_proto_depIdxs = nil + return nil } diff --git a/signaling/rpc/server/server.pb.ts b/signaling/rpc/server/server.pb.ts deleted file mode 100644 index dbd6f56f..00000000 --- a/signaling/rpc/server/server.pb.ts +++ /dev/null @@ -1,155 +0,0 @@ -/* eslint-disable */ -import Long from 'long' -import _m0 from 'protobufjs/minimal.js' -import { Config as Config1 } from '../../../stream/srpc/server/server.pb.js' - -export const protobufPackage = 'signaling.rpc.server' - -/** Config is the configuration for the Signaling RPC server. */ -export interface Config { - /** Server configures the peer ids and protocol ids to listen on. */ - server: Config1 | undefined -} - -function createBaseConfig(): Config { - return { server: undefined } -} - -export const Config = { - encode( - message: Config, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.server !== undefined) { - Config1.encode(message.server, writer.uint32(10).fork()).ldelim() - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Config { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseConfig() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break - } - - message.server = Config1.decode(reader, reader.uint32()) - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: AsyncIterable | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config.encode(p).finish()] - } - } else { - yield* [Config.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config.decode(p)] - } - } else { - yield* [Config.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): Config { - return { - server: isSet(object.server) - ? Config1.fromJSON(object.server) - : undefined, - } - }, - - toJSON(message: Config): unknown { - const obj: any = {} - if (message.server !== undefined) { - obj.server = Config1.toJSON(message.server) - } - return obj - }, - - create, I>>(base?: I): Config { - return Config.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>(object: I): Config { - const message = createBaseConfig() - message.server = - object.server !== undefined && object.server !== null - ? Config1.fromPartial(object.server) - : undefined - return message - }, -} - -type Builtin = - | Date - | Function - | Uint8Array - | string - | number - | boolean - | undefined - -export type DeepPartial = T extends Builtin - ? T - : T extends Long - ? string | number | Long - : T extends globalThis.Array - ? globalThis.Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends { $case: string } - ? { [K in keyof Omit]?: DeepPartial } & { - $case: T['$case'] - } - : T extends {} - ? { [K in keyof T]?: DeepPartial } - : Partial - -type KeysOfUnion = T extends T ? keyof T : never -export type Exact = P extends Builtin - ? P - : P & { [K in keyof P]: Exact } & { - [K in Exclude>]: never - } - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any - _m0.configure() -} - -function isSet(value: any): boolean { - return value !== null && value !== undefined -} diff --git a/signaling/rpc/server/server_pb.ts b/signaling/rpc/server/server_pb.ts new file mode 100644 index 00000000..7361906c --- /dev/null +++ b/signaling/rpc/server/server_pb.ts @@ -0,0 +1,67 @@ +// @generated by protoc-gen-es v1.8.0 with parameter "target=ts,ts_nocheck=false" +// @generated from file github.com/aperturerobotics/bifrost/signaling/rpc/server/server.proto (package signaling.rpc.server, syntax proto3) +/* eslint-disable */ + +import type { + BinaryReadOptions, + FieldList, + JsonReadOptions, + JsonValue, + PartialMessage, + PlainMessage, +} from '@bufbuild/protobuf' +import { Message, proto3 } from '@bufbuild/protobuf' +import { Config as Config$1 } from '../../../stream/srpc/server/server_pb.js' + +/** + * Config is the configuration for the Signaling RPC server. + * + * @generated from message signaling.rpc.server.Config + */ +export class Config extends Message { + /** + * Server configures the peer ids and protocol ids to listen on. + * + * @generated from field: stream.srpc.server.Config server = 1; + */ + server?: Config$1 + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'signaling.rpc.server.Config' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: 'server', kind: 'message', T: Config$1 }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): Config { + return new Config().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): Config { + return new Config().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): Config { + return new Config().fromJsonString(jsonString, options) + } + + static equals( + a: Config | PlainMessage | undefined, + b: Config | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(Config, a, b) + } +} diff --git a/signaling/rpc/server/server_vtproto.pb.go b/signaling/rpc/server/server_vtproto.pb.go deleted file mode 100644 index f5043ace..00000000 --- a/signaling/rpc/server/server_vtproto.pb.go +++ /dev/null @@ -1,239 +0,0 @@ -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// protoc-gen-go-vtproto version: v0.6.0 -// source: github.com/aperturerobotics/bifrost/signaling/rpc/server/server.proto - -package signaling_rpc_server - -import ( - fmt "fmt" - io "io" - - server "github.com/aperturerobotics/bifrost/stream/srpc/server" - protohelpers "github.com/planetscale/vtprotobuf/protohelpers" - proto "google.golang.org/protobuf/proto" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) -) - -func (m *Config) CloneVT() *Config { - if m == nil { - return (*Config)(nil) - } - r := new(Config) - if rhs := m.Server; rhs != nil { - if vtpb, ok := interface{}(rhs).(interface{ CloneVT() *server.Config }); ok { - r.Server = vtpb.CloneVT() - } else { - r.Server = proto.Clone(rhs).(*server.Config) - } - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Config) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (this *Config) EqualVT(that *Config) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if equal, ok := interface{}(this.Server).(interface{ EqualVT(*server.Config) bool }); ok { - if !equal.EqualVT(that.Server) { - return false - } - } else if !proto.Equal(this.Server, that.Server) { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Config) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Config) - if !ok { - return false - } - return this.EqualVT(that) -} -func (m *Config) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Config) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Server != nil { - if vtmsg, ok := interface{}(m.Server).(interface { - MarshalToSizedBufferVT([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.Server) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Config) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Server != nil { - if size, ok := interface{}(m.Server).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.Server) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *Config) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Config: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Config: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Server", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Server == nil { - m.Server = &server.Config{} - } - if unmarshal, ok := interface{}(m.Server).(interface { - UnmarshalVT([]byte) error - }); ok { - if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - } else { - if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.Server); err != nil { - return err - } - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} diff --git a/signaling/rpc/signaling.pb.go b/signaling/rpc/signaling.pb.go index 02b919e9..c4374efa 100644 --- a/signaling/rpc/signaling.pb.go +++ b/signaling/rpc/signaling.pb.go @@ -1,72 +1,32 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0-devel -// protoc v5.26.1 +// Code generated by protoc-gen-go-lite. DO NOT EDIT. +// protoc-gen-go-lite version: v0.4.5 // source: github.com/aperturerobotics/bifrost/signaling/rpc/signaling.proto package signaling_rpc import ( - reflect "reflect" - sync "sync" + io "io" peer "github.com/aperturerobotics/bifrost/peer" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) + protobuf_go_lite "github.com/aperturerobotics/protobuf-go-lite" + json "github.com/aperturerobotics/protobuf-go-lite/json" + errors "github.com/pkg/errors" ) // ListenRequest is the body of the Listen request. type ListenRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields + unknownFields []byte } func (x *ListenRequest) Reset() { *x = ListenRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_signaling_rpc_signaling_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ListenRequest) String() string { - return protoimpl.X.MessageStringOf(x) } func (*ListenRequest) ProtoMessage() {} -func (x *ListenRequest) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_signaling_rpc_signaling_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 ListenRequest.ProtoReflect.Descriptor instead. -func (*ListenRequest) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_signaling_rpc_signaling_proto_rawDescGZIP(), []int{0} -} - // ListenResponse is a message sent in a stream in response to Listen. type ListenResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + unknownFields []byte // Body is the body of the response. // // Types that are assignable to Body: @@ -78,36 +38,10 @@ type ListenResponse struct { func (x *ListenResponse) Reset() { *x = ListenResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_signaling_rpc_signaling_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ListenResponse) String() string { - return protoimpl.X.MessageStringOf(x) } func (*ListenResponse) ProtoMessage() {} -func (x *ListenResponse) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_signaling_rpc_signaling_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 ListenResponse.ProtoReflect.Descriptor instead. -func (*ListenResponse) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_signaling_rpc_signaling_proto_rawDescGZIP(), []int{1} -} - func (m *ListenResponse) GetBody() isListenResponse_Body { if m != nil { return m.Body @@ -151,14 +85,11 @@ func (*ListenResponse_ClearPeer) isListenResponse_Body() {} // SessionRequest is a message sent from the client to the server. type SessionRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + unknownFields []byte // SessionSeqno is the session sequence number. // If this doesn't match the current session no, this pkt will be dropped. // This should be zero for the init packet. - SessionSeqno uint64 `protobuf:"varint,1,opt,name=session_seqno,json=sessionSeqno,proto3" json:"session_seqno,omitempty"` + SessionSeqno uint64 `protobuf:"varint,1,opt,name=session_seqno,json=sessionSeqno,proto3" json:"sessionSeqno,omitempty"` // Body is the body of the request. // // Types that are assignable to Body: @@ -172,36 +103,10 @@ type SessionRequest struct { func (x *SessionRequest) Reset() { *x = SessionRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_signaling_rpc_signaling_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SessionRequest) String() string { - return protoimpl.X.MessageStringOf(x) } func (*SessionRequest) ProtoMessage() {} -func (x *SessionRequest) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_signaling_rpc_signaling_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 SessionRequest.ProtoReflect.Descriptor instead. -func (*SessionRequest) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_signaling_rpc_signaling_proto_rawDescGZIP(), []int{2} -} - func (x *SessionRequest) GetSessionSeqno() uint64 { if x != nil { return x.SessionSeqno @@ -284,46 +189,17 @@ func (*SessionRequest_AckMsg) isSessionRequest_Body() {} // SessionInit is a message to init a Session. type SessionInit struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + unknownFields []byte // PeerId is the remote peer id we want to contact. - PeerId string `protobuf:"bytes,1,opt,name=peer_id,json=peerId,proto3" json:"peer_id,omitempty"` + PeerId string `protobuf:"bytes,1,opt,name=peer_id,json=peerId,proto3" json:"peerId,omitempty"` } func (x *SessionInit) Reset() { *x = SessionInit{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_signaling_rpc_signaling_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SessionInit) String() string { - return protoimpl.X.MessageStringOf(x) } func (*SessionInit) ProtoMessage() {} -func (x *SessionInit) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_signaling_rpc_signaling_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 SessionInit.ProtoReflect.Descriptor instead. -func (*SessionInit) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_signaling_rpc_signaling_proto_rawDescGZIP(), []int{3} -} - func (x *SessionInit) GetPeerId() string { if x != nil { return x.PeerId @@ -333,48 +209,19 @@ func (x *SessionInit) GetPeerId() string { // SessionMsg contains a signed message and a sequence number. type SessionMsg struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + unknownFields []byte // SignedMsg is the signed message body. - SignedMsg *peer.SignedMsg `protobuf:"bytes,1,opt,name=signed_msg,json=signedMsg,proto3" json:"signed_msg,omitempty"` + SignedMsg *peer.SignedMsg `protobuf:"bytes,1,opt,name=signed_msg,json=signedMsg,proto3" json:"signedMsg,omitempty"` // Seqno is the message sequence number for clear and ack. Seqno uint64 `protobuf:"varint,2,opt,name=seqno,proto3" json:"seqno,omitempty"` } func (x *SessionMsg) Reset() { *x = SessionMsg{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_signaling_rpc_signaling_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SessionMsg) String() string { - return protoimpl.X.MessageStringOf(x) } func (*SessionMsg) ProtoMessage() {} -func (x *SessionMsg) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_signaling_rpc_signaling_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 SessionMsg.ProtoReflect.Descriptor instead. -func (*SessionMsg) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_signaling_rpc_signaling_proto_rawDescGZIP(), []int{4} -} - func (x *SessionMsg) GetSignedMsg() *peer.SignedMsg { if x != nil { return x.SignedMsg @@ -391,10 +238,7 @@ func (x *SessionMsg) GetSeqno() uint64 { // SessionResponse is a message sent from the server to the client. type SessionResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + unknownFields []byte // Body is the body of the request. // // Types that are assignable to Body: @@ -409,36 +253,10 @@ type SessionResponse struct { func (x *SessionResponse) Reset() { *x = SessionResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_signaling_rpc_signaling_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *SessionResponse) String() string { - return protoimpl.X.MessageStringOf(x) } func (*SessionResponse) ProtoMessage() {} -func (x *SessionResponse) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_signaling_rpc_signaling_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 SessionResponse.ProtoReflect.Descriptor instead. -func (*SessionResponse) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_signaling_rpc_signaling_proto_rawDescGZIP(), []int{5} -} - func (m *SessionResponse) GetBody() isSessionResponse_Body { if m != nil { return m.Body @@ -525,222 +343,2269 @@ func (*SessionResponse_ClearMsg) isSessionResponse_Body() {} func (*SessionResponse_AckMsg) isSessionResponse_Body() {} -var File_github_com_aperturerobotics_bifrost_signaling_rpc_signaling_proto protoreflect.FileDescriptor - -var file_github_com_aperturerobotics_bifrost_signaling_rpc_signaling_proto_rawDesc = []byte{ - 0x0a, 0x41, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, - 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x62, 0x69, - 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x69, 0x6e, 0x67, 0x2f, - 0x72, 0x70, 0x63, 0x2f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x12, 0x0d, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x69, 0x6e, 0x67, 0x2e, 0x72, - 0x70, 0x63, 0x1a, 0x33, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, - 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, - 0x62, 0x69, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2f, 0x70, 0x65, 0x65, 0x72, 0x2f, 0x70, 0x65, 0x65, - 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x0f, 0x0a, 0x0d, 0x4c, 0x69, 0x73, 0x74, 0x65, - 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x56, 0x0a, 0x0e, 0x4c, 0x69, 0x73, 0x74, - 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1b, 0x0a, 0x08, 0x73, 0x65, - 0x74, 0x5f, 0x70, 0x65, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x07, - 0x73, 0x65, 0x74, 0x50, 0x65, 0x65, 0x72, 0x12, 0x1f, 0x0a, 0x0a, 0x63, 0x6c, 0x65, 0x61, 0x72, - 0x5f, 0x70, 0x65, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x09, 0x63, - 0x6c, 0x65, 0x61, 0x72, 0x50, 0x65, 0x65, 0x72, 0x42, 0x06, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, - 0x22, 0xe1, 0x01, 0x0a, 0x0e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x73, - 0x65, 0x71, 0x6e, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0c, 0x73, 0x65, 0x73, 0x73, - 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x71, 0x6e, 0x6f, 0x12, 0x30, 0x0a, 0x04, 0x69, 0x6e, 0x69, 0x74, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x69, - 0x6e, 0x67, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x6e, - 0x69, 0x74, 0x48, 0x00, 0x52, 0x04, 0x69, 0x6e, 0x69, 0x74, 0x12, 0x36, 0x0a, 0x08, 0x73, 0x65, - 0x6e, 0x64, 0x5f, 0x6d, 0x73, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x73, - 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x69, 0x6e, 0x67, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x65, 0x73, - 0x73, 0x69, 0x6f, 0x6e, 0x4d, 0x73, 0x67, 0x48, 0x00, 0x52, 0x07, 0x73, 0x65, 0x6e, 0x64, 0x4d, - 0x73, 0x67, 0x12, 0x1d, 0x0a, 0x09, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x6d, 0x73, 0x67, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x04, 0x48, 0x00, 0x52, 0x08, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x4d, 0x73, - 0x67, 0x12, 0x19, 0x0a, 0x07, 0x61, 0x63, 0x6b, 0x5f, 0x6d, 0x73, 0x67, 0x18, 0x05, 0x20, 0x01, - 0x28, 0x04, 0x48, 0x00, 0x52, 0x06, 0x61, 0x63, 0x6b, 0x4d, 0x73, 0x67, 0x42, 0x06, 0x0a, 0x04, - 0x62, 0x6f, 0x64, 0x79, 0x22, 0x26, 0x0a, 0x0b, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, - 0x6e, 0x69, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x70, 0x65, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x65, 0x65, 0x72, 0x49, 0x64, 0x22, 0x52, 0x0a, 0x0a, - 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4d, 0x73, 0x67, 0x12, 0x2e, 0x0a, 0x0a, 0x73, 0x69, - 0x67, 0x6e, 0x65, 0x64, 0x5f, 0x6d, 0x73, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, - 0x2e, 0x70, 0x65, 0x65, 0x72, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x4d, 0x73, 0x67, 0x52, - 0x09, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x64, 0x4d, 0x73, 0x67, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x65, - 0x71, 0x6e, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x73, 0x65, 0x71, 0x6e, 0x6f, - 0x22, 0xbf, 0x01, 0x0a, 0x0f, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x06, 0x6f, 0x70, 0x65, 0x6e, 0x65, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x04, 0x48, 0x00, 0x52, 0x06, 0x6f, 0x70, 0x65, 0x6e, 0x65, 0x64, 0x12, 0x18, - 0x0a, 0x06, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, - 0x52, 0x06, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x12, 0x36, 0x0a, 0x08, 0x72, 0x65, 0x63, 0x76, - 0x5f, 0x6d, 0x73, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x73, 0x69, 0x67, - 0x6e, 0x61, 0x6c, 0x69, 0x6e, 0x67, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, - 0x6f, 0x6e, 0x4d, 0x73, 0x67, 0x48, 0x00, 0x52, 0x07, 0x72, 0x65, 0x63, 0x76, 0x4d, 0x73, 0x67, - 0x12, 0x1d, 0x0a, 0x09, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x5f, 0x6d, 0x73, 0x67, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x04, 0x48, 0x00, 0x52, 0x08, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x4d, 0x73, 0x67, 0x12, - 0x19, 0x0a, 0x07, 0x61, 0x63, 0x6b, 0x5f, 0x6d, 0x73, 0x67, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, - 0x48, 0x00, 0x52, 0x06, 0x61, 0x63, 0x6b, 0x4d, 0x73, 0x67, 0x42, 0x06, 0x0a, 0x04, 0x62, 0x6f, - 0x64, 0x79, 0x32, 0xa6, 0x01, 0x0a, 0x09, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x69, 0x6e, 0x67, - 0x12, 0x49, 0x0a, 0x06, 0x4c, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x12, 0x1c, 0x2e, 0x73, 0x69, 0x67, - 0x6e, 0x61, 0x6c, 0x69, 0x6e, 0x67, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x65, - 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x73, 0x69, 0x67, 0x6e, 0x61, - 0x6c, 0x69, 0x6e, 0x67, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x30, 0x01, 0x12, 0x4e, 0x0a, 0x07, 0x53, - 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1d, 0x2e, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x69, - 0x6e, 0x67, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x69, 0x6e, - 0x67, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x28, 0x01, 0x30, 0x01, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, -} - -var ( - file_github_com_aperturerobotics_bifrost_signaling_rpc_signaling_proto_rawDescOnce sync.Once - file_github_com_aperturerobotics_bifrost_signaling_rpc_signaling_proto_rawDescData = file_github_com_aperturerobotics_bifrost_signaling_rpc_signaling_proto_rawDesc -) +func (m *ListenRequest) CloneVT() *ListenRequest { + if m == nil { + return (*ListenRequest)(nil) + } + r := new(ListenRequest) + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} -func file_github_com_aperturerobotics_bifrost_signaling_rpc_signaling_proto_rawDescGZIP() []byte { - file_github_com_aperturerobotics_bifrost_signaling_rpc_signaling_proto_rawDescOnce.Do(func() { - file_github_com_aperturerobotics_bifrost_signaling_rpc_signaling_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_aperturerobotics_bifrost_signaling_rpc_signaling_proto_rawDescData) - }) - return file_github_com_aperturerobotics_bifrost_signaling_rpc_signaling_proto_rawDescData -} - -var file_github_com_aperturerobotics_bifrost_signaling_rpc_signaling_proto_msgTypes = make([]protoimpl.MessageInfo, 6) -var file_github_com_aperturerobotics_bifrost_signaling_rpc_signaling_proto_goTypes = []interface{}{ - (*ListenRequest)(nil), // 0: signaling.rpc.ListenRequest - (*ListenResponse)(nil), // 1: signaling.rpc.ListenResponse - (*SessionRequest)(nil), // 2: signaling.rpc.SessionRequest - (*SessionInit)(nil), // 3: signaling.rpc.SessionInit - (*SessionMsg)(nil), // 4: signaling.rpc.SessionMsg - (*SessionResponse)(nil), // 5: signaling.rpc.SessionResponse - (*peer.SignedMsg)(nil), // 6: peer.SignedMsg -} -var file_github_com_aperturerobotics_bifrost_signaling_rpc_signaling_proto_depIdxs = []int32{ - 3, // 0: signaling.rpc.SessionRequest.init:type_name -> signaling.rpc.SessionInit - 4, // 1: signaling.rpc.SessionRequest.send_msg:type_name -> signaling.rpc.SessionMsg - 6, // 2: signaling.rpc.SessionMsg.signed_msg:type_name -> peer.SignedMsg - 4, // 3: signaling.rpc.SessionResponse.recv_msg:type_name -> signaling.rpc.SessionMsg - 0, // 4: signaling.rpc.Signaling.Listen:input_type -> signaling.rpc.ListenRequest - 2, // 5: signaling.rpc.Signaling.Session:input_type -> signaling.rpc.SessionRequest - 1, // 6: signaling.rpc.Signaling.Listen:output_type -> signaling.rpc.ListenResponse - 5, // 7: signaling.rpc.Signaling.Session:output_type -> signaling.rpc.SessionResponse - 6, // [6:8] is the sub-list for method output_type - 4, // [4:6] is the sub-list for method input_type - 4, // [4:4] is the sub-list for extension type_name - 4, // [4:4] is the sub-list for extension extendee - 0, // [0:4] is the sub-list for field type_name -} - -func init() { file_github_com_aperturerobotics_bifrost_signaling_rpc_signaling_proto_init() } -func file_github_com_aperturerobotics_bifrost_signaling_rpc_signaling_proto_init() { - if File_github_com_aperturerobotics_bifrost_signaling_rpc_signaling_proto != nil { +func (m *ListenRequest) CloneMessageVT() any { + return m.CloneVT() +} + +func (m *ListenResponse) CloneVT() *ListenResponse { + if m == nil { + return (*ListenResponse)(nil) + } + r := new(ListenResponse) + if m.Body != nil { + r.Body = m.Body.(interface{ CloneVT() isListenResponse_Body }).CloneVT() + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *ListenResponse) CloneMessageVT() any { + return m.CloneVT() +} + +func (m *ListenResponse_SetPeer) CloneVT() *ListenResponse_SetPeer { + if m == nil { + return (*ListenResponse_SetPeer)(nil) + } + r := new(ListenResponse_SetPeer) + r.SetPeer = m.SetPeer + return r +} + +func (m *ListenResponse_ClearPeer) CloneVT() *ListenResponse_ClearPeer { + if m == nil { + return (*ListenResponse_ClearPeer)(nil) + } + r := new(ListenResponse_ClearPeer) + r.ClearPeer = m.ClearPeer + return r +} + +func (m *SessionRequest) CloneVT() *SessionRequest { + if m == nil { + return (*SessionRequest)(nil) + } + r := new(SessionRequest) + r.SessionSeqno = m.SessionSeqno + if m.Body != nil { + r.Body = m.Body.(interface{ CloneVT() isSessionRequest_Body }).CloneVT() + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *SessionRequest) CloneMessageVT() any { + return m.CloneVT() +} + +func (m *SessionRequest_Init) CloneVT() *SessionRequest_Init { + if m == nil { + return (*SessionRequest_Init)(nil) + } + r := new(SessionRequest_Init) + r.Init = m.Init.CloneVT() + return r +} + +func (m *SessionRequest_SendMsg) CloneVT() *SessionRequest_SendMsg { + if m == nil { + return (*SessionRequest_SendMsg)(nil) + } + r := new(SessionRequest_SendMsg) + r.SendMsg = m.SendMsg.CloneVT() + return r +} + +func (m *SessionRequest_ClearMsg) CloneVT() *SessionRequest_ClearMsg { + if m == nil { + return (*SessionRequest_ClearMsg)(nil) + } + r := new(SessionRequest_ClearMsg) + r.ClearMsg = m.ClearMsg + return r +} + +func (m *SessionRequest_AckMsg) CloneVT() *SessionRequest_AckMsg { + if m == nil { + return (*SessionRequest_AckMsg)(nil) + } + r := new(SessionRequest_AckMsg) + r.AckMsg = m.AckMsg + return r +} + +func (m *SessionInit) CloneVT() *SessionInit { + if m == nil { + return (*SessionInit)(nil) + } + r := new(SessionInit) + r.PeerId = m.PeerId + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *SessionInit) CloneMessageVT() any { + return m.CloneVT() +} + +func (m *SessionMsg) CloneVT() *SessionMsg { + if m == nil { + return (*SessionMsg)(nil) + } + r := new(SessionMsg) + r.Seqno = m.Seqno + if rhs := m.SignedMsg; rhs != nil { + r.SignedMsg = rhs.CloneVT() + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *SessionMsg) CloneMessageVT() any { + return m.CloneVT() +} + +func (m *SessionResponse) CloneVT() *SessionResponse { + if m == nil { + return (*SessionResponse)(nil) + } + r := new(SessionResponse) + if m.Body != nil { + r.Body = m.Body.(interface{ CloneVT() isSessionResponse_Body }).CloneVT() + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *SessionResponse) CloneMessageVT() any { + return m.CloneVT() +} + +func (m *SessionResponse_Opened) CloneVT() *SessionResponse_Opened { + if m == nil { + return (*SessionResponse_Opened)(nil) + } + r := new(SessionResponse_Opened) + r.Opened = m.Opened + return r +} + +func (m *SessionResponse_Closed) CloneVT() *SessionResponse_Closed { + if m == nil { + return (*SessionResponse_Closed)(nil) + } + r := new(SessionResponse_Closed) + r.Closed = m.Closed + return r +} + +func (m *SessionResponse_RecvMsg) CloneVT() *SessionResponse_RecvMsg { + if m == nil { + return (*SessionResponse_RecvMsg)(nil) + } + r := new(SessionResponse_RecvMsg) + r.RecvMsg = m.RecvMsg.CloneVT() + return r +} + +func (m *SessionResponse_ClearMsg) CloneVT() *SessionResponse_ClearMsg { + if m == nil { + return (*SessionResponse_ClearMsg)(nil) + } + r := new(SessionResponse_ClearMsg) + r.ClearMsg = m.ClearMsg + return r +} + +func (m *SessionResponse_AckMsg) CloneVT() *SessionResponse_AckMsg { + if m == nil { + return (*SessionResponse_AckMsg)(nil) + } + r := new(SessionResponse_AckMsg) + r.AckMsg = m.AckMsg + return r +} + +func (this *ListenRequest) EqualVT(that *ListenRequest) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *ListenRequest) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*ListenRequest) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *ListenResponse) EqualVT(that *ListenResponse) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.Body == nil && that.Body != nil { + return false + } else if this.Body != nil { + if that.Body == nil { + return false + } + if !this.Body.(interface { + EqualVT(isListenResponse_Body) bool + }).EqualVT(that.Body) { + return false + } + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *ListenResponse) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*ListenResponse) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *ListenResponse_SetPeer) EqualVT(thatIface isListenResponse_Body) bool { + that, ok := thatIface.(*ListenResponse_SetPeer) + if !ok { + return false + } + if this == that { + return true + } + if this == nil && that != nil || this != nil && that == nil { + return false + } + if this.SetPeer != that.SetPeer { + return false + } + return true +} + +func (this *ListenResponse_ClearPeer) EqualVT(thatIface isListenResponse_Body) bool { + that, ok := thatIface.(*ListenResponse_ClearPeer) + if !ok { + return false + } + if this == that { + return true + } + if this == nil && that != nil || this != nil && that == nil { + return false + } + if this.ClearPeer != that.ClearPeer { + return false + } + return true +} + +func (this *SessionRequest) EqualVT(that *SessionRequest) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.Body == nil && that.Body != nil { + return false + } else if this.Body != nil { + if that.Body == nil { + return false + } + if !this.Body.(interface { + EqualVT(isSessionRequest_Body) bool + }).EqualVT(that.Body) { + return false + } + } + if this.SessionSeqno != that.SessionSeqno { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *SessionRequest) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*SessionRequest) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *SessionRequest_Init) EqualVT(thatIface isSessionRequest_Body) bool { + that, ok := thatIface.(*SessionRequest_Init) + if !ok { + return false + } + if this == that { + return true + } + if this == nil && that != nil || this != nil && that == nil { + return false + } + if p, q := this.Init, that.Init; p != q { + if p == nil { + p = &SessionInit{} + } + if q == nil { + q = &SessionInit{} + } + if !p.EqualVT(q) { + return false + } + } + return true +} + +func (this *SessionRequest_SendMsg) EqualVT(thatIface isSessionRequest_Body) bool { + that, ok := thatIface.(*SessionRequest_SendMsg) + if !ok { + return false + } + if this == that { + return true + } + if this == nil && that != nil || this != nil && that == nil { + return false + } + if p, q := this.SendMsg, that.SendMsg; p != q { + if p == nil { + p = &SessionMsg{} + } + if q == nil { + q = &SessionMsg{} + } + if !p.EqualVT(q) { + return false + } + } + return true +} + +func (this *SessionRequest_ClearMsg) EqualVT(thatIface isSessionRequest_Body) bool { + that, ok := thatIface.(*SessionRequest_ClearMsg) + if !ok { + return false + } + if this == that { + return true + } + if this == nil && that != nil || this != nil && that == nil { + return false + } + if this.ClearMsg != that.ClearMsg { + return false + } + return true +} + +func (this *SessionRequest_AckMsg) EqualVT(thatIface isSessionRequest_Body) bool { + that, ok := thatIface.(*SessionRequest_AckMsg) + if !ok { + return false + } + if this == that { + return true + } + if this == nil && that != nil || this != nil && that == nil { + return false + } + if this.AckMsg != that.AckMsg { + return false + } + return true +} + +func (this *SessionInit) EqualVT(that *SessionInit) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.PeerId != that.PeerId { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *SessionInit) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*SessionInit) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *SessionMsg) EqualVT(that *SessionMsg) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if !this.SignedMsg.EqualVT(that.SignedMsg) { + return false + } + if this.Seqno != that.Seqno { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *SessionMsg) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*SessionMsg) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *SessionResponse) EqualVT(that *SessionResponse) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.Body == nil && that.Body != nil { + return false + } else if this.Body != nil { + if that.Body == nil { + return false + } + if !this.Body.(interface { + EqualVT(isSessionResponse_Body) bool + }).EqualVT(that.Body) { + return false + } + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *SessionResponse) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*SessionResponse) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *SessionResponse_Opened) EqualVT(thatIface isSessionResponse_Body) bool { + that, ok := thatIface.(*SessionResponse_Opened) + if !ok { + return false + } + if this == that { + return true + } + if this == nil && that != nil || this != nil && that == nil { + return false + } + if this.Opened != that.Opened { + return false + } + return true +} + +func (this *SessionResponse_Closed) EqualVT(thatIface isSessionResponse_Body) bool { + that, ok := thatIface.(*SessionResponse_Closed) + if !ok { + return false + } + if this == that { + return true + } + if this == nil && that != nil || this != nil && that == nil { + return false + } + if this.Closed != that.Closed { + return false + } + return true +} + +func (this *SessionResponse_RecvMsg) EqualVT(thatIface isSessionResponse_Body) bool { + that, ok := thatIface.(*SessionResponse_RecvMsg) + if !ok { + return false + } + if this == that { + return true + } + if this == nil && that != nil || this != nil && that == nil { + return false + } + if p, q := this.RecvMsg, that.RecvMsg; p != q { + if p == nil { + p = &SessionMsg{} + } + if q == nil { + q = &SessionMsg{} + } + if !p.EqualVT(q) { + return false + } + } + return true +} + +func (this *SessionResponse_ClearMsg) EqualVT(thatIface isSessionResponse_Body) bool { + that, ok := thatIface.(*SessionResponse_ClearMsg) + if !ok { + return false + } + if this == that { + return true + } + if this == nil && that != nil || this != nil && that == nil { + return false + } + if this.ClearMsg != that.ClearMsg { + return false + } + return true +} + +func (this *SessionResponse_AckMsg) EqualVT(thatIface isSessionResponse_Body) bool { + that, ok := thatIface.(*SessionResponse_AckMsg) + if !ok { + return false + } + if this == that { + return true + } + if this == nil && that != nil || this != nil && that == nil { + return false + } + if this.AckMsg != that.AckMsg { + return false + } + return true +} + +// MarshalProtoJSON marshals the ListenRequest message to JSON. +func (x *ListenRequest) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() return } - if !protoimpl.UnsafeEnabled { - file_github_com_aperturerobotics_bifrost_signaling_rpc_signaling_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListenRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_github_com_aperturerobotics_bifrost_signaling_rpc_signaling_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListenResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_github_com_aperturerobotics_bifrost_signaling_rpc_signaling_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SessionRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_github_com_aperturerobotics_bifrost_signaling_rpc_signaling_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SessionInit); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_github_com_aperturerobotics_bifrost_signaling_rpc_signaling_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SessionMsg); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_github_com_aperturerobotics_bifrost_signaling_rpc_signaling_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*SessionResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_github_com_aperturerobotics_bifrost_signaling_rpc_signaling_proto_msgTypes[1].OneofWrappers = []interface{}{ - (*ListenResponse_SetPeer)(nil), - (*ListenResponse_ClearPeer)(nil), - } - file_github_com_aperturerobotics_bifrost_signaling_rpc_signaling_proto_msgTypes[2].OneofWrappers = []interface{}{ - (*SessionRequest_Init)(nil), - (*SessionRequest_SendMsg)(nil), - (*SessionRequest_ClearMsg)(nil), - (*SessionRequest_AckMsg)(nil), - } - file_github_com_aperturerobotics_bifrost_signaling_rpc_signaling_proto_msgTypes[5].OneofWrappers = []interface{}{ - (*SessionResponse_Opened)(nil), - (*SessionResponse_Closed)(nil), - (*SessionResponse_RecvMsg)(nil), - (*SessionResponse_ClearMsg)(nil), - (*SessionResponse_AckMsg)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_github_com_aperturerobotics_bifrost_signaling_rpc_signaling_proto_rawDesc, - NumEnums: 0, - NumMessages: 6, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_github_com_aperturerobotics_bifrost_signaling_rpc_signaling_proto_goTypes, - DependencyIndexes: file_github_com_aperturerobotics_bifrost_signaling_rpc_signaling_proto_depIdxs, - MessageInfos: file_github_com_aperturerobotics_bifrost_signaling_rpc_signaling_proto_msgTypes, - }.Build() - File_github_com_aperturerobotics_bifrost_signaling_rpc_signaling_proto = out.File - file_github_com_aperturerobotics_bifrost_signaling_rpc_signaling_proto_rawDesc = nil - file_github_com_aperturerobotics_bifrost_signaling_rpc_signaling_proto_goTypes = nil - file_github_com_aperturerobotics_bifrost_signaling_rpc_signaling_proto_depIdxs = nil + s.WriteObjectStart() + s.WriteObjectEnd() +} + +// MarshalJSON marshals the ListenRequest to JSON. +func (x *ListenRequest) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) +} + +// UnmarshalProtoJSON unmarshals the ListenRequest message from JSON. +func (x *ListenRequest) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { + return + } +} + +// UnmarshalJSON unmarshals the ListenRequest from JSON. +func (x *ListenRequest) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +// MarshalProtoJSON marshals the ListenResponse message to JSON. +func (x *ListenResponse) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return + } + s.WriteObjectStart() + var wroteField bool + if x.Body != nil { + switch ov := x.Body.(type) { + case *ListenResponse_SetPeer: + s.WriteMoreIf(&wroteField) + s.WriteObjectField("setPeer") + s.WriteString(ov.SetPeer) + case *ListenResponse_ClearPeer: + s.WriteMoreIf(&wroteField) + s.WriteObjectField("clearPeer") + s.WriteString(ov.ClearPeer) + } + } + s.WriteObjectEnd() +} + +// MarshalJSON marshals the ListenResponse to JSON. +func (x *ListenResponse) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) +} + +// UnmarshalProtoJSON unmarshals the ListenResponse message from JSON. +func (x *ListenResponse) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { + return + } + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "set_peer", "setPeer": + s.AddField("set_peer") + ov := &ListenResponse_SetPeer{} + x.Body = ov + ov.SetPeer = s.ReadString() + case "clear_peer", "clearPeer": + s.AddField("clear_peer") + ov := &ListenResponse_ClearPeer{} + x.Body = ov + ov.ClearPeer = s.ReadString() + } + }) +} + +// UnmarshalJSON unmarshals the ListenResponse from JSON. +func (x *ListenResponse) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +// MarshalProtoJSON marshals the SessionRequest message to JSON. +func (x *SessionRequest) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return + } + s.WriteObjectStart() + var wroteField bool + if x.SessionSeqno != 0 || s.HasField("sessionSeqno") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("sessionSeqno") + s.WriteUint64(x.SessionSeqno) + } + if x.Body != nil { + switch ov := x.Body.(type) { + case *SessionRequest_Init: + s.WriteMoreIf(&wroteField) + s.WriteObjectField("init") + ov.Init.MarshalProtoJSON(s.WithField("init")) + case *SessionRequest_SendMsg: + s.WriteMoreIf(&wroteField) + s.WriteObjectField("sendMsg") + ov.SendMsg.MarshalProtoJSON(s.WithField("sendMsg")) + case *SessionRequest_ClearMsg: + s.WriteMoreIf(&wroteField) + s.WriteObjectField("clearMsg") + s.WriteUint64(ov.ClearMsg) + case *SessionRequest_AckMsg: + s.WriteMoreIf(&wroteField) + s.WriteObjectField("ackMsg") + s.WriteUint64(ov.AckMsg) + } + } + s.WriteObjectEnd() +} + +// MarshalJSON marshals the SessionRequest to JSON. +func (x *SessionRequest) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) +} + +// UnmarshalProtoJSON unmarshals the SessionRequest message from JSON. +func (x *SessionRequest) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { + return + } + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "session_seqno", "sessionSeqno": + s.AddField("session_seqno") + x.SessionSeqno = s.ReadUint64() + case "init": + ov := &SessionRequest_Init{} + x.Body = ov + if s.ReadNil() { + ov.Init = nil + return + } + ov.Init = &SessionInit{} + ov.Init.UnmarshalProtoJSON(s.WithField("init", true)) + case "send_msg", "sendMsg": + ov := &SessionRequest_SendMsg{} + x.Body = ov + if s.ReadNil() { + ov.SendMsg = nil + return + } + ov.SendMsg = &SessionMsg{} + ov.SendMsg.UnmarshalProtoJSON(s.WithField("send_msg", true)) + case "clear_msg", "clearMsg": + s.AddField("clear_msg") + ov := &SessionRequest_ClearMsg{} + x.Body = ov + ov.ClearMsg = s.ReadUint64() + case "ack_msg", "ackMsg": + s.AddField("ack_msg") + ov := &SessionRequest_AckMsg{} + x.Body = ov + ov.AckMsg = s.ReadUint64() + } + }) +} + +// UnmarshalJSON unmarshals the SessionRequest from JSON. +func (x *SessionRequest) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +// MarshalProtoJSON marshals the SessionInit message to JSON. +func (x *SessionInit) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return + } + s.WriteObjectStart() + var wroteField bool + if x.PeerId != "" || s.HasField("peerId") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("peerId") + s.WriteString(x.PeerId) + } + s.WriteObjectEnd() +} + +// MarshalJSON marshals the SessionInit to JSON. +func (x *SessionInit) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) +} + +// UnmarshalProtoJSON unmarshals the SessionInit message from JSON. +func (x *SessionInit) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { + return + } + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "peer_id", "peerId": + s.AddField("peer_id") + x.PeerId = s.ReadString() + } + }) +} + +// UnmarshalJSON unmarshals the SessionInit from JSON. +func (x *SessionInit) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +// MarshalProtoJSON marshals the SessionMsg message to JSON. +func (x *SessionMsg) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return + } + s.WriteObjectStart() + var wroteField bool + if x.SignedMsg != nil || s.HasField("signedMsg") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("signedMsg") + x.SignedMsg.MarshalProtoJSON(s.WithField("signedMsg")) + } + if x.Seqno != 0 || s.HasField("seqno") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("seqno") + s.WriteUint64(x.Seqno) + } + s.WriteObjectEnd() +} + +// MarshalJSON marshals the SessionMsg to JSON. +func (x *SessionMsg) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) +} + +// UnmarshalProtoJSON unmarshals the SessionMsg message from JSON. +func (x *SessionMsg) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { + return + } + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "signed_msg", "signedMsg": + if s.ReadNil() { + x.SignedMsg = nil + return + } + x.SignedMsg = &peer.SignedMsg{} + x.SignedMsg.UnmarshalProtoJSON(s.WithField("signed_msg", true)) + case "seqno": + s.AddField("seqno") + x.Seqno = s.ReadUint64() + } + }) +} + +// UnmarshalJSON unmarshals the SessionMsg from JSON. +func (x *SessionMsg) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +// MarshalProtoJSON marshals the SessionResponse message to JSON. +func (x *SessionResponse) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return + } + s.WriteObjectStart() + var wroteField bool + if x.Body != nil { + switch ov := x.Body.(type) { + case *SessionResponse_Opened: + s.WriteMoreIf(&wroteField) + s.WriteObjectField("opened") + s.WriteUint64(ov.Opened) + case *SessionResponse_Closed: + s.WriteMoreIf(&wroteField) + s.WriteObjectField("closed") + s.WriteBool(ov.Closed) + case *SessionResponse_RecvMsg: + s.WriteMoreIf(&wroteField) + s.WriteObjectField("recvMsg") + ov.RecvMsg.MarshalProtoJSON(s.WithField("recvMsg")) + case *SessionResponse_ClearMsg: + s.WriteMoreIf(&wroteField) + s.WriteObjectField("clearMsg") + s.WriteUint64(ov.ClearMsg) + case *SessionResponse_AckMsg: + s.WriteMoreIf(&wroteField) + s.WriteObjectField("ackMsg") + s.WriteUint64(ov.AckMsg) + } + } + s.WriteObjectEnd() +} + +// MarshalJSON marshals the SessionResponse to JSON. +func (x *SessionResponse) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) +} + +// UnmarshalProtoJSON unmarshals the SessionResponse message from JSON. +func (x *SessionResponse) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { + return + } + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "opened": + s.AddField("opened") + ov := &SessionResponse_Opened{} + x.Body = ov + ov.Opened = s.ReadUint64() + case "closed": + s.AddField("closed") + ov := &SessionResponse_Closed{} + x.Body = ov + ov.Closed = s.ReadBool() + case "recv_msg", "recvMsg": + ov := &SessionResponse_RecvMsg{} + x.Body = ov + if s.ReadNil() { + ov.RecvMsg = nil + return + } + ov.RecvMsg = &SessionMsg{} + ov.RecvMsg.UnmarshalProtoJSON(s.WithField("recv_msg", true)) + case "clear_msg", "clearMsg": + s.AddField("clear_msg") + ov := &SessionResponse_ClearMsg{} + x.Body = ov + ov.ClearMsg = s.ReadUint64() + case "ack_msg", "ackMsg": + s.AddField("ack_msg") + ov := &SessionResponse_AckMsg{} + x.Body = ov + ov.AckMsg = s.ReadUint64() + } + }) +} + +// UnmarshalJSON unmarshals the SessionResponse from JSON. +func (x *SessionResponse) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +func (m *ListenRequest) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ListenRequest) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *ListenRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + return len(dAtA) - i, nil +} + +func (m *ListenResponse) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ListenResponse) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *ListenResponse) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if vtmsg, ok := m.Body.(interface { + MarshalToSizedBufferVT([]byte) (int, error) + }); ok { + size, err := vtmsg.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + } + return len(dAtA) - i, nil +} + +func (m *ListenResponse_SetPeer) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *ListenResponse_SetPeer) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + i := len(dAtA) + i -= len(m.SetPeer) + copy(dAtA[i:], m.SetPeer) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.SetPeer))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} +func (m *ListenResponse_ClearPeer) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *ListenResponse_ClearPeer) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + i := len(dAtA) + i -= len(m.ClearPeer) + copy(dAtA[i:], m.ClearPeer) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.ClearPeer))) + i-- + dAtA[i] = 0x12 + return len(dAtA) - i, nil +} +func (m *SessionRequest) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SessionRequest) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *SessionRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if vtmsg, ok := m.Body.(interface { + MarshalToSizedBufferVT([]byte) (int, error) + }); ok { + size, err := vtmsg.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + } + if m.SessionSeqno != 0 { + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(m.SessionSeqno)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *SessionRequest_Init) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *SessionRequest_Init) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + i := len(dAtA) + if m.Init != nil { + size, err := m.Init.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x12 + } else { + i = protobuf_go_lite.EncodeVarint(dAtA, i, 0) + i-- + dAtA[i] = 0x12 + } + return len(dAtA) - i, nil +} +func (m *SessionRequest_SendMsg) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *SessionRequest_SendMsg) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + i := len(dAtA) + if m.SendMsg != nil { + size, err := m.SendMsg.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x1a + } else { + i = protobuf_go_lite.EncodeVarint(dAtA, i, 0) + i-- + dAtA[i] = 0x1a + } + return len(dAtA) - i, nil +} +func (m *SessionRequest_ClearMsg) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *SessionRequest_ClearMsg) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + i := len(dAtA) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(m.ClearMsg)) + i-- + dAtA[i] = 0x20 + return len(dAtA) - i, nil +} +func (m *SessionRequest_AckMsg) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *SessionRequest_AckMsg) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + i := len(dAtA) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(m.AckMsg)) + i-- + dAtA[i] = 0x28 + return len(dAtA) - i, nil +} +func (m *SessionInit) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SessionInit) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *SessionInit) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.PeerId) > 0 { + i -= len(m.PeerId) + copy(dAtA[i:], m.PeerId) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.PeerId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *SessionMsg) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SessionMsg) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *SessionMsg) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.Seqno != 0 { + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(m.Seqno)) + i-- + dAtA[i] = 0x10 + } + if m.SignedMsg != nil { + size, err := m.SignedMsg.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *SessionResponse) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SessionResponse) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *SessionResponse) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if vtmsg, ok := m.Body.(interface { + MarshalToSizedBufferVT([]byte) (int, error) + }); ok { + size, err := vtmsg.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + } + return len(dAtA) - i, nil +} + +func (m *SessionResponse_Opened) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *SessionResponse_Opened) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + i := len(dAtA) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(m.Opened)) + i-- + dAtA[i] = 0x8 + return len(dAtA) - i, nil +} +func (m *SessionResponse_Closed) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *SessionResponse_Closed) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + i := len(dAtA) + i-- + if m.Closed { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x10 + return len(dAtA) - i, nil +} +func (m *SessionResponse_RecvMsg) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *SessionResponse_RecvMsg) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + i := len(dAtA) + if m.RecvMsg != nil { + size, err := m.RecvMsg.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x1a + } else { + i = protobuf_go_lite.EncodeVarint(dAtA, i, 0) + i-- + dAtA[i] = 0x1a + } + return len(dAtA) - i, nil +} +func (m *SessionResponse_ClearMsg) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *SessionResponse_ClearMsg) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + i := len(dAtA) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(m.ClearMsg)) + i-- + dAtA[i] = 0x20 + return len(dAtA) - i, nil +} +func (m *SessionResponse_AckMsg) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *SessionResponse_AckMsg) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + i := len(dAtA) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(m.AckMsg)) + i-- + dAtA[i] = 0x28 + return len(dAtA) - i, nil +} +func (m *ListenRequest) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + n += len(m.unknownFields) + return n +} + +func (m *ListenResponse) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if vtmsg, ok := m.Body.(interface{ SizeVT() int }); ok { + n += vtmsg.SizeVT() + } + n += len(m.unknownFields) + return n +} + +func (m *ListenResponse_SetPeer) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.SetPeer) + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + return n +} +func (m *ListenResponse_ClearPeer) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ClearPeer) + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + return n +} +func (m *SessionRequest) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.SessionSeqno != 0 { + n += 1 + protobuf_go_lite.SizeOfVarint(uint64(m.SessionSeqno)) + } + if vtmsg, ok := m.Body.(interface{ SizeVT() int }); ok { + n += vtmsg.SizeVT() + } + n += len(m.unknownFields) + return n +} + +func (m *SessionRequest_Init) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Init != nil { + l = m.Init.SizeVT() + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } else { + n += 2 + } + return n +} +func (m *SessionRequest_SendMsg) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.SendMsg != nil { + l = m.SendMsg.SizeVT() + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } else { + n += 2 + } + return n +} +func (m *SessionRequest_ClearMsg) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + n += 1 + protobuf_go_lite.SizeOfVarint(uint64(m.ClearMsg)) + return n +} +func (m *SessionRequest_AckMsg) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + n += 1 + protobuf_go_lite.SizeOfVarint(uint64(m.AckMsg)) + return n +} +func (m *SessionInit) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.PeerId) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *SessionMsg) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.SignedMsg != nil { + l = m.SignedMsg.SizeVT() + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + if m.Seqno != 0 { + n += 1 + protobuf_go_lite.SizeOfVarint(uint64(m.Seqno)) + } + n += len(m.unknownFields) + return n +} + +func (m *SessionResponse) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if vtmsg, ok := m.Body.(interface{ SizeVT() int }); ok { + n += vtmsg.SizeVT() + } + n += len(m.unknownFields) + return n +} + +func (m *SessionResponse_Opened) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + n += 1 + protobuf_go_lite.SizeOfVarint(uint64(m.Opened)) + return n +} +func (m *SessionResponse_Closed) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + n += 2 + return n +} +func (m *SessionResponse_RecvMsg) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.RecvMsg != nil { + l = m.RecvMsg.SizeVT() + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } else { + n += 2 + } + return n +} +func (m *SessionResponse_ClearMsg) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + n += 1 + protobuf_go_lite.SizeOfVarint(uint64(m.ClearMsg)) + return n +} +func (m *SessionResponse_AckMsg) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + n += 1 + protobuf_go_lite.SizeOfVarint(uint64(m.AckMsg)) + return n +} +func (m *ListenRequest) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: ListenRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: ListenRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ListenResponse) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: ListenResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: ListenResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field SetPeer", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Body = &ListenResponse_SetPeer{SetPeer: string(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + case 2: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field ClearPeer", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Body = &ListenResponse_ClearPeer{ClearPeer: string(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SessionRequest) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: SessionRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: SessionRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return errors.Errorf("proto: wrong wireType = %d for field SessionSeqno", wireType) + } + m.SessionSeqno = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.SessionSeqno |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field Init", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if oneof, ok := m.Body.(*SessionRequest_Init); ok { + if err := oneof.Init.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + } else { + v := &SessionInit{} + if err := v.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Body = &SessionRequest_Init{Init: v} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field SendMsg", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if oneof, ok := m.Body.(*SessionRequest_SendMsg); ok { + if err := oneof.SendMsg.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + } else { + v := &SessionMsg{} + if err := v.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Body = &SessionRequest_SendMsg{SendMsg: v} + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return errors.Errorf("proto: wrong wireType = %d for field ClearMsg", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Body = &SessionRequest_ClearMsg{ClearMsg: v} + case 5: + if wireType != 0 { + return errors.Errorf("proto: wrong wireType = %d for field AckMsg", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Body = &SessionRequest_AckMsg{AckMsg: v} + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SessionInit) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: SessionInit: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: SessionInit: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field PeerId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PeerId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SessionMsg) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: SessionMsg: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: SessionMsg: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field SignedMsg", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.SignedMsg == nil { + m.SignedMsg = &peer.SignedMsg{} + } + if err := m.SignedMsg.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return errors.Errorf("proto: wrong wireType = %d for field Seqno", wireType) + } + m.Seqno = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Seqno |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *SessionResponse) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: SessionResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: SessionResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return errors.Errorf("proto: wrong wireType = %d for field Opened", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Body = &SessionResponse_Opened{Opened: v} + case 2: + if wireType != 0 { + return errors.Errorf("proto: wrong wireType = %d for field Closed", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + b := bool(v != 0) + m.Body = &SessionResponse_Closed{Closed: b} + case 3: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field RecvMsg", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if oneof, ok := m.Body.(*SessionResponse_RecvMsg); ok { + if err := oneof.RecvMsg.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + } else { + v := &SessionMsg{} + if err := v.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Body = &SessionResponse_RecvMsg{RecvMsg: v} + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return errors.Errorf("proto: wrong wireType = %d for field ClearMsg", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Body = &SessionResponse_ClearMsg{ClearMsg: v} + case 5: + if wireType != 0 { + return errors.Errorf("proto: wrong wireType = %d for field AckMsg", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Body = &SessionResponse_AckMsg{AckMsg: v} + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil } diff --git a/signaling/rpc/signaling.pb.ts b/signaling/rpc/signaling.pb.ts deleted file mode 100644 index a75dc94e..00000000 --- a/signaling/rpc/signaling.pb.ts +++ /dev/null @@ -1,1101 +0,0 @@ -/* eslint-disable */ -import Long from 'long' -import _m0 from 'protobufjs/minimal.js' -import { SignedMsg } from '../../peer/peer.pb.js' - -export const protobufPackage = 'signaling.rpc' - -/** ListenRequest is the body of the Listen request. */ -export interface ListenRequest {} - -/** ListenResponse is a message sent in a stream in response to Listen. */ -export interface ListenResponse { - body?: - | { $case: 'setPeer'; setPeer: string } - | { $case: 'clearPeer'; clearPeer: string } - | undefined -} - -/** SessionRequest is a message sent from the client to the server. */ -export interface SessionRequest { - /** - * SessionSeqno is the session sequence number. - * If this doesn't match the current session no, this pkt will be dropped. - * This should be zero for the init packet. - */ - sessionSeqno: Long - body?: - | { $case: 'init'; init: SessionInit } - | { $case: 'sendMsg'; sendMsg: SessionMsg } - | { $case: 'clearMsg'; clearMsg: Long } - | { $case: 'ackMsg'; ackMsg: Long } - | undefined -} - -/** SessionInit is a message to init a Session. */ -export interface SessionInit { - /** PeerId is the remote peer id we want to contact. */ - peerId: string -} - -/** SessionMsg contains a signed message and a sequence number. */ -export interface SessionMsg { - /** SignedMsg is the signed message body. */ - signedMsg: SignedMsg | undefined - /** Seqno is the message sequence number for clear and ack. */ - seqno: Long -} - -/** SessionResponse is a message sent from the server to the client. */ -export interface SessionResponse { - body?: - | { $case: 'opened'; opened: Long } - | { $case: 'closed'; closed: boolean } - | { $case: 'recvMsg'; recvMsg: SessionMsg } - | { $case: 'clearMsg'; clearMsg: Long } - | { $case: 'ackMsg'; ackMsg: Long } - | undefined -} - -function createBaseListenRequest(): ListenRequest { - return {} -} - -export const ListenRequest = { - encode( - _: ListenRequest, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ListenRequest { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseListenRequest() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [ListenRequest.encode(p).finish()] - } - } else { - yield* [ListenRequest.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [ListenRequest.decode(p)] - } - } else { - yield* [ListenRequest.decode(pkt as any)] - } - } - }, - - fromJSON(_: any): ListenRequest { - return {} - }, - - toJSON(_: ListenRequest): unknown { - const obj: any = {} - return obj - }, - - create, I>>( - base?: I, - ): ListenRequest { - return ListenRequest.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>( - _: I, - ): ListenRequest { - const message = createBaseListenRequest() - return message - }, -} - -function createBaseListenResponse(): ListenResponse { - return { body: undefined } -} - -export const ListenResponse = { - encode( - message: ListenResponse, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - switch (message.body?.$case) { - case 'setPeer': - writer.uint32(10).string(message.body.setPeer) - break - case 'clearPeer': - writer.uint32(18).string(message.body.clearPeer) - break - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ListenResponse { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseListenResponse() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break - } - - message.body = { $case: 'setPeer', setPeer: reader.string() } - continue - case 2: - if (tag !== 18) { - break - } - - message.body = { $case: 'clearPeer', clearPeer: reader.string() } - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [ListenResponse.encode(p).finish()] - } - } else { - yield* [ListenResponse.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [ListenResponse.decode(p)] - } - } else { - yield* [ListenResponse.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): ListenResponse { - return { - body: isSet(object.setPeer) - ? { $case: 'setPeer', setPeer: globalThis.String(object.setPeer) } - : isSet(object.clearPeer) - ? { - $case: 'clearPeer', - clearPeer: globalThis.String(object.clearPeer), - } - : undefined, - } - }, - - toJSON(message: ListenResponse): unknown { - const obj: any = {} - if (message.body?.$case === 'setPeer') { - obj.setPeer = message.body.setPeer - } - if (message.body?.$case === 'clearPeer') { - obj.clearPeer = message.body.clearPeer - } - return obj - }, - - create, I>>( - base?: I, - ): ListenResponse { - return ListenResponse.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>( - object: I, - ): ListenResponse { - const message = createBaseListenResponse() - if ( - object.body?.$case === 'setPeer' && - object.body?.setPeer !== undefined && - object.body?.setPeer !== null - ) { - message.body = { $case: 'setPeer', setPeer: object.body.setPeer } - } - if ( - object.body?.$case === 'clearPeer' && - object.body?.clearPeer !== undefined && - object.body?.clearPeer !== null - ) { - message.body = { $case: 'clearPeer', clearPeer: object.body.clearPeer } - } - return message - }, -} - -function createBaseSessionRequest(): SessionRequest { - return { sessionSeqno: Long.UZERO, body: undefined } -} - -export const SessionRequest = { - encode( - message: SessionRequest, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (!message.sessionSeqno.equals(Long.UZERO)) { - writer.uint32(8).uint64(message.sessionSeqno) - } - switch (message.body?.$case) { - case 'init': - SessionInit.encode(message.body.init, writer.uint32(18).fork()).ldelim() - break - case 'sendMsg': - SessionMsg.encode( - message.body.sendMsg, - writer.uint32(26).fork(), - ).ldelim() - break - case 'clearMsg': - writer.uint32(32).uint64(message.body.clearMsg) - break - case 'ackMsg': - writer.uint32(40).uint64(message.body.ackMsg) - break - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): SessionRequest { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseSessionRequest() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 8) { - break - } - - message.sessionSeqno = reader.uint64() as Long - continue - case 2: - if (tag !== 18) { - break - } - - message.body = { - $case: 'init', - init: SessionInit.decode(reader, reader.uint32()), - } - continue - case 3: - if (tag !== 26) { - break - } - - message.body = { - $case: 'sendMsg', - sendMsg: SessionMsg.decode(reader, reader.uint32()), - } - continue - case 4: - if (tag !== 32) { - break - } - - message.body = { - $case: 'clearMsg', - clearMsg: reader.uint64() as Long, - } - continue - case 5: - if (tag !== 40) { - break - } - - message.body = { $case: 'ackMsg', ackMsg: reader.uint64() as Long } - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [SessionRequest.encode(p).finish()] - } - } else { - yield* [SessionRequest.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [SessionRequest.decode(p)] - } - } else { - yield* [SessionRequest.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): SessionRequest { - return { - sessionSeqno: isSet(object.sessionSeqno) - ? Long.fromValue(object.sessionSeqno) - : Long.UZERO, - body: isSet(object.init) - ? { $case: 'init', init: SessionInit.fromJSON(object.init) } - : isSet(object.sendMsg) - ? { $case: 'sendMsg', sendMsg: SessionMsg.fromJSON(object.sendMsg) } - : isSet(object.clearMsg) - ? { $case: 'clearMsg', clearMsg: Long.fromValue(object.clearMsg) } - : isSet(object.ackMsg) - ? { $case: 'ackMsg', ackMsg: Long.fromValue(object.ackMsg) } - : undefined, - } - }, - - toJSON(message: SessionRequest): unknown { - const obj: any = {} - if (!message.sessionSeqno.equals(Long.UZERO)) { - obj.sessionSeqno = (message.sessionSeqno || Long.UZERO).toString() - } - if (message.body?.$case === 'init') { - obj.init = SessionInit.toJSON(message.body.init) - } - if (message.body?.$case === 'sendMsg') { - obj.sendMsg = SessionMsg.toJSON(message.body.sendMsg) - } - if (message.body?.$case === 'clearMsg') { - obj.clearMsg = (message.body.clearMsg || Long.UZERO).toString() - } - if (message.body?.$case === 'ackMsg') { - obj.ackMsg = (message.body.ackMsg || Long.UZERO).toString() - } - return obj - }, - - create, I>>( - base?: I, - ): SessionRequest { - return SessionRequest.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>( - object: I, - ): SessionRequest { - const message = createBaseSessionRequest() - message.sessionSeqno = - object.sessionSeqno !== undefined && object.sessionSeqno !== null - ? Long.fromValue(object.sessionSeqno) - : Long.UZERO - if ( - object.body?.$case === 'init' && - object.body?.init !== undefined && - object.body?.init !== null - ) { - message.body = { - $case: 'init', - init: SessionInit.fromPartial(object.body.init), - } - } - if ( - object.body?.$case === 'sendMsg' && - object.body?.sendMsg !== undefined && - object.body?.sendMsg !== null - ) { - message.body = { - $case: 'sendMsg', - sendMsg: SessionMsg.fromPartial(object.body.sendMsg), - } - } - if ( - object.body?.$case === 'clearMsg' && - object.body?.clearMsg !== undefined && - object.body?.clearMsg !== null - ) { - message.body = { - $case: 'clearMsg', - clearMsg: Long.fromValue(object.body.clearMsg), - } - } - if ( - object.body?.$case === 'ackMsg' && - object.body?.ackMsg !== undefined && - object.body?.ackMsg !== null - ) { - message.body = { - $case: 'ackMsg', - ackMsg: Long.fromValue(object.body.ackMsg), - } - } - return message - }, -} - -function createBaseSessionInit(): SessionInit { - return { peerId: '' } -} - -export const SessionInit = { - encode( - message: SessionInit, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.peerId !== '') { - writer.uint32(10).string(message.peerId) - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): SessionInit { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseSessionInit() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break - } - - message.peerId = reader.string() - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [SessionInit.encode(p).finish()] - } - } else { - yield* [SessionInit.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [SessionInit.decode(p)] - } - } else { - yield* [SessionInit.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): SessionInit { - return { - peerId: isSet(object.peerId) ? globalThis.String(object.peerId) : '', - } - }, - - toJSON(message: SessionInit): unknown { - const obj: any = {} - if (message.peerId !== '') { - obj.peerId = message.peerId - } - return obj - }, - - create, I>>(base?: I): SessionInit { - return SessionInit.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>( - object: I, - ): SessionInit { - const message = createBaseSessionInit() - message.peerId = object.peerId ?? '' - return message - }, -} - -function createBaseSessionMsg(): SessionMsg { - return { signedMsg: undefined, seqno: Long.UZERO } -} - -export const SessionMsg = { - encode( - message: SessionMsg, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.signedMsg !== undefined) { - SignedMsg.encode(message.signedMsg, writer.uint32(10).fork()).ldelim() - } - if (!message.seqno.equals(Long.UZERO)) { - writer.uint32(16).uint64(message.seqno) - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): SessionMsg { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseSessionMsg() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break - } - - message.signedMsg = SignedMsg.decode(reader, reader.uint32()) - continue - case 2: - if (tag !== 16) { - break - } - - message.seqno = reader.uint64() as Long - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [SessionMsg.encode(p).finish()] - } - } else { - yield* [SessionMsg.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [SessionMsg.decode(p)] - } - } else { - yield* [SessionMsg.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): SessionMsg { - return { - signedMsg: isSet(object.signedMsg) - ? SignedMsg.fromJSON(object.signedMsg) - : undefined, - seqno: isSet(object.seqno) ? Long.fromValue(object.seqno) : Long.UZERO, - } - }, - - toJSON(message: SessionMsg): unknown { - const obj: any = {} - if (message.signedMsg !== undefined) { - obj.signedMsg = SignedMsg.toJSON(message.signedMsg) - } - if (!message.seqno.equals(Long.UZERO)) { - obj.seqno = (message.seqno || Long.UZERO).toString() - } - return obj - }, - - create, I>>(base?: I): SessionMsg { - return SessionMsg.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>( - object: I, - ): SessionMsg { - const message = createBaseSessionMsg() - message.signedMsg = - object.signedMsg !== undefined && object.signedMsg !== null - ? SignedMsg.fromPartial(object.signedMsg) - : undefined - message.seqno = - object.seqno !== undefined && object.seqno !== null - ? Long.fromValue(object.seqno) - : Long.UZERO - return message - }, -} - -function createBaseSessionResponse(): SessionResponse { - return { body: undefined } -} - -export const SessionResponse = { - encode( - message: SessionResponse, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - switch (message.body?.$case) { - case 'opened': - writer.uint32(8).uint64(message.body.opened) - break - case 'closed': - writer.uint32(16).bool(message.body.closed) - break - case 'recvMsg': - SessionMsg.encode( - message.body.recvMsg, - writer.uint32(26).fork(), - ).ldelim() - break - case 'clearMsg': - writer.uint32(32).uint64(message.body.clearMsg) - break - case 'ackMsg': - writer.uint32(40).uint64(message.body.ackMsg) - break - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): SessionResponse { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseSessionResponse() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 8) { - break - } - - message.body = { $case: 'opened', opened: reader.uint64() as Long } - continue - case 2: - if (tag !== 16) { - break - } - - message.body = { $case: 'closed', closed: reader.bool() } - continue - case 3: - if (tag !== 26) { - break - } - - message.body = { - $case: 'recvMsg', - recvMsg: SessionMsg.decode(reader, reader.uint32()), - } - continue - case 4: - if (tag !== 32) { - break - } - - message.body = { - $case: 'clearMsg', - clearMsg: reader.uint64() as Long, - } - continue - case 5: - if (tag !== 40) { - break - } - - message.body = { $case: 'ackMsg', ackMsg: reader.uint64() as Long } - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [SessionResponse.encode(p).finish()] - } - } else { - yield* [SessionResponse.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [SessionResponse.decode(p)] - } - } else { - yield* [SessionResponse.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): SessionResponse { - return { - body: isSet(object.opened) - ? { $case: 'opened', opened: Long.fromValue(object.opened) } - : isSet(object.closed) - ? { $case: 'closed', closed: globalThis.Boolean(object.closed) } - : isSet(object.recvMsg) - ? { $case: 'recvMsg', recvMsg: SessionMsg.fromJSON(object.recvMsg) } - : isSet(object.clearMsg) - ? { $case: 'clearMsg', clearMsg: Long.fromValue(object.clearMsg) } - : isSet(object.ackMsg) - ? { $case: 'ackMsg', ackMsg: Long.fromValue(object.ackMsg) } - : undefined, - } - }, - - toJSON(message: SessionResponse): unknown { - const obj: any = {} - if (message.body?.$case === 'opened') { - obj.opened = (message.body.opened || Long.UZERO).toString() - } - if (message.body?.$case === 'closed') { - obj.closed = message.body.closed - } - if (message.body?.$case === 'recvMsg') { - obj.recvMsg = SessionMsg.toJSON(message.body.recvMsg) - } - if (message.body?.$case === 'clearMsg') { - obj.clearMsg = (message.body.clearMsg || Long.UZERO).toString() - } - if (message.body?.$case === 'ackMsg') { - obj.ackMsg = (message.body.ackMsg || Long.UZERO).toString() - } - return obj - }, - - create, I>>( - base?: I, - ): SessionResponse { - return SessionResponse.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>( - object: I, - ): SessionResponse { - const message = createBaseSessionResponse() - if ( - object.body?.$case === 'opened' && - object.body?.opened !== undefined && - object.body?.opened !== null - ) { - message.body = { - $case: 'opened', - opened: Long.fromValue(object.body.opened), - } - } - if ( - object.body?.$case === 'closed' && - object.body?.closed !== undefined && - object.body?.closed !== null - ) { - message.body = { $case: 'closed', closed: object.body.closed } - } - if ( - object.body?.$case === 'recvMsg' && - object.body?.recvMsg !== undefined && - object.body?.recvMsg !== null - ) { - message.body = { - $case: 'recvMsg', - recvMsg: SessionMsg.fromPartial(object.body.recvMsg), - } - } - if ( - object.body?.$case === 'clearMsg' && - object.body?.clearMsg !== undefined && - object.body?.clearMsg !== null - ) { - message.body = { - $case: 'clearMsg', - clearMsg: Long.fromValue(object.body.clearMsg), - } - } - if ( - object.body?.$case === 'ackMsg' && - object.body?.ackMsg !== undefined && - object.body?.ackMsg !== null - ) { - message.body = { - $case: 'ackMsg', - ackMsg: Long.fromValue(object.body.ackMsg), - } - } - return message - }, -} - -/** Signaling is a service which allows peers to signal each other via a RPC server. */ -export interface Signaling { - /** Listen waits for messages to be available in our inbox from remote peers. */ - Listen( - request: ListenRequest, - abortSignal?: AbortSignal, - ): AsyncIterable - /** Session opens a signaling session to send and recv messages from a remote peer. */ - Session( - request: AsyncIterable, - abortSignal?: AbortSignal, - ): AsyncIterable -} - -export const SignalingServiceName = 'signaling.rpc.Signaling' -export class SignalingClientImpl implements Signaling { - private readonly rpc: Rpc - private readonly service: string - constructor(rpc: Rpc, opts?: { service?: string }) { - this.service = opts?.service || SignalingServiceName - this.rpc = rpc - this.Listen = this.Listen.bind(this) - this.Session = this.Session.bind(this) - } - Listen( - request: ListenRequest, - abortSignal?: AbortSignal, - ): AsyncIterable { - const data = ListenRequest.encode(request).finish() - const result = this.rpc.serverStreamingRequest( - this.service, - 'Listen', - data, - abortSignal || undefined, - ) - return ListenResponse.decodeTransform(result) - } - - Session( - request: AsyncIterable, - abortSignal?: AbortSignal, - ): AsyncIterable { - const data = SessionRequest.encodeTransform(request) - const result = this.rpc.bidirectionalStreamingRequest( - this.service, - 'Session', - data, - abortSignal || undefined, - ) - return SessionResponse.decodeTransform(result) - } -} - -/** Signaling is a service which allows peers to signal each other via a RPC server. */ -export type SignalingDefinition = typeof SignalingDefinition -export const SignalingDefinition = { - name: 'Signaling', - fullName: 'signaling.rpc.Signaling', - methods: { - /** Listen waits for messages to be available in our inbox from remote peers. */ - listen: { - name: 'Listen', - requestType: ListenRequest, - requestStream: false, - responseType: ListenResponse, - responseStream: true, - options: {}, - }, - /** Session opens a signaling session to send and recv messages from a remote peer. */ - session: { - name: 'Session', - requestType: SessionRequest, - requestStream: true, - responseType: SessionResponse, - responseStream: true, - options: {}, - }, - }, -} as const - -interface Rpc { - request( - service: string, - method: string, - data: Uint8Array, - abortSignal?: AbortSignal, - ): Promise - clientStreamingRequest( - service: string, - method: string, - data: AsyncIterable, - abortSignal?: AbortSignal, - ): Promise - serverStreamingRequest( - service: string, - method: string, - data: Uint8Array, - abortSignal?: AbortSignal, - ): AsyncIterable - bidirectionalStreamingRequest( - service: string, - method: string, - data: AsyncIterable, - abortSignal?: AbortSignal, - ): AsyncIterable -} - -type Builtin = - | Date - | Function - | Uint8Array - | string - | number - | boolean - | undefined - -export type DeepPartial = T extends Builtin - ? T - : T extends Long - ? string | number | Long - : T extends globalThis.Array - ? globalThis.Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends { $case: string } - ? { [K in keyof Omit]?: DeepPartial } & { - $case: T['$case'] - } - : T extends {} - ? { [K in keyof T]?: DeepPartial } - : Partial - -type KeysOfUnion = T extends T ? keyof T : never -export type Exact = P extends Builtin - ? P - : P & { [K in keyof P]: Exact } & { - [K in Exclude>]: never - } - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any - _m0.configure() -} - -function isSet(value: any): boolean { - return value !== null && value !== undefined -} diff --git a/signaling/rpc/signaling_drpc.pb.go b/signaling/rpc/signaling_drpc.pb.go deleted file mode 100644 index 69d38d6d..00000000 --- a/signaling/rpc/signaling_drpc.pb.go +++ /dev/null @@ -1,206 +0,0 @@ -// Code generated by protoc-gen-go-drpc. DO NOT EDIT. -// protoc-gen-go-drpc version: v0.0.34 -// source: github.com/aperturerobotics/bifrost/signaling/rpc/signaling.proto - -package signaling_rpc - -import ( - context "context" - errors "errors" - - drpc1 "github.com/planetscale/vtprotobuf/codec/drpc" - drpc "storj.io/drpc" - drpcerr "storj.io/drpc/drpcerr" -) - -type drpcEncoding_File_github_com_aperturerobotics_bifrost_signaling_rpc_signaling_proto struct{} - -func (drpcEncoding_File_github_com_aperturerobotics_bifrost_signaling_rpc_signaling_proto) Marshal(msg drpc.Message) ([]byte, error) { - return drpc1.Marshal(msg) -} - -func (drpcEncoding_File_github_com_aperturerobotics_bifrost_signaling_rpc_signaling_proto) Unmarshal(buf []byte, msg drpc.Message) error { - return drpc1.Unmarshal(buf, msg) -} - -type DRPCSignalingClient interface { - DRPCConn() drpc.Conn - - Listen(ctx context.Context, in *ListenRequest) (DRPCSignaling_ListenClient, error) - Session(ctx context.Context) (DRPCSignaling_SessionClient, error) -} - -type drpcSignalingClient struct { - cc drpc.Conn -} - -func NewDRPCSignalingClient(cc drpc.Conn) DRPCSignalingClient { - return &drpcSignalingClient{cc} -} - -func (c *drpcSignalingClient) DRPCConn() drpc.Conn { return c.cc } - -func (c *drpcSignalingClient) Listen(ctx context.Context, in *ListenRequest) (DRPCSignaling_ListenClient, error) { - stream, err := c.cc.NewStream(ctx, "/signaling.rpc.Signaling/Listen", drpcEncoding_File_github_com_aperturerobotics_bifrost_signaling_rpc_signaling_proto{}) - if err != nil { - return nil, err - } - x := &drpcSignaling_ListenClient{stream} - if err := x.MsgSend(in, drpcEncoding_File_github_com_aperturerobotics_bifrost_signaling_rpc_signaling_proto{}); err != nil { - return nil, err - } - if err := x.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type DRPCSignaling_ListenClient interface { - drpc.Stream - Recv() (*ListenResponse, error) -} - -type drpcSignaling_ListenClient struct { - drpc.Stream -} - -func (x *drpcSignaling_ListenClient) GetStream() drpc.Stream { - return x.Stream -} - -func (x *drpcSignaling_ListenClient) Recv() (*ListenResponse, error) { - m := new(ListenResponse) - if err := x.MsgRecv(m, drpcEncoding_File_github_com_aperturerobotics_bifrost_signaling_rpc_signaling_proto{}); err != nil { - return nil, err - } - return m, nil -} - -func (x *drpcSignaling_ListenClient) RecvMsg(m *ListenResponse) error { - return x.MsgRecv(m, drpcEncoding_File_github_com_aperturerobotics_bifrost_signaling_rpc_signaling_proto{}) -} - -func (c *drpcSignalingClient) Session(ctx context.Context) (DRPCSignaling_SessionClient, error) { - stream, err := c.cc.NewStream(ctx, "/signaling.rpc.Signaling/Session", drpcEncoding_File_github_com_aperturerobotics_bifrost_signaling_rpc_signaling_proto{}) - if err != nil { - return nil, err - } - x := &drpcSignaling_SessionClient{stream} - return x, nil -} - -type DRPCSignaling_SessionClient interface { - drpc.Stream - Send(*SessionRequest) error - Recv() (*SessionResponse, error) -} - -type drpcSignaling_SessionClient struct { - drpc.Stream -} - -func (x *drpcSignaling_SessionClient) GetStream() drpc.Stream { - return x.Stream -} - -func (x *drpcSignaling_SessionClient) Send(m *SessionRequest) error { - return x.MsgSend(m, drpcEncoding_File_github_com_aperturerobotics_bifrost_signaling_rpc_signaling_proto{}) -} - -func (x *drpcSignaling_SessionClient) Recv() (*SessionResponse, error) { - m := new(SessionResponse) - if err := x.MsgRecv(m, drpcEncoding_File_github_com_aperturerobotics_bifrost_signaling_rpc_signaling_proto{}); err != nil { - return nil, err - } - return m, nil -} - -func (x *drpcSignaling_SessionClient) RecvMsg(m *SessionResponse) error { - return x.MsgRecv(m, drpcEncoding_File_github_com_aperturerobotics_bifrost_signaling_rpc_signaling_proto{}) -} - -type DRPCSignalingServer interface { - Listen(*ListenRequest, DRPCSignaling_ListenStream) error - Session(DRPCSignaling_SessionStream) error -} - -type DRPCSignalingUnimplementedServer struct{} - -func (s *DRPCSignalingUnimplementedServer) Listen(*ListenRequest, DRPCSignaling_ListenStream) error { - return drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) -} - -func (s *DRPCSignalingUnimplementedServer) Session(DRPCSignaling_SessionStream) error { - return drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) -} - -type DRPCSignalingDescription struct{} - -func (DRPCSignalingDescription) NumMethods() int { return 2 } - -func (DRPCSignalingDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver, interface{}, bool) { - switch n { - case 0: - return "/signaling.rpc.Signaling/Listen", drpcEncoding_File_github_com_aperturerobotics_bifrost_signaling_rpc_signaling_proto{}, - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return nil, srv.(DRPCSignalingServer). - Listen( - in1.(*ListenRequest), - &drpcSignaling_ListenStream{in2.(drpc.Stream)}, - ) - }, DRPCSignalingServer.Listen, true - case 1: - return "/signaling.rpc.Signaling/Session", drpcEncoding_File_github_com_aperturerobotics_bifrost_signaling_rpc_signaling_proto{}, - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return nil, srv.(DRPCSignalingServer). - Session( - &drpcSignaling_SessionStream{in1.(drpc.Stream)}, - ) - }, DRPCSignalingServer.Session, true - default: - return "", nil, nil, nil, false - } -} - -func DRPCRegisterSignaling(mux drpc.Mux, impl DRPCSignalingServer) error { - return mux.Register(impl, DRPCSignalingDescription{}) -} - -type DRPCSignaling_ListenStream interface { - drpc.Stream - Send(*ListenResponse) error -} - -type drpcSignaling_ListenStream struct { - drpc.Stream -} - -func (x *drpcSignaling_ListenStream) Send(m *ListenResponse) error { - return x.MsgSend(m, drpcEncoding_File_github_com_aperturerobotics_bifrost_signaling_rpc_signaling_proto{}) -} - -type DRPCSignaling_SessionStream interface { - drpc.Stream - Send(*SessionResponse) error - Recv() (*SessionRequest, error) -} - -type drpcSignaling_SessionStream struct { - drpc.Stream -} - -func (x *drpcSignaling_SessionStream) Send(m *SessionResponse) error { - return x.MsgSend(m, drpcEncoding_File_github_com_aperturerobotics_bifrost_signaling_rpc_signaling_proto{}) -} - -func (x *drpcSignaling_SessionStream) Recv() (*SessionRequest, error) { - m := new(SessionRequest) - if err := x.MsgRecv(m, drpcEncoding_File_github_com_aperturerobotics_bifrost_signaling_rpc_signaling_proto{}); err != nil { - return nil, err - } - return m, nil -} - -func (x *drpcSignaling_SessionStream) RecvMsg(m *SessionRequest) error { - return x.MsgRecv(m, drpcEncoding_File_github_com_aperturerobotics_bifrost_signaling_rpc_signaling_proto{}) -} diff --git a/signaling/rpc/signaling_pb.ts b/signaling/rpc/signaling_pb.ts new file mode 100644 index 00000000..601fefef --- /dev/null +++ b/signaling/rpc/signaling_pb.ts @@ -0,0 +1,517 @@ +// @generated by protoc-gen-es v1.8.0 with parameter "target=ts,ts_nocheck=false" +// @generated from file github.com/aperturerobotics/bifrost/signaling/rpc/signaling.proto (package signaling.rpc, syntax proto3) +/* eslint-disable */ + +import type { + BinaryReadOptions, + FieldList, + JsonReadOptions, + JsonValue, + PartialMessage, + PlainMessage, +} from '@bufbuild/protobuf' +import { Message, proto3, protoInt64 } from '@bufbuild/protobuf' +import { SignedMsg } from '../../peer/peer_pb.js' + +/** + * ListenRequest is the body of the Listen request. + * + * @generated from message signaling.rpc.ListenRequest + */ +export class ListenRequest extends Message { + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'signaling.rpc.ListenRequest' + static readonly fields: FieldList = proto3.util.newFieldList(() => []) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): ListenRequest { + return new ListenRequest().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): ListenRequest { + return new ListenRequest().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): ListenRequest { + return new ListenRequest().fromJsonString(jsonString, options) + } + + static equals( + a: ListenRequest | PlainMessage | undefined, + b: ListenRequest | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(ListenRequest, a, b) + } +} + +/** + * ListenResponse is a message sent in a stream in response to Listen. + * + * @generated from message signaling.rpc.ListenResponse + */ +export class ListenResponse extends Message { + /** + * Body is the body of the response. + * + * @generated from oneof signaling.rpc.ListenResponse.body + */ + body: + | { + /** + * SetPeer marks that a remote peer wants a session. + * The contents of the string is the encoded peer id of the remote peer. + * + * @generated from field: string set_peer = 1; + */ + value: string + case: 'setPeer' + } + | { + /** + * ClearPeer marks that a remote peer no longer wants a session. + * The contents of the string is the encoded peer id of the remote peer. + * + * @generated from field: string clear_peer = 2; + */ + value: string + case: 'clearPeer' + } + | { case: undefined; value?: undefined } = { case: undefined } + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'signaling.rpc.ListenResponse' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { + no: 1, + name: 'set_peer', + kind: 'scalar', + T: 9 /* ScalarType.STRING */, + oneof: 'body', + }, + { + no: 2, + name: 'clear_peer', + kind: 'scalar', + T: 9 /* ScalarType.STRING */, + oneof: 'body', + }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): ListenResponse { + return new ListenResponse().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): ListenResponse { + return new ListenResponse().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): ListenResponse { + return new ListenResponse().fromJsonString(jsonString, options) + } + + static equals( + a: ListenResponse | PlainMessage | undefined, + b: ListenResponse | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(ListenResponse, a, b) + } +} + +/** + * SessionRequest is a message sent from the client to the server. + * + * @generated from message signaling.rpc.SessionRequest + */ +export class SessionRequest extends Message { + /** + * SessionSeqno is the session sequence number. + * If this doesn't match the current session no, this pkt will be dropped. + * This should be zero for the init packet. + * + * @generated from field: uint64 session_seqno = 1; + */ + sessionSeqno = protoInt64.zero + + /** + * Body is the body of the request. + * + * @generated from oneof signaling.rpc.SessionRequest.body + */ + body: + | { + /** + * Init initializes the session setting which peer to contact. + * + * @generated from field: signaling.rpc.SessionInit init = 2; + */ + value: SessionInit + case: 'init' + } + | { + /** + * SendMsg sends a signed message to the remote peer. + * The server will buffer at most one message for the remote peer at a time. + * If there is an existing pending outgoing message this will overwrite it. + * Wait for the message received ack before sending again to avoid overwriting. + * The signature must match the peer id associated with the rpc session. + * + * @generated from field: signaling.rpc.SessionMsg send_msg = 3; + */ + value: SessionMsg + case: 'sendMsg' + } + | { + /** + * ClearMsg clears a previously sent message from the outbox. + * If the sequence number does not match, does nothing. + * + * @generated from field: uint64 clear_msg = 4; + */ + value: bigint + case: 'clearMsg' + } + | { + /** + * AckMsg acknowledges that the current incoming message was processed. + * If the id doesn't match the current incoming message seqno, does nothing. + * + * @generated from field: uint64 ack_msg = 5; + */ + value: bigint + case: 'ackMsg' + } + | { case: undefined; value?: undefined } = { case: undefined } + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'signaling.rpc.SessionRequest' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { + no: 1, + name: 'session_seqno', + kind: 'scalar', + T: 4 /* ScalarType.UINT64 */, + }, + { no: 2, name: 'init', kind: 'message', T: SessionInit, oneof: 'body' }, + { no: 3, name: 'send_msg', kind: 'message', T: SessionMsg, oneof: 'body' }, + { + no: 4, + name: 'clear_msg', + kind: 'scalar', + T: 4 /* ScalarType.UINT64 */, + oneof: 'body', + }, + { + no: 5, + name: 'ack_msg', + kind: 'scalar', + T: 4 /* ScalarType.UINT64 */, + oneof: 'body', + }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): SessionRequest { + return new SessionRequest().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): SessionRequest { + return new SessionRequest().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): SessionRequest { + return new SessionRequest().fromJsonString(jsonString, options) + } + + static equals( + a: SessionRequest | PlainMessage | undefined, + b: SessionRequest | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(SessionRequest, a, b) + } +} + +/** + * SessionInit is a message to init a Session. + * + * @generated from message signaling.rpc.SessionInit + */ +export class SessionInit extends Message { + /** + * PeerId is the remote peer id we want to contact. + * + * @generated from field: string peer_id = 1; + */ + peerId = '' + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'signaling.rpc.SessionInit' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: 'peer_id', kind: 'scalar', T: 9 /* ScalarType.STRING */ }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): SessionInit { + return new SessionInit().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): SessionInit { + return new SessionInit().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): SessionInit { + return new SessionInit().fromJsonString(jsonString, options) + } + + static equals( + a: SessionInit | PlainMessage | undefined, + b: SessionInit | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(SessionInit, a, b) + } +} + +/** + * SessionMsg contains a signed message and a sequence number. + * + * @generated from message signaling.rpc.SessionMsg + */ +export class SessionMsg extends Message { + /** + * SignedMsg is the signed message body. + * + * @generated from field: peer.SignedMsg signed_msg = 1; + */ + signedMsg?: SignedMsg + + /** + * Seqno is the message sequence number for clear and ack. + * + * @generated from field: uint64 seqno = 2; + */ + seqno = protoInt64.zero + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'signaling.rpc.SessionMsg' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: 'signed_msg', kind: 'message', T: SignedMsg }, + { no: 2, name: 'seqno', kind: 'scalar', T: 4 /* ScalarType.UINT64 */ }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): SessionMsg { + return new SessionMsg().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): SessionMsg { + return new SessionMsg().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): SessionMsg { + return new SessionMsg().fromJsonString(jsonString, options) + } + + static equals( + a: SessionMsg | PlainMessage | undefined, + b: SessionMsg | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(SessionMsg, a, b) + } +} + +/** + * SessionResponse is a message sent from the server to the client. + * + * @generated from message signaling.rpc.SessionResponse + */ +export class SessionResponse extends Message { + /** + * Body is the body of the request. + * + * @generated from oneof signaling.rpc.SessionResponse.body + */ + body: + | { + /** + * Opened indicates the connection w/ the remote peer is open. + * Contains the session nonce, incremented if the peer re-connected. + * If this increments, re-send the outgoing message. + * + * @generated from field: uint64 opened = 1; + */ + value: bigint + case: 'opened' + } + | { + /** + * Closed indicates the connection w/ the remote peer is closed. + * This is the assumed initial state. + * + * @generated from field: bool closed = 2; + */ + value: boolean + case: 'closed' + } + | { + /** + * RecvMsg transfers a message sent by the remote peer. + * Send ACK once the message has been processed. + * + * @generated from field: signaling.rpc.SessionMsg recv_msg = 3; + */ + value: SessionMsg + case: 'recvMsg' + } + | { + /** + * ClearMsg clears a message from the remote peer previously sent with recv_msg. + * This is sent if the remote peer clears their outgoing message before acked. + * + * @generated from field: uint64 clear_msg = 4; + */ + value: bigint + case: 'clearMsg' + } + | { + /** + * AckMsg confirms that the outgoing message was sent and acked. + * + * @generated from field: uint64 ack_msg = 5; + */ + value: bigint + case: 'ackMsg' + } + | { case: undefined; value?: undefined } = { case: undefined } + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'signaling.rpc.SessionResponse' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { + no: 1, + name: 'opened', + kind: 'scalar', + T: 4 /* ScalarType.UINT64 */, + oneof: 'body', + }, + { + no: 2, + name: 'closed', + kind: 'scalar', + T: 8 /* ScalarType.BOOL */, + oneof: 'body', + }, + { no: 3, name: 'recv_msg', kind: 'message', T: SessionMsg, oneof: 'body' }, + { + no: 4, + name: 'clear_msg', + kind: 'scalar', + T: 4 /* ScalarType.UINT64 */, + oneof: 'body', + }, + { + no: 5, + name: 'ack_msg', + kind: 'scalar', + T: 4 /* ScalarType.UINT64 */, + oneof: 'body', + }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): SessionResponse { + return new SessionResponse().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): SessionResponse { + return new SessionResponse().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): SessionResponse { + return new SessionResponse().fromJsonString(jsonString, options) + } + + static equals( + a: SessionResponse | PlainMessage | undefined, + b: SessionResponse | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(SessionResponse, a, b) + } +} diff --git a/signaling/rpc/signaling_srpc.pb.go b/signaling/rpc/signaling_srpc.pb.go index 055eb957..ddb2b364 100644 --- a/signaling/rpc/signaling_srpc.pb.go +++ b/signaling/rpc/signaling_srpc.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-srpc. DO NOT EDIT. -// protoc-gen-srpc version: v0.27.3 +// protoc-gen-srpc version: v0.31.2 // source: github.com/aperturerobotics/bifrost/signaling/rpc/signaling.proto package signaling_rpc diff --git a/signaling/rpc/signaling_srpc.pb.ts b/signaling/rpc/signaling_srpc.pb.ts new file mode 100644 index 00000000..82336bdc --- /dev/null +++ b/signaling/rpc/signaling_srpc.pb.ts @@ -0,0 +1,127 @@ +// @generated by protoc-gen-es-starpc none with parameter "target=ts,ts_nocheck=false" +// @generated from file github.com/aperturerobotics/bifrost/signaling/rpc/signaling.proto (package signaling.rpc, syntax proto3) +/* eslint-disable */ + +import { + ListenRequest, + ListenResponse, + SessionRequest, + SessionResponse, +} from './signaling_pb.js' +import type { PartialMessage } from '@bufbuild/protobuf' +import { MethodKind } from '@bufbuild/protobuf' +import { + buildDecodeMessageTransform, + buildEncodeMessageTransform, + MessageStream, + ProtoRpc, +} from 'starpc' + +/** + * Signaling is a service which allows peers to signal each other via a RPC server. + * + * @generated from service signaling.rpc.Signaling + */ +export const SignalingDefinition = { + typeName: 'signaling.rpc.Signaling', + methods: { + /** + * Listen waits for messages to be available in our inbox from remote peers. + * + * @generated from rpc signaling.rpc.Signaling.Listen + */ + Listen: { + name: 'Listen', + I: ListenRequest, + O: ListenResponse, + kind: MethodKind.ServerStreaming, + }, + /** + * Session opens a signaling session to send and recv messages from a remote peer. + * + * @generated from rpc signaling.rpc.Signaling.Session + */ + Session: { + name: 'Session', + I: SessionRequest, + O: SessionResponse, + kind: MethodKind.BiDiStreaming, + }, + }, +} as const + +/** + * Signaling is a service which allows peers to signal each other via a RPC server. + * + * @generated from service signaling.rpc.Signaling + */ +export interface Signaling { + /** + * Listen waits for messages to be available in our inbox from remote peers. + * + * @generated from rpc signaling.rpc.Signaling.Listen + */ + Listen( + request: PartialMessage, + abortSignal?: AbortSignal, + ): MessageStream + + /** + * Session opens a signaling session to send and recv messages from a remote peer. + * + * @generated from rpc signaling.rpc.Signaling.Session + */ + Session( + request: MessageStream, + abortSignal?: AbortSignal, + ): MessageStream +} + +export const SignalingServiceName = SignalingDefinition.typeName + +export class SignalingClient implements Signaling { + private readonly rpc: ProtoRpc + private readonly service: string + constructor(rpc: ProtoRpc, opts?: { service?: string }) { + this.service = opts?.service || SignalingServiceName + this.rpc = rpc + this.Listen = this.Listen.bind(this) + this.Session = this.Session.bind(this) + } + /** + * Listen waits for messages to be available in our inbox from remote peers. + * + * @generated from rpc signaling.rpc.Signaling.Listen + */ + Listen( + request: PartialMessage, + abortSignal?: AbortSignal, + ): MessageStream { + const requestMsg = new ListenRequest(request) + const result = this.rpc.serverStreamingRequest( + this.service, + SignalingDefinition.methods.Listen.name, + requestMsg.toBinary(), + abortSignal || undefined, + ) + return buildDecodeMessageTransform(ListenResponse)(result) + } + + /** + * Session opens a signaling session to send and recv messages from a remote peer. + * + * @generated from rpc signaling.rpc.Signaling.Session + */ + Session( + request: MessageStream, + abortSignal?: AbortSignal, + ): MessageStream { + const result = this.rpc.bidirectionalStreamingRequest( + this.service, + SignalingDefinition.methods.Session.name, + buildEncodeMessageTransform(SessionRequest)(request), + abortSignal || undefined, + ) + return buildDecodeMessageTransform(SessionResponse)(result) + } +} diff --git a/signaling/rpc/signaling_vtproto.pb.go b/signaling/rpc/signaling_vtproto.pb.go deleted file mode 100644 index 26331804..00000000 --- a/signaling/rpc/signaling_vtproto.pb.go +++ /dev/null @@ -1,1949 +0,0 @@ -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// protoc-gen-go-vtproto version: v0.6.0 -// source: github.com/aperturerobotics/bifrost/signaling/rpc/signaling.proto - -package signaling_rpc - -import ( - fmt "fmt" - io "io" - - peer "github.com/aperturerobotics/bifrost/peer" - protohelpers "github.com/planetscale/vtprotobuf/protohelpers" - proto "google.golang.org/protobuf/proto" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) -) - -func (m *ListenRequest) CloneVT() *ListenRequest { - if m == nil { - return (*ListenRequest)(nil) - } - r := new(ListenRequest) - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *ListenRequest) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *ListenResponse) CloneVT() *ListenResponse { - if m == nil { - return (*ListenResponse)(nil) - } - r := new(ListenResponse) - if m.Body != nil { - r.Body = m.Body.(interface{ CloneVT() isListenResponse_Body }).CloneVT() - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *ListenResponse) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *ListenResponse_SetPeer) CloneVT() isListenResponse_Body { - if m == nil { - return (*ListenResponse_SetPeer)(nil) - } - r := new(ListenResponse_SetPeer) - r.SetPeer = m.SetPeer - return r -} - -func (m *ListenResponse_ClearPeer) CloneVT() isListenResponse_Body { - if m == nil { - return (*ListenResponse_ClearPeer)(nil) - } - r := new(ListenResponse_ClearPeer) - r.ClearPeer = m.ClearPeer - return r -} - -func (m *SessionRequest) CloneVT() *SessionRequest { - if m == nil { - return (*SessionRequest)(nil) - } - r := new(SessionRequest) - r.SessionSeqno = m.SessionSeqno - if m.Body != nil { - r.Body = m.Body.(interface{ CloneVT() isSessionRequest_Body }).CloneVT() - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *SessionRequest) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *SessionRequest_Init) CloneVT() isSessionRequest_Body { - if m == nil { - return (*SessionRequest_Init)(nil) - } - r := new(SessionRequest_Init) - r.Init = m.Init.CloneVT() - return r -} - -func (m *SessionRequest_SendMsg) CloneVT() isSessionRequest_Body { - if m == nil { - return (*SessionRequest_SendMsg)(nil) - } - r := new(SessionRequest_SendMsg) - r.SendMsg = m.SendMsg.CloneVT() - return r -} - -func (m *SessionRequest_ClearMsg) CloneVT() isSessionRequest_Body { - if m == nil { - return (*SessionRequest_ClearMsg)(nil) - } - r := new(SessionRequest_ClearMsg) - r.ClearMsg = m.ClearMsg - return r -} - -func (m *SessionRequest_AckMsg) CloneVT() isSessionRequest_Body { - if m == nil { - return (*SessionRequest_AckMsg)(nil) - } - r := new(SessionRequest_AckMsg) - r.AckMsg = m.AckMsg - return r -} - -func (m *SessionInit) CloneVT() *SessionInit { - if m == nil { - return (*SessionInit)(nil) - } - r := new(SessionInit) - r.PeerId = m.PeerId - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *SessionInit) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *SessionMsg) CloneVT() *SessionMsg { - if m == nil { - return (*SessionMsg)(nil) - } - r := new(SessionMsg) - r.Seqno = m.Seqno - if rhs := m.SignedMsg; rhs != nil { - if vtpb, ok := interface{}(rhs).(interface{ CloneVT() *peer.SignedMsg }); ok { - r.SignedMsg = vtpb.CloneVT() - } else { - r.SignedMsg = proto.Clone(rhs).(*peer.SignedMsg) - } - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *SessionMsg) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *SessionResponse) CloneVT() *SessionResponse { - if m == nil { - return (*SessionResponse)(nil) - } - r := new(SessionResponse) - if m.Body != nil { - r.Body = m.Body.(interface{ CloneVT() isSessionResponse_Body }).CloneVT() - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *SessionResponse) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *SessionResponse_Opened) CloneVT() isSessionResponse_Body { - if m == nil { - return (*SessionResponse_Opened)(nil) - } - r := new(SessionResponse_Opened) - r.Opened = m.Opened - return r -} - -func (m *SessionResponse_Closed) CloneVT() isSessionResponse_Body { - if m == nil { - return (*SessionResponse_Closed)(nil) - } - r := new(SessionResponse_Closed) - r.Closed = m.Closed - return r -} - -func (m *SessionResponse_RecvMsg) CloneVT() isSessionResponse_Body { - if m == nil { - return (*SessionResponse_RecvMsg)(nil) - } - r := new(SessionResponse_RecvMsg) - r.RecvMsg = m.RecvMsg.CloneVT() - return r -} - -func (m *SessionResponse_ClearMsg) CloneVT() isSessionResponse_Body { - if m == nil { - return (*SessionResponse_ClearMsg)(nil) - } - r := new(SessionResponse_ClearMsg) - r.ClearMsg = m.ClearMsg - return r -} - -func (m *SessionResponse_AckMsg) CloneVT() isSessionResponse_Body { - if m == nil { - return (*SessionResponse_AckMsg)(nil) - } - r := new(SessionResponse_AckMsg) - r.AckMsg = m.AckMsg - return r -} - -func (this *ListenRequest) EqualVT(that *ListenRequest) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *ListenRequest) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*ListenRequest) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *ListenResponse) EqualVT(that *ListenResponse) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.Body == nil && that.Body != nil { - return false - } else if this.Body != nil { - if that.Body == nil { - return false - } - if !this.Body.(interface { - EqualVT(isListenResponse_Body) bool - }).EqualVT(that.Body) { - return false - } - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *ListenResponse) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*ListenResponse) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *ListenResponse_SetPeer) EqualVT(thatIface isListenResponse_Body) bool { - that, ok := thatIface.(*ListenResponse_SetPeer) - if !ok { - return false - } - if this == that { - return true - } - if this == nil && that != nil || this != nil && that == nil { - return false - } - if this.SetPeer != that.SetPeer { - return false - } - return true -} - -func (this *ListenResponse_ClearPeer) EqualVT(thatIface isListenResponse_Body) bool { - that, ok := thatIface.(*ListenResponse_ClearPeer) - if !ok { - return false - } - if this == that { - return true - } - if this == nil && that != nil || this != nil && that == nil { - return false - } - if this.ClearPeer != that.ClearPeer { - return false - } - return true -} - -func (this *SessionRequest) EqualVT(that *SessionRequest) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.Body == nil && that.Body != nil { - return false - } else if this.Body != nil { - if that.Body == nil { - return false - } - if !this.Body.(interface { - EqualVT(isSessionRequest_Body) bool - }).EqualVT(that.Body) { - return false - } - } - if this.SessionSeqno != that.SessionSeqno { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *SessionRequest) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*SessionRequest) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *SessionRequest_Init) EqualVT(thatIface isSessionRequest_Body) bool { - that, ok := thatIface.(*SessionRequest_Init) - if !ok { - return false - } - if this == that { - return true - } - if this == nil && that != nil || this != nil && that == nil { - return false - } - if p, q := this.Init, that.Init; p != q { - if p == nil { - p = &SessionInit{} - } - if q == nil { - q = &SessionInit{} - } - if !p.EqualVT(q) { - return false - } - } - return true -} - -func (this *SessionRequest_SendMsg) EqualVT(thatIface isSessionRequest_Body) bool { - that, ok := thatIface.(*SessionRequest_SendMsg) - if !ok { - return false - } - if this == that { - return true - } - if this == nil && that != nil || this != nil && that == nil { - return false - } - if p, q := this.SendMsg, that.SendMsg; p != q { - if p == nil { - p = &SessionMsg{} - } - if q == nil { - q = &SessionMsg{} - } - if !p.EqualVT(q) { - return false - } - } - return true -} - -func (this *SessionRequest_ClearMsg) EqualVT(thatIface isSessionRequest_Body) bool { - that, ok := thatIface.(*SessionRequest_ClearMsg) - if !ok { - return false - } - if this == that { - return true - } - if this == nil && that != nil || this != nil && that == nil { - return false - } - if this.ClearMsg != that.ClearMsg { - return false - } - return true -} - -func (this *SessionRequest_AckMsg) EqualVT(thatIface isSessionRequest_Body) bool { - that, ok := thatIface.(*SessionRequest_AckMsg) - if !ok { - return false - } - if this == that { - return true - } - if this == nil && that != nil || this != nil && that == nil { - return false - } - if this.AckMsg != that.AckMsg { - return false - } - return true -} - -func (this *SessionInit) EqualVT(that *SessionInit) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.PeerId != that.PeerId { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *SessionInit) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*SessionInit) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *SessionMsg) EqualVT(that *SessionMsg) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if equal, ok := interface{}(this.SignedMsg).(interface{ EqualVT(*peer.SignedMsg) bool }); ok { - if !equal.EqualVT(that.SignedMsg) { - return false - } - } else if !proto.Equal(this.SignedMsg, that.SignedMsg) { - return false - } - if this.Seqno != that.Seqno { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *SessionMsg) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*SessionMsg) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *SessionResponse) EqualVT(that *SessionResponse) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.Body == nil && that.Body != nil { - return false - } else if this.Body != nil { - if that.Body == nil { - return false - } - if !this.Body.(interface { - EqualVT(isSessionResponse_Body) bool - }).EqualVT(that.Body) { - return false - } - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *SessionResponse) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*SessionResponse) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *SessionResponse_Opened) EqualVT(thatIface isSessionResponse_Body) bool { - that, ok := thatIface.(*SessionResponse_Opened) - if !ok { - return false - } - if this == that { - return true - } - if this == nil && that != nil || this != nil && that == nil { - return false - } - if this.Opened != that.Opened { - return false - } - return true -} - -func (this *SessionResponse_Closed) EqualVT(thatIface isSessionResponse_Body) bool { - that, ok := thatIface.(*SessionResponse_Closed) - if !ok { - return false - } - if this == that { - return true - } - if this == nil && that != nil || this != nil && that == nil { - return false - } - if this.Closed != that.Closed { - return false - } - return true -} - -func (this *SessionResponse_RecvMsg) EqualVT(thatIface isSessionResponse_Body) bool { - that, ok := thatIface.(*SessionResponse_RecvMsg) - if !ok { - return false - } - if this == that { - return true - } - if this == nil && that != nil || this != nil && that == nil { - return false - } - if p, q := this.RecvMsg, that.RecvMsg; p != q { - if p == nil { - p = &SessionMsg{} - } - if q == nil { - q = &SessionMsg{} - } - if !p.EqualVT(q) { - return false - } - } - return true -} - -func (this *SessionResponse_ClearMsg) EqualVT(thatIface isSessionResponse_Body) bool { - that, ok := thatIface.(*SessionResponse_ClearMsg) - if !ok { - return false - } - if this == that { - return true - } - if this == nil && that != nil || this != nil && that == nil { - return false - } - if this.ClearMsg != that.ClearMsg { - return false - } - return true -} - -func (this *SessionResponse_AckMsg) EqualVT(thatIface isSessionResponse_Body) bool { - that, ok := thatIface.(*SessionResponse_AckMsg) - if !ok { - return false - } - if this == that { - return true - } - if this == nil && that != nil || this != nil && that == nil { - return false - } - if this.AckMsg != that.AckMsg { - return false - } - return true -} - -func (m *ListenRequest) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ListenRequest) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *ListenRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - return len(dAtA) - i, nil -} - -func (m *ListenResponse) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ListenResponse) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *ListenResponse) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if vtmsg, ok := m.Body.(interface { - MarshalToSizedBufferVT([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - } - return len(dAtA) - i, nil -} - -func (m *ListenResponse_SetPeer) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *ListenResponse_SetPeer) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - i := len(dAtA) - i -= len(m.SetPeer) - copy(dAtA[i:], m.SetPeer) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.SetPeer))) - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} -func (m *ListenResponse_ClearPeer) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *ListenResponse_ClearPeer) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - i := len(dAtA) - i -= len(m.ClearPeer) - copy(dAtA[i:], m.ClearPeer) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.ClearPeer))) - i-- - dAtA[i] = 0x12 - return len(dAtA) - i, nil -} -func (m *SessionRequest) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *SessionRequest) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *SessionRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if vtmsg, ok := m.Body.(interface { - MarshalToSizedBufferVT([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - } - if m.SessionSeqno != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.SessionSeqno)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *SessionRequest_Init) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *SessionRequest_Init) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - i := len(dAtA) - if m.Init != nil { - size, err := m.Init.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x12 - } - return len(dAtA) - i, nil -} -func (m *SessionRequest_SendMsg) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *SessionRequest_SendMsg) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - i := len(dAtA) - if m.SendMsg != nil { - size, err := m.SendMsg.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x1a - } - return len(dAtA) - i, nil -} -func (m *SessionRequest_ClearMsg) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *SessionRequest_ClearMsg) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - i := len(dAtA) - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.ClearMsg)) - i-- - dAtA[i] = 0x20 - return len(dAtA) - i, nil -} -func (m *SessionRequest_AckMsg) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *SessionRequest_AckMsg) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - i := len(dAtA) - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.AckMsg)) - i-- - dAtA[i] = 0x28 - return len(dAtA) - i, nil -} -func (m *SessionInit) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *SessionInit) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *SessionInit) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.PeerId) > 0 { - i -= len(m.PeerId) - copy(dAtA[i:], m.PeerId) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.PeerId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *SessionMsg) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *SessionMsg) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *SessionMsg) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Seqno != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Seqno)) - i-- - dAtA[i] = 0x10 - } - if m.SignedMsg != nil { - if vtmsg, ok := interface{}(m.SignedMsg).(interface { - MarshalToSizedBufferVT([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.SignedMsg) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *SessionResponse) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *SessionResponse) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *SessionResponse) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if vtmsg, ok := m.Body.(interface { - MarshalToSizedBufferVT([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - } - return len(dAtA) - i, nil -} - -func (m *SessionResponse_Opened) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *SessionResponse_Opened) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - i := len(dAtA) - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Opened)) - i-- - dAtA[i] = 0x8 - return len(dAtA) - i, nil -} -func (m *SessionResponse_Closed) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *SessionResponse_Closed) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - i := len(dAtA) - i-- - if m.Closed { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x10 - return len(dAtA) - i, nil -} -func (m *SessionResponse_RecvMsg) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *SessionResponse_RecvMsg) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - i := len(dAtA) - if m.RecvMsg != nil { - size, err := m.RecvMsg.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x1a - } - return len(dAtA) - i, nil -} -func (m *SessionResponse_ClearMsg) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *SessionResponse_ClearMsg) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - i := len(dAtA) - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.ClearMsg)) - i-- - dAtA[i] = 0x20 - return len(dAtA) - i, nil -} -func (m *SessionResponse_AckMsg) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *SessionResponse_AckMsg) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - i := len(dAtA) - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.AckMsg)) - i-- - dAtA[i] = 0x28 - return len(dAtA) - i, nil -} -func (m *ListenRequest) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - n += len(m.unknownFields) - return n -} - -func (m *ListenResponse) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if vtmsg, ok := m.Body.(interface{ SizeVT() int }); ok { - n += vtmsg.SizeVT() - } - n += len(m.unknownFields) - return n -} - -func (m *ListenResponse_SetPeer) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.SetPeer) - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - return n -} -func (m *ListenResponse_ClearPeer) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ClearPeer) - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - return n -} -func (m *SessionRequest) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.SessionSeqno != 0 { - n += 1 + protohelpers.SizeOfVarint(uint64(m.SessionSeqno)) - } - if vtmsg, ok := m.Body.(interface{ SizeVT() int }); ok { - n += vtmsg.SizeVT() - } - n += len(m.unknownFields) - return n -} - -func (m *SessionRequest_Init) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Init != nil { - l = m.Init.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - return n -} -func (m *SessionRequest_SendMsg) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.SendMsg != nil { - l = m.SendMsg.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - return n -} -func (m *SessionRequest_ClearMsg) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - n += 1 + protohelpers.SizeOfVarint(uint64(m.ClearMsg)) - return n -} -func (m *SessionRequest_AckMsg) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - n += 1 + protohelpers.SizeOfVarint(uint64(m.AckMsg)) - return n -} -func (m *SessionInit) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.PeerId) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *SessionMsg) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.SignedMsg != nil { - if size, ok := interface{}(m.SignedMsg).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.SignedMsg) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.Seqno != 0 { - n += 1 + protohelpers.SizeOfVarint(uint64(m.Seqno)) - } - n += len(m.unknownFields) - return n -} - -func (m *SessionResponse) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if vtmsg, ok := m.Body.(interface{ SizeVT() int }); ok { - n += vtmsg.SizeVT() - } - n += len(m.unknownFields) - return n -} - -func (m *SessionResponse_Opened) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - n += 1 + protohelpers.SizeOfVarint(uint64(m.Opened)) - return n -} -func (m *SessionResponse_Closed) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - n += 2 - return n -} -func (m *SessionResponse_RecvMsg) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.RecvMsg != nil { - l = m.RecvMsg.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - return n -} -func (m *SessionResponse_ClearMsg) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - n += 1 + protohelpers.SizeOfVarint(uint64(m.ClearMsg)) - return n -} -func (m *SessionResponse_AckMsg) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - n += 1 + protohelpers.SizeOfVarint(uint64(m.AckMsg)) - return n -} -func (m *ListenRequest) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ListenRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ListenRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ListenResponse) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ListenResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ListenResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SetPeer", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Body = &ListenResponse_SetPeer{SetPeer: string(dAtA[iNdEx:postIndex])} - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClearPeer", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Body = &ListenResponse_ClearPeer{ClearPeer: string(dAtA[iNdEx:postIndex])} - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SessionRequest) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: SessionRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SessionRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field SessionSeqno", wireType) - } - m.SessionSeqno = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.SessionSeqno |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Init", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if oneof, ok := m.Body.(*SessionRequest_Init); ok { - if err := oneof.Init.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - } else { - v := &SessionInit{} - if err := v.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Body = &SessionRequest_Init{Init: v} - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SendMsg", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if oneof, ok := m.Body.(*SessionRequest_SendMsg); ok { - if err := oneof.SendMsg.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - } else { - v := &SessionMsg{} - if err := v.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Body = &SessionRequest_SendMsg{SendMsg: v} - } - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ClearMsg", wireType) - } - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Body = &SessionRequest_ClearMsg{ClearMsg: v} - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field AckMsg", wireType) - } - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Body = &SessionRequest_AckMsg{AckMsg: v} - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SessionInit) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: SessionInit: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SessionInit: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PeerId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PeerId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SessionMsg) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: SessionMsg: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SessionMsg: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SignedMsg", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.SignedMsg == nil { - m.SignedMsg = &peer.SignedMsg{} - } - if unmarshal, ok := interface{}(m.SignedMsg).(interface { - UnmarshalVT([]byte) error - }); ok { - if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - } else { - if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.SignedMsg); err != nil { - return err - } - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Seqno", wireType) - } - m.Seqno = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Seqno |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SessionResponse) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: SessionResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SessionResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Opened", wireType) - } - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Body = &SessionResponse_Opened{Opened: v} - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Closed", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - b := bool(v != 0) - m.Body = &SessionResponse_Closed{Closed: b} - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RecvMsg", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if oneof, ok := m.Body.(*SessionResponse_RecvMsg); ok { - if err := oneof.RecvMsg.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - } else { - v := &SessionMsg{} - if err := v.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Body = &SessionResponse_RecvMsg{RecvMsg: v} - } - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ClearMsg", wireType) - } - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Body = &SessionResponse_ClearMsg{ClearMsg: v} - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field AckMsg", wireType) - } - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Body = &SessionResponse_AckMsg{AckMsg: v} - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} diff --git a/stream/api/accept/accept.pb.go b/stream/api/accept/accept.pb.go index 1505ee5e..5db5b0d7 100644 --- a/stream/api/accept/accept.pb.go +++ b/stream/api/accept/accept.pb.go @@ -1,77 +1,39 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0-devel -// protoc v5.26.1 +// Code generated by protoc-gen-go-lite. DO NOT EDIT. +// protoc-gen-go-lite version: v0.4.5 // source: github.com/aperturerobotics/bifrost/stream/api/accept/accept.proto package stream_api_accept import ( - reflect "reflect" - sync "sync" + io "io" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) + protobuf_go_lite "github.com/aperturerobotics/protobuf-go-lite" + json "github.com/aperturerobotics/protobuf-go-lite/json" + errors "github.com/pkg/errors" ) // Config configures the accept controller. type Config struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + unknownFields []byte // LocalPeerId is the peer ID to accept incoming connections with. // Can be empty to accept any peer. - LocalPeerId string `protobuf:"bytes,1,opt,name=local_peer_id,json=localPeerId,proto3" json:"local_peer_id,omitempty"` + LocalPeerId string `protobuf:"bytes,1,opt,name=local_peer_id,json=localPeerId,proto3" json:"localPeerId,omitempty"` // RemotePeerIds are peer IDs to accept incoming connections from. // Can be empty to accept any remote peer IDs. - RemotePeerIds []string `protobuf:"bytes,2,rep,name=remote_peer_ids,json=remotePeerIds,proto3" json:"remote_peer_ids,omitempty"` + RemotePeerIds []string `protobuf:"bytes,2,rep,name=remote_peer_ids,json=remotePeerIds,proto3" json:"remotePeerIds,omitempty"` // ProtocolId is the protocol ID to accept. - ProtocolId string `protobuf:"bytes,3,opt,name=protocol_id,json=protocolId,proto3" json:"protocol_id,omitempty"` + ProtocolId string `protobuf:"bytes,3,opt,name=protocol_id,json=protocolId,proto3" json:"protocolId,omitempty"` // TransportId constrains the transport ID to accept from. // Can be empty. - TransportId uint64 `protobuf:"varint,4,opt,name=transport_id,json=transportId,proto3" json:"transport_id,omitempty"` + TransportId uint64 `protobuf:"varint,4,opt,name=transport_id,json=transportId,proto3" json:"transportId,omitempty"` } func (x *Config) Reset() { *x = Config{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_stream_api_accept_accept_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Config) String() string { - return protoimpl.X.MessageStringOf(x) } func (*Config) ProtoMessage() {} -func (x *Config) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_stream_api_accept_accept_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 Config.ProtoReflect.Descriptor instead. -func (*Config) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_stream_api_accept_accept_proto_rawDescGZIP(), []int{0} -} - func (x *Config) GetLocalPeerId() string { if x != nil { return x.LocalPeerId @@ -100,86 +62,386 @@ func (x *Config) GetTransportId() uint64 { return 0 } -var File_github_com_aperturerobotics_bifrost_stream_api_accept_accept_proto protoreflect.FileDescriptor - -var file_github_com_aperturerobotics_bifrost_stream_api_accept_accept_proto_rawDesc = []byte{ - 0x0a, 0x42, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, - 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x62, 0x69, - 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2f, 0x61, 0x70, 0x69, - 0x2f, 0x61, 0x63, 0x63, 0x65, 0x70, 0x74, 0x2f, 0x61, 0x63, 0x63, 0x65, 0x70, 0x74, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x11, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x61, 0x63, 0x63, 0x65, 0x70, 0x74, 0x22, 0x98, 0x01, 0x0a, 0x06, 0x43, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x12, 0x22, 0x0a, 0x0d, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x5f, 0x70, 0x65, 0x65, 0x72, - 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6c, 0x6f, 0x63, 0x61, 0x6c, - 0x50, 0x65, 0x65, 0x72, 0x49, 0x64, 0x12, 0x26, 0x0a, 0x0f, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, - 0x5f, 0x70, 0x65, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, - 0x0d, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x50, 0x65, 0x65, 0x72, 0x49, 0x64, 0x73, 0x12, 0x1f, - 0x0a, 0x0b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x49, 0x64, 0x12, - 0x21, 0x0a, 0x0c, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x69, 0x64, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, - 0x49, 0x64, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_github_com_aperturerobotics_bifrost_stream_api_accept_accept_proto_rawDescOnce sync.Once - file_github_com_aperturerobotics_bifrost_stream_api_accept_accept_proto_rawDescData = file_github_com_aperturerobotics_bifrost_stream_api_accept_accept_proto_rawDesc -) +func (m *Config) CloneVT() *Config { + if m == nil { + return (*Config)(nil) + } + r := new(Config) + r.LocalPeerId = m.LocalPeerId + r.ProtocolId = m.ProtocolId + r.TransportId = m.TransportId + if rhs := m.RemotePeerIds; rhs != nil { + tmpContainer := make([]string, len(rhs)) + copy(tmpContainer, rhs) + r.RemotePeerIds = tmpContainer + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} -func file_github_com_aperturerobotics_bifrost_stream_api_accept_accept_proto_rawDescGZIP() []byte { - file_github_com_aperturerobotics_bifrost_stream_api_accept_accept_proto_rawDescOnce.Do(func() { - file_github_com_aperturerobotics_bifrost_stream_api_accept_accept_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_aperturerobotics_bifrost_stream_api_accept_accept_proto_rawDescData) - }) - return file_github_com_aperturerobotics_bifrost_stream_api_accept_accept_proto_rawDescData +func (m *Config) CloneMessageVT() any { + return m.CloneVT() +} + +func (this *Config) EqualVT(that *Config) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.LocalPeerId != that.LocalPeerId { + return false + } + if len(this.RemotePeerIds) != len(that.RemotePeerIds) { + return false + } + for i, vx := range this.RemotePeerIds { + vy := that.RemotePeerIds[i] + if vx != vy { + return false + } + } + if this.ProtocolId != that.ProtocolId { + return false + } + if this.TransportId != that.TransportId { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *Config) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*Config) + if !ok { + return false + } + return this.EqualVT(that) } -var file_github_com_aperturerobotics_bifrost_stream_api_accept_accept_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_github_com_aperturerobotics_bifrost_stream_api_accept_accept_proto_goTypes = []interface{}{ - (*Config)(nil), // 0: stream.api.accept.Config +// MarshalProtoJSON marshals the Config message to JSON. +func (x *Config) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return + } + s.WriteObjectStart() + var wroteField bool + if x.LocalPeerId != "" || s.HasField("localPeerId") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("localPeerId") + s.WriteString(x.LocalPeerId) + } + if len(x.RemotePeerIds) > 0 || s.HasField("remotePeerIds") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("remotePeerIds") + s.WriteStringArray(x.RemotePeerIds) + } + if x.ProtocolId != "" || s.HasField("protocolId") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("protocolId") + s.WriteString(x.ProtocolId) + } + if x.TransportId != 0 || s.HasField("transportId") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("transportId") + s.WriteUint64(x.TransportId) + } + s.WriteObjectEnd() } -var file_github_com_aperturerobotics_bifrost_stream_api_accept_accept_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] 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 + +// MarshalJSON marshals the Config to JSON. +func (x *Config) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) } -func init() { file_github_com_aperturerobotics_bifrost_stream_api_accept_accept_proto_init() } -func file_github_com_aperturerobotics_bifrost_stream_api_accept_accept_proto_init() { - if File_github_com_aperturerobotics_bifrost_stream_api_accept_accept_proto != nil { +// UnmarshalProtoJSON unmarshals the Config message from JSON. +func (x *Config) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { return } - if !protoimpl.UnsafeEnabled { - file_github_com_aperturerobotics_bifrost_stream_api_accept_accept_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Config); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "local_peer_id", "localPeerId": + s.AddField("local_peer_id") + x.LocalPeerId = s.ReadString() + case "remote_peer_ids", "remotePeerIds": + s.AddField("remote_peer_ids") + if s.ReadNil() { + x.RemotePeerIds = nil + return } + x.RemotePeerIds = s.ReadStringArray() + case "protocol_id", "protocolId": + s.AddField("protocol_id") + x.ProtocolId = s.ReadString() + case "transport_id", "transportId": + s.AddField("transport_id") + x.TransportId = s.ReadUint64() } + }) +} + +// UnmarshalJSON unmarshals the Config from JSON. +func (x *Config) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +func (m *Config) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Config) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_github_com_aperturerobotics_bifrost_stream_api_accept_accept_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_github_com_aperturerobotics_bifrost_stream_api_accept_accept_proto_goTypes, - DependencyIndexes: file_github_com_aperturerobotics_bifrost_stream_api_accept_accept_proto_depIdxs, - MessageInfos: file_github_com_aperturerobotics_bifrost_stream_api_accept_accept_proto_msgTypes, - }.Build() - File_github_com_aperturerobotics_bifrost_stream_api_accept_accept_proto = out.File - file_github_com_aperturerobotics_bifrost_stream_api_accept_accept_proto_rawDesc = nil - file_github_com_aperturerobotics_bifrost_stream_api_accept_accept_proto_goTypes = nil - file_github_com_aperturerobotics_bifrost_stream_api_accept_accept_proto_depIdxs = nil + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.TransportId != 0 { + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(m.TransportId)) + i-- + dAtA[i] = 0x20 + } + if len(m.ProtocolId) > 0 { + i -= len(m.ProtocolId) + copy(dAtA[i:], m.ProtocolId) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.ProtocolId))) + i-- + dAtA[i] = 0x1a + } + if len(m.RemotePeerIds) > 0 { + for iNdEx := len(m.RemotePeerIds) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.RemotePeerIds[iNdEx]) + copy(dAtA[i:], m.RemotePeerIds[iNdEx]) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.RemotePeerIds[iNdEx]))) + i-- + dAtA[i] = 0x12 + } + } + if len(m.LocalPeerId) > 0 { + i -= len(m.LocalPeerId) + copy(dAtA[i:], m.LocalPeerId) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.LocalPeerId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Config) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.LocalPeerId) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + if len(m.RemotePeerIds) > 0 { + for _, s := range m.RemotePeerIds { + l = len(s) + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + } + l = len(m.ProtocolId) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + if m.TransportId != 0 { + n += 1 + protobuf_go_lite.SizeOfVarint(uint64(m.TransportId)) + } + n += len(m.unknownFields) + return n +} + +func (m *Config) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: Config: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: Config: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field LocalPeerId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.LocalPeerId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field RemotePeerIds", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RemotePeerIds = append(m.RemotePeerIds, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 3: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field ProtocolId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ProtocolId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 0 { + return errors.Errorf("proto: wrong wireType = %d for field TransportId", wireType) + } + m.TransportId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TransportId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil } diff --git a/stream/api/accept/accept.pb.ts b/stream/api/accept/accept.pb.ts deleted file mode 100644 index 6857995d..00000000 --- a/stream/api/accept/accept.pb.ts +++ /dev/null @@ -1,225 +0,0 @@ -/* eslint-disable */ -import Long from 'long' -import _m0 from 'protobufjs/minimal.js' - -export const protobufPackage = 'stream.api.accept' - -/** Config configures the accept controller. */ -export interface Config { - /** - * LocalPeerId is the peer ID to accept incoming connections with. - * Can be empty to accept any peer. - */ - localPeerId: string - /** - * RemotePeerIds are peer IDs to accept incoming connections from. - * Can be empty to accept any remote peer IDs. - */ - remotePeerIds: string[] - /** ProtocolId is the protocol ID to accept. */ - protocolId: string - /** - * TransportId constrains the transport ID to accept from. - * Can be empty. - */ - transportId: Long -} - -function createBaseConfig(): Config { - return { - localPeerId: '', - remotePeerIds: [], - protocolId: '', - transportId: Long.UZERO, - } -} - -export const Config = { - encode( - message: Config, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.localPeerId !== '') { - writer.uint32(10).string(message.localPeerId) - } - for (const v of message.remotePeerIds) { - writer.uint32(18).string(v!) - } - if (message.protocolId !== '') { - writer.uint32(26).string(message.protocolId) - } - if (!message.transportId.equals(Long.UZERO)) { - writer.uint32(32).uint64(message.transportId) - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Config { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseConfig() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break - } - - message.localPeerId = reader.string() - continue - case 2: - if (tag !== 18) { - break - } - - message.remotePeerIds.push(reader.string()) - continue - case 3: - if (tag !== 26) { - break - } - - message.protocolId = reader.string() - continue - case 4: - if (tag !== 32) { - break - } - - message.transportId = reader.uint64() as Long - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: AsyncIterable | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config.encode(p).finish()] - } - } else { - yield* [Config.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config.decode(p)] - } - } else { - yield* [Config.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): Config { - return { - localPeerId: isSet(object.localPeerId) - ? globalThis.String(object.localPeerId) - : '', - remotePeerIds: globalThis.Array.isArray(object?.remotePeerIds) - ? object.remotePeerIds.map((e: any) => globalThis.String(e)) - : [], - protocolId: isSet(object.protocolId) - ? globalThis.String(object.protocolId) - : '', - transportId: isSet(object.transportId) - ? Long.fromValue(object.transportId) - : Long.UZERO, - } - }, - - toJSON(message: Config): unknown { - const obj: any = {} - if (message.localPeerId !== '') { - obj.localPeerId = message.localPeerId - } - if (message.remotePeerIds?.length) { - obj.remotePeerIds = message.remotePeerIds - } - if (message.protocolId !== '') { - obj.protocolId = message.protocolId - } - if (!message.transportId.equals(Long.UZERO)) { - obj.transportId = (message.transportId || Long.UZERO).toString() - } - return obj - }, - - create, I>>(base?: I): Config { - return Config.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>(object: I): Config { - const message = createBaseConfig() - message.localPeerId = object.localPeerId ?? '' - message.remotePeerIds = object.remotePeerIds?.map((e) => e) || [] - message.protocolId = object.protocolId ?? '' - message.transportId = - object.transportId !== undefined && object.transportId !== null - ? Long.fromValue(object.transportId) - : Long.UZERO - return message - }, -} - -type Builtin = - | Date - | Function - | Uint8Array - | string - | number - | boolean - | undefined - -export type DeepPartial = T extends Builtin - ? T - : T extends Long - ? string | number | Long - : T extends globalThis.Array - ? globalThis.Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends { $case: string } - ? { [K in keyof Omit]?: DeepPartial } & { - $case: T['$case'] - } - : T extends {} - ? { [K in keyof T]?: DeepPartial } - : Partial - -type KeysOfUnion = T extends T ? keyof T : never -export type Exact = P extends Builtin - ? P - : P & { [K in keyof P]: Exact } & { - [K in Exclude>]: never - } - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any - _m0.configure() -} - -function isSet(value: any): boolean { - return value !== null && value !== undefined -} diff --git a/stream/api/accept/accept_pb.ts b/stream/api/accept/accept_pb.ts new file mode 100644 index 00000000..c325c5d1 --- /dev/null +++ b/stream/api/accept/accept_pb.ts @@ -0,0 +1,114 @@ +// @generated by protoc-gen-es v1.8.0 with parameter "target=ts,ts_nocheck=false" +// @generated from file github.com/aperturerobotics/bifrost/stream/api/accept/accept.proto (package stream.api.accept, syntax proto3) +/* eslint-disable */ + +import type { + BinaryReadOptions, + FieldList, + JsonReadOptions, + JsonValue, + PartialMessage, + PlainMessage, +} from '@bufbuild/protobuf' +import { Message, proto3, protoInt64 } from '@bufbuild/protobuf' + +/** + * Config configures the accept controller. + * + * @generated from message stream.api.accept.Config + */ +export class Config extends Message { + /** + * LocalPeerId is the peer ID to accept incoming connections with. + * Can be empty to accept any peer. + * + * @generated from field: string local_peer_id = 1; + */ + localPeerId = '' + + /** + * RemotePeerIds are peer IDs to accept incoming connections from. + * Can be empty to accept any remote peer IDs. + * + * @generated from field: repeated string remote_peer_ids = 2; + */ + remotePeerIds: string[] = [] + + /** + * ProtocolId is the protocol ID to accept. + * + * @generated from field: string protocol_id = 3; + */ + protocolId = '' + + /** + * TransportId constrains the transport ID to accept from. + * Can be empty. + * + * @generated from field: uint64 transport_id = 4; + */ + transportId = protoInt64.zero + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'stream.api.accept.Config' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { + no: 1, + name: 'local_peer_id', + kind: 'scalar', + T: 9 /* ScalarType.STRING */, + }, + { + no: 2, + name: 'remote_peer_ids', + kind: 'scalar', + T: 9 /* ScalarType.STRING */, + repeated: true, + }, + { + no: 3, + name: 'protocol_id', + kind: 'scalar', + T: 9 /* ScalarType.STRING */, + }, + { + no: 4, + name: 'transport_id', + kind: 'scalar', + T: 4 /* ScalarType.UINT64 */, + }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): Config { + return new Config().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): Config { + return new Config().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): Config { + return new Config().fromJsonString(jsonString, options) + } + + static equals( + a: Config | PlainMessage | undefined, + b: Config | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(Config, a, b) + } +} diff --git a/stream/api/accept/accept_vtproto.pb.go b/stream/api/accept/accept_vtproto.pb.go deleted file mode 100644 index 80a63cbf..00000000 --- a/stream/api/accept/accept_vtproto.pb.go +++ /dev/null @@ -1,334 +0,0 @@ -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// protoc-gen-go-vtproto version: v0.6.0 -// source: github.com/aperturerobotics/bifrost/stream/api/accept/accept.proto - -package stream_api_accept - -import ( - fmt "fmt" - io "io" - - protohelpers "github.com/planetscale/vtprotobuf/protohelpers" - proto "google.golang.org/protobuf/proto" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) -) - -func (m *Config) CloneVT() *Config { - if m == nil { - return (*Config)(nil) - } - r := new(Config) - r.LocalPeerId = m.LocalPeerId - r.ProtocolId = m.ProtocolId - r.TransportId = m.TransportId - if rhs := m.RemotePeerIds; rhs != nil { - tmpContainer := make([]string, len(rhs)) - copy(tmpContainer, rhs) - r.RemotePeerIds = tmpContainer - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Config) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (this *Config) EqualVT(that *Config) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.LocalPeerId != that.LocalPeerId { - return false - } - if len(this.RemotePeerIds) != len(that.RemotePeerIds) { - return false - } - for i, vx := range this.RemotePeerIds { - vy := that.RemotePeerIds[i] - if vx != vy { - return false - } - } - if this.ProtocolId != that.ProtocolId { - return false - } - if this.TransportId != that.TransportId { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Config) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Config) - if !ok { - return false - } - return this.EqualVT(that) -} -func (m *Config) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Config) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.TransportId != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.TransportId)) - i-- - dAtA[i] = 0x20 - } - if len(m.ProtocolId) > 0 { - i -= len(m.ProtocolId) - copy(dAtA[i:], m.ProtocolId) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.ProtocolId))) - i-- - dAtA[i] = 0x1a - } - if len(m.RemotePeerIds) > 0 { - for iNdEx := len(m.RemotePeerIds) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.RemotePeerIds[iNdEx]) - copy(dAtA[i:], m.RemotePeerIds[iNdEx]) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.RemotePeerIds[iNdEx]))) - i-- - dAtA[i] = 0x12 - } - } - if len(m.LocalPeerId) > 0 { - i -= len(m.LocalPeerId) - copy(dAtA[i:], m.LocalPeerId) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.LocalPeerId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Config) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.LocalPeerId) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if len(m.RemotePeerIds) > 0 { - for _, s := range m.RemotePeerIds { - l = len(s) - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - } - l = len(m.ProtocolId) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.TransportId != 0 { - n += 1 + protohelpers.SizeOfVarint(uint64(m.TransportId)) - } - n += len(m.unknownFields) - return n -} - -func (m *Config) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Config: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Config: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LocalPeerId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.LocalPeerId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RemotePeerIds", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.RemotePeerIds = append(m.RemotePeerIds, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ProtocolId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ProtocolId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TransportId", wireType) - } - m.TransportId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TransportId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} diff --git a/stream/api/api.pb.go b/stream/api/api.pb.go index 7828dff0..af42789c 100644 --- a/stream/api/api.pb.go +++ b/stream/api/api.pb.go @@ -1,14 +1,11 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0-devel -// protoc v5.26.1 +// Code generated by protoc-gen-go-lite. DO NOT EDIT. +// protoc-gen-go-lite version: v0.4.5 // source: github.com/aperturerobotics/bifrost/stream/api/api.proto package stream_api import ( - reflect "reflect" - sync "sync" + io "io" accept "github.com/aperturerobotics/bifrost/stream/api/accept" dial "github.com/aperturerobotics/bifrost/stream/api/dial" @@ -16,58 +13,23 @@ import ( forwarding "github.com/aperturerobotics/bifrost/stream/forwarding" listening "github.com/aperturerobotics/bifrost/stream/listening" exec "github.com/aperturerobotics/controllerbus/controller/exec" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) + protobuf_go_lite "github.com/aperturerobotics/protobuf-go-lite" + json "github.com/aperturerobotics/protobuf-go-lite/json" + errors "github.com/pkg/errors" ) // ForwardStreamsRequest is the request type for ForwardStreams. type ForwardStreamsRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ForwardingConfig *forwarding.Config `protobuf:"bytes,1,opt,name=forwarding_config,json=forwardingConfig,proto3" json:"forwarding_config,omitempty"` + unknownFields []byte + ForwardingConfig *forwarding.Config `protobuf:"bytes,1,opt,name=forwarding_config,json=forwardingConfig,proto3" json:"forwardingConfig,omitempty"` } func (x *ForwardStreamsRequest) Reset() { *x = ForwardStreamsRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_stream_api_api_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ForwardStreamsRequest) String() string { - return protoimpl.X.MessageStringOf(x) } func (*ForwardStreamsRequest) ProtoMessage() {} -func (x *ForwardStreamsRequest) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_stream_api_api_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 ForwardStreamsRequest.ProtoReflect.Descriptor instead. -func (*ForwardStreamsRequest) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_stream_api_api_proto_rawDescGZIP(), []int{0} -} - func (x *ForwardStreamsRequest) GetForwardingConfig() *forwarding.Config { if x != nil { return x.ForwardingConfig @@ -77,46 +39,17 @@ func (x *ForwardStreamsRequest) GetForwardingConfig() *forwarding.Config { // ForwardStreamsResponse is the response type for ForwardStreams. type ForwardStreamsResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + unknownFields []byte // ControllerStatus is the status of the forwarding controller. - ControllerStatus exec.ControllerStatus `protobuf:"varint,1,opt,name=controller_status,json=controllerStatus,proto3,enum=controller.exec.ControllerStatus" json:"controller_status,omitempty"` + ControllerStatus exec.ControllerStatus `protobuf:"varint,1,opt,name=controller_status,json=controllerStatus,proto3" json:"controllerStatus,omitempty"` } func (x *ForwardStreamsResponse) Reset() { *x = ForwardStreamsResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_stream_api_api_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ForwardStreamsResponse) String() string { - return protoimpl.X.MessageStringOf(x) } func (*ForwardStreamsResponse) ProtoMessage() {} -func (x *ForwardStreamsResponse) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_stream_api_api_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 ForwardStreamsResponse.ProtoReflect.Descriptor instead. -func (*ForwardStreamsResponse) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_stream_api_api_proto_rawDescGZIP(), []int{1} -} - func (x *ForwardStreamsResponse) GetControllerStatus() exec.ControllerStatus { if x != nil { return x.ControllerStatus @@ -126,45 +59,16 @@ func (x *ForwardStreamsResponse) GetControllerStatus() exec.ControllerStatus { // ListenStreamsRequest is the request type for ListenStreams. type ListenStreamsRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ListeningConfig *listening.Config `protobuf:"bytes,1,opt,name=listening_config,json=listeningConfig,proto3" json:"listening_config,omitempty"` + unknownFields []byte + ListeningConfig *listening.Config `protobuf:"bytes,1,opt,name=listening_config,json=listeningConfig,proto3" json:"listeningConfig,omitempty"` } func (x *ListenStreamsRequest) Reset() { *x = ListenStreamsRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_stream_api_api_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ListenStreamsRequest) String() string { - return protoimpl.X.MessageStringOf(x) } func (*ListenStreamsRequest) ProtoMessage() {} -func (x *ListenStreamsRequest) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_stream_api_api_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 ListenStreamsRequest.ProtoReflect.Descriptor instead. -func (*ListenStreamsRequest) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_stream_api_api_proto_rawDescGZIP(), []int{2} -} - func (x *ListenStreamsRequest) GetListeningConfig() *listening.Config { if x != nil { return x.ListeningConfig @@ -174,46 +78,17 @@ func (x *ListenStreamsRequest) GetListeningConfig() *listening.Config { // ListenStreamsResponse is the response type for ListenStreams. type ListenStreamsResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + unknownFields []byte // ControllerStatus is the status of the forwarding controller. - ControllerStatus exec.ControllerStatus `protobuf:"varint,1,opt,name=controller_status,json=controllerStatus,proto3,enum=controller.exec.ControllerStatus" json:"controller_status,omitempty"` + ControllerStatus exec.ControllerStatus `protobuf:"varint,1,opt,name=controller_status,json=controllerStatus,proto3" json:"controllerStatus,omitempty"` } func (x *ListenStreamsResponse) Reset() { *x = ListenStreamsResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_stream_api_api_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ListenStreamsResponse) String() string { - return protoimpl.X.MessageStringOf(x) } func (*ListenStreamsResponse) ProtoMessage() {} -func (x *ListenStreamsResponse) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_stream_api_api_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 ListenStreamsResponse.ProtoReflect.Descriptor instead. -func (*ListenStreamsResponse) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_stream_api_api_proto_rawDescGZIP(), []int{3} -} - func (x *ListenStreamsResponse) GetControllerStatus() exec.ControllerStatus { if x != nil { return x.ControllerStatus @@ -223,10 +98,7 @@ func (x *ListenStreamsResponse) GetControllerStatus() exec.ControllerStatus { // AcceptStreamRequest is the request type for AcceptStream. type AcceptStreamRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + unknownFields []byte // Config is the configuration for the accept. // The first packet will contain this value. Config *accept.Config `protobuf:"bytes,1,opt,name=config,proto3" json:"config,omitempty"` @@ -236,36 +108,10 @@ type AcceptStreamRequest struct { func (x *AcceptStreamRequest) Reset() { *x = AcceptStreamRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_stream_api_api_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AcceptStreamRequest) String() string { - return protoimpl.X.MessageStringOf(x) } func (*AcceptStreamRequest) ProtoMessage() {} -func (x *AcceptStreamRequest) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_stream_api_api_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 AcceptStreamRequest.ProtoReflect.Descriptor instead. -func (*AcceptStreamRequest) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_stream_api_api_proto_rawDescGZIP(), []int{4} -} - func (x *AcceptStreamRequest) GetConfig() *accept.Config { if x != nil { return x.Config @@ -282,46 +128,17 @@ func (x *AcceptStreamRequest) GetData() *rpc.Data { // AcceptStreamResponse is the response type for AcceptStream. type AcceptStreamResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + unknownFields []byte // Data is a data packet. Data *rpc.Data `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` } func (x *AcceptStreamResponse) Reset() { *x = AcceptStreamResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_stream_api_api_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AcceptStreamResponse) String() string { - return protoimpl.X.MessageStringOf(x) } func (*AcceptStreamResponse) ProtoMessage() {} -func (x *AcceptStreamResponse) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_stream_api_api_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 AcceptStreamResponse.ProtoReflect.Descriptor instead. -func (*AcceptStreamResponse) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_stream_api_api_proto_rawDescGZIP(), []int{5} -} - func (x *AcceptStreamResponse) GetData() *rpc.Data { if x != nil { return x.Data @@ -331,10 +148,7 @@ func (x *AcceptStreamResponse) GetData() *rpc.Data { // DialStreamRequest is the request type for DialStream. type DialStreamRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + unknownFields []byte // Config is the configuration for the dial. // The first packet will contain this value. Config *dial.Config `protobuf:"bytes,1,opt,name=config,proto3" json:"config,omitempty"` @@ -344,36 +158,10 @@ type DialStreamRequest struct { func (x *DialStreamRequest) Reset() { *x = DialStreamRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_stream_api_api_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DialStreamRequest) String() string { - return protoimpl.X.MessageStringOf(x) } func (*DialStreamRequest) ProtoMessage() {} -func (x *DialStreamRequest) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_stream_api_api_proto_msgTypes[6] - 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 DialStreamRequest.ProtoReflect.Descriptor instead. -func (*DialStreamRequest) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_stream_api_api_proto_rawDescGZIP(), []int{6} -} - func (x *DialStreamRequest) GetConfig() *dial.Config { if x != nil { return x.Config @@ -390,333 +178,1924 @@ func (x *DialStreamRequest) GetData() *rpc.Data { // DialStreamResponse is the response type for DialStream. type DialStreamResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + unknownFields []byte // Data is a data packet. Data *rpc.Data `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` } func (x *DialStreamResponse) Reset() { *x = DialStreamResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_stream_api_api_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) +} + +func (*DialStreamResponse) ProtoMessage() {} + +func (x *DialStreamResponse) GetData() *rpc.Data { + if x != nil { + return x.Data } + return nil +} + +func (m *ForwardStreamsRequest) CloneVT() *ForwardStreamsRequest { + if m == nil { + return (*ForwardStreamsRequest)(nil) + } + r := new(ForwardStreamsRequest) + if rhs := m.ForwardingConfig; rhs != nil { + r.ForwardingConfig = rhs.CloneVT() + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r } -func (x *DialStreamResponse) String() string { - return protoimpl.X.MessageStringOf(x) +func (m *ForwardStreamsRequest) CloneMessageVT() any { + return m.CloneVT() } -func (*DialStreamResponse) ProtoMessage() {} +func (m *ForwardStreamsResponse) CloneVT() *ForwardStreamsResponse { + if m == nil { + return (*ForwardStreamsResponse)(nil) + } + r := new(ForwardStreamsResponse) + r.ControllerStatus = m.ControllerStatus + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *ForwardStreamsResponse) CloneMessageVT() any { + return m.CloneVT() +} + +func (m *ListenStreamsRequest) CloneVT() *ListenStreamsRequest { + if m == nil { + return (*ListenStreamsRequest)(nil) + } + r := new(ListenStreamsRequest) + if rhs := m.ListeningConfig; rhs != nil { + r.ListeningConfig = rhs.CloneVT() + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *ListenStreamsRequest) CloneMessageVT() any { + return m.CloneVT() +} + +func (m *ListenStreamsResponse) CloneVT() *ListenStreamsResponse { + if m == nil { + return (*ListenStreamsResponse)(nil) + } + r := new(ListenStreamsResponse) + r.ControllerStatus = m.ControllerStatus + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *ListenStreamsResponse) CloneMessageVT() any { + return m.CloneVT() +} + +func (m *AcceptStreamRequest) CloneVT() *AcceptStreamRequest { + if m == nil { + return (*AcceptStreamRequest)(nil) + } + r := new(AcceptStreamRequest) + if rhs := m.Config; rhs != nil { + r.Config = rhs.CloneVT() + } + if rhs := m.Data; rhs != nil { + r.Data = rhs.CloneVT() + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *AcceptStreamRequest) CloneMessageVT() any { + return m.CloneVT() +} + +func (m *AcceptStreamResponse) CloneVT() *AcceptStreamResponse { + if m == nil { + return (*AcceptStreamResponse)(nil) + } + r := new(AcceptStreamResponse) + if rhs := m.Data; rhs != nil { + r.Data = rhs.CloneVT() + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *AcceptStreamResponse) CloneMessageVT() any { + return m.CloneVT() +} + +func (m *DialStreamRequest) CloneVT() *DialStreamRequest { + if m == nil { + return (*DialStreamRequest)(nil) + } + r := new(DialStreamRequest) + if rhs := m.Config; rhs != nil { + r.Config = rhs.CloneVT() + } + if rhs := m.Data; rhs != nil { + r.Data = rhs.CloneVT() + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *DialStreamRequest) CloneMessageVT() any { + return m.CloneVT() +} -func (x *DialStreamResponse) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_stream_api_api_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) +func (m *DialStreamResponse) CloneVT() *DialStreamResponse { + if m == nil { + return (*DialStreamResponse)(nil) + } + r := new(DialStreamResponse) + if rhs := m.Data; rhs != nil { + r.Data = rhs.CloneVT() + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *DialStreamResponse) CloneMessageVT() any { + return m.CloneVT() +} + +func (this *ForwardStreamsRequest) EqualVT(that *ForwardStreamsRequest) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if !this.ForwardingConfig.EqualVT(that.ForwardingConfig) { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *ForwardStreamsRequest) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*ForwardStreamsRequest) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *ForwardStreamsResponse) EqualVT(that *ForwardStreamsResponse) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.ControllerStatus != that.ControllerStatus { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *ForwardStreamsResponse) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*ForwardStreamsResponse) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *ListenStreamsRequest) EqualVT(that *ListenStreamsRequest) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if !this.ListeningConfig.EqualVT(that.ListeningConfig) { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *ListenStreamsRequest) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*ListenStreamsRequest) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *ListenStreamsResponse) EqualVT(that *ListenStreamsResponse) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.ControllerStatus != that.ControllerStatus { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *ListenStreamsResponse) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*ListenStreamsResponse) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *AcceptStreamRequest) EqualVT(that *AcceptStreamRequest) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if !this.Config.EqualVT(that.Config) { + return false + } + if !this.Data.EqualVT(that.Data) { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *AcceptStreamRequest) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*AcceptStreamRequest) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *AcceptStreamResponse) EqualVT(that *AcceptStreamResponse) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if !this.Data.EqualVT(that.Data) { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *AcceptStreamResponse) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*AcceptStreamResponse) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *DialStreamRequest) EqualVT(that *DialStreamRequest) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if !this.Config.EqualVT(that.Config) { + return false + } + if !this.Data.EqualVT(that.Data) { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *DialStreamRequest) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*DialStreamRequest) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *DialStreamResponse) EqualVT(that *DialStreamResponse) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if !this.Data.EqualVT(that.Data) { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *DialStreamResponse) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*DialStreamResponse) + if !ok { + return false + } + return this.EqualVT(that) +} + +// MarshalProtoJSON marshals the ForwardStreamsRequest message to JSON. +func (x *ForwardStreamsRequest) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return + } + s.WriteObjectStart() + var wroteField bool + if x.ForwardingConfig != nil || s.HasField("forwardingConfig") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("forwardingConfig") + x.ForwardingConfig.MarshalProtoJSON(s.WithField("forwardingConfig")) + } + s.WriteObjectEnd() +} + +// MarshalJSON marshals the ForwardStreamsRequest to JSON. +func (x *ForwardStreamsRequest) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) +} + +// UnmarshalProtoJSON unmarshals the ForwardStreamsRequest message from JSON. +func (x *ForwardStreamsRequest) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { + return + } + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "forwarding_config", "forwardingConfig": + if s.ReadNil() { + x.ForwardingConfig = nil + return + } + x.ForwardingConfig = &forwarding.Config{} + x.ForwardingConfig.UnmarshalProtoJSON(s.WithField("forwarding_config", true)) } - return ms + }) +} + +// UnmarshalJSON unmarshals the ForwardStreamsRequest from JSON. +func (x *ForwardStreamsRequest) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +// MarshalProtoJSON marshals the ForwardStreamsResponse message to JSON. +func (x *ForwardStreamsResponse) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return } - return mi.MessageOf(x) + s.WriteObjectStart() + var wroteField bool + if x.ControllerStatus != 0 || s.HasField("controllerStatus") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("controllerStatus") + x.ControllerStatus.MarshalProtoJSON(s) + } + s.WriteObjectEnd() } -// Deprecated: Use DialStreamResponse.ProtoReflect.Descriptor instead. -func (*DialStreamResponse) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_stream_api_api_proto_rawDescGZIP(), []int{7} +// MarshalJSON marshals the ForwardStreamsResponse to JSON. +func (x *ForwardStreamsResponse) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) } -func (x *DialStreamResponse) GetData() *rpc.Data { - if x != nil { - return x.Data +// UnmarshalProtoJSON unmarshals the ForwardStreamsResponse message from JSON. +func (x *ForwardStreamsResponse) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { + return } - return nil + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "controller_status", "controllerStatus": + s.AddField("controller_status") + x.ControllerStatus.UnmarshalProtoJSON(s) + } + }) } -var File_github_com_aperturerobotics_bifrost_stream_api_api_proto protoreflect.FileDescriptor - -var file_github_com_aperturerobotics_bifrost_stream_api_api_proto_rawDesc = []byte{ - 0x0a, 0x38, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, - 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x62, 0x69, - 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2f, 0x61, 0x70, 0x69, - 0x2f, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0a, 0x73, 0x74, 0x72, 0x65, - 0x61, 0x6d, 0x2e, 0x61, 0x70, 0x69, 0x1a, 0x44, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, - 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, - 0x69, 0x63, 0x73, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x62, 0x75, - 0x73, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x65, 0x78, 0x65, - 0x63, 0x2f, 0x65, 0x78, 0x65, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x46, 0x67, 0x69, - 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, - 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x62, 0x69, 0x66, 0x72, 0x6f, 0x73, - 0x74, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2f, 0x66, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, - 0x69, 0x6e, 0x67, 0x2f, 0x66, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x67, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x44, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, - 0x2f, 0x61, 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, - 0x73, 0x2f, 0x62, 0x69, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, - 0x2f, 0x6c, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x69, 0x6e, 0x67, 0x2f, 0x6c, 0x69, 0x73, 0x74, 0x65, - 0x6e, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x3c, 0x67, 0x69, 0x74, 0x68, - 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, - 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x62, 0x69, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2f, - 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x70, 0x63, 0x2f, 0x72, - 0x70, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x42, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, - 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, - 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x62, 0x69, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2f, 0x73, 0x74, - 0x72, 0x65, 0x61, 0x6d, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x63, 0x63, 0x65, 0x70, 0x74, 0x2f, - 0x61, 0x63, 0x63, 0x65, 0x70, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x3e, 0x67, 0x69, - 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, - 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x62, 0x69, 0x66, 0x72, 0x6f, 0x73, - 0x74, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x64, 0x69, 0x61, - 0x6c, 0x2f, 0x64, 0x69, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x5f, 0x0a, 0x15, - 0x46, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x46, 0x0a, 0x11, 0x66, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, - 0x69, 0x6e, 0x67, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x19, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x66, 0x6f, 0x72, 0x77, 0x61, 0x72, - 0x64, 0x69, 0x6e, 0x67, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x10, 0x66, 0x6f, 0x72, - 0x77, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x67, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x22, 0x68, 0x0a, - 0x16, 0x46, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4e, 0x0a, 0x11, 0x63, 0x6f, 0x6e, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0e, 0x32, 0x21, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, - 0x65, 0x78, 0x65, 0x63, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x53, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x10, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, - 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x5b, 0x0a, 0x14, 0x4c, 0x69, 0x73, 0x74, 0x65, - 0x6e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, - 0x43, 0x0a, 0x10, 0x6c, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x69, 0x6e, 0x67, 0x5f, 0x63, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x73, 0x74, 0x72, 0x65, - 0x61, 0x6d, 0x2e, 0x6c, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x69, 0x6e, 0x67, 0x2e, 0x43, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x52, 0x0f, 0x6c, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x69, 0x6e, 0x67, 0x43, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x22, 0x67, 0x0a, 0x15, 0x4c, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x53, 0x74, - 0x72, 0x65, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4e, 0x0a, - 0x11, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x5f, 0x73, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x21, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x65, 0x78, 0x65, 0x63, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x10, 0x63, 0x6f, 0x6e, - 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x72, 0x0a, - 0x13, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x12, 0x31, 0x0a, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x61, 0x70, - 0x69, 0x2e, 0x61, 0x63, 0x63, 0x65, 0x70, 0x74, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, - 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x28, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x61, - 0x70, 0x69, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x52, 0x04, 0x64, 0x61, 0x74, - 0x61, 0x22, 0x40, 0x0a, 0x14, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, - 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x28, 0x0a, 0x04, 0x64, 0x61, 0x74, - 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, - 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x52, 0x04, 0x64, - 0x61, 0x74, 0x61, 0x22, 0x6e, 0x0a, 0x11, 0x44, 0x69, 0x61, 0x6c, 0x53, 0x74, 0x72, 0x65, 0x61, - 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2f, 0x0a, 0x06, 0x63, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x61, - 0x6d, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x64, 0x69, 0x61, 0x6c, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, - 0x67, 0x52, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x28, 0x0a, 0x04, 0x64, 0x61, 0x74, - 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, - 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x52, 0x04, 0x64, - 0x61, 0x74, 0x61, 0x22, 0x3e, 0x0a, 0x12, 0x44, 0x69, 0x61, 0x6c, 0x53, 0x74, 0x72, 0x65, 0x61, - 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x28, 0x0a, 0x04, 0x64, 0x61, 0x74, - 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, - 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x52, 0x04, 0x64, - 0x61, 0x74, 0x61, 0x32, 0xf2, 0x02, 0x0a, 0x0d, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x53, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x5b, 0x0a, 0x0e, 0x46, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, - 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x12, 0x21, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, - 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x46, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, 0x53, 0x74, 0x72, 0x65, - 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x73, 0x74, 0x72, - 0x65, 0x61, 0x6d, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x46, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, 0x53, - 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, - 0x30, 0x01, 0x12, 0x58, 0x0a, 0x0d, 0x4c, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x53, 0x74, 0x72, 0x65, - 0x61, 0x6d, 0x73, 0x12, 0x20, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x61, - 0x70, 0x69, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x30, 0x01, 0x12, 0x57, 0x0a, 0x0c, - 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x1f, 0x2e, 0x73, - 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x41, 0x63, 0x63, 0x65, 0x70, 0x74, - 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, - 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x41, 0x63, 0x63, 0x65, 0x70, - 0x74, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x00, 0x28, 0x01, 0x30, 0x01, 0x12, 0x51, 0x0a, 0x0a, 0x44, 0x69, 0x61, 0x6c, 0x53, 0x74, 0x72, - 0x65, 0x61, 0x6d, 0x12, 0x1d, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x61, 0x70, 0x69, - 0x2e, 0x44, 0x69, 0x61, 0x6c, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x61, 0x70, 0x69, 0x2e, - 0x44, 0x69, 0x61, 0x6c, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x00, 0x28, 0x01, 0x30, 0x01, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_github_com_aperturerobotics_bifrost_stream_api_api_proto_rawDescOnce sync.Once - file_github_com_aperturerobotics_bifrost_stream_api_api_proto_rawDescData = file_github_com_aperturerobotics_bifrost_stream_api_api_proto_rawDesc -) +// UnmarshalJSON unmarshals the ForwardStreamsResponse from JSON. +func (x *ForwardStreamsResponse) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +// MarshalProtoJSON marshals the ListenStreamsRequest message to JSON. +func (x *ListenStreamsRequest) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return + } + s.WriteObjectStart() + var wroteField bool + if x.ListeningConfig != nil || s.HasField("listeningConfig") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("listeningConfig") + x.ListeningConfig.MarshalProtoJSON(s.WithField("listeningConfig")) + } + s.WriteObjectEnd() +} + +// MarshalJSON marshals the ListenStreamsRequest to JSON. +func (x *ListenStreamsRequest) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) +} + +// UnmarshalProtoJSON unmarshals the ListenStreamsRequest message from JSON. +func (x *ListenStreamsRequest) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { + return + } + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "listening_config", "listeningConfig": + if s.ReadNil() { + x.ListeningConfig = nil + return + } + x.ListeningConfig = &listening.Config{} + x.ListeningConfig.UnmarshalProtoJSON(s.WithField("listening_config", true)) + } + }) +} + +// UnmarshalJSON unmarshals the ListenStreamsRequest from JSON. +func (x *ListenStreamsRequest) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +// MarshalProtoJSON marshals the ListenStreamsResponse message to JSON. +func (x *ListenStreamsResponse) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return + } + s.WriteObjectStart() + var wroteField bool + if x.ControllerStatus != 0 || s.HasField("controllerStatus") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("controllerStatus") + x.ControllerStatus.MarshalProtoJSON(s) + } + s.WriteObjectEnd() +} + +// MarshalJSON marshals the ListenStreamsResponse to JSON. +func (x *ListenStreamsResponse) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) +} -func file_github_com_aperturerobotics_bifrost_stream_api_api_proto_rawDescGZIP() []byte { - file_github_com_aperturerobotics_bifrost_stream_api_api_proto_rawDescOnce.Do(func() { - file_github_com_aperturerobotics_bifrost_stream_api_api_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_aperturerobotics_bifrost_stream_api_api_proto_rawDescData) +// UnmarshalProtoJSON unmarshals the ListenStreamsResponse message from JSON. +func (x *ListenStreamsResponse) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { + return + } + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "controller_status", "controllerStatus": + s.AddField("controller_status") + x.ControllerStatus.UnmarshalProtoJSON(s) + } }) - return file_github_com_aperturerobotics_bifrost_stream_api_api_proto_rawDescData -} - -var file_github_com_aperturerobotics_bifrost_stream_api_api_proto_msgTypes = make([]protoimpl.MessageInfo, 8) -var file_github_com_aperturerobotics_bifrost_stream_api_api_proto_goTypes = []interface{}{ - (*ForwardStreamsRequest)(nil), // 0: stream.api.ForwardStreamsRequest - (*ForwardStreamsResponse)(nil), // 1: stream.api.ForwardStreamsResponse - (*ListenStreamsRequest)(nil), // 2: stream.api.ListenStreamsRequest - (*ListenStreamsResponse)(nil), // 3: stream.api.ListenStreamsResponse - (*AcceptStreamRequest)(nil), // 4: stream.api.AcceptStreamRequest - (*AcceptStreamResponse)(nil), // 5: stream.api.AcceptStreamResponse - (*DialStreamRequest)(nil), // 6: stream.api.DialStreamRequest - (*DialStreamResponse)(nil), // 7: stream.api.DialStreamResponse - (*forwarding.Config)(nil), // 8: stream.forwarding.Config - (exec.ControllerStatus)(0), // 9: controller.exec.ControllerStatus - (*listening.Config)(nil), // 10: stream.listening.Config - (*accept.Config)(nil), // 11: stream.api.accept.Config - (*rpc.Data)(nil), // 12: stream.api.rpc.Data - (*dial.Config)(nil), // 13: stream.api.dial.Config -} -var file_github_com_aperturerobotics_bifrost_stream_api_api_proto_depIdxs = []int32{ - 8, // 0: stream.api.ForwardStreamsRequest.forwarding_config:type_name -> stream.forwarding.Config - 9, // 1: stream.api.ForwardStreamsResponse.controller_status:type_name -> controller.exec.ControllerStatus - 10, // 2: stream.api.ListenStreamsRequest.listening_config:type_name -> stream.listening.Config - 9, // 3: stream.api.ListenStreamsResponse.controller_status:type_name -> controller.exec.ControllerStatus - 11, // 4: stream.api.AcceptStreamRequest.config:type_name -> stream.api.accept.Config - 12, // 5: stream.api.AcceptStreamRequest.data:type_name -> stream.api.rpc.Data - 12, // 6: stream.api.AcceptStreamResponse.data:type_name -> stream.api.rpc.Data - 13, // 7: stream.api.DialStreamRequest.config:type_name -> stream.api.dial.Config - 12, // 8: stream.api.DialStreamRequest.data:type_name -> stream.api.rpc.Data - 12, // 9: stream.api.DialStreamResponse.data:type_name -> stream.api.rpc.Data - 0, // 10: stream.api.StreamService.ForwardStreams:input_type -> stream.api.ForwardStreamsRequest - 2, // 11: stream.api.StreamService.ListenStreams:input_type -> stream.api.ListenStreamsRequest - 4, // 12: stream.api.StreamService.AcceptStream:input_type -> stream.api.AcceptStreamRequest - 6, // 13: stream.api.StreamService.DialStream:input_type -> stream.api.DialStreamRequest - 1, // 14: stream.api.StreamService.ForwardStreams:output_type -> stream.api.ForwardStreamsResponse - 3, // 15: stream.api.StreamService.ListenStreams:output_type -> stream.api.ListenStreamsResponse - 5, // 16: stream.api.StreamService.AcceptStream:output_type -> stream.api.AcceptStreamResponse - 7, // 17: stream.api.StreamService.DialStream:output_type -> stream.api.DialStreamResponse - 14, // [14:18] is the sub-list for method output_type - 10, // [10:14] is the sub-list for method input_type - 10, // [10:10] is the sub-list for extension type_name - 10, // [10:10] is the sub-list for extension extendee - 0, // [0:10] is the sub-list for field type_name -} - -func init() { file_github_com_aperturerobotics_bifrost_stream_api_api_proto_init() } -func file_github_com_aperturerobotics_bifrost_stream_api_api_proto_init() { - if File_github_com_aperturerobotics_bifrost_stream_api_api_proto != nil { +} + +// UnmarshalJSON unmarshals the ListenStreamsResponse from JSON. +func (x *ListenStreamsResponse) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +// MarshalProtoJSON marshals the AcceptStreamRequest message to JSON. +func (x *AcceptStreamRequest) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return + } + s.WriteObjectStart() + var wroteField bool + if x.Config != nil || s.HasField("config") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("config") + x.Config.MarshalProtoJSON(s.WithField("config")) + } + if x.Data != nil || s.HasField("data") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("data") + x.Data.MarshalProtoJSON(s.WithField("data")) + } + s.WriteObjectEnd() +} + +// MarshalJSON marshals the AcceptStreamRequest to JSON. +func (x *AcceptStreamRequest) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) +} + +// UnmarshalProtoJSON unmarshals the AcceptStreamRequest message from JSON. +func (x *AcceptStreamRequest) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { return } - if !protoimpl.UnsafeEnabled { - file_github_com_aperturerobotics_bifrost_stream_api_api_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ForwardStreamsRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_github_com_aperturerobotics_bifrost_stream_api_api_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ForwardStreamsResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_github_com_aperturerobotics_bifrost_stream_api_api_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListenStreamsRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_github_com_aperturerobotics_bifrost_stream_api_api_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ListenStreamsResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_github_com_aperturerobotics_bifrost_stream_api_api_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AcceptStreamRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_github_com_aperturerobotics_bifrost_stream_api_api_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AcceptStreamResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_github_com_aperturerobotics_bifrost_stream_api_api_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DialStreamRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_github_com_aperturerobotics_bifrost_stream_api_api_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DialStreamResponse); 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_github_com_aperturerobotics_bifrost_stream_api_api_proto_rawDesc, - NumEnums: 0, - NumMessages: 8, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_github_com_aperturerobotics_bifrost_stream_api_api_proto_goTypes, - DependencyIndexes: file_github_com_aperturerobotics_bifrost_stream_api_api_proto_depIdxs, - MessageInfos: file_github_com_aperturerobotics_bifrost_stream_api_api_proto_msgTypes, - }.Build() - File_github_com_aperturerobotics_bifrost_stream_api_api_proto = out.File - file_github_com_aperturerobotics_bifrost_stream_api_api_proto_rawDesc = nil - file_github_com_aperturerobotics_bifrost_stream_api_api_proto_goTypes = nil - file_github_com_aperturerobotics_bifrost_stream_api_api_proto_depIdxs = nil + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "config": + if s.ReadNil() { + x.Config = nil + return + } + x.Config = &accept.Config{} + x.Config.UnmarshalProtoJSON(s.WithField("config", true)) + case "data": + if s.ReadNil() { + x.Data = nil + return + } + x.Data = &rpc.Data{} + x.Data.UnmarshalProtoJSON(s.WithField("data", true)) + } + }) +} + +// UnmarshalJSON unmarshals the AcceptStreamRequest from JSON. +func (x *AcceptStreamRequest) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +// MarshalProtoJSON marshals the AcceptStreamResponse message to JSON. +func (x *AcceptStreamResponse) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return + } + s.WriteObjectStart() + var wroteField bool + if x.Data != nil || s.HasField("data") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("data") + x.Data.MarshalProtoJSON(s.WithField("data")) + } + s.WriteObjectEnd() +} + +// MarshalJSON marshals the AcceptStreamResponse to JSON. +func (x *AcceptStreamResponse) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) +} + +// UnmarshalProtoJSON unmarshals the AcceptStreamResponse message from JSON. +func (x *AcceptStreamResponse) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { + return + } + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "data": + if s.ReadNil() { + x.Data = nil + return + } + x.Data = &rpc.Data{} + x.Data.UnmarshalProtoJSON(s.WithField("data", true)) + } + }) +} + +// UnmarshalJSON unmarshals the AcceptStreamResponse from JSON. +func (x *AcceptStreamResponse) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +// MarshalProtoJSON marshals the DialStreamRequest message to JSON. +func (x *DialStreamRequest) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return + } + s.WriteObjectStart() + var wroteField bool + if x.Config != nil || s.HasField("config") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("config") + x.Config.MarshalProtoJSON(s.WithField("config")) + } + if x.Data != nil || s.HasField("data") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("data") + x.Data.MarshalProtoJSON(s.WithField("data")) + } + s.WriteObjectEnd() +} + +// MarshalJSON marshals the DialStreamRequest to JSON. +func (x *DialStreamRequest) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) +} + +// UnmarshalProtoJSON unmarshals the DialStreamRequest message from JSON. +func (x *DialStreamRequest) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { + return + } + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "config": + if s.ReadNil() { + x.Config = nil + return + } + x.Config = &dial.Config{} + x.Config.UnmarshalProtoJSON(s.WithField("config", true)) + case "data": + if s.ReadNil() { + x.Data = nil + return + } + x.Data = &rpc.Data{} + x.Data.UnmarshalProtoJSON(s.WithField("data", true)) + } + }) +} + +// UnmarshalJSON unmarshals the DialStreamRequest from JSON. +func (x *DialStreamRequest) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +// MarshalProtoJSON marshals the DialStreamResponse message to JSON. +func (x *DialStreamResponse) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return + } + s.WriteObjectStart() + var wroteField bool + if x.Data != nil || s.HasField("data") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("data") + x.Data.MarshalProtoJSON(s.WithField("data")) + } + s.WriteObjectEnd() +} + +// MarshalJSON marshals the DialStreamResponse to JSON. +func (x *DialStreamResponse) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) +} + +// UnmarshalProtoJSON unmarshals the DialStreamResponse message from JSON. +func (x *DialStreamResponse) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { + return + } + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "data": + if s.ReadNil() { + x.Data = nil + return + } + x.Data = &rpc.Data{} + x.Data.UnmarshalProtoJSON(s.WithField("data", true)) + } + }) +} + +// UnmarshalJSON unmarshals the DialStreamResponse from JSON. +func (x *DialStreamResponse) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +func (m *ForwardStreamsRequest) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ForwardStreamsRequest) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *ForwardStreamsRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.ForwardingConfig != nil { + size, err := m.ForwardingConfig.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ForwardStreamsResponse) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ForwardStreamsResponse) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *ForwardStreamsResponse) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.ControllerStatus != 0 { + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(m.ControllerStatus)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *ListenStreamsRequest) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ListenStreamsRequest) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *ListenStreamsRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.ListeningConfig != nil { + size, err := m.ListeningConfig.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ListenStreamsResponse) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ListenStreamsResponse) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *ListenStreamsResponse) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.ControllerStatus != 0 { + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(m.ControllerStatus)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *AcceptStreamRequest) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *AcceptStreamRequest) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *AcceptStreamRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.Data != nil { + size, err := m.Data.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x12 + } + if m.Config != nil { + size, err := m.Config.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *AcceptStreamResponse) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *AcceptStreamResponse) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *AcceptStreamResponse) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.Data != nil { + size, err := m.Data.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *DialStreamRequest) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DialStreamRequest) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *DialStreamRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.Data != nil { + size, err := m.Data.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x12 + } + if m.Config != nil { + size, err := m.Config.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *DialStreamResponse) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DialStreamResponse) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *DialStreamResponse) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.Data != nil { + size, err := m.Data.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *ForwardStreamsRequest) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ForwardingConfig != nil { + l = m.ForwardingConfig.SizeVT() + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *ForwardStreamsResponse) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ControllerStatus != 0 { + n += 1 + protobuf_go_lite.SizeOfVarint(uint64(m.ControllerStatus)) + } + n += len(m.unknownFields) + return n +} + +func (m *ListenStreamsRequest) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ListeningConfig != nil { + l = m.ListeningConfig.SizeVT() + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *ListenStreamsResponse) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ControllerStatus != 0 { + n += 1 + protobuf_go_lite.SizeOfVarint(uint64(m.ControllerStatus)) + } + n += len(m.unknownFields) + return n +} + +func (m *AcceptStreamRequest) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Config != nil { + l = m.Config.SizeVT() + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + if m.Data != nil { + l = m.Data.SizeVT() + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *AcceptStreamResponse) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Data != nil { + l = m.Data.SizeVT() + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *DialStreamRequest) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Config != nil { + l = m.Config.SizeVT() + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + if m.Data != nil { + l = m.Data.SizeVT() + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *DialStreamResponse) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Data != nil { + l = m.Data.SizeVT() + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *ForwardStreamsRequest) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: ForwardStreamsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: ForwardStreamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field ForwardingConfig", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ForwardingConfig == nil { + m.ForwardingConfig = &forwarding.Config{} + } + if err := m.ForwardingConfig.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ForwardStreamsResponse) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: ForwardStreamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: ForwardStreamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return errors.Errorf("proto: wrong wireType = %d for field ControllerStatus", wireType) + } + m.ControllerStatus = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ControllerStatus |= exec.ControllerStatus(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ListenStreamsRequest) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: ListenStreamsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: ListenStreamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field ListeningConfig", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ListeningConfig == nil { + m.ListeningConfig = &listening.Config{} + } + if err := m.ListeningConfig.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ListenStreamsResponse) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: ListenStreamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: ListenStreamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return errors.Errorf("proto: wrong wireType = %d for field ControllerStatus", wireType) + } + m.ControllerStatus = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ControllerStatus |= exec.ControllerStatus(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *AcceptStreamRequest) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: AcceptStreamRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: AcceptStreamRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field Config", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Config == nil { + m.Config = &accept.Config{} + } + if err := m.Config.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Data == nil { + m.Data = &rpc.Data{} + } + if err := m.Data.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *AcceptStreamResponse) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: AcceptStreamResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: AcceptStreamResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Data == nil { + m.Data = &rpc.Data{} + } + if err := m.Data.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DialStreamRequest) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: DialStreamRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: DialStreamRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field Config", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Config == nil { + m.Config = &dial.Config{} + } + if err := m.Config.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Data == nil { + m.Data = &rpc.Data{} + } + if err := m.Data.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DialStreamResponse) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: DialStreamResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: DialStreamResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Data == nil { + m.Data = &rpc.Data{} + } + if err := m.Data.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil } diff --git a/stream/api/api.pb.ts b/stream/api/api.pb.ts deleted file mode 100644 index b82e87ac..00000000 --- a/stream/api/api.pb.ts +++ /dev/null @@ -1,1202 +0,0 @@ -/* eslint-disable */ -import { - ControllerStatus, - controllerStatusFromJSON, - controllerStatusToJSON, -} from '@go/github.com/aperturerobotics/controllerbus/controller/exec/exec.pb.js' -import Long from 'long' -import _m0 from 'protobufjs/minimal.js' -import { Config } from '../forwarding/forwarding.pb.js' -import { Config as Config1 } from '../listening/listening.pb.js' -import { Config as Config2 } from './accept/accept.pb.js' -import { Config as Config3 } from './dial/dial.pb.js' -import { Data } from './rpc/rpc.pb.js' - -export const protobufPackage = 'stream.api' - -/** ForwardStreamsRequest is the request type for ForwardStreams. */ -export interface ForwardStreamsRequest { - forwardingConfig: Config | undefined -} - -/** ForwardStreamsResponse is the response type for ForwardStreams. */ -export interface ForwardStreamsResponse { - /** ControllerStatus is the status of the forwarding controller. */ - controllerStatus: ControllerStatus -} - -/** ListenStreamsRequest is the request type for ListenStreams. */ -export interface ListenStreamsRequest { - listeningConfig: Config1 | undefined -} - -/** ListenStreamsResponse is the response type for ListenStreams. */ -export interface ListenStreamsResponse { - /** ControllerStatus is the status of the forwarding controller. */ - controllerStatus: ControllerStatus -} - -/** AcceptStreamRequest is the request type for AcceptStream. */ -export interface AcceptStreamRequest { - /** - * Config is the configuration for the accept. - * The first packet will contain this value. - */ - config: Config2 | undefined - /** Data is a data packet. */ - data: Data | undefined -} - -/** AcceptStreamResponse is the response type for AcceptStream. */ -export interface AcceptStreamResponse { - /** Data is a data packet. */ - data: Data | undefined -} - -/** DialStreamRequest is the request type for DialStream. */ -export interface DialStreamRequest { - /** - * Config is the configuration for the dial. - * The first packet will contain this value. - */ - config: Config3 | undefined - /** Data is a data packet. */ - data: Data | undefined -} - -/** DialStreamResponse is the response type for DialStream. */ -export interface DialStreamResponse { - /** Data is a data packet. */ - data: Data | undefined -} - -function createBaseForwardStreamsRequest(): ForwardStreamsRequest { - return { forwardingConfig: undefined } -} - -export const ForwardStreamsRequest = { - encode( - message: ForwardStreamsRequest, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.forwardingConfig !== undefined) { - Config.encode(message.forwardingConfig, writer.uint32(10).fork()).ldelim() - } - return writer - }, - - decode( - input: _m0.Reader | Uint8Array, - length?: number, - ): ForwardStreamsRequest { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseForwardStreamsRequest() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break - } - - message.forwardingConfig = Config.decode(reader, reader.uint32()) - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [ForwardStreamsRequest.encode(p).finish()] - } - } else { - yield* [ForwardStreamsRequest.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [ForwardStreamsRequest.decode(p)] - } - } else { - yield* [ForwardStreamsRequest.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): ForwardStreamsRequest { - return { - forwardingConfig: isSet(object.forwardingConfig) - ? Config.fromJSON(object.forwardingConfig) - : undefined, - } - }, - - toJSON(message: ForwardStreamsRequest): unknown { - const obj: any = {} - if (message.forwardingConfig !== undefined) { - obj.forwardingConfig = Config.toJSON(message.forwardingConfig) - } - return obj - }, - - create, I>>( - base?: I, - ): ForwardStreamsRequest { - return ForwardStreamsRequest.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>( - object: I, - ): ForwardStreamsRequest { - const message = createBaseForwardStreamsRequest() - message.forwardingConfig = - object.forwardingConfig !== undefined && object.forwardingConfig !== null - ? Config.fromPartial(object.forwardingConfig) - : undefined - return message - }, -} - -function createBaseForwardStreamsResponse(): ForwardStreamsResponse { - return { controllerStatus: 0 } -} - -export const ForwardStreamsResponse = { - encode( - message: ForwardStreamsResponse, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.controllerStatus !== 0) { - writer.uint32(8).int32(message.controllerStatus) - } - return writer - }, - - decode( - input: _m0.Reader | Uint8Array, - length?: number, - ): ForwardStreamsResponse { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseForwardStreamsResponse() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 8) { - break - } - - message.controllerStatus = reader.int32() as any - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [ForwardStreamsResponse.encode(p).finish()] - } - } else { - yield* [ForwardStreamsResponse.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [ForwardStreamsResponse.decode(p)] - } - } else { - yield* [ForwardStreamsResponse.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): ForwardStreamsResponse { - return { - controllerStatus: isSet(object.controllerStatus) - ? controllerStatusFromJSON(object.controllerStatus) - : 0, - } - }, - - toJSON(message: ForwardStreamsResponse): unknown { - const obj: any = {} - if (message.controllerStatus !== 0) { - obj.controllerStatus = controllerStatusToJSON(message.controllerStatus) - } - return obj - }, - - create, I>>( - base?: I, - ): ForwardStreamsResponse { - return ForwardStreamsResponse.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>( - object: I, - ): ForwardStreamsResponse { - const message = createBaseForwardStreamsResponse() - message.controllerStatus = object.controllerStatus ?? 0 - return message - }, -} - -function createBaseListenStreamsRequest(): ListenStreamsRequest { - return { listeningConfig: undefined } -} - -export const ListenStreamsRequest = { - encode( - message: ListenStreamsRequest, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.listeningConfig !== undefined) { - Config1.encode(message.listeningConfig, writer.uint32(10).fork()).ldelim() - } - return writer - }, - - decode( - input: _m0.Reader | Uint8Array, - length?: number, - ): ListenStreamsRequest { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseListenStreamsRequest() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break - } - - message.listeningConfig = Config1.decode(reader, reader.uint32()) - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [ListenStreamsRequest.encode(p).finish()] - } - } else { - yield* [ListenStreamsRequest.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [ListenStreamsRequest.decode(p)] - } - } else { - yield* [ListenStreamsRequest.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): ListenStreamsRequest { - return { - listeningConfig: isSet(object.listeningConfig) - ? Config1.fromJSON(object.listeningConfig) - : undefined, - } - }, - - toJSON(message: ListenStreamsRequest): unknown { - const obj: any = {} - if (message.listeningConfig !== undefined) { - obj.listeningConfig = Config1.toJSON(message.listeningConfig) - } - return obj - }, - - create, I>>( - base?: I, - ): ListenStreamsRequest { - return ListenStreamsRequest.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>( - object: I, - ): ListenStreamsRequest { - const message = createBaseListenStreamsRequest() - message.listeningConfig = - object.listeningConfig !== undefined && object.listeningConfig !== null - ? Config1.fromPartial(object.listeningConfig) - : undefined - return message - }, -} - -function createBaseListenStreamsResponse(): ListenStreamsResponse { - return { controllerStatus: 0 } -} - -export const ListenStreamsResponse = { - encode( - message: ListenStreamsResponse, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.controllerStatus !== 0) { - writer.uint32(8).int32(message.controllerStatus) - } - return writer - }, - - decode( - input: _m0.Reader | Uint8Array, - length?: number, - ): ListenStreamsResponse { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseListenStreamsResponse() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 8) { - break - } - - message.controllerStatus = reader.int32() as any - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [ListenStreamsResponse.encode(p).finish()] - } - } else { - yield* [ListenStreamsResponse.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [ListenStreamsResponse.decode(p)] - } - } else { - yield* [ListenStreamsResponse.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): ListenStreamsResponse { - return { - controllerStatus: isSet(object.controllerStatus) - ? controllerStatusFromJSON(object.controllerStatus) - : 0, - } - }, - - toJSON(message: ListenStreamsResponse): unknown { - const obj: any = {} - if (message.controllerStatus !== 0) { - obj.controllerStatus = controllerStatusToJSON(message.controllerStatus) - } - return obj - }, - - create, I>>( - base?: I, - ): ListenStreamsResponse { - return ListenStreamsResponse.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>( - object: I, - ): ListenStreamsResponse { - const message = createBaseListenStreamsResponse() - message.controllerStatus = object.controllerStatus ?? 0 - return message - }, -} - -function createBaseAcceptStreamRequest(): AcceptStreamRequest { - return { config: undefined, data: undefined } -} - -export const AcceptStreamRequest = { - encode( - message: AcceptStreamRequest, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.config !== undefined) { - Config2.encode(message.config, writer.uint32(10).fork()).ldelim() - } - if (message.data !== undefined) { - Data.encode(message.data, writer.uint32(18).fork()).ldelim() - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): AcceptStreamRequest { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseAcceptStreamRequest() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break - } - - message.config = Config2.decode(reader, reader.uint32()) - continue - case 2: - if (tag !== 18) { - break - } - - message.data = Data.decode(reader, reader.uint32()) - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [AcceptStreamRequest.encode(p).finish()] - } - } else { - yield* [AcceptStreamRequest.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [AcceptStreamRequest.decode(p)] - } - } else { - yield* [AcceptStreamRequest.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): AcceptStreamRequest { - return { - config: isSet(object.config) - ? Config2.fromJSON(object.config) - : undefined, - data: isSet(object.data) ? Data.fromJSON(object.data) : undefined, - } - }, - - toJSON(message: AcceptStreamRequest): unknown { - const obj: any = {} - if (message.config !== undefined) { - obj.config = Config2.toJSON(message.config) - } - if (message.data !== undefined) { - obj.data = Data.toJSON(message.data) - } - return obj - }, - - create, I>>( - base?: I, - ): AcceptStreamRequest { - return AcceptStreamRequest.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>( - object: I, - ): AcceptStreamRequest { - const message = createBaseAcceptStreamRequest() - message.config = - object.config !== undefined && object.config !== null - ? Config2.fromPartial(object.config) - : undefined - message.data = - object.data !== undefined && object.data !== null - ? Data.fromPartial(object.data) - : undefined - return message - }, -} - -function createBaseAcceptStreamResponse(): AcceptStreamResponse { - return { data: undefined } -} - -export const AcceptStreamResponse = { - encode( - message: AcceptStreamResponse, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.data !== undefined) { - Data.encode(message.data, writer.uint32(10).fork()).ldelim() - } - return writer - }, - - decode( - input: _m0.Reader | Uint8Array, - length?: number, - ): AcceptStreamResponse { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseAcceptStreamResponse() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break - } - - message.data = Data.decode(reader, reader.uint32()) - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [AcceptStreamResponse.encode(p).finish()] - } - } else { - yield* [AcceptStreamResponse.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [AcceptStreamResponse.decode(p)] - } - } else { - yield* [AcceptStreamResponse.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): AcceptStreamResponse { - return { data: isSet(object.data) ? Data.fromJSON(object.data) : undefined } - }, - - toJSON(message: AcceptStreamResponse): unknown { - const obj: any = {} - if (message.data !== undefined) { - obj.data = Data.toJSON(message.data) - } - return obj - }, - - create, I>>( - base?: I, - ): AcceptStreamResponse { - return AcceptStreamResponse.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>( - object: I, - ): AcceptStreamResponse { - const message = createBaseAcceptStreamResponse() - message.data = - object.data !== undefined && object.data !== null - ? Data.fromPartial(object.data) - : undefined - return message - }, -} - -function createBaseDialStreamRequest(): DialStreamRequest { - return { config: undefined, data: undefined } -} - -export const DialStreamRequest = { - encode( - message: DialStreamRequest, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.config !== undefined) { - Config3.encode(message.config, writer.uint32(10).fork()).ldelim() - } - if (message.data !== undefined) { - Data.encode(message.data, writer.uint32(18).fork()).ldelim() - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): DialStreamRequest { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseDialStreamRequest() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break - } - - message.config = Config3.decode(reader, reader.uint32()) - continue - case 2: - if (tag !== 18) { - break - } - - message.data = Data.decode(reader, reader.uint32()) - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [DialStreamRequest.encode(p).finish()] - } - } else { - yield* [DialStreamRequest.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [DialStreamRequest.decode(p)] - } - } else { - yield* [DialStreamRequest.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): DialStreamRequest { - return { - config: isSet(object.config) - ? Config3.fromJSON(object.config) - : undefined, - data: isSet(object.data) ? Data.fromJSON(object.data) : undefined, - } - }, - - toJSON(message: DialStreamRequest): unknown { - const obj: any = {} - if (message.config !== undefined) { - obj.config = Config3.toJSON(message.config) - } - if (message.data !== undefined) { - obj.data = Data.toJSON(message.data) - } - return obj - }, - - create, I>>( - base?: I, - ): DialStreamRequest { - return DialStreamRequest.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>( - object: I, - ): DialStreamRequest { - const message = createBaseDialStreamRequest() - message.config = - object.config !== undefined && object.config !== null - ? Config3.fromPartial(object.config) - : undefined - message.data = - object.data !== undefined && object.data !== null - ? Data.fromPartial(object.data) - : undefined - return message - }, -} - -function createBaseDialStreamResponse(): DialStreamResponse { - return { data: undefined } -} - -export const DialStreamResponse = { - encode( - message: DialStreamResponse, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.data !== undefined) { - Data.encode(message.data, writer.uint32(10).fork()).ldelim() - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): DialStreamResponse { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseDialStreamResponse() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break - } - - message.data = Data.decode(reader, reader.uint32()) - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [DialStreamResponse.encode(p).finish()] - } - } else { - yield* [DialStreamResponse.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [DialStreamResponse.decode(p)] - } - } else { - yield* [DialStreamResponse.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): DialStreamResponse { - return { data: isSet(object.data) ? Data.fromJSON(object.data) : undefined } - }, - - toJSON(message: DialStreamResponse): unknown { - const obj: any = {} - if (message.data !== undefined) { - obj.data = Data.toJSON(message.data) - } - return obj - }, - - create, I>>( - base?: I, - ): DialStreamResponse { - return DialStreamResponse.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>( - object: I, - ): DialStreamResponse { - const message = createBaseDialStreamResponse() - message.data = - object.data !== undefined && object.data !== null - ? Data.fromPartial(object.data) - : undefined - return message - }, -} - -/** StreamService is the bifrost stream service. */ -export interface StreamService { - /** - * ForwardStreams forwards streams to the target multiaddress. - * Handles HandleMountedStream directives by contacting the target. - */ - ForwardStreams( - request: ForwardStreamsRequest, - abortSignal?: AbortSignal, - ): AsyncIterable - /** - * ListenStreams listens for connections to the multiaddress. - * Forwards the connections to a remote peer with a protocol ID. - */ - ListenStreams( - request: ListenStreamsRequest, - abortSignal?: AbortSignal, - ): AsyncIterable - /** - * AcceptStream accepts an incoming stream. - * Stream data is sent over the request / response streams. - */ - AcceptStream( - request: AsyncIterable, - abortSignal?: AbortSignal, - ): AsyncIterable - /** - * DialStream dials a outgoing stream. - * Stream data is sent over the request / response streams. - */ - DialStream( - request: AsyncIterable, - abortSignal?: AbortSignal, - ): AsyncIterable -} - -export const StreamServiceServiceName = 'stream.api.StreamService' -export class StreamServiceClientImpl implements StreamService { - private readonly rpc: Rpc - private readonly service: string - constructor(rpc: Rpc, opts?: { service?: string }) { - this.service = opts?.service || StreamServiceServiceName - this.rpc = rpc - this.ForwardStreams = this.ForwardStreams.bind(this) - this.ListenStreams = this.ListenStreams.bind(this) - this.AcceptStream = this.AcceptStream.bind(this) - this.DialStream = this.DialStream.bind(this) - } - ForwardStreams( - request: ForwardStreamsRequest, - abortSignal?: AbortSignal, - ): AsyncIterable { - const data = ForwardStreamsRequest.encode(request).finish() - const result = this.rpc.serverStreamingRequest( - this.service, - 'ForwardStreams', - data, - abortSignal || undefined, - ) - return ForwardStreamsResponse.decodeTransform(result) - } - - ListenStreams( - request: ListenStreamsRequest, - abortSignal?: AbortSignal, - ): AsyncIterable { - const data = ListenStreamsRequest.encode(request).finish() - const result = this.rpc.serverStreamingRequest( - this.service, - 'ListenStreams', - data, - abortSignal || undefined, - ) - return ListenStreamsResponse.decodeTransform(result) - } - - AcceptStream( - request: AsyncIterable, - abortSignal?: AbortSignal, - ): AsyncIterable { - const data = AcceptStreamRequest.encodeTransform(request) - const result = this.rpc.bidirectionalStreamingRequest( - this.service, - 'AcceptStream', - data, - abortSignal || undefined, - ) - return AcceptStreamResponse.decodeTransform(result) - } - - DialStream( - request: AsyncIterable, - abortSignal?: AbortSignal, - ): AsyncIterable { - const data = DialStreamRequest.encodeTransform(request) - const result = this.rpc.bidirectionalStreamingRequest( - this.service, - 'DialStream', - data, - abortSignal || undefined, - ) - return DialStreamResponse.decodeTransform(result) - } -} - -/** StreamService is the bifrost stream service. */ -export type StreamServiceDefinition = typeof StreamServiceDefinition -export const StreamServiceDefinition = { - name: 'StreamService', - fullName: 'stream.api.StreamService', - methods: { - /** - * ForwardStreams forwards streams to the target multiaddress. - * Handles HandleMountedStream directives by contacting the target. - */ - forwardStreams: { - name: 'ForwardStreams', - requestType: ForwardStreamsRequest, - requestStream: false, - responseType: ForwardStreamsResponse, - responseStream: true, - options: {}, - }, - /** - * ListenStreams listens for connections to the multiaddress. - * Forwards the connections to a remote peer with a protocol ID. - */ - listenStreams: { - name: 'ListenStreams', - requestType: ListenStreamsRequest, - requestStream: false, - responseType: ListenStreamsResponse, - responseStream: true, - options: {}, - }, - /** - * AcceptStream accepts an incoming stream. - * Stream data is sent over the request / response streams. - */ - acceptStream: { - name: 'AcceptStream', - requestType: AcceptStreamRequest, - requestStream: true, - responseType: AcceptStreamResponse, - responseStream: true, - options: {}, - }, - /** - * DialStream dials a outgoing stream. - * Stream data is sent over the request / response streams. - */ - dialStream: { - name: 'DialStream', - requestType: DialStreamRequest, - requestStream: true, - responseType: DialStreamResponse, - responseStream: true, - options: {}, - }, - }, -} as const - -interface Rpc { - request( - service: string, - method: string, - data: Uint8Array, - abortSignal?: AbortSignal, - ): Promise - clientStreamingRequest( - service: string, - method: string, - data: AsyncIterable, - abortSignal?: AbortSignal, - ): Promise - serverStreamingRequest( - service: string, - method: string, - data: Uint8Array, - abortSignal?: AbortSignal, - ): AsyncIterable - bidirectionalStreamingRequest( - service: string, - method: string, - data: AsyncIterable, - abortSignal?: AbortSignal, - ): AsyncIterable -} - -type Builtin = - | Date - | Function - | Uint8Array - | string - | number - | boolean - | undefined - -export type DeepPartial = T extends Builtin - ? T - : T extends Long - ? string | number | Long - : T extends globalThis.Array - ? globalThis.Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends { $case: string } - ? { [K in keyof Omit]?: DeepPartial } & { - $case: T['$case'] - } - : T extends {} - ? { [K in keyof T]?: DeepPartial } - : Partial - -type KeysOfUnion = T extends T ? keyof T : never -export type Exact = P extends Builtin - ? P - : P & { [K in keyof P]: Exact } & { - [K in Exclude>]: never - } - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any - _m0.configure() -} - -function isSet(value: any): boolean { - return value !== null && value !== undefined -} diff --git a/stream/api/api_drpc.pb.go b/stream/api/api_drpc.pb.go deleted file mode 100644 index 3749cc95..00000000 --- a/stream/api/api_drpc.pb.go +++ /dev/null @@ -1,353 +0,0 @@ -// Code generated by protoc-gen-go-drpc. DO NOT EDIT. -// protoc-gen-go-drpc version: v0.0.34 -// source: github.com/aperturerobotics/bifrost/stream/api/api.proto - -package stream_api - -import ( - context "context" - errors "errors" - - drpc1 "github.com/planetscale/vtprotobuf/codec/drpc" - drpc "storj.io/drpc" - drpcerr "storj.io/drpc/drpcerr" -) - -type drpcEncoding_File_github_com_aperturerobotics_bifrost_stream_api_api_proto struct{} - -func (drpcEncoding_File_github_com_aperturerobotics_bifrost_stream_api_api_proto) Marshal(msg drpc.Message) ([]byte, error) { - return drpc1.Marshal(msg) -} - -func (drpcEncoding_File_github_com_aperturerobotics_bifrost_stream_api_api_proto) Unmarshal(buf []byte, msg drpc.Message) error { - return drpc1.Unmarshal(buf, msg) -} - -type DRPCStreamServiceClient interface { - DRPCConn() drpc.Conn - - ForwardStreams(ctx context.Context, in *ForwardStreamsRequest) (DRPCStreamService_ForwardStreamsClient, error) - ListenStreams(ctx context.Context, in *ListenStreamsRequest) (DRPCStreamService_ListenStreamsClient, error) - AcceptStream(ctx context.Context) (DRPCStreamService_AcceptStreamClient, error) - DialStream(ctx context.Context) (DRPCStreamService_DialStreamClient, error) -} - -type drpcStreamServiceClient struct { - cc drpc.Conn -} - -func NewDRPCStreamServiceClient(cc drpc.Conn) DRPCStreamServiceClient { - return &drpcStreamServiceClient{cc} -} - -func (c *drpcStreamServiceClient) DRPCConn() drpc.Conn { return c.cc } - -func (c *drpcStreamServiceClient) ForwardStreams(ctx context.Context, in *ForwardStreamsRequest) (DRPCStreamService_ForwardStreamsClient, error) { - stream, err := c.cc.NewStream(ctx, "/stream.api.StreamService/ForwardStreams", drpcEncoding_File_github_com_aperturerobotics_bifrost_stream_api_api_proto{}) - if err != nil { - return nil, err - } - x := &drpcStreamService_ForwardStreamsClient{stream} - if err := x.MsgSend(in, drpcEncoding_File_github_com_aperturerobotics_bifrost_stream_api_api_proto{}); err != nil { - return nil, err - } - if err := x.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type DRPCStreamService_ForwardStreamsClient interface { - drpc.Stream - Recv() (*ForwardStreamsResponse, error) -} - -type drpcStreamService_ForwardStreamsClient struct { - drpc.Stream -} - -func (x *drpcStreamService_ForwardStreamsClient) GetStream() drpc.Stream { - return x.Stream -} - -func (x *drpcStreamService_ForwardStreamsClient) Recv() (*ForwardStreamsResponse, error) { - m := new(ForwardStreamsResponse) - if err := x.MsgRecv(m, drpcEncoding_File_github_com_aperturerobotics_bifrost_stream_api_api_proto{}); err != nil { - return nil, err - } - return m, nil -} - -func (x *drpcStreamService_ForwardStreamsClient) RecvMsg(m *ForwardStreamsResponse) error { - return x.MsgRecv(m, drpcEncoding_File_github_com_aperturerobotics_bifrost_stream_api_api_proto{}) -} - -func (c *drpcStreamServiceClient) ListenStreams(ctx context.Context, in *ListenStreamsRequest) (DRPCStreamService_ListenStreamsClient, error) { - stream, err := c.cc.NewStream(ctx, "/stream.api.StreamService/ListenStreams", drpcEncoding_File_github_com_aperturerobotics_bifrost_stream_api_api_proto{}) - if err != nil { - return nil, err - } - x := &drpcStreamService_ListenStreamsClient{stream} - if err := x.MsgSend(in, drpcEncoding_File_github_com_aperturerobotics_bifrost_stream_api_api_proto{}); err != nil { - return nil, err - } - if err := x.CloseSend(); err != nil { - return nil, err - } - return x, nil -} - -type DRPCStreamService_ListenStreamsClient interface { - drpc.Stream - Recv() (*ListenStreamsResponse, error) -} - -type drpcStreamService_ListenStreamsClient struct { - drpc.Stream -} - -func (x *drpcStreamService_ListenStreamsClient) GetStream() drpc.Stream { - return x.Stream -} - -func (x *drpcStreamService_ListenStreamsClient) Recv() (*ListenStreamsResponse, error) { - m := new(ListenStreamsResponse) - if err := x.MsgRecv(m, drpcEncoding_File_github_com_aperturerobotics_bifrost_stream_api_api_proto{}); err != nil { - return nil, err - } - return m, nil -} - -func (x *drpcStreamService_ListenStreamsClient) RecvMsg(m *ListenStreamsResponse) error { - return x.MsgRecv(m, drpcEncoding_File_github_com_aperturerobotics_bifrost_stream_api_api_proto{}) -} - -func (c *drpcStreamServiceClient) AcceptStream(ctx context.Context) (DRPCStreamService_AcceptStreamClient, error) { - stream, err := c.cc.NewStream(ctx, "/stream.api.StreamService/AcceptStream", drpcEncoding_File_github_com_aperturerobotics_bifrost_stream_api_api_proto{}) - if err != nil { - return nil, err - } - x := &drpcStreamService_AcceptStreamClient{stream} - return x, nil -} - -type DRPCStreamService_AcceptStreamClient interface { - drpc.Stream - Send(*AcceptStreamRequest) error - Recv() (*AcceptStreamResponse, error) -} - -type drpcStreamService_AcceptStreamClient struct { - drpc.Stream -} - -func (x *drpcStreamService_AcceptStreamClient) GetStream() drpc.Stream { - return x.Stream -} - -func (x *drpcStreamService_AcceptStreamClient) Send(m *AcceptStreamRequest) error { - return x.MsgSend(m, drpcEncoding_File_github_com_aperturerobotics_bifrost_stream_api_api_proto{}) -} - -func (x *drpcStreamService_AcceptStreamClient) Recv() (*AcceptStreamResponse, error) { - m := new(AcceptStreamResponse) - if err := x.MsgRecv(m, drpcEncoding_File_github_com_aperturerobotics_bifrost_stream_api_api_proto{}); err != nil { - return nil, err - } - return m, nil -} - -func (x *drpcStreamService_AcceptStreamClient) RecvMsg(m *AcceptStreamResponse) error { - return x.MsgRecv(m, drpcEncoding_File_github_com_aperturerobotics_bifrost_stream_api_api_proto{}) -} - -func (c *drpcStreamServiceClient) DialStream(ctx context.Context) (DRPCStreamService_DialStreamClient, error) { - stream, err := c.cc.NewStream(ctx, "/stream.api.StreamService/DialStream", drpcEncoding_File_github_com_aperturerobotics_bifrost_stream_api_api_proto{}) - if err != nil { - return nil, err - } - x := &drpcStreamService_DialStreamClient{stream} - return x, nil -} - -type DRPCStreamService_DialStreamClient interface { - drpc.Stream - Send(*DialStreamRequest) error - Recv() (*DialStreamResponse, error) -} - -type drpcStreamService_DialStreamClient struct { - drpc.Stream -} - -func (x *drpcStreamService_DialStreamClient) GetStream() drpc.Stream { - return x.Stream -} - -func (x *drpcStreamService_DialStreamClient) Send(m *DialStreamRequest) error { - return x.MsgSend(m, drpcEncoding_File_github_com_aperturerobotics_bifrost_stream_api_api_proto{}) -} - -func (x *drpcStreamService_DialStreamClient) Recv() (*DialStreamResponse, error) { - m := new(DialStreamResponse) - if err := x.MsgRecv(m, drpcEncoding_File_github_com_aperturerobotics_bifrost_stream_api_api_proto{}); err != nil { - return nil, err - } - return m, nil -} - -func (x *drpcStreamService_DialStreamClient) RecvMsg(m *DialStreamResponse) error { - return x.MsgRecv(m, drpcEncoding_File_github_com_aperturerobotics_bifrost_stream_api_api_proto{}) -} - -type DRPCStreamServiceServer interface { - ForwardStreams(*ForwardStreamsRequest, DRPCStreamService_ForwardStreamsStream) error - ListenStreams(*ListenStreamsRequest, DRPCStreamService_ListenStreamsStream) error - AcceptStream(DRPCStreamService_AcceptStreamStream) error - DialStream(DRPCStreamService_DialStreamStream) error -} - -type DRPCStreamServiceUnimplementedServer struct{} - -func (s *DRPCStreamServiceUnimplementedServer) ForwardStreams(*ForwardStreamsRequest, DRPCStreamService_ForwardStreamsStream) error { - return drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) -} - -func (s *DRPCStreamServiceUnimplementedServer) ListenStreams(*ListenStreamsRequest, DRPCStreamService_ListenStreamsStream) error { - return drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) -} - -func (s *DRPCStreamServiceUnimplementedServer) AcceptStream(DRPCStreamService_AcceptStreamStream) error { - return drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) -} - -func (s *DRPCStreamServiceUnimplementedServer) DialStream(DRPCStreamService_DialStreamStream) error { - return drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) -} - -type DRPCStreamServiceDescription struct{} - -func (DRPCStreamServiceDescription) NumMethods() int { return 4 } - -func (DRPCStreamServiceDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver, interface{}, bool) { - switch n { - case 0: - return "/stream.api.StreamService/ForwardStreams", drpcEncoding_File_github_com_aperturerobotics_bifrost_stream_api_api_proto{}, - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return nil, srv.(DRPCStreamServiceServer). - ForwardStreams( - in1.(*ForwardStreamsRequest), - &drpcStreamService_ForwardStreamsStream{in2.(drpc.Stream)}, - ) - }, DRPCStreamServiceServer.ForwardStreams, true - case 1: - return "/stream.api.StreamService/ListenStreams", drpcEncoding_File_github_com_aperturerobotics_bifrost_stream_api_api_proto{}, - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return nil, srv.(DRPCStreamServiceServer). - ListenStreams( - in1.(*ListenStreamsRequest), - &drpcStreamService_ListenStreamsStream{in2.(drpc.Stream)}, - ) - }, DRPCStreamServiceServer.ListenStreams, true - case 2: - return "/stream.api.StreamService/AcceptStream", drpcEncoding_File_github_com_aperturerobotics_bifrost_stream_api_api_proto{}, - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return nil, srv.(DRPCStreamServiceServer). - AcceptStream( - &drpcStreamService_AcceptStreamStream{in1.(drpc.Stream)}, - ) - }, DRPCStreamServiceServer.AcceptStream, true - case 3: - return "/stream.api.StreamService/DialStream", drpcEncoding_File_github_com_aperturerobotics_bifrost_stream_api_api_proto{}, - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return nil, srv.(DRPCStreamServiceServer). - DialStream( - &drpcStreamService_DialStreamStream{in1.(drpc.Stream)}, - ) - }, DRPCStreamServiceServer.DialStream, true - default: - return "", nil, nil, nil, false - } -} - -func DRPCRegisterStreamService(mux drpc.Mux, impl DRPCStreamServiceServer) error { - return mux.Register(impl, DRPCStreamServiceDescription{}) -} - -type DRPCStreamService_ForwardStreamsStream interface { - drpc.Stream - Send(*ForwardStreamsResponse) error -} - -type drpcStreamService_ForwardStreamsStream struct { - drpc.Stream -} - -func (x *drpcStreamService_ForwardStreamsStream) Send(m *ForwardStreamsResponse) error { - return x.MsgSend(m, drpcEncoding_File_github_com_aperturerobotics_bifrost_stream_api_api_proto{}) -} - -type DRPCStreamService_ListenStreamsStream interface { - drpc.Stream - Send(*ListenStreamsResponse) error -} - -type drpcStreamService_ListenStreamsStream struct { - drpc.Stream -} - -func (x *drpcStreamService_ListenStreamsStream) Send(m *ListenStreamsResponse) error { - return x.MsgSend(m, drpcEncoding_File_github_com_aperturerobotics_bifrost_stream_api_api_proto{}) -} - -type DRPCStreamService_AcceptStreamStream interface { - drpc.Stream - Send(*AcceptStreamResponse) error - Recv() (*AcceptStreamRequest, error) -} - -type drpcStreamService_AcceptStreamStream struct { - drpc.Stream -} - -func (x *drpcStreamService_AcceptStreamStream) Send(m *AcceptStreamResponse) error { - return x.MsgSend(m, drpcEncoding_File_github_com_aperturerobotics_bifrost_stream_api_api_proto{}) -} - -func (x *drpcStreamService_AcceptStreamStream) Recv() (*AcceptStreamRequest, error) { - m := new(AcceptStreamRequest) - if err := x.MsgRecv(m, drpcEncoding_File_github_com_aperturerobotics_bifrost_stream_api_api_proto{}); err != nil { - return nil, err - } - return m, nil -} - -func (x *drpcStreamService_AcceptStreamStream) RecvMsg(m *AcceptStreamRequest) error { - return x.MsgRecv(m, drpcEncoding_File_github_com_aperturerobotics_bifrost_stream_api_api_proto{}) -} - -type DRPCStreamService_DialStreamStream interface { - drpc.Stream - Send(*DialStreamResponse) error - Recv() (*DialStreamRequest, error) -} - -type drpcStreamService_DialStreamStream struct { - drpc.Stream -} - -func (x *drpcStreamService_DialStreamStream) Send(m *DialStreamResponse) error { - return x.MsgSend(m, drpcEncoding_File_github_com_aperturerobotics_bifrost_stream_api_api_proto{}) -} - -func (x *drpcStreamService_DialStreamStream) Recv() (*DialStreamRequest, error) { - m := new(DialStreamRequest) - if err := x.MsgRecv(m, drpcEncoding_File_github_com_aperturerobotics_bifrost_stream_api_api_proto{}); err != nil { - return nil, err - } - return m, nil -} - -func (x *drpcStreamService_DialStreamStream) RecvMsg(m *DialStreamRequest) error { - return x.MsgRecv(m, drpcEncoding_File_github_com_aperturerobotics_bifrost_stream_api_api_proto{}) -} diff --git a/stream/api/api_pb.ts b/stream/api/api_pb.ts new file mode 100644 index 00000000..b262a1ae --- /dev/null +++ b/stream/api/api_pb.ts @@ -0,0 +1,473 @@ +// @generated by protoc-gen-es v1.8.0 with parameter "target=ts,ts_nocheck=false" +// @generated from file github.com/aperturerobotics/bifrost/stream/api/api.proto (package stream.api, syntax proto3) +/* eslint-disable */ + +import type { + BinaryReadOptions, + FieldList, + JsonReadOptions, + JsonValue, + PartialMessage, + PlainMessage, +} from '@bufbuild/protobuf' +import { Message, proto3 } from '@bufbuild/protobuf' +import { Config } from '../forwarding/forwarding_pb.js' +import { ControllerStatus } from '../../../controllerbus/controller/exec/exec_pb.js' +import { Config as Config$1 } from '../listening/listening_pb.js' +import { Config as Config$2 } from './accept/accept_pb.js' +import { Data } from './rpc/rpc_pb.js' +import { Config as Config$3 } from './dial/dial_pb.js' + +/** + * ForwardStreamsRequest is the request type for ForwardStreams. + * + * @generated from message stream.api.ForwardStreamsRequest + */ +export class ForwardStreamsRequest extends Message { + /** + * @generated from field: stream.forwarding.Config forwarding_config = 1; + */ + forwardingConfig?: Config + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'stream.api.ForwardStreamsRequest' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: 'forwarding_config', kind: 'message', T: Config }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): ForwardStreamsRequest { + return new ForwardStreamsRequest().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): ForwardStreamsRequest { + return new ForwardStreamsRequest().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): ForwardStreamsRequest { + return new ForwardStreamsRequest().fromJsonString(jsonString, options) + } + + static equals( + a: ForwardStreamsRequest | PlainMessage | undefined, + b: ForwardStreamsRequest | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(ForwardStreamsRequest, a, b) + } +} + +/** + * ForwardStreamsResponse is the response type for ForwardStreams. + * + * @generated from message stream.api.ForwardStreamsResponse + */ +export class ForwardStreamsResponse extends Message { + /** + * ControllerStatus is the status of the forwarding controller. + * + * @generated from field: controller.exec.ControllerStatus controller_status = 1; + */ + controllerStatus = ControllerStatus.ControllerStatus_UNKNOWN + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'stream.api.ForwardStreamsResponse' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { + no: 1, + name: 'controller_status', + kind: 'enum', + T: proto3.getEnumType(ControllerStatus), + }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): ForwardStreamsResponse { + return new ForwardStreamsResponse().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): ForwardStreamsResponse { + return new ForwardStreamsResponse().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): ForwardStreamsResponse { + return new ForwardStreamsResponse().fromJsonString(jsonString, options) + } + + static equals( + a: + | ForwardStreamsResponse + | PlainMessage + | undefined, + b: + | ForwardStreamsResponse + | PlainMessage + | undefined, + ): boolean { + return proto3.util.equals(ForwardStreamsResponse, a, b) + } +} + +/** + * ListenStreamsRequest is the request type for ListenStreams. + * + * @generated from message stream.api.ListenStreamsRequest + */ +export class ListenStreamsRequest extends Message { + /** + * @generated from field: stream.listening.Config listening_config = 1; + */ + listeningConfig?: Config$1 + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'stream.api.ListenStreamsRequest' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: 'listening_config', kind: 'message', T: Config$1 }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): ListenStreamsRequest { + return new ListenStreamsRequest().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): ListenStreamsRequest { + return new ListenStreamsRequest().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): ListenStreamsRequest { + return new ListenStreamsRequest().fromJsonString(jsonString, options) + } + + static equals( + a: ListenStreamsRequest | PlainMessage | undefined, + b: ListenStreamsRequest | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(ListenStreamsRequest, a, b) + } +} + +/** + * ListenStreamsResponse is the response type for ListenStreams. + * + * @generated from message stream.api.ListenStreamsResponse + */ +export class ListenStreamsResponse extends Message { + /** + * ControllerStatus is the status of the forwarding controller. + * + * @generated from field: controller.exec.ControllerStatus controller_status = 1; + */ + controllerStatus = ControllerStatus.ControllerStatus_UNKNOWN + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'stream.api.ListenStreamsResponse' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { + no: 1, + name: 'controller_status', + kind: 'enum', + T: proto3.getEnumType(ControllerStatus), + }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): ListenStreamsResponse { + return new ListenStreamsResponse().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): ListenStreamsResponse { + return new ListenStreamsResponse().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): ListenStreamsResponse { + return new ListenStreamsResponse().fromJsonString(jsonString, options) + } + + static equals( + a: ListenStreamsResponse | PlainMessage | undefined, + b: ListenStreamsResponse | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(ListenStreamsResponse, a, b) + } +} + +/** + * AcceptStreamRequest is the request type for AcceptStream. + * + * @generated from message stream.api.AcceptStreamRequest + */ +export class AcceptStreamRequest extends Message { + /** + * Config is the configuration for the accept. + * The first packet will contain this value. + * + * @generated from field: stream.api.accept.Config config = 1; + */ + config?: Config$2 + + /** + * Data is a data packet. + * + * @generated from field: stream.api.rpc.Data data = 2; + */ + data?: Data + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'stream.api.AcceptStreamRequest' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: 'config', kind: 'message', T: Config$2 }, + { no: 2, name: 'data', kind: 'message', T: Data }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): AcceptStreamRequest { + return new AcceptStreamRequest().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): AcceptStreamRequest { + return new AcceptStreamRequest().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): AcceptStreamRequest { + return new AcceptStreamRequest().fromJsonString(jsonString, options) + } + + static equals( + a: AcceptStreamRequest | PlainMessage | undefined, + b: AcceptStreamRequest | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(AcceptStreamRequest, a, b) + } +} + +/** + * AcceptStreamResponse is the response type for AcceptStream. + * + * @generated from message stream.api.AcceptStreamResponse + */ +export class AcceptStreamResponse extends Message { + /** + * Data is a data packet. + * + * @generated from field: stream.api.rpc.Data data = 1; + */ + data?: Data + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'stream.api.AcceptStreamResponse' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: 'data', kind: 'message', T: Data }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): AcceptStreamResponse { + return new AcceptStreamResponse().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): AcceptStreamResponse { + return new AcceptStreamResponse().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): AcceptStreamResponse { + return new AcceptStreamResponse().fromJsonString(jsonString, options) + } + + static equals( + a: AcceptStreamResponse | PlainMessage | undefined, + b: AcceptStreamResponse | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(AcceptStreamResponse, a, b) + } +} + +/** + * DialStreamRequest is the request type for DialStream. + * + * @generated from message stream.api.DialStreamRequest + */ +export class DialStreamRequest extends Message { + /** + * Config is the configuration for the dial. + * The first packet will contain this value. + * + * @generated from field: stream.api.dial.Config config = 1; + */ + config?: Config$3 + + /** + * Data is a data packet. + * + * @generated from field: stream.api.rpc.Data data = 2; + */ + data?: Data + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'stream.api.DialStreamRequest' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: 'config', kind: 'message', T: Config$3 }, + { no: 2, name: 'data', kind: 'message', T: Data }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): DialStreamRequest { + return new DialStreamRequest().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): DialStreamRequest { + return new DialStreamRequest().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): DialStreamRequest { + return new DialStreamRequest().fromJsonString(jsonString, options) + } + + static equals( + a: DialStreamRequest | PlainMessage | undefined, + b: DialStreamRequest | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(DialStreamRequest, a, b) + } +} + +/** + * DialStreamResponse is the response type for DialStream. + * + * @generated from message stream.api.DialStreamResponse + */ +export class DialStreamResponse extends Message { + /** + * Data is a data packet. + * + * @generated from field: stream.api.rpc.Data data = 1; + */ + data?: Data + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'stream.api.DialStreamResponse' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: 'data', kind: 'message', T: Data }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): DialStreamResponse { + return new DialStreamResponse().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): DialStreamResponse { + return new DialStreamResponse().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): DialStreamResponse { + return new DialStreamResponse().fromJsonString(jsonString, options) + } + + static equals( + a: DialStreamResponse | PlainMessage | undefined, + b: DialStreamResponse | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(DialStreamResponse, a, b) + } +} diff --git a/stream/api/api_srpc.pb.go b/stream/api/api_srpc.pb.go index fde45d7e..99f6c88a 100644 --- a/stream/api/api_srpc.pb.go +++ b/stream/api/api_srpc.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-srpc. DO NOT EDIT. -// protoc-gen-srpc version: v0.27.3 +// protoc-gen-srpc version: v0.31.2 // source: github.com/aperturerobotics/bifrost/stream/api/api.proto package stream_api diff --git a/stream/api/api_srpc.pb.ts b/stream/api/api_srpc.pb.ts new file mode 100644 index 00000000..9273fb62 --- /dev/null +++ b/stream/api/api_srpc.pb.ts @@ -0,0 +1,224 @@ +// @generated by protoc-gen-es-starpc none with parameter "target=ts,ts_nocheck=false" +// @generated from file github.com/aperturerobotics/bifrost/stream/api/api.proto (package stream.api, syntax proto3) +/* eslint-disable */ + +import { + AcceptStreamRequest, + AcceptStreamResponse, + DialStreamRequest, + DialStreamResponse, + ForwardStreamsRequest, + ForwardStreamsResponse, + ListenStreamsRequest, + ListenStreamsResponse, +} from './api_pb.js' +import type { PartialMessage } from '@bufbuild/protobuf' +import { MethodKind } from '@bufbuild/protobuf' +import { + buildDecodeMessageTransform, + buildEncodeMessageTransform, + MessageStream, + ProtoRpc, +} from 'starpc' + +/** + * StreamService is the bifrost stream service. + * + * @generated from service stream.api.StreamService + */ +export const StreamServiceDefinition = { + typeName: 'stream.api.StreamService', + methods: { + /** + * ForwardStreams forwards streams to the target multiaddress. + * Handles HandleMountedStream directives by contacting the target. + * + * @generated from rpc stream.api.StreamService.ForwardStreams + */ + ForwardStreams: { + name: 'ForwardStreams', + I: ForwardStreamsRequest, + O: ForwardStreamsResponse, + kind: MethodKind.ServerStreaming, + }, + /** + * ListenStreams listens for connections to the multiaddress. + * Forwards the connections to a remote peer with a protocol ID. + * + * @generated from rpc stream.api.StreamService.ListenStreams + */ + ListenStreams: { + name: 'ListenStreams', + I: ListenStreamsRequest, + O: ListenStreamsResponse, + kind: MethodKind.ServerStreaming, + }, + /** + * AcceptStream accepts an incoming stream. + * Stream data is sent over the request / response streams. + * + * @generated from rpc stream.api.StreamService.AcceptStream + */ + AcceptStream: { + name: 'AcceptStream', + I: AcceptStreamRequest, + O: AcceptStreamResponse, + kind: MethodKind.BiDiStreaming, + }, + /** + * DialStream dials a outgoing stream. + * Stream data is sent over the request / response streams. + * + * @generated from rpc stream.api.StreamService.DialStream + */ + DialStream: { + name: 'DialStream', + I: DialStreamRequest, + O: DialStreamResponse, + kind: MethodKind.BiDiStreaming, + }, + }, +} as const + +/** + * StreamService is the bifrost stream service. + * + * @generated from service stream.api.StreamService + */ +export interface StreamService { + /** + * ForwardStreams forwards streams to the target multiaddress. + * Handles HandleMountedStream directives by contacting the target. + * + * @generated from rpc stream.api.StreamService.ForwardStreams + */ + ForwardStreams( + request: PartialMessage, + abortSignal?: AbortSignal, + ): MessageStream + + /** + * ListenStreams listens for connections to the multiaddress. + * Forwards the connections to a remote peer with a protocol ID. + * + * @generated from rpc stream.api.StreamService.ListenStreams + */ + ListenStreams( + request: PartialMessage, + abortSignal?: AbortSignal, + ): MessageStream + + /** + * AcceptStream accepts an incoming stream. + * Stream data is sent over the request / response streams. + * + * @generated from rpc stream.api.StreamService.AcceptStream + */ + AcceptStream( + request: MessageStream, + abortSignal?: AbortSignal, + ): MessageStream + + /** + * DialStream dials a outgoing stream. + * Stream data is sent over the request / response streams. + * + * @generated from rpc stream.api.StreamService.DialStream + */ + DialStream( + request: MessageStream, + abortSignal?: AbortSignal, + ): MessageStream +} + +export const StreamServiceServiceName = StreamServiceDefinition.typeName + +export class StreamServiceClient implements StreamService { + private readonly rpc: ProtoRpc + private readonly service: string + constructor(rpc: ProtoRpc, opts?: { service?: string }) { + this.service = opts?.service || StreamServiceServiceName + this.rpc = rpc + this.ForwardStreams = this.ForwardStreams.bind(this) + this.ListenStreams = this.ListenStreams.bind(this) + this.AcceptStream = this.AcceptStream.bind(this) + this.DialStream = this.DialStream.bind(this) + } + /** + * ForwardStreams forwards streams to the target multiaddress. + * Handles HandleMountedStream directives by contacting the target. + * + * @generated from rpc stream.api.StreamService.ForwardStreams + */ + ForwardStreams( + request: PartialMessage, + abortSignal?: AbortSignal, + ): MessageStream { + const requestMsg = new ForwardStreamsRequest(request) + const result = this.rpc.serverStreamingRequest( + this.service, + StreamServiceDefinition.methods.ForwardStreams.name, + requestMsg.toBinary(), + abortSignal || undefined, + ) + return buildDecodeMessageTransform(ForwardStreamsResponse)(result) + } + + /** + * ListenStreams listens for connections to the multiaddress. + * Forwards the connections to a remote peer with a protocol ID. + * + * @generated from rpc stream.api.StreamService.ListenStreams + */ + ListenStreams( + request: PartialMessage, + abortSignal?: AbortSignal, + ): MessageStream { + const requestMsg = new ListenStreamsRequest(request) + const result = this.rpc.serverStreamingRequest( + this.service, + StreamServiceDefinition.methods.ListenStreams.name, + requestMsg.toBinary(), + abortSignal || undefined, + ) + return buildDecodeMessageTransform(ListenStreamsResponse)(result) + } + + /** + * AcceptStream accepts an incoming stream. + * Stream data is sent over the request / response streams. + * + * @generated from rpc stream.api.StreamService.AcceptStream + */ + AcceptStream( + request: MessageStream, + abortSignal?: AbortSignal, + ): MessageStream { + const result = this.rpc.bidirectionalStreamingRequest( + this.service, + StreamServiceDefinition.methods.AcceptStream.name, + buildEncodeMessageTransform(AcceptStreamRequest)(request), + abortSignal || undefined, + ) + return buildDecodeMessageTransform(AcceptStreamResponse)(result) + } + + /** + * DialStream dials a outgoing stream. + * Stream data is sent over the request / response streams. + * + * @generated from rpc stream.api.StreamService.DialStream + */ + DialStream( + request: MessageStream, + abortSignal?: AbortSignal, + ): MessageStream { + const result = this.rpc.bidirectionalStreamingRequest( + this.service, + StreamServiceDefinition.methods.DialStream.name, + buildEncodeMessageTransform(DialStreamRequest)(request), + abortSignal || undefined, + ) + return buildDecodeMessageTransform(DialStreamResponse)(result) + } +} diff --git a/stream/api/api_vtproto.pb.go b/stream/api/api_vtproto.pb.go deleted file mode 100644 index ad06d5f6..00000000 --- a/stream/api/api_vtproto.pb.go +++ /dev/null @@ -1,1818 +0,0 @@ -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// protoc-gen-go-vtproto version: v0.6.0 -// source: github.com/aperturerobotics/bifrost/stream/api/api.proto - -package stream_api - -import ( - fmt "fmt" - io "io" - - accept "github.com/aperturerobotics/bifrost/stream/api/accept" - dial "github.com/aperturerobotics/bifrost/stream/api/dial" - rpc "github.com/aperturerobotics/bifrost/stream/api/rpc" - forwarding "github.com/aperturerobotics/bifrost/stream/forwarding" - listening "github.com/aperturerobotics/bifrost/stream/listening" - exec "github.com/aperturerobotics/controllerbus/controller/exec" - protohelpers "github.com/planetscale/vtprotobuf/protohelpers" - proto "google.golang.org/protobuf/proto" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) -) - -func (m *ForwardStreamsRequest) CloneVT() *ForwardStreamsRequest { - if m == nil { - return (*ForwardStreamsRequest)(nil) - } - r := new(ForwardStreamsRequest) - if rhs := m.ForwardingConfig; rhs != nil { - if vtpb, ok := interface{}(rhs).(interface{ CloneVT() *forwarding.Config }); ok { - r.ForwardingConfig = vtpb.CloneVT() - } else { - r.ForwardingConfig = proto.Clone(rhs).(*forwarding.Config) - } - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *ForwardStreamsRequest) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *ForwardStreamsResponse) CloneVT() *ForwardStreamsResponse { - if m == nil { - return (*ForwardStreamsResponse)(nil) - } - r := new(ForwardStreamsResponse) - r.ControllerStatus = m.ControllerStatus - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *ForwardStreamsResponse) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *ListenStreamsRequest) CloneVT() *ListenStreamsRequest { - if m == nil { - return (*ListenStreamsRequest)(nil) - } - r := new(ListenStreamsRequest) - if rhs := m.ListeningConfig; rhs != nil { - if vtpb, ok := interface{}(rhs).(interface{ CloneVT() *listening.Config }); ok { - r.ListeningConfig = vtpb.CloneVT() - } else { - r.ListeningConfig = proto.Clone(rhs).(*listening.Config) - } - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *ListenStreamsRequest) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *ListenStreamsResponse) CloneVT() *ListenStreamsResponse { - if m == nil { - return (*ListenStreamsResponse)(nil) - } - r := new(ListenStreamsResponse) - r.ControllerStatus = m.ControllerStatus - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *ListenStreamsResponse) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *AcceptStreamRequest) CloneVT() *AcceptStreamRequest { - if m == nil { - return (*AcceptStreamRequest)(nil) - } - r := new(AcceptStreamRequest) - if rhs := m.Config; rhs != nil { - if vtpb, ok := interface{}(rhs).(interface{ CloneVT() *accept.Config }); ok { - r.Config = vtpb.CloneVT() - } else { - r.Config = proto.Clone(rhs).(*accept.Config) - } - } - if rhs := m.Data; rhs != nil { - if vtpb, ok := interface{}(rhs).(interface{ CloneVT() *rpc.Data }); ok { - r.Data = vtpb.CloneVT() - } else { - r.Data = proto.Clone(rhs).(*rpc.Data) - } - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *AcceptStreamRequest) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *AcceptStreamResponse) CloneVT() *AcceptStreamResponse { - if m == nil { - return (*AcceptStreamResponse)(nil) - } - r := new(AcceptStreamResponse) - if rhs := m.Data; rhs != nil { - if vtpb, ok := interface{}(rhs).(interface{ CloneVT() *rpc.Data }); ok { - r.Data = vtpb.CloneVT() - } else { - r.Data = proto.Clone(rhs).(*rpc.Data) - } - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *AcceptStreamResponse) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *DialStreamRequest) CloneVT() *DialStreamRequest { - if m == nil { - return (*DialStreamRequest)(nil) - } - r := new(DialStreamRequest) - if rhs := m.Config; rhs != nil { - if vtpb, ok := interface{}(rhs).(interface{ CloneVT() *dial.Config }); ok { - r.Config = vtpb.CloneVT() - } else { - r.Config = proto.Clone(rhs).(*dial.Config) - } - } - if rhs := m.Data; rhs != nil { - if vtpb, ok := interface{}(rhs).(interface{ CloneVT() *rpc.Data }); ok { - r.Data = vtpb.CloneVT() - } else { - r.Data = proto.Clone(rhs).(*rpc.Data) - } - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *DialStreamRequest) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *DialStreamResponse) CloneVT() *DialStreamResponse { - if m == nil { - return (*DialStreamResponse)(nil) - } - r := new(DialStreamResponse) - if rhs := m.Data; rhs != nil { - if vtpb, ok := interface{}(rhs).(interface{ CloneVT() *rpc.Data }); ok { - r.Data = vtpb.CloneVT() - } else { - r.Data = proto.Clone(rhs).(*rpc.Data) - } - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *DialStreamResponse) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (this *ForwardStreamsRequest) EqualVT(that *ForwardStreamsRequest) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if equal, ok := interface{}(this.ForwardingConfig).(interface{ EqualVT(*forwarding.Config) bool }); ok { - if !equal.EqualVT(that.ForwardingConfig) { - return false - } - } else if !proto.Equal(this.ForwardingConfig, that.ForwardingConfig) { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *ForwardStreamsRequest) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*ForwardStreamsRequest) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *ForwardStreamsResponse) EqualVT(that *ForwardStreamsResponse) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.ControllerStatus != that.ControllerStatus { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *ForwardStreamsResponse) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*ForwardStreamsResponse) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *ListenStreamsRequest) EqualVT(that *ListenStreamsRequest) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if equal, ok := interface{}(this.ListeningConfig).(interface{ EqualVT(*listening.Config) bool }); ok { - if !equal.EqualVT(that.ListeningConfig) { - return false - } - } else if !proto.Equal(this.ListeningConfig, that.ListeningConfig) { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *ListenStreamsRequest) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*ListenStreamsRequest) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *ListenStreamsResponse) EqualVT(that *ListenStreamsResponse) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.ControllerStatus != that.ControllerStatus { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *ListenStreamsResponse) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*ListenStreamsResponse) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *AcceptStreamRequest) EqualVT(that *AcceptStreamRequest) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if equal, ok := interface{}(this.Config).(interface{ EqualVT(*accept.Config) bool }); ok { - if !equal.EqualVT(that.Config) { - return false - } - } else if !proto.Equal(this.Config, that.Config) { - return false - } - if equal, ok := interface{}(this.Data).(interface{ EqualVT(*rpc.Data) bool }); ok { - if !equal.EqualVT(that.Data) { - return false - } - } else if !proto.Equal(this.Data, that.Data) { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *AcceptStreamRequest) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*AcceptStreamRequest) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *AcceptStreamResponse) EqualVT(that *AcceptStreamResponse) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if equal, ok := interface{}(this.Data).(interface{ EqualVT(*rpc.Data) bool }); ok { - if !equal.EqualVT(that.Data) { - return false - } - } else if !proto.Equal(this.Data, that.Data) { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *AcceptStreamResponse) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*AcceptStreamResponse) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *DialStreamRequest) EqualVT(that *DialStreamRequest) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if equal, ok := interface{}(this.Config).(interface{ EqualVT(*dial.Config) bool }); ok { - if !equal.EqualVT(that.Config) { - return false - } - } else if !proto.Equal(this.Config, that.Config) { - return false - } - if equal, ok := interface{}(this.Data).(interface{ EqualVT(*rpc.Data) bool }); ok { - if !equal.EqualVT(that.Data) { - return false - } - } else if !proto.Equal(this.Data, that.Data) { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *DialStreamRequest) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*DialStreamRequest) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *DialStreamResponse) EqualVT(that *DialStreamResponse) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if equal, ok := interface{}(this.Data).(interface{ EqualVT(*rpc.Data) bool }); ok { - if !equal.EqualVT(that.Data) { - return false - } - } else if !proto.Equal(this.Data, that.Data) { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *DialStreamResponse) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*DialStreamResponse) - if !ok { - return false - } - return this.EqualVT(that) -} -func (m *ForwardStreamsRequest) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ForwardStreamsRequest) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *ForwardStreamsRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.ForwardingConfig != nil { - if vtmsg, ok := interface{}(m.ForwardingConfig).(interface { - MarshalToSizedBufferVT([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.ForwardingConfig) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ForwardStreamsResponse) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ForwardStreamsResponse) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *ForwardStreamsResponse) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.ControllerStatus != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.ControllerStatus)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *ListenStreamsRequest) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ListenStreamsRequest) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *ListenStreamsRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.ListeningConfig != nil { - if vtmsg, ok := interface{}(m.ListeningConfig).(interface { - MarshalToSizedBufferVT([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.ListeningConfig) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ListenStreamsResponse) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ListenStreamsResponse) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *ListenStreamsResponse) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.ControllerStatus != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.ControllerStatus)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *AcceptStreamRequest) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *AcceptStreamRequest) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *AcceptStreamRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Data != nil { - if vtmsg, ok := interface{}(m.Data).(interface { - MarshalToSizedBufferVT([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.Data) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0x12 - } - if m.Config != nil { - if vtmsg, ok := interface{}(m.Config).(interface { - MarshalToSizedBufferVT([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.Config) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *AcceptStreamResponse) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *AcceptStreamResponse) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *AcceptStreamResponse) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Data != nil { - if vtmsg, ok := interface{}(m.Data).(interface { - MarshalToSizedBufferVT([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.Data) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *DialStreamRequest) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *DialStreamRequest) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *DialStreamRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Data != nil { - if vtmsg, ok := interface{}(m.Data).(interface { - MarshalToSizedBufferVT([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.Data) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0x12 - } - if m.Config != nil { - if vtmsg, ok := interface{}(m.Config).(interface { - MarshalToSizedBufferVT([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.Config) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *DialStreamResponse) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *DialStreamResponse) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *DialStreamResponse) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Data != nil { - if vtmsg, ok := interface{}(m.Data).(interface { - MarshalToSizedBufferVT([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.Data) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ForwardStreamsRequest) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ForwardingConfig != nil { - if size, ok := interface{}(m.ForwardingConfig).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.ForwardingConfig) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *ForwardStreamsResponse) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ControllerStatus != 0 { - n += 1 + protohelpers.SizeOfVarint(uint64(m.ControllerStatus)) - } - n += len(m.unknownFields) - return n -} - -func (m *ListenStreamsRequest) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ListeningConfig != nil { - if size, ok := interface{}(m.ListeningConfig).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.ListeningConfig) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *ListenStreamsResponse) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ControllerStatus != 0 { - n += 1 + protohelpers.SizeOfVarint(uint64(m.ControllerStatus)) - } - n += len(m.unknownFields) - return n -} - -func (m *AcceptStreamRequest) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Config != nil { - if size, ok := interface{}(m.Config).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.Config) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.Data != nil { - if size, ok := interface{}(m.Data).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.Data) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *AcceptStreamResponse) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Data != nil { - if size, ok := interface{}(m.Data).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.Data) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *DialStreamRequest) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Config != nil { - if size, ok := interface{}(m.Config).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.Config) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.Data != nil { - if size, ok := interface{}(m.Data).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.Data) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *DialStreamResponse) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Data != nil { - if size, ok := interface{}(m.Data).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.Data) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *ForwardStreamsRequest) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ForwardStreamsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ForwardStreamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ForwardingConfig", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.ForwardingConfig == nil { - m.ForwardingConfig = &forwarding.Config{} - } - if unmarshal, ok := interface{}(m.ForwardingConfig).(interface { - UnmarshalVT([]byte) error - }); ok { - if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - } else { - if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.ForwardingConfig); err != nil { - return err - } - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ForwardStreamsResponse) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ForwardStreamsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ForwardStreamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ControllerStatus", wireType) - } - m.ControllerStatus = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ControllerStatus |= exec.ControllerStatus(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ListenStreamsRequest) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ListenStreamsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ListenStreamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListeningConfig", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.ListeningConfig == nil { - m.ListeningConfig = &listening.Config{} - } - if unmarshal, ok := interface{}(m.ListeningConfig).(interface { - UnmarshalVT([]byte) error - }); ok { - if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - } else { - if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.ListeningConfig); err != nil { - return err - } - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ListenStreamsResponse) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ListenStreamsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ListenStreamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ControllerStatus", wireType) - } - m.ControllerStatus = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ControllerStatus |= exec.ControllerStatus(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *AcceptStreamRequest) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: AcceptStreamRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AcceptStreamRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Config", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Config == nil { - m.Config = &accept.Config{} - } - if unmarshal, ok := interface{}(m.Config).(interface { - UnmarshalVT([]byte) error - }); ok { - if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - } else { - if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.Config); err != nil { - return err - } - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Data == nil { - m.Data = &rpc.Data{} - } - if unmarshal, ok := interface{}(m.Data).(interface { - UnmarshalVT([]byte) error - }); ok { - if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - } else { - if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.Data); err != nil { - return err - } - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *AcceptStreamResponse) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: AcceptStreamResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: AcceptStreamResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Data == nil { - m.Data = &rpc.Data{} - } - if unmarshal, ok := interface{}(m.Data).(interface { - UnmarshalVT([]byte) error - }); ok { - if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - } else { - if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.Data); err != nil { - return err - } - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DialStreamRequest) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: DialStreamRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DialStreamRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Config", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Config == nil { - m.Config = &dial.Config{} - } - if unmarshal, ok := interface{}(m.Config).(interface { - UnmarshalVT([]byte) error - }); ok { - if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - } else { - if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.Config); err != nil { - return err - } - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Data == nil { - m.Data = &rpc.Data{} - } - if unmarshal, ok := interface{}(m.Data).(interface { - UnmarshalVT([]byte) error - }); ok { - if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - } else { - if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.Data); err != nil { - return err - } - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DialStreamResponse) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: DialStreamResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DialStreamResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Data == nil { - m.Data = &rpc.Data{} - } - if unmarshal, ok := interface{}(m.Data).(interface { - UnmarshalVT([]byte) error - }); ok { - if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - } else { - if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.Data); err != nil { - return err - } - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} diff --git a/stream/api/dial/dial.pb.go b/stream/api/dial/dial.pb.go index 40473f8d..60f5798b 100644 --- a/stream/api/dial/dial.pb.go +++ b/stream/api/dial/dial.pb.go @@ -1,42 +1,30 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0-devel -// protoc v5.26.1 +// Code generated by protoc-gen-go-lite. DO NOT EDIT. +// protoc-gen-go-lite version: v0.4.5 // source: github.com/aperturerobotics/bifrost/stream/api/dial/dial.proto package stream_api_dial import ( - reflect "reflect" - sync "sync" + io "io" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) + protobuf_go_lite "github.com/aperturerobotics/protobuf-go-lite" + json "github.com/aperturerobotics/protobuf-go-lite/json" + errors "github.com/pkg/errors" ) // Config configures the dial controller. type Config struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + unknownFields []byte // PeerId is the remote peer ID to dial. - PeerId string `protobuf:"bytes,1,opt,name=peer_id,json=peerId,proto3" json:"peer_id,omitempty"` + PeerId string `protobuf:"bytes,1,opt,name=peer_id,json=peerId,proto3" json:"peerId,omitempty"` // LocalPeerId is the peer ID to dial with. // Can be empty to accept any loaded peer. - LocalPeerId string `protobuf:"bytes,2,opt,name=local_peer_id,json=localPeerId,proto3" json:"local_peer_id,omitempty"` + LocalPeerId string `protobuf:"bytes,2,opt,name=local_peer_id,json=localPeerId,proto3" json:"localPeerId,omitempty"` // ProtocolId is the protocol ID to dial with. - ProtocolId string `protobuf:"bytes,3,opt,name=protocol_id,json=protocolId,proto3" json:"protocol_id,omitempty"` + ProtocolId string `protobuf:"bytes,3,opt,name=protocol_id,json=protocolId,proto3" json:"protocolId,omitempty"` // TransportId constrains the transport ID to dial with. // Can be empty. - TransportId uint64 `protobuf:"varint,4,opt,name=transport_id,json=transportId,proto3" json:"transport_id,omitempty"` + TransportId uint64 `protobuf:"varint,4,opt,name=transport_id,json=transportId,proto3" json:"transportId,omitempty"` // Encrypted indicates the stream should be encrypted. Encrypted bool `protobuf:"varint,5,opt,name=encrypted,proto3" json:"encrypted,omitempty"` // Reliable indicates the stream should be reliable. @@ -45,36 +33,10 @@ type Config struct { func (x *Config) Reset() { *x = Config{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_stream_api_dial_dial_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Config) String() string { - return protoimpl.X.MessageStringOf(x) } func (*Config) ProtoMessage() {} -func (x *Config) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_stream_api_dial_dial_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 Config.ProtoReflect.Descriptor instead. -func (*Config) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_stream_api_dial_dial_proto_rawDescGZIP(), []int{0} -} - func (x *Config) GetPeerId() string { if x != nil { return x.PeerId @@ -117,88 +79,458 @@ func (x *Config) GetReliable() bool { return false } -var File_github_com_aperturerobotics_bifrost_stream_api_dial_dial_proto protoreflect.FileDescriptor - -var file_github_com_aperturerobotics_bifrost_stream_api_dial_dial_proto_rawDesc = []byte{ - 0x0a, 0x3e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, - 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x62, 0x69, - 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2f, 0x61, 0x70, 0x69, - 0x2f, 0x64, 0x69, 0x61, 0x6c, 0x2f, 0x64, 0x69, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x12, 0x0f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x64, 0x69, 0x61, - 0x6c, 0x22, 0xc3, 0x01, 0x0a, 0x06, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x17, 0x0a, 0x07, - 0x70, 0x65, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, - 0x65, 0x65, 0x72, 0x49, 0x64, 0x12, 0x22, 0x0a, 0x0d, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x5f, 0x70, - 0x65, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6c, 0x6f, - 0x63, 0x61, 0x6c, 0x50, 0x65, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x49, 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x74, 0x72, - 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, - 0x52, 0x0b, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x49, 0x64, 0x12, 0x1c, 0x0a, - 0x09, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x09, 0x65, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x65, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x72, - 0x65, 0x6c, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, - 0x65, 0x6c, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_github_com_aperturerobotics_bifrost_stream_api_dial_dial_proto_rawDescOnce sync.Once - file_github_com_aperturerobotics_bifrost_stream_api_dial_dial_proto_rawDescData = file_github_com_aperturerobotics_bifrost_stream_api_dial_dial_proto_rawDesc -) +func (m *Config) CloneVT() *Config { + if m == nil { + return (*Config)(nil) + } + r := new(Config) + r.PeerId = m.PeerId + r.LocalPeerId = m.LocalPeerId + r.ProtocolId = m.ProtocolId + r.TransportId = m.TransportId + r.Encrypted = m.Encrypted + r.Reliable = m.Reliable + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} -func file_github_com_aperturerobotics_bifrost_stream_api_dial_dial_proto_rawDescGZIP() []byte { - file_github_com_aperturerobotics_bifrost_stream_api_dial_dial_proto_rawDescOnce.Do(func() { - file_github_com_aperturerobotics_bifrost_stream_api_dial_dial_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_aperturerobotics_bifrost_stream_api_dial_dial_proto_rawDescData) - }) - return file_github_com_aperturerobotics_bifrost_stream_api_dial_dial_proto_rawDescData +func (m *Config) CloneMessageVT() any { + return m.CloneVT() } -var file_github_com_aperturerobotics_bifrost_stream_api_dial_dial_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_github_com_aperturerobotics_bifrost_stream_api_dial_dial_proto_goTypes = []interface{}{ - (*Config)(nil), // 0: stream.api.dial.Config +func (this *Config) EqualVT(that *Config) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.PeerId != that.PeerId { + return false + } + if this.LocalPeerId != that.LocalPeerId { + return false + } + if this.ProtocolId != that.ProtocolId { + return false + } + if this.TransportId != that.TransportId { + return false + } + if this.Encrypted != that.Encrypted { + return false + } + if this.Reliable != that.Reliable { + return false + } + return string(this.unknownFields) == string(that.unknownFields) } -var file_github_com_aperturerobotics_bifrost_stream_api_dial_dial_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] 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 (this *Config) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*Config) + if !ok { + return false + } + return this.EqualVT(that) } -func init() { file_github_com_aperturerobotics_bifrost_stream_api_dial_dial_proto_init() } -func file_github_com_aperturerobotics_bifrost_stream_api_dial_dial_proto_init() { - if File_github_com_aperturerobotics_bifrost_stream_api_dial_dial_proto != nil { +// MarshalProtoJSON marshals the Config message to JSON. +func (x *Config) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() return } - if !protoimpl.UnsafeEnabled { - file_github_com_aperturerobotics_bifrost_stream_api_dial_dial_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Config); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil + s.WriteObjectStart() + var wroteField bool + if x.PeerId != "" || s.HasField("peerId") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("peerId") + s.WriteString(x.PeerId) + } + if x.LocalPeerId != "" || s.HasField("localPeerId") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("localPeerId") + s.WriteString(x.LocalPeerId) + } + if x.ProtocolId != "" || s.HasField("protocolId") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("protocolId") + s.WriteString(x.ProtocolId) + } + if x.TransportId != 0 || s.HasField("transportId") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("transportId") + s.WriteUint64(x.TransportId) + } + if x.Encrypted || s.HasField("encrypted") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("encrypted") + s.WriteBool(x.Encrypted) + } + if x.Reliable || s.HasField("reliable") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("reliable") + s.WriteBool(x.Reliable) + } + s.WriteObjectEnd() +} + +// MarshalJSON marshals the Config to JSON. +func (x *Config) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) +} + +// UnmarshalProtoJSON unmarshals the Config message from JSON. +func (x *Config) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { + return + } + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "peer_id", "peerId": + s.AddField("peer_id") + x.PeerId = s.ReadString() + case "local_peer_id", "localPeerId": + s.AddField("local_peer_id") + x.LocalPeerId = s.ReadString() + case "protocol_id", "protocolId": + s.AddField("protocol_id") + x.ProtocolId = s.ReadString() + case "transport_id", "transportId": + s.AddField("transport_id") + x.TransportId = s.ReadUint64() + case "encrypted": + s.AddField("encrypted") + x.Encrypted = s.ReadBool() + case "reliable": + s.AddField("reliable") + x.Reliable = s.ReadBool() + } + }) +} + +// UnmarshalJSON unmarshals the Config from JSON. +func (x *Config) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +func (m *Config) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Config) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.Reliable { + i-- + if m.Reliable { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x30 + } + if m.Encrypted { + i-- + if m.Encrypted { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x28 + } + if m.TransportId != 0 { + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(m.TransportId)) + i-- + dAtA[i] = 0x20 + } + if len(m.ProtocolId) > 0 { + i -= len(m.ProtocolId) + copy(dAtA[i:], m.ProtocolId) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.ProtocolId))) + i-- + dAtA[i] = 0x1a + } + if len(m.LocalPeerId) > 0 { + i -= len(m.LocalPeerId) + copy(dAtA[i:], m.LocalPeerId) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.LocalPeerId))) + i-- + dAtA[i] = 0x12 + } + if len(m.PeerId) > 0 { + i -= len(m.PeerId) + copy(dAtA[i:], m.PeerId) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.PeerId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Config) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.PeerId) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + l = len(m.LocalPeerId) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + l = len(m.ProtocolId) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + if m.TransportId != 0 { + n += 1 + protobuf_go_lite.SizeOfVarint(uint64(m.TransportId)) + } + if m.Encrypted { + n += 2 + } + if m.Reliable { + n += 2 + } + n += len(m.unknownFields) + return n +} + +func (m *Config) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: Config: wiretype end group for non-group") } + if fieldNum <= 0 { + return errors.Errorf("proto: Config: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field PeerId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PeerId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field LocalPeerId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.LocalPeerId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field ProtocolId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ProtocolId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 0 { + return errors.Errorf("proto: wrong wireType = %d for field TransportId", wireType) + } + m.TransportId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TransportId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return errors.Errorf("proto: wrong wireType = %d for field Encrypted", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Encrypted = bool(v != 0) + case 6: + if wireType != 0 { + return errors.Errorf("proto: wrong wireType = %d for field Reliable", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Reliable = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_github_com_aperturerobotics_bifrost_stream_api_dial_dial_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_github_com_aperturerobotics_bifrost_stream_api_dial_dial_proto_goTypes, - DependencyIndexes: file_github_com_aperturerobotics_bifrost_stream_api_dial_dial_proto_depIdxs, - MessageInfos: file_github_com_aperturerobotics_bifrost_stream_api_dial_dial_proto_msgTypes, - }.Build() - File_github_com_aperturerobotics_bifrost_stream_api_dial_dial_proto = out.File - file_github_com_aperturerobotics_bifrost_stream_api_dial_dial_proto_rawDesc = nil - file_github_com_aperturerobotics_bifrost_stream_api_dial_dial_proto_goTypes = nil - file_github_com_aperturerobotics_bifrost_stream_api_dial_dial_proto_depIdxs = nil + return nil } diff --git a/stream/api/dial/dial.pb.ts b/stream/api/dial/dial.pb.ts deleted file mode 100644 index 6efb3d45..00000000 --- a/stream/api/dial/dial.pb.ts +++ /dev/null @@ -1,260 +0,0 @@ -/* eslint-disable */ -import Long from 'long' -import _m0 from 'protobufjs/minimal.js' - -export const protobufPackage = 'stream.api.dial' - -/** Config configures the dial controller. */ -export interface Config { - /** PeerId is the remote peer ID to dial. */ - peerId: string - /** - * LocalPeerId is the peer ID to dial with. - * Can be empty to accept any loaded peer. - */ - localPeerId: string - /** ProtocolId is the protocol ID to dial with. */ - protocolId: string - /** - * TransportId constrains the transport ID to dial with. - * Can be empty. - */ - transportId: Long - /** Encrypted indicates the stream should be encrypted. */ - encrypted: boolean - /** Reliable indicates the stream should be reliable. */ - reliable: boolean -} - -function createBaseConfig(): Config { - return { - peerId: '', - localPeerId: '', - protocolId: '', - transportId: Long.UZERO, - encrypted: false, - reliable: false, - } -} - -export const Config = { - encode( - message: Config, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.peerId !== '') { - writer.uint32(10).string(message.peerId) - } - if (message.localPeerId !== '') { - writer.uint32(18).string(message.localPeerId) - } - if (message.protocolId !== '') { - writer.uint32(26).string(message.protocolId) - } - if (!message.transportId.equals(Long.UZERO)) { - writer.uint32(32).uint64(message.transportId) - } - if (message.encrypted !== false) { - writer.uint32(40).bool(message.encrypted) - } - if (message.reliable !== false) { - writer.uint32(48).bool(message.reliable) - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Config { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseConfig() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break - } - - message.peerId = reader.string() - continue - case 2: - if (tag !== 18) { - break - } - - message.localPeerId = reader.string() - continue - case 3: - if (tag !== 26) { - break - } - - message.protocolId = reader.string() - continue - case 4: - if (tag !== 32) { - break - } - - message.transportId = reader.uint64() as Long - continue - case 5: - if (tag !== 40) { - break - } - - message.encrypted = reader.bool() - continue - case 6: - if (tag !== 48) { - break - } - - message.reliable = reader.bool() - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: AsyncIterable | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config.encode(p).finish()] - } - } else { - yield* [Config.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config.decode(p)] - } - } else { - yield* [Config.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): Config { - return { - peerId: isSet(object.peerId) ? globalThis.String(object.peerId) : '', - localPeerId: isSet(object.localPeerId) - ? globalThis.String(object.localPeerId) - : '', - protocolId: isSet(object.protocolId) - ? globalThis.String(object.protocolId) - : '', - transportId: isSet(object.transportId) - ? Long.fromValue(object.transportId) - : Long.UZERO, - encrypted: isSet(object.encrypted) - ? globalThis.Boolean(object.encrypted) - : false, - reliable: isSet(object.reliable) - ? globalThis.Boolean(object.reliable) - : false, - } - }, - - toJSON(message: Config): unknown { - const obj: any = {} - if (message.peerId !== '') { - obj.peerId = message.peerId - } - if (message.localPeerId !== '') { - obj.localPeerId = message.localPeerId - } - if (message.protocolId !== '') { - obj.protocolId = message.protocolId - } - if (!message.transportId.equals(Long.UZERO)) { - obj.transportId = (message.transportId || Long.UZERO).toString() - } - if (message.encrypted !== false) { - obj.encrypted = message.encrypted - } - if (message.reliable !== false) { - obj.reliable = message.reliable - } - return obj - }, - - create, I>>(base?: I): Config { - return Config.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>(object: I): Config { - const message = createBaseConfig() - message.peerId = object.peerId ?? '' - message.localPeerId = object.localPeerId ?? '' - message.protocolId = object.protocolId ?? '' - message.transportId = - object.transportId !== undefined && object.transportId !== null - ? Long.fromValue(object.transportId) - : Long.UZERO - message.encrypted = object.encrypted ?? false - message.reliable = object.reliable ?? false - return message - }, -} - -type Builtin = - | Date - | Function - | Uint8Array - | string - | number - | boolean - | undefined - -export type DeepPartial = T extends Builtin - ? T - : T extends Long - ? string | number | Long - : T extends globalThis.Array - ? globalThis.Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends { $case: string } - ? { [K in keyof Omit]?: DeepPartial } & { - $case: T['$case'] - } - : T extends {} - ? { [K in keyof T]?: DeepPartial } - : Partial - -type KeysOfUnion = T extends T ? keyof T : never -export type Exact = P extends Builtin - ? P - : P & { [K in keyof P]: Exact } & { - [K in Exclude>]: never - } - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any - _m0.configure() -} - -function isSet(value: any): boolean { - return value !== null && value !== undefined -} diff --git a/stream/api/dial/dial_pb.ts b/stream/api/dial/dial_pb.ts new file mode 100644 index 00000000..d62d07f6 --- /dev/null +++ b/stream/api/dial/dial_pb.ts @@ -0,0 +1,123 @@ +// @generated by protoc-gen-es v1.8.0 with parameter "target=ts,ts_nocheck=false" +// @generated from file github.com/aperturerobotics/bifrost/stream/api/dial/dial.proto (package stream.api.dial, syntax proto3) +/* eslint-disable */ + +import type { + BinaryReadOptions, + FieldList, + JsonReadOptions, + JsonValue, + PartialMessage, + PlainMessage, +} from '@bufbuild/protobuf' +import { Message, proto3, protoInt64 } from '@bufbuild/protobuf' + +/** + * Config configures the dial controller. + * + * @generated from message stream.api.dial.Config + */ +export class Config extends Message { + /** + * PeerId is the remote peer ID to dial. + * + * @generated from field: string peer_id = 1; + */ + peerId = '' + + /** + * LocalPeerId is the peer ID to dial with. + * Can be empty to accept any loaded peer. + * + * @generated from field: string local_peer_id = 2; + */ + localPeerId = '' + + /** + * ProtocolId is the protocol ID to dial with. + * + * @generated from field: string protocol_id = 3; + */ + protocolId = '' + + /** + * TransportId constrains the transport ID to dial with. + * Can be empty. + * + * @generated from field: uint64 transport_id = 4; + */ + transportId = protoInt64.zero + + /** + * Encrypted indicates the stream should be encrypted. + * + * @generated from field: bool encrypted = 5; + */ + encrypted = false + + /** + * Reliable indicates the stream should be reliable. + * + * @generated from field: bool reliable = 6; + */ + reliable = false + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'stream.api.dial.Config' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: 'peer_id', kind: 'scalar', T: 9 /* ScalarType.STRING */ }, + { + no: 2, + name: 'local_peer_id', + kind: 'scalar', + T: 9 /* ScalarType.STRING */, + }, + { + no: 3, + name: 'protocol_id', + kind: 'scalar', + T: 9 /* ScalarType.STRING */, + }, + { + no: 4, + name: 'transport_id', + kind: 'scalar', + T: 4 /* ScalarType.UINT64 */, + }, + { no: 5, name: 'encrypted', kind: 'scalar', T: 8 /* ScalarType.BOOL */ }, + { no: 6, name: 'reliable', kind: 'scalar', T: 8 /* ScalarType.BOOL */ }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): Config { + return new Config().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): Config { + return new Config().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): Config { + return new Config().fromJsonString(jsonString, options) + } + + static equals( + a: Config | PlainMessage | undefined, + b: Config | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(Config, a, b) + } +} diff --git a/stream/api/dial/dial_vtproto.pb.go b/stream/api/dial/dial_vtproto.pb.go deleted file mode 100644 index 78598edd..00000000 --- a/stream/api/dial/dial_vtproto.pb.go +++ /dev/null @@ -1,394 +0,0 @@ -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// protoc-gen-go-vtproto version: v0.6.0 -// source: github.com/aperturerobotics/bifrost/stream/api/dial/dial.proto - -package stream_api_dial - -import ( - fmt "fmt" - io "io" - - protohelpers "github.com/planetscale/vtprotobuf/protohelpers" - proto "google.golang.org/protobuf/proto" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) -) - -func (m *Config) CloneVT() *Config { - if m == nil { - return (*Config)(nil) - } - r := new(Config) - r.PeerId = m.PeerId - r.LocalPeerId = m.LocalPeerId - r.ProtocolId = m.ProtocolId - r.TransportId = m.TransportId - r.Encrypted = m.Encrypted - r.Reliable = m.Reliable - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Config) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (this *Config) EqualVT(that *Config) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.PeerId != that.PeerId { - return false - } - if this.LocalPeerId != that.LocalPeerId { - return false - } - if this.ProtocolId != that.ProtocolId { - return false - } - if this.TransportId != that.TransportId { - return false - } - if this.Encrypted != that.Encrypted { - return false - } - if this.Reliable != that.Reliable { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Config) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Config) - if !ok { - return false - } - return this.EqualVT(that) -} -func (m *Config) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Config) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Reliable { - i-- - if m.Reliable { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x30 - } - if m.Encrypted { - i-- - if m.Encrypted { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x28 - } - if m.TransportId != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.TransportId)) - i-- - dAtA[i] = 0x20 - } - if len(m.ProtocolId) > 0 { - i -= len(m.ProtocolId) - copy(dAtA[i:], m.ProtocolId) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.ProtocolId))) - i-- - dAtA[i] = 0x1a - } - if len(m.LocalPeerId) > 0 { - i -= len(m.LocalPeerId) - copy(dAtA[i:], m.LocalPeerId) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.LocalPeerId))) - i-- - dAtA[i] = 0x12 - } - if len(m.PeerId) > 0 { - i -= len(m.PeerId) - copy(dAtA[i:], m.PeerId) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.PeerId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Config) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.PeerId) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - l = len(m.LocalPeerId) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - l = len(m.ProtocolId) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.TransportId != 0 { - n += 1 + protohelpers.SizeOfVarint(uint64(m.TransportId)) - } - if m.Encrypted { - n += 2 - } - if m.Reliable { - n += 2 - } - n += len(m.unknownFields) - return n -} - -func (m *Config) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Config: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Config: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PeerId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PeerId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LocalPeerId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.LocalPeerId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ProtocolId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ProtocolId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TransportId", wireType) - } - m.TransportId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TransportId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Encrypted", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Encrypted = bool(v != 0) - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Reliable", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Reliable = bool(v != 0) - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} diff --git a/stream/api/rpc/rpc.pb.go b/stream/api/rpc/rpc.pb.go index ee6121b5..8a0c9318 100644 --- a/stream/api/rpc/rpc.pb.go +++ b/stream/api/rpc/rpc.pb.go @@ -1,24 +1,16 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0-devel -// protoc v5.26.1 +// Code generated by protoc-gen-go-lite. DO NOT EDIT. +// protoc-gen-go-lite version: v0.4.5 // source: github.com/aperturerobotics/bifrost/stream/api/rpc/rpc.proto package stream_api_rpc import ( - reflect "reflect" - sync "sync" + io "io" + strconv "strconv" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) + protobuf_go_lite "github.com/aperturerobotics/protobuf-go-lite" + json "github.com/aperturerobotics/protobuf-go-lite/json" + errors "github.com/pkg/errors" ) // StreamState is state for the stream related calls. @@ -54,71 +46,29 @@ func (x StreamState) Enum() *StreamState { } func (x StreamState) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (StreamState) Descriptor() protoreflect.EnumDescriptor { - return file_github_com_aperturerobotics_bifrost_stream_api_rpc_rpc_proto_enumTypes[0].Descriptor() -} - -func (StreamState) Type() protoreflect.EnumType { - return &file_github_com_aperturerobotics_bifrost_stream_api_rpc_rpc_proto_enumTypes[0] -} - -func (x StreamState) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use StreamState.Descriptor instead. -func (StreamState) EnumDescriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_stream_api_rpc_rpc_proto_rawDescGZIP(), []int{0} + name, valid := StreamState_name[int32(x)] + if valid { + return name + } + return strconv.Itoa(int(x)) } // Data is a data packet. type Data struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + unknownFields []byte // State indicates stream state in-band. // Data is packet data from the remote. Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` // State indicates the stream state. - State StreamState `protobuf:"varint,2,opt,name=state,proto3,enum=stream.api.rpc.StreamState" json:"state,omitempty"` + State StreamState `protobuf:"varint,2,opt,name=state,proto3" json:"state,omitempty"` } func (x *Data) Reset() { *x = Data{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_stream_api_rpc_rpc_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Data) String() string { - return protoimpl.X.MessageStringOf(x) } func (*Data) ProtoMessage() {} -func (x *Data) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_stream_api_rpc_rpc_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 Data.ProtoReflect.Descriptor instead. -func (*Data) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_stream_api_rpc_rpc_proto_rawDescGZIP(), []int{0} -} - func (x *Data) GetData() []byte { if x != nil { return x.Data @@ -133,91 +83,304 @@ func (x *Data) GetState() StreamState { return StreamState_StreamState_NONE } -var File_github_com_aperturerobotics_bifrost_stream_api_rpc_rpc_proto protoreflect.FileDescriptor - -var file_github_com_aperturerobotics_bifrost_stream_api_rpc_rpc_proto_rawDesc = []byte{ - 0x0a, 0x3c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, - 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x62, 0x69, - 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2f, 0x61, 0x70, 0x69, - 0x2f, 0x72, 0x70, 0x63, 0x2f, 0x72, 0x70, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, - 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x70, 0x63, 0x22, 0x4d, - 0x0a, 0x04, 0x44, 0x61, 0x74, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x31, 0x0a, 0x05, 0x73, 0x74, - 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1b, 0x2e, 0x73, 0x74, 0x72, 0x65, - 0x61, 0x6d, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, - 0x6d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2a, 0x5e, 0x0a, - 0x0b, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x14, 0x0a, 0x10, - 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x5f, 0x4e, 0x4f, 0x4e, 0x45, - 0x10, 0x00, 0x12, 0x1c, 0x0a, 0x18, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x53, 0x74, 0x61, 0x74, - 0x65, 0x5f, 0x45, 0x53, 0x54, 0x41, 0x42, 0x4c, 0x49, 0x53, 0x48, 0x49, 0x4e, 0x47, 0x10, 0x01, - 0x12, 0x1b, 0x0a, 0x17, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x5f, - 0x45, 0x53, 0x54, 0x41, 0x42, 0x4c, 0x49, 0x53, 0x48, 0x45, 0x44, 0x10, 0x02, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, +func (m *Data) CloneVT() *Data { + if m == nil { + return (*Data)(nil) + } + r := new(Data) + r.State = m.State + if rhs := m.Data; rhs != nil { + tmpBytes := make([]byte, len(rhs)) + copy(tmpBytes, rhs) + r.Data = tmpBytes + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r } -var ( - file_github_com_aperturerobotics_bifrost_stream_api_rpc_rpc_proto_rawDescOnce sync.Once - file_github_com_aperturerobotics_bifrost_stream_api_rpc_rpc_proto_rawDescData = file_github_com_aperturerobotics_bifrost_stream_api_rpc_rpc_proto_rawDesc -) +func (m *Data) CloneMessageVT() any { + return m.CloneVT() +} -func file_github_com_aperturerobotics_bifrost_stream_api_rpc_rpc_proto_rawDescGZIP() []byte { - file_github_com_aperturerobotics_bifrost_stream_api_rpc_rpc_proto_rawDescOnce.Do(func() { - file_github_com_aperturerobotics_bifrost_stream_api_rpc_rpc_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_aperturerobotics_bifrost_stream_api_rpc_rpc_proto_rawDescData) - }) - return file_github_com_aperturerobotics_bifrost_stream_api_rpc_rpc_proto_rawDescData +func (this *Data) EqualVT(that *Data) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if string(this.Data) != string(that.Data) { + return false + } + if this.State != that.State { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *Data) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*Data) + if !ok { + return false + } + return this.EqualVT(that) +} + +// MarshalProtoJSON marshals the StreamState to JSON. +func (x StreamState) MarshalProtoJSON(s *json.MarshalState) { + s.WriteEnumString(int32(x), StreamState_name) +} + +// MarshalText marshals the StreamState to text. +func (x StreamState) MarshalText() ([]byte, error) { + return []byte(json.GetEnumString(int32(x), StreamState_name)), nil +} + +// MarshalJSON marshals the StreamState to JSON. +func (x StreamState) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) +} + +// UnmarshalProtoJSON unmarshals the StreamState from JSON. +func (x *StreamState) UnmarshalProtoJSON(s *json.UnmarshalState) { + v := s.ReadEnum(StreamState_value) + if err := s.Err(); err != nil { + s.SetErrorf("could not read StreamState enum: %v", err) + return + } + *x = StreamState(v) +} + +// UnmarshalText unmarshals the StreamState from text. +func (x *StreamState) UnmarshalText(b []byte) error { + i, err := json.ParseEnumString(string(b), StreamState_value) + if err != nil { + return err + } + *x = StreamState(i) + return nil } -var file_github_com_aperturerobotics_bifrost_stream_api_rpc_rpc_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_github_com_aperturerobotics_bifrost_stream_api_rpc_rpc_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_github_com_aperturerobotics_bifrost_stream_api_rpc_rpc_proto_goTypes = []interface{}{ - (StreamState)(0), // 0: stream.api.rpc.StreamState - (*Data)(nil), // 1: stream.api.rpc.Data +// UnmarshalJSON unmarshals the StreamState from JSON. +func (x *StreamState) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) } -var file_github_com_aperturerobotics_bifrost_stream_api_rpc_rpc_proto_depIdxs = []int32{ - 0, // 0: stream.api.rpc.Data.state:type_name -> stream.api.rpc.StreamState - 1, // [1:1] is the sub-list for method output_type - 1, // [1:1] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name + +// MarshalProtoJSON marshals the Data message to JSON. +func (x *Data) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return + } + s.WriteObjectStart() + var wroteField bool + if len(x.Data) > 0 || s.HasField("data") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("data") + s.WriteBytes(x.Data) + } + if x.State != 0 || s.HasField("state") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("state") + x.State.MarshalProtoJSON(s) + } + s.WriteObjectEnd() +} + +// MarshalJSON marshals the Data to JSON. +func (x *Data) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) } -func init() { file_github_com_aperturerobotics_bifrost_stream_api_rpc_rpc_proto_init() } -func file_github_com_aperturerobotics_bifrost_stream_api_rpc_rpc_proto_init() { - if File_github_com_aperturerobotics_bifrost_stream_api_rpc_rpc_proto != nil { +// UnmarshalProtoJSON unmarshals the Data message from JSON. +func (x *Data) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { return } - if !protoimpl.UnsafeEnabled { - file_github_com_aperturerobotics_bifrost_stream_api_rpc_rpc_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Data); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "data": + s.AddField("data") + x.Data = s.ReadBytes() + case "state": + s.AddField("state") + x.State.UnmarshalProtoJSON(s) + } + }) +} + +// UnmarshalJSON unmarshals the Data from JSON. +func (x *Data) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +func (m *Data) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Data) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *Data) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.State != 0 { + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(m.State)) + i-- + dAtA[i] = 0x10 + } + if len(m.Data) > 0 { + i -= len(m.Data) + copy(dAtA[i:], m.Data) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.Data))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Data) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Data) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + if m.State != 0 { + n += 1 + protobuf_go_lite.SizeOfVarint(uint64(m.State)) + } + n += len(m.unknownFields) + return n +} + +func (m *Data) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: Data: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: Data: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } } + if byteLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) + if m.Data == nil { + m.Data = []byte{} + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return errors.Errorf("proto: wrong wireType = %d for field State", wireType) + } + m.State = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.State |= StreamState(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy } } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_github_com_aperturerobotics_bifrost_stream_api_rpc_rpc_proto_rawDesc, - NumEnums: 1, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_github_com_aperturerobotics_bifrost_stream_api_rpc_rpc_proto_goTypes, - DependencyIndexes: file_github_com_aperturerobotics_bifrost_stream_api_rpc_rpc_proto_depIdxs, - EnumInfos: file_github_com_aperturerobotics_bifrost_stream_api_rpc_rpc_proto_enumTypes, - MessageInfos: file_github_com_aperturerobotics_bifrost_stream_api_rpc_rpc_proto_msgTypes, - }.Build() - File_github_com_aperturerobotics_bifrost_stream_api_rpc_rpc_proto = out.File - file_github_com_aperturerobotics_bifrost_stream_api_rpc_rpc_proto_rawDesc = nil - file_github_com_aperturerobotics_bifrost_stream_api_rpc_rpc_proto_goTypes = nil - file_github_com_aperturerobotics_bifrost_stream_api_rpc_rpc_proto_depIdxs = nil + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil } diff --git a/stream/api/rpc/rpc.pb.ts b/stream/api/rpc/rpc.pb.ts deleted file mode 100644 index d5de8d62..00000000 --- a/stream/api/rpc/rpc.pb.ts +++ /dev/null @@ -1,236 +0,0 @@ -/* eslint-disable */ -import Long from 'long' -import _m0 from 'protobufjs/minimal.js' - -export const protobufPackage = 'stream.api.rpc' - -/** StreamState is state for the stream related calls. */ -export enum StreamState { - /** StreamState_NONE - StreamState_NONE indicates nothing about the state */ - StreamState_NONE = 0, - /** StreamState_ESTABLISHING - StreamState_ESTABLISHING indicates the stream is connecting. */ - StreamState_ESTABLISHING = 1, - /** StreamState_ESTABLISHED - StreamState_ESTABLISHED indicates the stream is established. */ - StreamState_ESTABLISHED = 2, - UNRECOGNIZED = -1, -} - -export function streamStateFromJSON(object: any): StreamState { - switch (object) { - case 0: - case 'StreamState_NONE': - return StreamState.StreamState_NONE - case 1: - case 'StreamState_ESTABLISHING': - return StreamState.StreamState_ESTABLISHING - case 2: - case 'StreamState_ESTABLISHED': - return StreamState.StreamState_ESTABLISHED - case -1: - case 'UNRECOGNIZED': - default: - return StreamState.UNRECOGNIZED - } -} - -export function streamStateToJSON(object: StreamState): string { - switch (object) { - case StreamState.StreamState_NONE: - return 'StreamState_NONE' - case StreamState.StreamState_ESTABLISHING: - return 'StreamState_ESTABLISHING' - case StreamState.StreamState_ESTABLISHED: - return 'StreamState_ESTABLISHED' - case StreamState.UNRECOGNIZED: - default: - return 'UNRECOGNIZED' - } -} - -/** Data is a data packet. */ -export interface Data { - /** - * State indicates stream state in-band. - * Data is packet data from the remote. - */ - data: Uint8Array - /** State indicates the stream state. */ - state: StreamState -} - -function createBaseData(): Data { - return { data: new Uint8Array(0), state: 0 } -} - -export const Data = { - encode(message: Data, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.data.length !== 0) { - writer.uint32(10).bytes(message.data) - } - if (message.state !== 0) { - writer.uint32(16).int32(message.state) - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Data { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseData() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break - } - - message.data = reader.bytes() - continue - case 2: - if (tag !== 16) { - break - } - - message.state = reader.int32() as any - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: AsyncIterable | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Data.encode(p).finish()] - } - } else { - yield* [Data.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Data.decode(p)] - } - } else { - yield* [Data.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): Data { - return { - data: isSet(object.data) - ? bytesFromBase64(object.data) - : new Uint8Array(0), - state: isSet(object.state) ? streamStateFromJSON(object.state) : 0, - } - }, - - toJSON(message: Data): unknown { - const obj: any = {} - if (message.data.length !== 0) { - obj.data = base64FromBytes(message.data) - } - if (message.state !== 0) { - obj.state = streamStateToJSON(message.state) - } - return obj - }, - - create, I>>(base?: I): Data { - return Data.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>(object: I): Data { - const message = createBaseData() - message.data = object.data ?? new Uint8Array(0) - message.state = object.state ?? 0 - return message - }, -} - -function bytesFromBase64(b64: string): Uint8Array { - if ((globalThis as any).Buffer) { - return Uint8Array.from(globalThis.Buffer.from(b64, 'base64')) - } else { - const bin = globalThis.atob(b64) - const arr = new Uint8Array(bin.length) - for (let i = 0; i < bin.length; ++i) { - arr[i] = bin.charCodeAt(i) - } - return arr - } -} - -function base64FromBytes(arr: Uint8Array): string { - if ((globalThis as any).Buffer) { - return globalThis.Buffer.from(arr).toString('base64') - } else { - const bin: string[] = [] - arr.forEach((byte) => { - bin.push(globalThis.String.fromCharCode(byte)) - }) - return globalThis.btoa(bin.join('')) - } -} - -type Builtin = - | Date - | Function - | Uint8Array - | string - | number - | boolean - | undefined - -export type DeepPartial = T extends Builtin - ? T - : T extends Long - ? string | number | Long - : T extends globalThis.Array - ? globalThis.Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends { $case: string } - ? { [K in keyof Omit]?: DeepPartial } & { - $case: T['$case'] - } - : T extends {} - ? { [K in keyof T]?: DeepPartial } - : Partial - -type KeysOfUnion = T extends T ? keyof T : never -export type Exact = P extends Builtin - ? P - : P & { [K in keyof P]: Exact } & { - [K in Exclude>]: never - } - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any - _m0.configure() -} - -function isSet(value: any): boolean { - return value !== null && value !== undefined -} diff --git a/stream/api/rpc/rpc_pb.ts b/stream/api/rpc/rpc_pb.ts new file mode 100644 index 00000000..df5f4d3d --- /dev/null +++ b/stream/api/rpc/rpc_pb.ts @@ -0,0 +1,109 @@ +// @generated by protoc-gen-es v1.8.0 with parameter "target=ts,ts_nocheck=false" +// @generated from file github.com/aperturerobotics/bifrost/stream/api/rpc/rpc.proto (package stream.api.rpc, syntax proto3) +/* eslint-disable */ + +import type { + BinaryReadOptions, + FieldList, + JsonReadOptions, + JsonValue, + PartialMessage, + PlainMessage, +} from '@bufbuild/protobuf' +import { Message, proto3 } from '@bufbuild/protobuf' + +/** + * StreamState is state for the stream related calls. + * + * @generated from enum stream.api.rpc.StreamState + */ +export enum StreamState { + /** + * StreamState_NONE indicates nothing about the state + * + * @generated from enum value: StreamState_NONE = 0; + */ + StreamState_NONE = 0, + + /** + * StreamState_ESTABLISHING indicates the stream is connecting. + * + * @generated from enum value: StreamState_ESTABLISHING = 1; + */ + StreamState_ESTABLISHING = 1, + + /** + * StreamState_ESTABLISHED indicates the stream is established. + * + * @generated from enum value: StreamState_ESTABLISHED = 2; + */ + StreamState_ESTABLISHED = 2, +} +// Retrieve enum metadata with: proto3.getEnumType(StreamState) +proto3.util.setEnumType(StreamState, 'stream.api.rpc.StreamState', [ + { no: 0, name: 'StreamState_NONE' }, + { no: 1, name: 'StreamState_ESTABLISHING' }, + { no: 2, name: 'StreamState_ESTABLISHED' }, +]) + +/** + * Data is a data packet. + * + * @generated from message stream.api.rpc.Data + */ +export class Data extends Message { + /** + * State indicates stream state in-band. + * Data is packet data from the remote. + * + * @generated from field: bytes data = 1; + */ + data = new Uint8Array(0) + + /** + * State indicates the stream state. + * + * @generated from field: stream.api.rpc.StreamState state = 2; + */ + state = StreamState.StreamState_NONE + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'stream.api.rpc.Data' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: 'data', kind: 'scalar', T: 12 /* ScalarType.BYTES */ }, + { no: 2, name: 'state', kind: 'enum', T: proto3.getEnumType(StreamState) }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): Data { + return new Data().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): Data { + return new Data().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): Data { + return new Data().fromJsonString(jsonString, options) + } + + static equals( + a: Data | PlainMessage | undefined, + b: Data | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(Data, a, b) + } +} diff --git a/stream/api/rpc/rpc_vtproto.pb.go b/stream/api/rpc/rpc_vtproto.pb.go deleted file mode 100644 index f59e6b9b..00000000 --- a/stream/api/rpc/rpc_vtproto.pb.go +++ /dev/null @@ -1,232 +0,0 @@ -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// protoc-gen-go-vtproto version: v0.6.0 -// source: github.com/aperturerobotics/bifrost/stream/api/rpc/rpc.proto - -package stream_api_rpc - -import ( - fmt "fmt" - io "io" - - protohelpers "github.com/planetscale/vtprotobuf/protohelpers" - proto "google.golang.org/protobuf/proto" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) -) - -func (m *Data) CloneVT() *Data { - if m == nil { - return (*Data)(nil) - } - r := new(Data) - r.State = m.State - if rhs := m.Data; rhs != nil { - tmpBytes := make([]byte, len(rhs)) - copy(tmpBytes, rhs) - r.Data = tmpBytes - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Data) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (this *Data) EqualVT(that *Data) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if string(this.Data) != string(that.Data) { - return false - } - if this.State != that.State { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Data) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Data) - if !ok { - return false - } - return this.EqualVT(that) -} -func (m *Data) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Data) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Data) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.State != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.State)) - i-- - dAtA[i] = 0x10 - } - if len(m.Data) > 0 { - i -= len(m.Data) - copy(dAtA[i:], m.Data) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Data))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Data) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Data) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.State != 0 { - n += 1 + protohelpers.SizeOfVarint(uint64(m.State)) - } - n += len(m.unknownFields) - return n -} - -func (m *Data) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Data: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Data: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) - if m.Data == nil { - m.Data = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field State", wireType) - } - m.State = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.State |= StreamState(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} diff --git a/stream/drpc/client/client.go b/stream/drpc/client/client.go deleted file mode 100644 index 713a3eca..00000000 --- a/stream/drpc/client/client.go +++ /dev/null @@ -1,129 +0,0 @@ -package stream_drpc_client - -import ( - "context" - "time" - - "github.com/aperturerobotics/bifrost/peer" - "github.com/aperturerobotics/bifrost/protocol" - stream_drpc "github.com/aperturerobotics/bifrost/stream/drpc" - "github.com/aperturerobotics/controllerbus/bus" - "github.com/pkg/errors" - "github.com/sirupsen/logrus" - "storj.io/drpc/drpcconn" -) - -// Client is a common drpc client implementation. -type Client struct { - // le is the logger - le *logrus.Entry - // b is the bus - b bus.Bus - // c is the config - c *Config - - // timeoutDur is the request timeout duration - // if unset, has none - timeoutDir time.Duration - // srcPeer is the src peer id - srcPeer peer.ID - // destPeers is the dest peer ids - destPeers []peer.ID -} - -// NewClient constructs a new client. -func NewClient(le *logrus.Entry, b bus.Bus, c *Config) (*Client, error) { - srcPeer, err := c.ParseSrcPeerId() - if err != nil { - return nil, errors.Wrap(err, "src_peer_id") - } - - serverPeerIDs, err := c.ParseServerPeerIds() - if err != nil { - return nil, errors.Wrap(err, "src_peer_id") - } - - timeoutDur, err := c.ParseTimeoutDur() - if err != nil { - return nil, errors.Wrap(err, "timeout_dur") - } - - return &Client{ - le: le, - b: b, - c: c, - - timeoutDir: timeoutDur, - srcPeer: srcPeer, - destPeers: serverPeerIDs, - }, nil -} - -// BuildTimeoutCtx builds a context with the configured timeout. -func (c *Client) BuildTimeoutCtx(ctx context.Context) (context.Context, context.CancelFunc) { - to := c.timeoutDir - if to <= 0 { - return context.WithCancel(ctx) - } - return context.WithTimeout(ctx, to) -} - -// ExecuteConnection attempts to contact one of the configured servers and -// execute the given callback, which should construct & use drpc clients. -// -// Callback should return nextServer, err. -// If next=true is returned, tries another server. -func (c *Client) ExecuteConnection( - ctx context.Context, - protocolID protocol.ID, - cb func(conn *drpcconn.Conn) (next bool, err error), -) error { - var lastErr error - for _, destPeer := range c.destPeers { - estCtx, estCtxCancel := c.BuildTimeoutCtx(ctx) - defer estCtxCancel() - - le := c.le.WithField("server-peer-id", destPeer.String()) - conn, connRel, err := stream_drpc.EstablishDrpcConn( - estCtx, - c.b, - c.c.GetDrpcOpts(), - protocolID, - c.srcPeer, destPeer, - c.c.GetTransportId(), - ) - if err != nil { - // detect deadline exceeded - if err == context.Canceled && estCtx.Err() != nil && ctx.Err() == nil { - err = context.DeadlineExceeded - } - le.WithError(err).Warn("unable to establish drpc conn") - lastErr = err - continue - } - - var tryNext bool - var tryErr error - func() { - // this also catches panic cases. - defer connRel() - defer conn.Close() - - tryNext, tryErr = cb(conn) - }() - if tryErr == nil { - return nil - } - - lastErr = tryErr - if !tryNext { - break - } - } - - if lastErr == nil { - lastErr = errors.New("connection failed") - } - - return lastErr -} diff --git a/stream/drpc/client/client.pb.go b/stream/drpc/client/client.pb.go deleted file mode 100644 index 2a882930..00000000 --- a/stream/drpc/client/client.pb.go +++ /dev/null @@ -1,224 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0-devel -// protoc v5.26.1 -// source: github.com/aperturerobotics/bifrost/stream/drpc/client/client.proto - -package stream_drpc_client - -import ( - reflect "reflect" - sync "sync" - - drpc "github.com/aperturerobotics/bifrost/stream/drpc" - backoff "github.com/aperturerobotics/util/backoff" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) -) - -// Config configures a client for a drpc service. -type Config struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // ServerPeerIds are the static list of peer IDs to contact. - ServerPeerIds []string `protobuf:"bytes,1,rep,name=server_peer_ids,json=serverPeerIds,proto3" json:"server_peer_ids,omitempty"` - // PerServerBackoff is the server peer error backoff configuration. - // Can be empty. - PerServerBackoff *backoff.Backoff `protobuf:"bytes,2,opt,name=per_server_backoff,json=perServerBackoff,proto3" json:"per_server_backoff,omitempty"` - // SrcPeerId is the source peer id to contact from. - // Can be empty. - SrcPeerId string `protobuf:"bytes,3,opt,name=src_peer_id,json=srcPeerId,proto3" json:"src_peer_id,omitempty"` - // TransportId restricts which transport we can dial out from. - TransportId uint64 `protobuf:"varint,4,opt,name=transport_id,json=transportId,proto3" json:"transport_id,omitempty"` - // DrpcOpts are options passed to drpc. - DrpcOpts *drpc.DrpcOpts `protobuf:"bytes,5,opt,name=drpc_opts,json=drpcOpts,proto3" json:"drpc_opts,omitempty"` - // TimeoutDur sets the per-server establish timeout. - // If unset, no timeout. - // Example: 15s - TimeoutDur string `protobuf:"bytes,6,opt,name=timeout_dur,json=timeoutDur,proto3" json:"timeout_dur,omitempty"` -} - -func (x *Config) Reset() { - *x = Config{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_stream_drpc_client_client_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Config) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Config) ProtoMessage() {} - -func (x *Config) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_stream_drpc_client_client_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 Config.ProtoReflect.Descriptor instead. -func (*Config) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_stream_drpc_client_client_proto_rawDescGZIP(), []int{0} -} - -func (x *Config) GetServerPeerIds() []string { - if x != nil { - return x.ServerPeerIds - } - return nil -} - -func (x *Config) GetPerServerBackoff() *backoff.Backoff { - if x != nil { - return x.PerServerBackoff - } - return nil -} - -func (x *Config) GetSrcPeerId() string { - if x != nil { - return x.SrcPeerId - } - return "" -} - -func (x *Config) GetTransportId() uint64 { - if x != nil { - return x.TransportId - } - return 0 -} - -func (x *Config) GetDrpcOpts() *drpc.DrpcOpts { - if x != nil { - return x.DrpcOpts - } - return nil -} - -func (x *Config) GetTimeoutDur() string { - if x != nil { - return x.TimeoutDur - } - return "" -} - -var File_github_com_aperturerobotics_bifrost_stream_drpc_client_client_proto protoreflect.FileDescriptor - -var file_github_com_aperturerobotics_bifrost_stream_drpc_client_client_proto_rawDesc = []byte{ - 0x0a, 0x43, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, - 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x62, 0x69, - 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2f, 0x64, 0x72, 0x70, - 0x63, 0x2f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x64, 0x72, - 0x70, 0x63, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x1a, 0x3a, 0x67, 0x69, 0x74, 0x68, 0x75, - 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, - 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x62, 0x69, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2f, 0x73, - 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2f, 0x64, 0x72, 0x70, 0x63, 0x2f, 0x64, 0x72, 0x70, 0x63, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x36, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, - 0x6d, 0x2f, 0x61, 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, - 0x63, 0x73, 0x2f, 0x75, 0x74, 0x69, 0x6c, 0x2f, 0x62, 0x61, 0x63, 0x6b, 0x6f, 0x66, 0x66, 0x2f, - 0x62, 0x61, 0x63, 0x6b, 0x6f, 0x66, 0x66, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x88, 0x02, - 0x0a, 0x06, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x26, 0x0a, 0x0f, 0x73, 0x65, 0x72, 0x76, - 0x65, 0x72, 0x5f, 0x70, 0x65, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, - 0x09, 0x52, 0x0d, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x50, 0x65, 0x65, 0x72, 0x49, 0x64, 0x73, - 0x12, 0x3e, 0x0a, 0x12, 0x70, 0x65, 0x72, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x62, - 0x61, 0x63, 0x6b, 0x6f, 0x66, 0x66, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x62, - 0x61, 0x63, 0x6b, 0x6f, 0x66, 0x66, 0x2e, 0x42, 0x61, 0x63, 0x6b, 0x6f, 0x66, 0x66, 0x52, 0x10, - 0x70, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x42, 0x61, 0x63, 0x6b, 0x6f, 0x66, 0x66, - 0x12, 0x1e, 0x0a, 0x0b, 0x73, 0x72, 0x63, 0x5f, 0x70, 0x65, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x72, 0x63, 0x50, 0x65, 0x65, 0x72, 0x49, 0x64, - 0x12, 0x21, 0x0a, 0x0c, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x69, 0x64, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, - 0x74, 0x49, 0x64, 0x12, 0x32, 0x0a, 0x09, 0x64, 0x72, 0x70, 0x63, 0x5f, 0x6f, 0x70, 0x74, 0x73, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, - 0x64, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x72, 0x70, 0x63, 0x4f, 0x70, 0x74, 0x73, 0x52, 0x08, 0x64, - 0x72, 0x70, 0x63, 0x4f, 0x70, 0x74, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x74, 0x69, 0x6d, 0x65, 0x6f, - 0x75, 0x74, 0x5f, 0x64, 0x75, 0x72, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x74, 0x69, - 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x44, 0x75, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_github_com_aperturerobotics_bifrost_stream_drpc_client_client_proto_rawDescOnce sync.Once - file_github_com_aperturerobotics_bifrost_stream_drpc_client_client_proto_rawDescData = file_github_com_aperturerobotics_bifrost_stream_drpc_client_client_proto_rawDesc -) - -func file_github_com_aperturerobotics_bifrost_stream_drpc_client_client_proto_rawDescGZIP() []byte { - file_github_com_aperturerobotics_bifrost_stream_drpc_client_client_proto_rawDescOnce.Do(func() { - file_github_com_aperturerobotics_bifrost_stream_drpc_client_client_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_aperturerobotics_bifrost_stream_drpc_client_client_proto_rawDescData) - }) - return file_github_com_aperturerobotics_bifrost_stream_drpc_client_client_proto_rawDescData -} - -var file_github_com_aperturerobotics_bifrost_stream_drpc_client_client_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_github_com_aperturerobotics_bifrost_stream_drpc_client_client_proto_goTypes = []interface{}{ - (*Config)(nil), // 0: stream.drpc.client.Config - (*backoff.Backoff)(nil), // 1: backoff.Backoff - (*drpc.DrpcOpts)(nil), // 2: stream.drpc.DrpcOpts -} -var file_github_com_aperturerobotics_bifrost_stream_drpc_client_client_proto_depIdxs = []int32{ - 1, // 0: stream.drpc.client.Config.per_server_backoff:type_name -> backoff.Backoff - 2, // 1: stream.drpc.client.Config.drpc_opts:type_name -> stream.drpc.DrpcOpts - 2, // [2:2] is the sub-list for method output_type - 2, // [2:2] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name -} - -func init() { file_github_com_aperturerobotics_bifrost_stream_drpc_client_client_proto_init() } -func file_github_com_aperturerobotics_bifrost_stream_drpc_client_client_proto_init() { - if File_github_com_aperturerobotics_bifrost_stream_drpc_client_client_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_github_com_aperturerobotics_bifrost_stream_drpc_client_client_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Config); 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_github_com_aperturerobotics_bifrost_stream_drpc_client_client_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_github_com_aperturerobotics_bifrost_stream_drpc_client_client_proto_goTypes, - DependencyIndexes: file_github_com_aperturerobotics_bifrost_stream_drpc_client_client_proto_depIdxs, - MessageInfos: file_github_com_aperturerobotics_bifrost_stream_drpc_client_client_proto_msgTypes, - }.Build() - File_github_com_aperturerobotics_bifrost_stream_drpc_client_client_proto = out.File - file_github_com_aperturerobotics_bifrost_stream_drpc_client_client_proto_rawDesc = nil - file_github_com_aperturerobotics_bifrost_stream_drpc_client_client_proto_goTypes = nil - file_github_com_aperturerobotics_bifrost_stream_drpc_client_client_proto_depIdxs = nil -} diff --git a/stream/drpc/client/client.pb.ts b/stream/drpc/client/client.pb.ts deleted file mode 100644 index 61afe13b..00000000 --- a/stream/drpc/client/client.pb.ts +++ /dev/null @@ -1,277 +0,0 @@ -/* eslint-disable */ -import { Backoff } from '@go/github.com/aperturerobotics/util/backoff/backoff.pb.js' -import Long from 'long' -import _m0 from 'protobufjs/minimal.js' -import { DrpcOpts } from '../drpc.pb.js' - -export const protobufPackage = 'stream.drpc.client' - -/** Config configures a client for a drpc service. */ -export interface Config { - /** ServerPeerIds are the static list of peer IDs to contact. */ - serverPeerIds: string[] - /** - * PerServerBackoff is the server peer error backoff configuration. - * Can be empty. - */ - perServerBackoff: Backoff | undefined - /** - * SrcPeerId is the source peer id to contact from. - * Can be empty. - */ - srcPeerId: string - /** TransportId restricts which transport we can dial out from. */ - transportId: Long - /** DrpcOpts are options passed to drpc. */ - drpcOpts: DrpcOpts | undefined - /** - * TimeoutDur sets the per-server establish timeout. - * If unset, no timeout. - * Example: 15s - */ - timeoutDur: string -} - -function createBaseConfig(): Config { - return { - serverPeerIds: [], - perServerBackoff: undefined, - srcPeerId: '', - transportId: Long.UZERO, - drpcOpts: undefined, - timeoutDur: '', - } -} - -export const Config = { - encode( - message: Config, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - for (const v of message.serverPeerIds) { - writer.uint32(10).string(v!) - } - if (message.perServerBackoff !== undefined) { - Backoff.encode( - message.perServerBackoff, - writer.uint32(18).fork(), - ).ldelim() - } - if (message.srcPeerId !== '') { - writer.uint32(26).string(message.srcPeerId) - } - if (!message.transportId.equals(Long.UZERO)) { - writer.uint32(32).uint64(message.transportId) - } - if (message.drpcOpts !== undefined) { - DrpcOpts.encode(message.drpcOpts, writer.uint32(42).fork()).ldelim() - } - if (message.timeoutDur !== '') { - writer.uint32(50).string(message.timeoutDur) - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Config { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseConfig() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break - } - - message.serverPeerIds.push(reader.string()) - continue - case 2: - if (tag !== 18) { - break - } - - message.perServerBackoff = Backoff.decode(reader, reader.uint32()) - continue - case 3: - if (tag !== 26) { - break - } - - message.srcPeerId = reader.string() - continue - case 4: - if (tag !== 32) { - break - } - - message.transportId = reader.uint64() as Long - continue - case 5: - if (tag !== 42) { - break - } - - message.drpcOpts = DrpcOpts.decode(reader, reader.uint32()) - continue - case 6: - if (tag !== 50) { - break - } - - message.timeoutDur = reader.string() - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: AsyncIterable | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config.encode(p).finish()] - } - } else { - yield* [Config.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config.decode(p)] - } - } else { - yield* [Config.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): Config { - return { - serverPeerIds: globalThis.Array.isArray(object?.serverPeerIds) - ? object.serverPeerIds.map((e: any) => globalThis.String(e)) - : [], - perServerBackoff: isSet(object.perServerBackoff) - ? Backoff.fromJSON(object.perServerBackoff) - : undefined, - srcPeerId: isSet(object.srcPeerId) - ? globalThis.String(object.srcPeerId) - : '', - transportId: isSet(object.transportId) - ? Long.fromValue(object.transportId) - : Long.UZERO, - drpcOpts: isSet(object.drpcOpts) - ? DrpcOpts.fromJSON(object.drpcOpts) - : undefined, - timeoutDur: isSet(object.timeoutDur) - ? globalThis.String(object.timeoutDur) - : '', - } - }, - - toJSON(message: Config): unknown { - const obj: any = {} - if (message.serverPeerIds?.length) { - obj.serverPeerIds = message.serverPeerIds - } - if (message.perServerBackoff !== undefined) { - obj.perServerBackoff = Backoff.toJSON(message.perServerBackoff) - } - if (message.srcPeerId !== '') { - obj.srcPeerId = message.srcPeerId - } - if (!message.transportId.equals(Long.UZERO)) { - obj.transportId = (message.transportId || Long.UZERO).toString() - } - if (message.drpcOpts !== undefined) { - obj.drpcOpts = DrpcOpts.toJSON(message.drpcOpts) - } - if (message.timeoutDur !== '') { - obj.timeoutDur = message.timeoutDur - } - return obj - }, - - create, I>>(base?: I): Config { - return Config.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>(object: I): Config { - const message = createBaseConfig() - message.serverPeerIds = object.serverPeerIds?.map((e) => e) || [] - message.perServerBackoff = - object.perServerBackoff !== undefined && object.perServerBackoff !== null - ? Backoff.fromPartial(object.perServerBackoff) - : undefined - message.srcPeerId = object.srcPeerId ?? '' - message.transportId = - object.transportId !== undefined && object.transportId !== null - ? Long.fromValue(object.transportId) - : Long.UZERO - message.drpcOpts = - object.drpcOpts !== undefined && object.drpcOpts !== null - ? DrpcOpts.fromPartial(object.drpcOpts) - : undefined - message.timeoutDur = object.timeoutDur ?? '' - return message - }, -} - -type Builtin = - | Date - | Function - | Uint8Array - | string - | number - | boolean - | undefined - -export type DeepPartial = T extends Builtin - ? T - : T extends Long - ? string | number | Long - : T extends globalThis.Array - ? globalThis.Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends { $case: string } - ? { [K in keyof Omit]?: DeepPartial } & { - $case: T['$case'] - } - : T extends {} - ? { [K in keyof T]?: DeepPartial } - : Partial - -type KeysOfUnion = T extends T ? keyof T : never -export type Exact = P extends Builtin - ? P - : P & { [K in keyof P]: Exact } & { - [K in Exclude>]: never - } - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any - _m0.configure() -} - -function isSet(value: any): boolean { - return value !== null && value !== undefined -} diff --git a/stream/drpc/client/client.proto b/stream/drpc/client/client.proto deleted file mode 100644 index 563df9c6..00000000 --- a/stream/drpc/client/client.proto +++ /dev/null @@ -1,25 +0,0 @@ -syntax = "proto3"; -package stream.drpc.client; - -import "github.com/aperturerobotics/bifrost/stream/drpc/drpc.proto"; -import "github.com/aperturerobotics/util/backoff/backoff.proto"; - -// Config configures a client for a drpc service. -message Config { - // ServerPeerIds are the static list of peer IDs to contact. - repeated string server_peer_ids = 1; - // PerServerBackoff is the server peer error backoff configuration. - // Can be empty. - .backoff.Backoff per_server_backoff = 2; - // SrcPeerId is the source peer id to contact from. - // Can be empty. - string src_peer_id = 3; - // TransportId restricts which transport we can dial out from. - uint64 transport_id = 4; - // DrpcOpts are options passed to drpc. - DrpcOpts drpc_opts = 5; - // TimeoutDur sets the per-server establish timeout. - // If unset, no timeout. - // Example: 15s - string timeout_dur = 6; -} diff --git a/stream/drpc/client/client_vtproto.pb.go b/stream/drpc/client/client_vtproto.pb.go deleted file mode 100644 index 792d0057..00000000 --- a/stream/drpc/client/client_vtproto.pb.go +++ /dev/null @@ -1,516 +0,0 @@ -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// protoc-gen-go-vtproto version: v0.6.0 -// source: github.com/aperturerobotics/bifrost/stream/drpc/client/client.proto - -package stream_drpc_client - -import ( - fmt "fmt" - io "io" - - drpc "github.com/aperturerobotics/bifrost/stream/drpc" - backoff "github.com/aperturerobotics/util/backoff" - protohelpers "github.com/planetscale/vtprotobuf/protohelpers" - proto "google.golang.org/protobuf/proto" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) -) - -func (m *Config) CloneVT() *Config { - if m == nil { - return (*Config)(nil) - } - r := new(Config) - r.SrcPeerId = m.SrcPeerId - r.TransportId = m.TransportId - r.TimeoutDur = m.TimeoutDur - if rhs := m.ServerPeerIds; rhs != nil { - tmpContainer := make([]string, len(rhs)) - copy(tmpContainer, rhs) - r.ServerPeerIds = tmpContainer - } - if rhs := m.PerServerBackoff; rhs != nil { - if vtpb, ok := interface{}(rhs).(interface{ CloneVT() *backoff.Backoff }); ok { - r.PerServerBackoff = vtpb.CloneVT() - } else { - r.PerServerBackoff = proto.Clone(rhs).(*backoff.Backoff) - } - } - if rhs := m.DrpcOpts; rhs != nil { - if vtpb, ok := interface{}(rhs).(interface{ CloneVT() *drpc.DrpcOpts }); ok { - r.DrpcOpts = vtpb.CloneVT() - } else { - r.DrpcOpts = proto.Clone(rhs).(*drpc.DrpcOpts) - } - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Config) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (this *Config) EqualVT(that *Config) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if len(this.ServerPeerIds) != len(that.ServerPeerIds) { - return false - } - for i, vx := range this.ServerPeerIds { - vy := that.ServerPeerIds[i] - if vx != vy { - return false - } - } - if equal, ok := interface{}(this.PerServerBackoff).(interface{ EqualVT(*backoff.Backoff) bool }); ok { - if !equal.EqualVT(that.PerServerBackoff) { - return false - } - } else if !proto.Equal(this.PerServerBackoff, that.PerServerBackoff) { - return false - } - if this.SrcPeerId != that.SrcPeerId { - return false - } - if this.TransportId != that.TransportId { - return false - } - if equal, ok := interface{}(this.DrpcOpts).(interface{ EqualVT(*drpc.DrpcOpts) bool }); ok { - if !equal.EqualVT(that.DrpcOpts) { - return false - } - } else if !proto.Equal(this.DrpcOpts, that.DrpcOpts) { - return false - } - if this.TimeoutDur != that.TimeoutDur { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Config) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Config) - if !ok { - return false - } - return this.EqualVT(that) -} -func (m *Config) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Config) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.TimeoutDur) > 0 { - i -= len(m.TimeoutDur) - copy(dAtA[i:], m.TimeoutDur) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.TimeoutDur))) - i-- - dAtA[i] = 0x32 - } - if m.DrpcOpts != nil { - if vtmsg, ok := interface{}(m.DrpcOpts).(interface { - MarshalToSizedBufferVT([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.DrpcOpts) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0x2a - } - if m.TransportId != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.TransportId)) - i-- - dAtA[i] = 0x20 - } - if len(m.SrcPeerId) > 0 { - i -= len(m.SrcPeerId) - copy(dAtA[i:], m.SrcPeerId) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.SrcPeerId))) - i-- - dAtA[i] = 0x1a - } - if m.PerServerBackoff != nil { - if vtmsg, ok := interface{}(m.PerServerBackoff).(interface { - MarshalToSizedBufferVT([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.PerServerBackoff) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0x12 - } - if len(m.ServerPeerIds) > 0 { - for iNdEx := len(m.ServerPeerIds) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.ServerPeerIds[iNdEx]) - copy(dAtA[i:], m.ServerPeerIds[iNdEx]) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.ServerPeerIds[iNdEx]))) - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *Config) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.ServerPeerIds) > 0 { - for _, s := range m.ServerPeerIds { - l = len(s) - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - } - if m.PerServerBackoff != nil { - if size, ok := interface{}(m.PerServerBackoff).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.PerServerBackoff) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - l = len(m.SrcPeerId) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.TransportId != 0 { - n += 1 + protohelpers.SizeOfVarint(uint64(m.TransportId)) - } - if m.DrpcOpts != nil { - if size, ok := interface{}(m.DrpcOpts).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.DrpcOpts) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - l = len(m.TimeoutDur) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *Config) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Config: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Config: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ServerPeerIds", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ServerPeerIds = append(m.ServerPeerIds, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PerServerBackoff", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.PerServerBackoff == nil { - m.PerServerBackoff = &backoff.Backoff{} - } - if unmarshal, ok := interface{}(m.PerServerBackoff).(interface { - UnmarshalVT([]byte) error - }); ok { - if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - } else { - if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.PerServerBackoff); err != nil { - return err - } - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SrcPeerId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SrcPeerId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TransportId", wireType) - } - m.TransportId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TransportId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DrpcOpts", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.DrpcOpts == nil { - m.DrpcOpts = &drpc.DrpcOpts{} - } - if unmarshal, ok := interface{}(m.DrpcOpts).(interface { - UnmarshalVT([]byte) error - }); ok { - if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - } else { - if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.DrpcOpts); err != nil { - return err - } - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TimeoutDur", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TimeoutDur = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} diff --git a/stream/drpc/client/config.go b/stream/drpc/client/config.go deleted file mode 100644 index 09405d4e..00000000 --- a/stream/drpc/client/config.go +++ /dev/null @@ -1,46 +0,0 @@ -package stream_drpc_client - -import ( - "time" - - "github.com/aperturerobotics/bifrost/peer" - "github.com/aperturerobotics/bifrost/util/confparse" - "github.com/pkg/errors" -) - -// Validate validates the config. -func (c *Config) Validate() error { - if err := c.GetDrpcOpts().Validate(); err != nil { - return err - } - if _, err := c.ParseSrcPeerId(); err != nil { - return errors.Wrap(err, "src_peer_id") - } - if _, err := c.ParseServerPeerIds(); err != nil { - return errors.Wrap(err, "server_peer_ids") - } - if _, err := c.ParseTimeoutDur(); err != nil { - return errors.Wrap(err, "timeout_dur") - } - return nil -} - -// ParseSrcPeerId parses the source peer id, if set. -func (c *Config) ParseSrcPeerId() (peer.ID, error) { - return confparse.ParsePeerID(c.GetSrcPeerId()) -} - -// ParseServerPeerIds parses the destination peer ids -func (c *Config) ParseServerPeerIds() ([]peer.ID, error) { - return confparse.ParsePeerIDs(c.GetServerPeerIds(), false) -} - -// ParseTimeoutDur parses the timeout duration. -// returns zero if empty -func (c *Config) ParseTimeoutDur() (time.Duration, error) { - durStr := c.GetTimeoutDur() - if durStr == "" { - return 0, nil - } - return time.ParseDuration(durStr) -} diff --git a/stream/drpc/drpc.go b/stream/drpc/drpc.go deleted file mode 100644 index d3c52594..00000000 --- a/stream/drpc/drpc.go +++ /dev/null @@ -1,74 +0,0 @@ -package stream_drpc - -import ( - "context" - - "github.com/aperturerobotics/bifrost/link" - "github.com/aperturerobotics/bifrost/peer" - "github.com/aperturerobotics/bifrost/protocol" - "github.com/aperturerobotics/bifrost/stream" - "github.com/aperturerobotics/controllerbus/bus" - "storj.io/drpc/drpcconn" -) - -// NewDrpcConn constructs a new dprc conn from a stream. -func NewDrpcConn(ctx context.Context, strm stream.Stream, opts *DrpcOpts) (*drpcconn.Conn, error) { - opt, err := opts.BuildOpts() - if err != nil { - return nil, err - } - return drpcconn.NewWithOptions(strm, opt), nil -} - -// EstablishDrpcConn establishes a drpc connection with a peer. -// -// srcPeer, transportID can be empty. -func EstablishDrpcConn( - ctx context.Context, - b bus.Bus, - opts *DrpcOpts, - protocolID protocol.ID, - srcPeer, destPeer peer.ID, - transportID uint64, -) (*drpcconn.Conn, func(), error) { - if err := opts.Validate(); err != nil { - return nil, nil, err - } - - // TODO: EstablishLinkWithPeer via transport id? - _, lkRel, err := b.AddDirective( - link.NewEstablishLinkWithPeer(srcPeer, destPeer), - nil, - ) - if err != nil { - return nil, nil, err - } - - ms, msRef, err := link.OpenStreamWithPeerEx( - ctx, - b, - protocolID, - srcPeer, destPeer, transportID, - stream.OpenOpts{ - Reliable: true, - Encrypted: true, - }, - ) - if err != nil { - lkRel.Release() - return nil, nil, err - } - - rel := func() { - msRef() - lkRel.Release() - } - - conn, err := NewDrpcConn(ctx, ms.GetStream(), opts) - if err != nil { - rel() - return nil, nil, err - } - - return conn, rel, err -} diff --git a/stream/drpc/drpc.pb.go b/stream/drpc/drpc.pb.go deleted file mode 100644 index 11824a53..00000000 --- a/stream/drpc/drpc.pb.go +++ /dev/null @@ -1,310 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0-devel -// protoc v5.26.1 -// source: github.com/aperturerobotics/bifrost/stream/drpc/drpc.proto - -package stream_drpc - -import ( - reflect "reflect" - sync "sync" - - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) -) - -// DprcOpts are drpc connection options. -type DrpcOpts struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // ManagerOpts are drpc manager options. - ManagerOpts *ManagerOpts `protobuf:"bytes,1,opt,name=manager_opts,json=managerOpts,proto3" json:"manager_opts,omitempty"` -} - -func (x *DrpcOpts) Reset() { - *x = DrpcOpts{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_stream_drpc_drpc_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DrpcOpts) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DrpcOpts) ProtoMessage() {} - -func (x *DrpcOpts) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_stream_drpc_drpc_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 DrpcOpts.ProtoReflect.Descriptor instead. -func (*DrpcOpts) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_stream_drpc_drpc_proto_rawDescGZIP(), []int{0} -} - -func (x *DrpcOpts) GetManagerOpts() *ManagerOpts { - if x != nil { - return x.ManagerOpts - } - return nil -} - -// ManagerOpts are drpc manager options. -type ManagerOpts struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // WriterBufferSize controls the size of the buffer that we will fill before - // flushing. Normal writes to streams typically issue a flush explicitly. - WriterBufferSize uint32 `protobuf:"varint,1,opt,name=writer_buffer_size,json=writerBufferSize,proto3" json:"writer_buffer_size,omitempty"` - // StreamOpts are options for streams created by the manager. - StreamOpts *StreamOpts `protobuf:"bytes,2,opt,name=stream_opts,json=streamOpts,proto3" json:"stream_opts,omitempty"` - // InactivityTimeout is the amount of time the manager will wait when creating - // a NewServerStream. It only includes the time it is reading packets from the - // remote client. In other words, it only includes the time that the client - // could delay before invoking an RPC. If zero or negative, no timeout. - InactivityTimeout string `protobuf:"bytes,3,opt,name=inactivity_timeout,json=inactivityTimeout,proto3" json:"inactivity_timeout,omitempty"` -} - -func (x *ManagerOpts) Reset() { - *x = ManagerOpts{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_stream_drpc_drpc_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ManagerOpts) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ManagerOpts) ProtoMessage() {} - -func (x *ManagerOpts) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_stream_drpc_drpc_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 ManagerOpts.ProtoReflect.Descriptor instead. -func (*ManagerOpts) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_stream_drpc_drpc_proto_rawDescGZIP(), []int{1} -} - -func (x *ManagerOpts) GetWriterBufferSize() uint32 { - if x != nil { - return x.WriterBufferSize - } - return 0 -} - -func (x *ManagerOpts) GetStreamOpts() *StreamOpts { - if x != nil { - return x.StreamOpts - } - return nil -} - -func (x *ManagerOpts) GetInactivityTimeout() string { - if x != nil { - return x.InactivityTimeout - } - return "" -} - -// StreamOpts are options for a drpc stream. -type StreamOpts struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // SplitSize controls the default size we split packets into frames. - SplitSize uint32 `protobuf:"varint,1,opt,name=split_size,json=splitSize,proto3" json:"split_size,omitempty"` -} - -func (x *StreamOpts) Reset() { - *x = StreamOpts{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_stream_drpc_drpc_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *StreamOpts) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*StreamOpts) ProtoMessage() {} - -func (x *StreamOpts) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_stream_drpc_drpc_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 StreamOpts.ProtoReflect.Descriptor instead. -func (*StreamOpts) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_stream_drpc_drpc_proto_rawDescGZIP(), []int{2} -} - -func (x *StreamOpts) GetSplitSize() uint32 { - if x != nil { - return x.SplitSize - } - return 0 -} - -var File_github_com_aperturerobotics_bifrost_stream_drpc_drpc_proto protoreflect.FileDescriptor - -var file_github_com_aperturerobotics_bifrost_stream_drpc_drpc_proto_rawDesc = []byte{ - 0x0a, 0x3a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, - 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x62, 0x69, - 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2f, 0x64, 0x72, 0x70, - 0x63, 0x2f, 0x64, 0x72, 0x70, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x73, 0x74, - 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x64, 0x72, 0x70, 0x63, 0x22, 0x47, 0x0a, 0x08, 0x44, 0x72, 0x70, - 0x63, 0x4f, 0x70, 0x74, 0x73, 0x12, 0x3b, 0x0a, 0x0c, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, - 0x5f, 0x6f, 0x70, 0x74, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x73, 0x74, - 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x64, 0x72, 0x70, 0x63, 0x2e, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, - 0x72, 0x4f, 0x70, 0x74, 0x73, 0x52, 0x0b, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x4f, 0x70, - 0x74, 0x73, 0x22, 0xa4, 0x01, 0x0a, 0x0b, 0x4d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x72, 0x4f, 0x70, - 0x74, 0x73, 0x12, 0x2c, 0x0a, 0x12, 0x77, 0x72, 0x69, 0x74, 0x65, 0x72, 0x5f, 0x62, 0x75, 0x66, - 0x66, 0x65, 0x72, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x10, - 0x77, 0x72, 0x69, 0x74, 0x65, 0x72, 0x42, 0x75, 0x66, 0x66, 0x65, 0x72, 0x53, 0x69, 0x7a, 0x65, - 0x12, 0x38, 0x0a, 0x0b, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x5f, 0x6f, 0x70, 0x74, 0x73, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x64, - 0x72, 0x70, 0x63, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x4f, 0x70, 0x74, 0x73, 0x52, 0x0a, - 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x4f, 0x70, 0x74, 0x73, 0x12, 0x2d, 0x0a, 0x12, 0x69, 0x6e, - 0x61, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x69, 0x6e, 0x61, 0x63, 0x74, 0x69, 0x76, 0x69, - 0x74, 0x79, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x22, 0x2b, 0x0a, 0x0a, 0x53, 0x74, 0x72, - 0x65, 0x61, 0x6d, 0x4f, 0x70, 0x74, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x70, 0x6c, 0x69, 0x74, - 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x73, 0x70, 0x6c, - 0x69, 0x74, 0x53, 0x69, 0x7a, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_github_com_aperturerobotics_bifrost_stream_drpc_drpc_proto_rawDescOnce sync.Once - file_github_com_aperturerobotics_bifrost_stream_drpc_drpc_proto_rawDescData = file_github_com_aperturerobotics_bifrost_stream_drpc_drpc_proto_rawDesc -) - -func file_github_com_aperturerobotics_bifrost_stream_drpc_drpc_proto_rawDescGZIP() []byte { - file_github_com_aperturerobotics_bifrost_stream_drpc_drpc_proto_rawDescOnce.Do(func() { - file_github_com_aperturerobotics_bifrost_stream_drpc_drpc_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_aperturerobotics_bifrost_stream_drpc_drpc_proto_rawDescData) - }) - return file_github_com_aperturerobotics_bifrost_stream_drpc_drpc_proto_rawDescData -} - -var file_github_com_aperturerobotics_bifrost_stream_drpc_drpc_proto_msgTypes = make([]protoimpl.MessageInfo, 3) -var file_github_com_aperturerobotics_bifrost_stream_drpc_drpc_proto_goTypes = []interface{}{ - (*DrpcOpts)(nil), // 0: stream.drpc.DrpcOpts - (*ManagerOpts)(nil), // 1: stream.drpc.ManagerOpts - (*StreamOpts)(nil), // 2: stream.drpc.StreamOpts -} -var file_github_com_aperturerobotics_bifrost_stream_drpc_drpc_proto_depIdxs = []int32{ - 1, // 0: stream.drpc.DrpcOpts.manager_opts:type_name -> stream.drpc.ManagerOpts - 2, // 1: stream.drpc.ManagerOpts.stream_opts:type_name -> stream.drpc.StreamOpts - 2, // [2:2] is the sub-list for method output_type - 2, // [2:2] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name -} - -func init() { file_github_com_aperturerobotics_bifrost_stream_drpc_drpc_proto_init() } -func file_github_com_aperturerobotics_bifrost_stream_drpc_drpc_proto_init() { - if File_github_com_aperturerobotics_bifrost_stream_drpc_drpc_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_github_com_aperturerobotics_bifrost_stream_drpc_drpc_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DrpcOpts); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_github_com_aperturerobotics_bifrost_stream_drpc_drpc_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ManagerOpts); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_github_com_aperturerobotics_bifrost_stream_drpc_drpc_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StreamOpts); 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_github_com_aperturerobotics_bifrost_stream_drpc_drpc_proto_rawDesc, - NumEnums: 0, - NumMessages: 3, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_github_com_aperturerobotics_bifrost_stream_drpc_drpc_proto_goTypes, - DependencyIndexes: file_github_com_aperturerobotics_bifrost_stream_drpc_drpc_proto_depIdxs, - MessageInfos: file_github_com_aperturerobotics_bifrost_stream_drpc_drpc_proto_msgTypes, - }.Build() - File_github_com_aperturerobotics_bifrost_stream_drpc_drpc_proto = out.File - file_github_com_aperturerobotics_bifrost_stream_drpc_drpc_proto_rawDesc = nil - file_github_com_aperturerobotics_bifrost_stream_drpc_drpc_proto_goTypes = nil - file_github_com_aperturerobotics_bifrost_stream_drpc_drpc_proto_depIdxs = nil -} diff --git a/stream/drpc/drpc.pb.ts b/stream/drpc/drpc.pb.ts deleted file mode 100644 index a740517d..00000000 --- a/stream/drpc/drpc.pb.ts +++ /dev/null @@ -1,423 +0,0 @@ -/* eslint-disable */ -import Long from 'long' -import _m0 from 'protobufjs/minimal.js' - -export const protobufPackage = 'stream.drpc' - -/** DprcOpts are drpc connection options. */ -export interface DrpcOpts { - /** ManagerOpts are drpc manager options. */ - managerOpts: ManagerOpts | undefined -} - -/** ManagerOpts are drpc manager options. */ -export interface ManagerOpts { - /** - * WriterBufferSize controls the size of the buffer that we will fill before - * flushing. Normal writes to streams typically issue a flush explicitly. - */ - writerBufferSize: number - /** StreamOpts are options for streams created by the manager. */ - streamOpts: StreamOpts | undefined - /** - * InactivityTimeout is the amount of time the manager will wait when creating - * a NewServerStream. It only includes the time it is reading packets from the - * remote client. In other words, it only includes the time that the client - * could delay before invoking an RPC. If zero or negative, no timeout. - */ - inactivityTimeout: string -} - -/** StreamOpts are options for a drpc stream. */ -export interface StreamOpts { - /** SplitSize controls the default size we split packets into frames. */ - splitSize: number -} - -function createBaseDrpcOpts(): DrpcOpts { - return { managerOpts: undefined } -} - -export const DrpcOpts = { - encode( - message: DrpcOpts, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.managerOpts !== undefined) { - ManagerOpts.encode(message.managerOpts, writer.uint32(10).fork()).ldelim() - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): DrpcOpts { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseDrpcOpts() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break - } - - message.managerOpts = ManagerOpts.decode(reader, reader.uint32()) - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [DrpcOpts.encode(p).finish()] - } - } else { - yield* [DrpcOpts.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [DrpcOpts.decode(p)] - } - } else { - yield* [DrpcOpts.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): DrpcOpts { - return { - managerOpts: isSet(object.managerOpts) - ? ManagerOpts.fromJSON(object.managerOpts) - : undefined, - } - }, - - toJSON(message: DrpcOpts): unknown { - const obj: any = {} - if (message.managerOpts !== undefined) { - obj.managerOpts = ManagerOpts.toJSON(message.managerOpts) - } - return obj - }, - - create, I>>(base?: I): DrpcOpts { - return DrpcOpts.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>(object: I): DrpcOpts { - const message = createBaseDrpcOpts() - message.managerOpts = - object.managerOpts !== undefined && object.managerOpts !== null - ? ManagerOpts.fromPartial(object.managerOpts) - : undefined - return message - }, -} - -function createBaseManagerOpts(): ManagerOpts { - return { writerBufferSize: 0, streamOpts: undefined, inactivityTimeout: '' } -} - -export const ManagerOpts = { - encode( - message: ManagerOpts, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.writerBufferSize !== 0) { - writer.uint32(8).uint32(message.writerBufferSize) - } - if (message.streamOpts !== undefined) { - StreamOpts.encode(message.streamOpts, writer.uint32(18).fork()).ldelim() - } - if (message.inactivityTimeout !== '') { - writer.uint32(26).string(message.inactivityTimeout) - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): ManagerOpts { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseManagerOpts() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 8) { - break - } - - message.writerBufferSize = reader.uint32() - continue - case 2: - if (tag !== 18) { - break - } - - message.streamOpts = StreamOpts.decode(reader, reader.uint32()) - continue - case 3: - if (tag !== 26) { - break - } - - message.inactivityTimeout = reader.string() - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [ManagerOpts.encode(p).finish()] - } - } else { - yield* [ManagerOpts.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [ManagerOpts.decode(p)] - } - } else { - yield* [ManagerOpts.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): ManagerOpts { - return { - writerBufferSize: isSet(object.writerBufferSize) - ? globalThis.Number(object.writerBufferSize) - : 0, - streamOpts: isSet(object.streamOpts) - ? StreamOpts.fromJSON(object.streamOpts) - : undefined, - inactivityTimeout: isSet(object.inactivityTimeout) - ? globalThis.String(object.inactivityTimeout) - : '', - } - }, - - toJSON(message: ManagerOpts): unknown { - const obj: any = {} - if (message.writerBufferSize !== 0) { - obj.writerBufferSize = Math.round(message.writerBufferSize) - } - if (message.streamOpts !== undefined) { - obj.streamOpts = StreamOpts.toJSON(message.streamOpts) - } - if (message.inactivityTimeout !== '') { - obj.inactivityTimeout = message.inactivityTimeout - } - return obj - }, - - create, I>>(base?: I): ManagerOpts { - return ManagerOpts.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>( - object: I, - ): ManagerOpts { - const message = createBaseManagerOpts() - message.writerBufferSize = object.writerBufferSize ?? 0 - message.streamOpts = - object.streamOpts !== undefined && object.streamOpts !== null - ? StreamOpts.fromPartial(object.streamOpts) - : undefined - message.inactivityTimeout = object.inactivityTimeout ?? '' - return message - }, -} - -function createBaseStreamOpts(): StreamOpts { - return { splitSize: 0 } -} - -export const StreamOpts = { - encode( - message: StreamOpts, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.splitSize !== 0) { - writer.uint32(8).uint32(message.splitSize) - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): StreamOpts { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseStreamOpts() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 8) { - break - } - - message.splitSize = reader.uint32() - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [StreamOpts.encode(p).finish()] - } - } else { - yield* [StreamOpts.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [StreamOpts.decode(p)] - } - } else { - yield* [StreamOpts.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): StreamOpts { - return { - splitSize: isSet(object.splitSize) - ? globalThis.Number(object.splitSize) - : 0, - } - }, - - toJSON(message: StreamOpts): unknown { - const obj: any = {} - if (message.splitSize !== 0) { - obj.splitSize = Math.round(message.splitSize) - } - return obj - }, - - create, I>>(base?: I): StreamOpts { - return StreamOpts.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>( - object: I, - ): StreamOpts { - const message = createBaseStreamOpts() - message.splitSize = object.splitSize ?? 0 - return message - }, -} - -type Builtin = - | Date - | Function - | Uint8Array - | string - | number - | boolean - | undefined - -export type DeepPartial = T extends Builtin - ? T - : T extends Long - ? string | number | Long - : T extends globalThis.Array - ? globalThis.Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends { $case: string } - ? { [K in keyof Omit]?: DeepPartial } & { - $case: T['$case'] - } - : T extends {} - ? { [K in keyof T]?: DeepPartial } - : Partial - -type KeysOfUnion = T extends T ? keyof T : never -export type Exact = P extends Builtin - ? P - : P & { [K in keyof P]: Exact } & { - [K in Exclude>]: never - } - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any - _m0.configure() -} - -function isSet(value: any): boolean { - return value !== null && value !== undefined -} diff --git a/stream/drpc/drpc.proto b/stream/drpc/drpc.proto deleted file mode 100644 index 1f2d9d7c..00000000 --- a/stream/drpc/drpc.proto +++ /dev/null @@ -1,28 +0,0 @@ -syntax = "proto3"; -package stream.drpc; - -// DprcOpts are drpc connection options. -message DrpcOpts { - // ManagerOpts are drpc manager options. - ManagerOpts manager_opts = 1; -} - -// ManagerOpts are drpc manager options. -message ManagerOpts { - // WriterBufferSize controls the size of the buffer that we will fill before - // flushing. Normal writes to streams typically issue a flush explicitly. - uint32 writer_buffer_size = 1; - // StreamOpts are options for streams created by the manager. - StreamOpts stream_opts = 2; - // InactivityTimeout is the amount of time the manager will wait when creating - // a NewServerStream. It only includes the time it is reading packets from the - // remote client. In other words, it only includes the time that the client - // could delay before invoking an RPC. If zero or negative, no timeout. - string inactivity_timeout = 3; -} - -// StreamOpts are options for a drpc stream. -message StreamOpts { - // SplitSize controls the default size we split packets into frames. - uint32 split_size = 1; -} diff --git a/stream/drpc/drpc_vtproto.pb.go b/stream/drpc/drpc_vtproto.pb.go deleted file mode 100644 index a3cc70a7..00000000 --- a/stream/drpc/drpc_vtproto.pb.go +++ /dev/null @@ -1,617 +0,0 @@ -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// protoc-gen-go-vtproto version: v0.6.0 -// source: github.com/aperturerobotics/bifrost/stream/drpc/drpc.proto - -package stream_drpc - -import ( - fmt "fmt" - io "io" - - protohelpers "github.com/planetscale/vtprotobuf/protohelpers" - proto "google.golang.org/protobuf/proto" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) -) - -func (m *DrpcOpts) CloneVT() *DrpcOpts { - if m == nil { - return (*DrpcOpts)(nil) - } - r := new(DrpcOpts) - r.ManagerOpts = m.ManagerOpts.CloneVT() - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *DrpcOpts) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *ManagerOpts) CloneVT() *ManagerOpts { - if m == nil { - return (*ManagerOpts)(nil) - } - r := new(ManagerOpts) - r.WriterBufferSize = m.WriterBufferSize - r.StreamOpts = m.StreamOpts.CloneVT() - r.InactivityTimeout = m.InactivityTimeout - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *ManagerOpts) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *StreamOpts) CloneVT() *StreamOpts { - if m == nil { - return (*StreamOpts)(nil) - } - r := new(StreamOpts) - r.SplitSize = m.SplitSize - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *StreamOpts) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (this *DrpcOpts) EqualVT(that *DrpcOpts) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if !this.ManagerOpts.EqualVT(that.ManagerOpts) { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *DrpcOpts) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*DrpcOpts) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *ManagerOpts) EqualVT(that *ManagerOpts) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.WriterBufferSize != that.WriterBufferSize { - return false - } - if !this.StreamOpts.EqualVT(that.StreamOpts) { - return false - } - if this.InactivityTimeout != that.InactivityTimeout { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *ManagerOpts) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*ManagerOpts) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *StreamOpts) EqualVT(that *StreamOpts) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.SplitSize != that.SplitSize { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *StreamOpts) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*StreamOpts) - if !ok { - return false - } - return this.EqualVT(that) -} -func (m *DrpcOpts) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *DrpcOpts) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *DrpcOpts) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.ManagerOpts != nil { - size, err := m.ManagerOpts.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *ManagerOpts) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ManagerOpts) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *ManagerOpts) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.InactivityTimeout) > 0 { - i -= len(m.InactivityTimeout) - copy(dAtA[i:], m.InactivityTimeout) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.InactivityTimeout))) - i-- - dAtA[i] = 0x1a - } - if m.StreamOpts != nil { - size, err := m.StreamOpts.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x12 - } - if m.WriterBufferSize != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.WriterBufferSize)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *StreamOpts) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *StreamOpts) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *StreamOpts) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.SplitSize != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.SplitSize)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *DrpcOpts) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ManagerOpts != nil { - l = m.ManagerOpts.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *ManagerOpts) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.WriterBufferSize != 0 { - n += 1 + protohelpers.SizeOfVarint(uint64(m.WriterBufferSize)) - } - if m.StreamOpts != nil { - l = m.StreamOpts.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - l = len(m.InactivityTimeout) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *StreamOpts) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.SplitSize != 0 { - n += 1 + protohelpers.SizeOfVarint(uint64(m.SplitSize)) - } - n += len(m.unknownFields) - return n -} - -func (m *DrpcOpts) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: DrpcOpts: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DrpcOpts: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ManagerOpts", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.ManagerOpts == nil { - m.ManagerOpts = &ManagerOpts{} - } - if err := m.ManagerOpts.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ManagerOpts) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ManagerOpts: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ManagerOpts: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field WriterBufferSize", wireType) - } - m.WriterBufferSize = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.WriterBufferSize |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StreamOpts", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.StreamOpts == nil { - m.StreamOpts = &StreamOpts{} - } - if err := m.StreamOpts.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field InactivityTimeout", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.InactivityTimeout = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *StreamOpts) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: StreamOpts: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: StreamOpts: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field SplitSize", wireType) - } - m.SplitSize = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.SplitSize |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} diff --git a/stream/drpc/e2e/e2e.go b/stream/drpc/e2e/e2e.go deleted file mode 100644 index ea4f1330..00000000 --- a/stream/drpc/e2e/e2e.go +++ /dev/null @@ -1,34 +0,0 @@ -package drpc_e2e - -import ( - context "context" - - "github.com/aperturerobotics/bifrost/protocol" - "storj.io/drpc" -) - -// ProtocolID is the protocol ID for the end-to-end test. -const ProtocolID protocol.ID = "bifrost/stream/drpc/e2e" - -// Server is the e2e server. -type Server struct{} - -// NewServer constructs the server. -func NewServer() *Server { - return &Server{} -} - -// Register registers the API with a DRPC mux. -func (s *Server) Register(mux drpc.Mux) error { - return DRPCRegisterEndToEnd(mux, s) -} - -// Mock performs the mock request. -func (s *Server) Mock(ctx context.Context, req *MockRequest) (*MockResponse, error) { - return &MockResponse{ - ReqBody: req.GetBody(), - }, nil -} - -// _ is a type assertion -var _ DRPCEndToEndServer = ((*Server)(nil)) diff --git a/stream/drpc/e2e/e2e.pb.go b/stream/drpc/e2e/e2e.pb.go deleted file mode 100644 index eae0b17a..00000000 --- a/stream/drpc/e2e/e2e.pb.go +++ /dev/null @@ -1,218 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0-devel -// protoc v5.26.1 -// source: github.com/aperturerobotics/bifrost/stream/drpc/e2e/e2e.proto - -package drpc_e2e - -import ( - reflect "reflect" - sync "sync" - - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) -) - -// MockRequest is the mock request. -type MockRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Body is the body of the request. - Body string `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` -} - -func (x *MockRequest) Reset() { - *x = MockRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_stream_drpc_e2e_e2e_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MockRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MockRequest) ProtoMessage() {} - -func (x *MockRequest) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_stream_drpc_e2e_e2e_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 MockRequest.ProtoReflect.Descriptor instead. -func (*MockRequest) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_stream_drpc_e2e_e2e_proto_rawDescGZIP(), []int{0} -} - -func (x *MockRequest) GetBody() string { - if x != nil { - return x.Body - } - return "" -} - -// MockResponse is the mock response. -type MockResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // ReqBody is the echoed request body. - ReqBody string `protobuf:"bytes,1,opt,name=req_body,json=reqBody,proto3" json:"req_body,omitempty"` -} - -func (x *MockResponse) Reset() { - *x = MockResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_stream_drpc_e2e_e2e_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MockResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MockResponse) ProtoMessage() {} - -func (x *MockResponse) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_stream_drpc_e2e_e2e_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 MockResponse.ProtoReflect.Descriptor instead. -func (*MockResponse) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_stream_drpc_e2e_e2e_proto_rawDescGZIP(), []int{1} -} - -func (x *MockResponse) GetReqBody() string { - if x != nil { - return x.ReqBody - } - return "" -} - -var File_github_com_aperturerobotics_bifrost_stream_drpc_e2e_e2e_proto protoreflect.FileDescriptor - -var file_github_com_aperturerobotics_bifrost_stream_drpc_e2e_e2e_proto_rawDesc = []byte{ - 0x0a, 0x3d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, - 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x62, 0x69, - 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2f, 0x64, 0x72, 0x70, - 0x63, 0x2f, 0x65, 0x32, 0x65, 0x2f, 0x65, 0x32, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, - 0x08, 0x64, 0x72, 0x70, 0x63, 0x2e, 0x65, 0x32, 0x65, 0x22, 0x21, 0x0a, 0x0b, 0x4d, 0x6f, 0x63, - 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x22, 0x29, 0x0a, 0x0c, - 0x4d, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x19, 0x0a, 0x08, - 0x72, 0x65, 0x71, 0x5f, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, - 0x72, 0x65, 0x71, 0x42, 0x6f, 0x64, 0x79, 0x32, 0x43, 0x0a, 0x08, 0x45, 0x6e, 0x64, 0x54, 0x6f, - 0x45, 0x6e, 0x64, 0x12, 0x37, 0x0a, 0x04, 0x4d, 0x6f, 0x63, 0x6b, 0x12, 0x15, 0x2e, 0x64, 0x72, - 0x70, 0x63, 0x2e, 0x65, 0x32, 0x65, 0x2e, 0x4d, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x64, 0x72, 0x70, 0x63, 0x2e, 0x65, 0x32, 0x65, 0x2e, 0x4d, 0x6f, - 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_github_com_aperturerobotics_bifrost_stream_drpc_e2e_e2e_proto_rawDescOnce sync.Once - file_github_com_aperturerobotics_bifrost_stream_drpc_e2e_e2e_proto_rawDescData = file_github_com_aperturerobotics_bifrost_stream_drpc_e2e_e2e_proto_rawDesc -) - -func file_github_com_aperturerobotics_bifrost_stream_drpc_e2e_e2e_proto_rawDescGZIP() []byte { - file_github_com_aperturerobotics_bifrost_stream_drpc_e2e_e2e_proto_rawDescOnce.Do(func() { - file_github_com_aperturerobotics_bifrost_stream_drpc_e2e_e2e_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_aperturerobotics_bifrost_stream_drpc_e2e_e2e_proto_rawDescData) - }) - return file_github_com_aperturerobotics_bifrost_stream_drpc_e2e_e2e_proto_rawDescData -} - -var file_github_com_aperturerobotics_bifrost_stream_drpc_e2e_e2e_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_github_com_aperturerobotics_bifrost_stream_drpc_e2e_e2e_proto_goTypes = []interface{}{ - (*MockRequest)(nil), // 0: drpc.e2e.MockRequest - (*MockResponse)(nil), // 1: drpc.e2e.MockResponse -} -var file_github_com_aperturerobotics_bifrost_stream_drpc_e2e_e2e_proto_depIdxs = []int32{ - 0, // 0: drpc.e2e.EndToEnd.Mock:input_type -> drpc.e2e.MockRequest - 1, // 1: drpc.e2e.EndToEnd.Mock:output_type -> drpc.e2e.MockResponse - 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_github_com_aperturerobotics_bifrost_stream_drpc_e2e_e2e_proto_init() } -func file_github_com_aperturerobotics_bifrost_stream_drpc_e2e_e2e_proto_init() { - if File_github_com_aperturerobotics_bifrost_stream_drpc_e2e_e2e_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_github_com_aperturerobotics_bifrost_stream_drpc_e2e_e2e_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MockRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_github_com_aperturerobotics_bifrost_stream_drpc_e2e_e2e_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MockResponse); 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_github_com_aperturerobotics_bifrost_stream_drpc_e2e_e2e_proto_rawDesc, - NumEnums: 0, - NumMessages: 2, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_github_com_aperturerobotics_bifrost_stream_drpc_e2e_e2e_proto_goTypes, - DependencyIndexes: file_github_com_aperturerobotics_bifrost_stream_drpc_e2e_e2e_proto_depIdxs, - MessageInfos: file_github_com_aperturerobotics_bifrost_stream_drpc_e2e_e2e_proto_msgTypes, - }.Build() - File_github_com_aperturerobotics_bifrost_stream_drpc_e2e_e2e_proto = out.File - file_github_com_aperturerobotics_bifrost_stream_drpc_e2e_e2e_proto_rawDesc = nil - file_github_com_aperturerobotics_bifrost_stream_drpc_e2e_e2e_proto_goTypes = nil - file_github_com_aperturerobotics_bifrost_stream_drpc_e2e_e2e_proto_depIdxs = nil -} diff --git a/stream/drpc/e2e/e2e.pb.ts b/stream/drpc/e2e/e2e.pb.ts deleted file mode 100644 index daa1248a..00000000 --- a/stream/drpc/e2e/e2e.pb.ts +++ /dev/null @@ -1,314 +0,0 @@ -/* eslint-disable */ -import Long from 'long' -import _m0 from 'protobufjs/minimal.js' - -export const protobufPackage = 'drpc.e2e' - -/** MockRequest is the mock request. */ -export interface MockRequest { - /** Body is the body of the request. */ - body: string -} - -/** MockResponse is the mock response. */ -export interface MockResponse { - /** ReqBody is the echoed request body. */ - reqBody: string -} - -function createBaseMockRequest(): MockRequest { - return { body: '' } -} - -export const MockRequest = { - encode( - message: MockRequest, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.body !== '') { - writer.uint32(10).string(message.body) - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MockRequest { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseMockRequest() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break - } - - message.body = reader.string() - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [MockRequest.encode(p).finish()] - } - } else { - yield* [MockRequest.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [MockRequest.decode(p)] - } - } else { - yield* [MockRequest.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): MockRequest { - return { body: isSet(object.body) ? globalThis.String(object.body) : '' } - }, - - toJSON(message: MockRequest): unknown { - const obj: any = {} - if (message.body !== '') { - obj.body = message.body - } - return obj - }, - - create, I>>(base?: I): MockRequest { - return MockRequest.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>( - object: I, - ): MockRequest { - const message = createBaseMockRequest() - message.body = object.body ?? '' - return message - }, -} - -function createBaseMockResponse(): MockResponse { - return { reqBody: '' } -} - -export const MockResponse = { - encode( - message: MockResponse, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.reqBody !== '') { - writer.uint32(10).string(message.reqBody) - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): MockResponse { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseMockResponse() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break - } - - message.reqBody = reader.string() - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [MockResponse.encode(p).finish()] - } - } else { - yield* [MockResponse.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [MockResponse.decode(p)] - } - } else { - yield* [MockResponse.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): MockResponse { - return { - reqBody: isSet(object.reqBody) ? globalThis.String(object.reqBody) : '', - } - }, - - toJSON(message: MockResponse): unknown { - const obj: any = {} - if (message.reqBody !== '') { - obj.reqBody = message.reqBody - } - return obj - }, - - create, I>>( - base?: I, - ): MockResponse { - return MockResponse.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>( - object: I, - ): MockResponse { - const message = createBaseMockResponse() - message.reqBody = object.reqBody ?? '' - return message - }, -} - -/** EndToEnd is a end to end test service. */ -export interface EndToEnd { - /** Mock performs the mock request. */ - Mock(request: MockRequest, abortSignal?: AbortSignal): Promise -} - -export const EndToEndServiceName = 'drpc.e2e.EndToEnd' -export class EndToEndClientImpl implements EndToEnd { - private readonly rpc: Rpc - private readonly service: string - constructor(rpc: Rpc, opts?: { service?: string }) { - this.service = opts?.service || EndToEndServiceName - this.rpc = rpc - this.Mock = this.Mock.bind(this) - } - Mock(request: MockRequest, abortSignal?: AbortSignal): Promise { - const data = MockRequest.encode(request).finish() - const promise = this.rpc.request( - this.service, - 'Mock', - data, - abortSignal || undefined, - ) - return promise.then((data) => MockResponse.decode(_m0.Reader.create(data))) - } -} - -/** EndToEnd is a end to end test service. */ -export type EndToEndDefinition = typeof EndToEndDefinition -export const EndToEndDefinition = { - name: 'EndToEnd', - fullName: 'drpc.e2e.EndToEnd', - methods: { - /** Mock performs the mock request. */ - mock: { - name: 'Mock', - requestType: MockRequest, - requestStream: false, - responseType: MockResponse, - responseStream: false, - options: {}, - }, - }, -} as const - -interface Rpc { - request( - service: string, - method: string, - data: Uint8Array, - abortSignal?: AbortSignal, - ): Promise -} - -type Builtin = - | Date - | Function - | Uint8Array - | string - | number - | boolean - | undefined - -export type DeepPartial = T extends Builtin - ? T - : T extends Long - ? string | number | Long - : T extends globalThis.Array - ? globalThis.Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends { $case: string } - ? { [K in keyof Omit]?: DeepPartial } & { - $case: T['$case'] - } - : T extends {} - ? { [K in keyof T]?: DeepPartial } - : Partial - -type KeysOfUnion = T extends T ? keyof T : never -export type Exact = P extends Builtin - ? P - : P & { [K in keyof P]: Exact } & { - [K in Exclude>]: never - } - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any - _m0.configure() -} - -function isSet(value: any): boolean { - return value !== null && value !== undefined -} diff --git a/stream/drpc/e2e/e2e.proto b/stream/drpc/e2e/e2e.proto deleted file mode 100644 index 87471865..00000000 --- a/stream/drpc/e2e/e2e.proto +++ /dev/null @@ -1,20 +0,0 @@ -syntax = "proto3"; -package drpc.e2e; - -// MockRequest is the mock request. -message MockRequest { - // Body is the body of the request. - string body = 1; -} - -// MockResponse is the mock response. -message MockResponse { - // ReqBody is the echoed request body. - string req_body = 1; -} - -// EndToEnd is a end to end test service. -service EndToEnd { - // Mock performs the mock request. - rpc Mock(MockRequest) returns (MockResponse) {} -} \ No newline at end of file diff --git a/stream/drpc/e2e/e2e_drpc.pb.go b/stream/drpc/e2e/e2e_drpc.pb.go deleted file mode 100644 index 82e2e85f..00000000 --- a/stream/drpc/e2e/e2e_drpc.pb.go +++ /dev/null @@ -1,99 +0,0 @@ -// Code generated by protoc-gen-go-drpc. DO NOT EDIT. -// protoc-gen-go-drpc version: v0.0.34 -// source: github.com/aperturerobotics/bifrost/stream/drpc/e2e/e2e.proto - -package drpc_e2e - -import ( - context "context" - errors "errors" - - drpc1 "github.com/planetscale/vtprotobuf/codec/drpc" - drpc "storj.io/drpc" - drpcerr "storj.io/drpc/drpcerr" -) - -type drpcEncoding_File_github_com_aperturerobotics_bifrost_stream_drpc_e2e_e2e_proto struct{} - -func (drpcEncoding_File_github_com_aperturerobotics_bifrost_stream_drpc_e2e_e2e_proto) Marshal(msg drpc.Message) ([]byte, error) { - return drpc1.Marshal(msg) -} - -func (drpcEncoding_File_github_com_aperturerobotics_bifrost_stream_drpc_e2e_e2e_proto) Unmarshal(buf []byte, msg drpc.Message) error { - return drpc1.Unmarshal(buf, msg) -} - -type DRPCEndToEndClient interface { - DRPCConn() drpc.Conn - - Mock(ctx context.Context, in *MockRequest) (*MockResponse, error) -} - -type drpcEndToEndClient struct { - cc drpc.Conn -} - -func NewDRPCEndToEndClient(cc drpc.Conn) DRPCEndToEndClient { - return &drpcEndToEndClient{cc} -} - -func (c *drpcEndToEndClient) DRPCConn() drpc.Conn { return c.cc } - -func (c *drpcEndToEndClient) Mock(ctx context.Context, in *MockRequest) (*MockResponse, error) { - out := new(MockResponse) - err := c.cc.Invoke(ctx, "/drpc.e2e.EndToEnd/Mock", drpcEncoding_File_github_com_aperturerobotics_bifrost_stream_drpc_e2e_e2e_proto{}, in, out) - if err != nil { - return nil, err - } - return out, nil -} - -type DRPCEndToEndServer interface { - Mock(context.Context, *MockRequest) (*MockResponse, error) -} - -type DRPCEndToEndUnimplementedServer struct{} - -func (s *DRPCEndToEndUnimplementedServer) Mock(context.Context, *MockRequest) (*MockResponse, error) { - return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented) -} - -type DRPCEndToEndDescription struct{} - -func (DRPCEndToEndDescription) NumMethods() int { return 1 } - -func (DRPCEndToEndDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver, interface{}, bool) { - switch n { - case 0: - return "/drpc.e2e.EndToEnd/Mock", drpcEncoding_File_github_com_aperturerobotics_bifrost_stream_drpc_e2e_e2e_proto{}, - func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) { - return srv.(DRPCEndToEndServer). - Mock( - ctx, - in1.(*MockRequest), - ) - }, DRPCEndToEndServer.Mock, true - default: - return "", nil, nil, nil, false - } -} - -func DRPCRegisterEndToEnd(mux drpc.Mux, impl DRPCEndToEndServer) error { - return mux.Register(impl, DRPCEndToEndDescription{}) -} - -type DRPCEndToEnd_MockStream interface { - drpc.Stream - SendAndClose(*MockResponse) error -} - -type drpcEndToEnd_MockStream struct { - drpc.Stream -} - -func (x *drpcEndToEnd_MockStream) SendAndClose(m *MockResponse) error { - if err := x.MsgSend(m, drpcEncoding_File_github_com_aperturerobotics_bifrost_stream_drpc_e2e_e2e_proto{}); err != nil { - return err - } - return x.CloseSend() -} diff --git a/stream/drpc/e2e/e2e_srpc.pb.go b/stream/drpc/e2e/e2e_srpc.pb.go deleted file mode 100644 index bda6c031..00000000 --- a/stream/drpc/e2e/e2e_srpc.pb.go +++ /dev/null @@ -1,120 +0,0 @@ -// Code generated by protoc-gen-srpc. DO NOT EDIT. -// protoc-gen-srpc version: v0.27.3 -// source: github.com/aperturerobotics/bifrost/stream/drpc/e2e/e2e.proto - -package drpc_e2e - -import ( - context "context" - - srpc "github.com/aperturerobotics/starpc/srpc" -) - -type SRPCEndToEndClient interface { - SRPCClient() srpc.Client - - Mock(ctx context.Context, in *MockRequest) (*MockResponse, error) -} - -type srpcEndToEndClient struct { - cc srpc.Client - serviceID string -} - -func NewSRPCEndToEndClient(cc srpc.Client) SRPCEndToEndClient { - return &srpcEndToEndClient{cc: cc, serviceID: SRPCEndToEndServiceID} -} - -func NewSRPCEndToEndClientWithServiceID(cc srpc.Client, serviceID string) SRPCEndToEndClient { - if serviceID == "" { - serviceID = SRPCEndToEndServiceID - } - return &srpcEndToEndClient{cc: cc, serviceID: serviceID} -} - -func (c *srpcEndToEndClient) SRPCClient() srpc.Client { return c.cc } - -func (c *srpcEndToEndClient) Mock(ctx context.Context, in *MockRequest) (*MockResponse, error) { - out := new(MockResponse) - err := c.cc.ExecCall(ctx, c.serviceID, "Mock", in, out) - if err != nil { - return nil, err - } - return out, nil -} - -type SRPCEndToEndServer interface { - Mock(context.Context, *MockRequest) (*MockResponse, error) -} - -type SRPCEndToEndUnimplementedServer struct{} - -func (s *SRPCEndToEndUnimplementedServer) Mock(context.Context, *MockRequest) (*MockResponse, error) { - return nil, srpc.ErrUnimplemented -} - -const SRPCEndToEndServiceID = "drpc.e2e.EndToEnd" - -type SRPCEndToEndHandler struct { - serviceID string - impl SRPCEndToEndServer -} - -// NewSRPCEndToEndHandler constructs a new RPC handler. -// serviceID: if empty, uses default: drpc.e2e.EndToEnd -func NewSRPCEndToEndHandler(impl SRPCEndToEndServer, serviceID string) srpc.Handler { - if serviceID == "" { - serviceID = SRPCEndToEndServiceID - } - return &SRPCEndToEndHandler{impl: impl, serviceID: serviceID} -} - -// SRPCRegisterEndToEnd registers the implementation with the mux. -// Uses the default serviceID: drpc.e2e.EndToEnd -func SRPCRegisterEndToEnd(mux srpc.Mux, impl SRPCEndToEndServer) error { - return mux.Register(NewSRPCEndToEndHandler(impl, "")) -} - -func (d *SRPCEndToEndHandler) GetServiceID() string { return d.serviceID } - -func (SRPCEndToEndHandler) GetMethodIDs() []string { - return []string{ - "Mock", - } -} - -func (d *SRPCEndToEndHandler) InvokeMethod( - serviceID, methodID string, - strm srpc.Stream, -) (bool, error) { - if serviceID != "" && serviceID != d.GetServiceID() { - return false, nil - } - - switch methodID { - case "Mock": - return true, d.InvokeMethod_Mock(d.impl, strm) - default: - return false, nil - } -} - -func (SRPCEndToEndHandler) InvokeMethod_Mock(impl SRPCEndToEndServer, strm srpc.Stream) error { - req := new(MockRequest) - if err := strm.MsgRecv(req); err != nil { - return err - } - out, err := impl.Mock(strm.Context(), req) - if err != nil { - return err - } - return strm.MsgSend(out) -} - -type SRPCEndToEnd_MockStream interface { - srpc.Stream -} - -type srpcEndToEnd_MockStream struct { - srpc.Stream -} diff --git a/stream/drpc/e2e/e2e_test.go b/stream/drpc/e2e/e2e_test.go deleted file mode 100644 index 6d8bdbf0..00000000 --- a/stream/drpc/e2e/e2e_test.go +++ /dev/null @@ -1,126 +0,0 @@ -package drpc_e2e - -import ( - "context" - "testing" - - "github.com/aperturerobotics/bifrost/peer" - "github.com/aperturerobotics/bifrost/protocol" - stream_drpc_client "github.com/aperturerobotics/bifrost/stream/drpc/client" - stream_drpc_server "github.com/aperturerobotics/bifrost/stream/drpc/server" - "github.com/aperturerobotics/bifrost/testbed" - "github.com/aperturerobotics/bifrost/transport/common/dialer" - "github.com/aperturerobotics/bifrost/transport/inproc" - "github.com/aperturerobotics/controllerbus/controller" - "github.com/blang/semver" - "github.com/pkg/errors" - "github.com/sirupsen/logrus" - "storj.io/drpc/drpcconn" -) - -// TestDrpc tests a drpc service end-to-end. -func TestDrpc(t *testing.T) { - ctx := context.Background() - log := logrus.New() - log.SetLevel(logrus.DebugLevel) - le := logrus.NewEntry(log) - - // tb1: client - tb1, err := testbed.NewTestbed(ctx, le.WithField("testbed", 1), testbed.TestbedOpts{NoEcho: true}) - if err != nil { - t.Fatal(err.Error()) - } - - // tb2: server - tb2, err := testbed.NewTestbed(ctx, le.WithField("testbed", 2), testbed.TestbedOpts{}) - if err != nil { - t.Fatal(err.Error()) - } - - tb1PeerID, err := peer.IDFromPrivateKey(tb1.PrivKey) - if err != nil { - t.Fatal(err.Error()) - } - - tb2PeerID, err := peer.IDFromPrivateKey(tb2.PrivKey) - if err != nil { - t.Fatal(err.Error()) - } - - // tb1 -> tb2 inproc - tp2 := inproc.BuildInprocController(tb2.Logger, tb2.Bus, tb2PeerID, &inproc.Config{ - TransportPeerId: tb2PeerID.String(), - }) - go func() { - _ = tb2.Bus.ExecuteController(ctx, tp2) - }() - - // tb2 -> tb1 inproc - tpt2dialer := &dialer.DialerOpts{ - Address: inproc.NewAddr(tb2PeerID).String(), - } - tp1 := inproc.BuildInprocController(tb1.Logger, tb1.Bus, tb1PeerID, &inproc.Config{ - TransportPeerId: tb1PeerID.String(), - Dialers: map[string]*dialer.DialerOpts{ - tb2PeerID.String(): tpt2dialer, - }, - }) - go func() { - _ = tb1.Bus.ExecuteController(ctx, tp1) - }() - - // connect tb1 <-> tb2 - tpt2, _ := tp2.GetTransport(ctx) - tpt1, _ := tp1.GetTransport(ctx) - tpt1.(*inproc.Inproc).ConnectToInproc(ctx, tpt2.(*inproc.Inproc)) - tpt2.(*inproc.Inproc).ConnectToInproc(ctx, tpt1.(*inproc.Inproc)) - - // tb2: Run the server (stream handler) - mockServer := NewServer() - server, err := stream_drpc_server.NewServer( - tb2.Bus, - controller.NewInfo( - string(ProtocolID)+"/server", - semver.MustParse("0.0.1"), - "test of drpc server", - ), - nil, - []protocol.ID{ProtocolID}, - []string{tb2PeerID.String()}, - []stream_drpc_server.RegisterFn{mockServer.Register}, - ) - if err != nil { - t.Fatal(err.Error()) - } - go func() { - _ = tb2.Bus.ExecuteController(ctx, server) - }() - - // tb1: construct client - cl, err := stream_drpc_client.NewClient(tb1.Logger, tb1.Bus, &stream_drpc_client.Config{ - ServerPeerIds: []string{tb2PeerID.String()}, - SrcPeerId: tb1PeerID.String(), - }) - if err != nil { - t.Fatal(err.Error()) - } - - // run a request - mockMsg := "hello world 123" - err = cl.ExecuteConnection(ctx, ProtocolID, func(conn *drpcconn.Conn) (next bool, err error) { - client := NewDRPCEndToEndClient(conn) - resp, err := client.Mock(ctx, &MockRequest{ - Body: mockMsg, - }) - if err == nil { - respBody := resp.GetReqBody() - if respBody != mockMsg { - err = errors.Errorf("expected response %s but got %s", mockMsg, respBody) - } - } - return false, err - }) - if err != nil { - t.Fatal(err.Error()) - } -} diff --git a/stream/drpc/e2e/e2e_vtproto.pb.go b/stream/drpc/e2e/e2e_vtproto.pb.go deleted file mode 100644 index 6b2301a2..00000000 --- a/stream/drpc/e2e/e2e_vtproto.pb.go +++ /dev/null @@ -1,368 +0,0 @@ -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// protoc-gen-go-vtproto version: v0.6.0 -// source: github.com/aperturerobotics/bifrost/stream/drpc/e2e/e2e.proto - -package drpc_e2e - -import ( - fmt "fmt" - io "io" - - protohelpers "github.com/planetscale/vtprotobuf/protohelpers" - proto "google.golang.org/protobuf/proto" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) -) - -func (m *MockRequest) CloneVT() *MockRequest { - if m == nil { - return (*MockRequest)(nil) - } - r := new(MockRequest) - r.Body = m.Body - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *MockRequest) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *MockResponse) CloneVT() *MockResponse { - if m == nil { - return (*MockResponse)(nil) - } - r := new(MockResponse) - r.ReqBody = m.ReqBody - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *MockResponse) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (this *MockRequest) EqualVT(that *MockRequest) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.Body != that.Body { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *MockRequest) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*MockRequest) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *MockResponse) EqualVT(that *MockResponse) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.ReqBody != that.ReqBody { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *MockResponse) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*MockResponse) - if !ok { - return false - } - return this.EqualVT(that) -} -func (m *MockRequest) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MockRequest) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *MockRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Body) > 0 { - i -= len(m.Body) - copy(dAtA[i:], m.Body) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Body))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MockResponse) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MockResponse) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *MockResponse) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.ReqBody) > 0 { - i -= len(m.ReqBody) - copy(dAtA[i:], m.ReqBody) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.ReqBody))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MockRequest) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Body) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *MockResponse) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ReqBody) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *MockRequest) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MockRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MockRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Body = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MockResponse) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MockResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MockResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ReqBody", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ReqBody = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} diff --git a/stream/drpc/opts.go b/stream/drpc/opts.go deleted file mode 100644 index d19dc93c..00000000 --- a/stream/drpc/opts.go +++ /dev/null @@ -1,67 +0,0 @@ -package stream_drpc - -import ( - "time" - - "github.com/aperturerobotics/bifrost/util/confparse" - "storj.io/drpc/drpcconn" - "storj.io/drpc/drpcmanager" - "storj.io/drpc/drpcstream" -) - -// Validate checks the ops. -func (o *DrpcOpts) Validate() error { - if err := o.GetManagerOpts().Validate(); err != nil { - return err - } - return nil -} - -// BuildOpts converts to drpc conn opts. -func (o *DrpcOpts) BuildOpts() (drpcconn.Options, error) { - opts := drpcconn.Options{} - var err error - opts.Manager, err = o.GetManagerOpts().BuildOpts() - return opts, err -} - -// Validate checks the ops. -func (o *ManagerOpts) Validate() error { - if err := o.GetStreamOpts().Validate(); err != nil { - return err - } - if _, err := o.ParseInactivityTimeout(); err != nil { - return err - } - return nil -} - -// BuildOpts converts to manager opts. -func (o *ManagerOpts) BuildOpts() (drpcmanager.Options, error) { - streamOpts := o.GetStreamOpts().BuildOpts() - opts := drpcmanager.Options{ - WriterBufferSize: int(o.GetWriterBufferSize()), - Stream: streamOpts, - } - var err error - opts.InactivityTimeout, err = o.ParseInactivityTimeout() - return opts, err -} - -// ParseInactivityTimeout parses the inactivity timeout field. -func (o *ManagerOpts) ParseInactivityTimeout() (time.Duration, error) { - return confparse.ParseDuration(o.GetInactivityTimeout()) -} - -// BuildOpts converts to stream opts. -func (o *StreamOpts) BuildOpts() drpcstream.Options { - return drpcstream.Options{ - SplitSize: int(o.GetSplitSize()), - } -} - -// Validate checks the ops. -func (o *StreamOpts) Validate() error { - // nothing to check - return nil -} diff --git a/stream/drpc/server/config.go b/stream/drpc/server/config.go deleted file mode 100644 index 0ef5ae1e..00000000 --- a/stream/drpc/server/config.go +++ /dev/null @@ -1,23 +0,0 @@ -package stream_drpc_server - -import ( - "github.com/aperturerobotics/bifrost/peer" - "github.com/aperturerobotics/bifrost/util/confparse" -) - -// Validate checks the config. -func (c *Config) Validate() error { - if _, err := c.ParsePeerIDs(); err != nil { - return err - } - if err := c.GetDrpcOpts().Validate(); err != nil { - return err - } - // TODO - return nil -} - -// ParsePeerIDs parses the peer ids field. -func (c *Config) ParsePeerIDs() ([]peer.ID, error) { - return confparse.ParsePeerIDs(c.GetPeerIds(), false) -} diff --git a/stream/drpc/server/resolver.go b/stream/drpc/server/resolver.go deleted file mode 100644 index d9a8d5ac..00000000 --- a/stream/drpc/server/resolver.go +++ /dev/null @@ -1,34 +0,0 @@ -package stream_drpc_server - -import ( - "context" - - "github.com/aperturerobotics/bifrost/link" - "github.com/aperturerobotics/controllerbus/directive" -) - -// mountedStreamResolver resolves HandleMountedStream. -type mountedStreamResolver struct { - c *Server -} - -func newMountedStreamResolver(c *Server) *mountedStreamResolver { - return &mountedStreamResolver{c: c} -} - -// Resolve resolves the values, emitting them to the handler. -// The resolver may be canceled and restarted multiple times. -// Any fatal error resolving the value is returned. -// The resolver will not be retried after returning an error. -// Values will be maintained from the previous call. -func (r *mountedStreamResolver) Resolve( - ctx context.Context, - handler directive.ResolverHandler, -) error { - var val link.MountedStreamHandler = r.c - _, _ = handler.AddValue(val) - return nil -} - -// _ is a type assertion -var _ directive.Resolver = ((*mountedStreamResolver)(nil)) diff --git a/stream/drpc/server/server.go b/stream/drpc/server/server.go deleted file mode 100644 index 5695ff2c..00000000 --- a/stream/drpc/server/server.go +++ /dev/null @@ -1,167 +0,0 @@ -package stream_drpc_server - -import ( - "context" - - "github.com/aperturerobotics/bifrost/link" - "github.com/aperturerobotics/bifrost/protocol" - stream_drpc "github.com/aperturerobotics/bifrost/stream/drpc" - "github.com/aperturerobotics/controllerbus/bus" - "github.com/aperturerobotics/controllerbus/controller" - "github.com/aperturerobotics/controllerbus/directive" - - "storj.io/drpc" - "storj.io/drpc/drpcmux" - "storj.io/drpc/drpcserver" -) - -// RegisterFn is a callback to register apis to a mux. -type RegisterFn func(mux drpc.Mux) error - -// Server handles incoming streams for a peer id. -type Server struct { - // b is the bus - b bus.Bus - // info is the controller info - info *controller.Info - // drpcOpts are opts passed to drpc - drpcOpts *stream_drpc.DrpcOpts - // protocolIDs is list of protocol id to listen on. - // cannot be empty - protocolIDs []protocol.ID - // peerIDs is the list of local peer ids to listen on - // if empty, allows any - peerIDs []string - - // mux is the drpc mux - mux *drpcmux.Mux - // server is the drpc server - server *drpcserver.Server -} - -// NewServer constructs a common drpc controller. -// If peerIDs and/or domainIDs are empty, matches any. -func NewServer( - b bus.Bus, - info *controller.Info, - opts *stream_drpc.DrpcOpts, - protocolIDs []protocol.ID, - peerIDs []string, - registerFns []RegisterFn, -) (*Server, error) { - mux := drpcmux.New() - for _, rf := range registerFns { - if err := rf(mux); err != nil { - return nil, err - } - } - - server := drpcserver.New(mux) - return &Server{ - b: b, - info: info, - drpcOpts: opts, - protocolIDs: protocolIDs, - peerIDs: peerIDs, - - mux: mux, - server: server, - }, nil -} - -// GetControllerInfo returns information about the controller. -func (s *Server) GetControllerInfo() *controller.Info { - return s.info -} - -// Execute executes the given controller. -// Returning nil ends execution. -// Returning an error triggers a retry with backoff. -func (s *Server) Execute(ctx context.Context) error { - return nil -} - -// HandleDirective asks if the handler can resolve the directive. -// If it can, it returns a resolver. If not, returns nil. -func (s *Server) HandleDirective(ctx context.Context, di directive.Instance) ([]directive.Resolver, error) { - dir := di.GetDirective() - switch d := dir.(type) { - case link.HandleMountedStream: - return s.ResolveHandleMountedStream(ctx, di, d) - } - - return nil, nil -} - -// ResolveHandleMountedStream resolves a HandleMountedStream directive. -func (s *Server) ResolveHandleMountedStream( - ctx context.Context, - di directive.Instance, - dir link.HandleMountedStream, -) ([]directive.Resolver, error) { - inProtocol := dir.HandleMountedStreamProtocolID() - var match bool - for _, pr := range s.protocolIDs { - if pr == inProtocol { - match = true - break - } - } - if !match { - return nil, nil - } - - inPeerID := dir.HandleMountedStreamLocalPeerID() - inPeerIDString := inPeerID.String() - if len(s.peerIDs) != 0 { - match = false - for _, pid := range s.peerIDs { - if pid == inPeerIDString { - match = true - } - } - if !match { - return nil, nil - } - } - - return directive.Resolvers(newMountedStreamResolver(s)), nil -} - -// HandleMountedStream handles an incoming mounted stream. -// Any returned error indicates the stream should be closed. -// This function should return as soon as possible, and start -// additional goroutines to manage the lifecycle of the stream. -// Typically EstablishLink is asserted in HandleMountedStream. -func (s *Server) HandleMountedStream(ctx context.Context, ms link.MountedStream) error { - // keep the link open - _, elRef, err := s.b.AddDirective( - link.NewEstablishLinkWithPeer(ms.GetLink().GetLocalPeer(), ms.GetPeerID()), - nil, - ) - if err != nil { - return err - } - go func() { - subCtx, subCtxCancel := context.WithCancel(ctx) - rpcCtx := link.WithMountedStreamContext(subCtx, ms) - strm := ms.GetStream() - _ = s.server.ServeOne(rpcCtx, strm) - subCtxCancel() - strm.Close() - elRef.Release() - }() - return nil -} - -// Close releases any resources used by the controller. -// Error indicates any issue encountered releasing. -func (s *Server) Close() error { - return nil -} - -// _ is a type assertion -var ( - _ link.MountedStreamHandler = ((*Server)(nil)) - _ controller.Controller = ((*Server)(nil)) -) diff --git a/stream/drpc/server/server.pb.go b/stream/drpc/server/server.pb.go deleted file mode 100644 index e086c2ee..00000000 --- a/stream/drpc/server/server.pb.go +++ /dev/null @@ -1,168 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0-devel -// protoc v5.26.1 -// source: github.com/aperturerobotics/bifrost/stream/drpc/server/server.proto - -package stream_drpc_server - -import ( - reflect "reflect" - sync "sync" - - drpc "github.com/aperturerobotics/bifrost/stream/drpc" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) -) - -// Config configures the server for the drpc service. -type Config struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // PeerIds are the list of peer IDs to listen on. - // If empty, allows any incoming peer id w/ the protocol id. - PeerIds []string `protobuf:"bytes,1,rep,name=peer_ids,json=peerIds,proto3" json:"peer_ids,omitempty"` - // DrpcOpts are options passed to drpc. - DrpcOpts *drpc.DrpcOpts `protobuf:"bytes,2,opt,name=drpc_opts,json=drpcOpts,proto3" json:"drpc_opts,omitempty"` -} - -func (x *Config) Reset() { - *x = Config{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_stream_drpc_server_server_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Config) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Config) ProtoMessage() {} - -func (x *Config) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_stream_drpc_server_server_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 Config.ProtoReflect.Descriptor instead. -func (*Config) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_stream_drpc_server_server_proto_rawDescGZIP(), []int{0} -} - -func (x *Config) GetPeerIds() []string { - if x != nil { - return x.PeerIds - } - return nil -} - -func (x *Config) GetDrpcOpts() *drpc.DrpcOpts { - if x != nil { - return x.DrpcOpts - } - return nil -} - -var File_github_com_aperturerobotics_bifrost_stream_drpc_server_server_proto protoreflect.FileDescriptor - -var file_github_com_aperturerobotics_bifrost_stream_drpc_server_server_proto_rawDesc = []byte{ - 0x0a, 0x43, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, - 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x62, 0x69, - 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2f, 0x64, 0x72, 0x70, - 0x63, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x64, 0x72, - 0x70, 0x63, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x1a, 0x3a, 0x67, 0x69, 0x74, 0x68, 0x75, - 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, - 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x62, 0x69, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2f, 0x73, - 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2f, 0x64, 0x72, 0x70, 0x63, 0x2f, 0x64, 0x72, 0x70, 0x63, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x57, 0x0a, 0x06, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, - 0x19, 0x0a, 0x08, 0x70, 0x65, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, - 0x09, 0x52, 0x07, 0x70, 0x65, 0x65, 0x72, 0x49, 0x64, 0x73, 0x12, 0x32, 0x0a, 0x09, 0x64, 0x72, - 0x70, 0x63, 0x5f, 0x6f, 0x70, 0x74, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, - 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x64, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x72, 0x70, 0x63, - 0x4f, 0x70, 0x74, 0x73, 0x52, 0x08, 0x64, 0x72, 0x70, 0x63, 0x4f, 0x70, 0x74, 0x73, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_github_com_aperturerobotics_bifrost_stream_drpc_server_server_proto_rawDescOnce sync.Once - file_github_com_aperturerobotics_bifrost_stream_drpc_server_server_proto_rawDescData = file_github_com_aperturerobotics_bifrost_stream_drpc_server_server_proto_rawDesc -) - -func file_github_com_aperturerobotics_bifrost_stream_drpc_server_server_proto_rawDescGZIP() []byte { - file_github_com_aperturerobotics_bifrost_stream_drpc_server_server_proto_rawDescOnce.Do(func() { - file_github_com_aperturerobotics_bifrost_stream_drpc_server_server_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_aperturerobotics_bifrost_stream_drpc_server_server_proto_rawDescData) - }) - return file_github_com_aperturerobotics_bifrost_stream_drpc_server_server_proto_rawDescData -} - -var file_github_com_aperturerobotics_bifrost_stream_drpc_server_server_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_github_com_aperturerobotics_bifrost_stream_drpc_server_server_proto_goTypes = []interface{}{ - (*Config)(nil), // 0: stream.drpc.server.Config - (*drpc.DrpcOpts)(nil), // 1: stream.drpc.DrpcOpts -} -var file_github_com_aperturerobotics_bifrost_stream_drpc_server_server_proto_depIdxs = []int32{ - 1, // 0: stream.drpc.server.Config.drpc_opts:type_name -> stream.drpc.DrpcOpts - 1, // [1:1] is the sub-list for method output_type - 1, // [1:1] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name -} - -func init() { file_github_com_aperturerobotics_bifrost_stream_drpc_server_server_proto_init() } -func file_github_com_aperturerobotics_bifrost_stream_drpc_server_server_proto_init() { - if File_github_com_aperturerobotics_bifrost_stream_drpc_server_server_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_github_com_aperturerobotics_bifrost_stream_drpc_server_server_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Config); 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_github_com_aperturerobotics_bifrost_stream_drpc_server_server_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_github_com_aperturerobotics_bifrost_stream_drpc_server_server_proto_goTypes, - DependencyIndexes: file_github_com_aperturerobotics_bifrost_stream_drpc_server_server_proto_depIdxs, - MessageInfos: file_github_com_aperturerobotics_bifrost_stream_drpc_server_server_proto_msgTypes, - }.Build() - File_github_com_aperturerobotics_bifrost_stream_drpc_server_server_proto = out.File - file_github_com_aperturerobotics_bifrost_stream_drpc_server_server_proto_rawDesc = nil - file_github_com_aperturerobotics_bifrost_stream_drpc_server_server_proto_goTypes = nil - file_github_com_aperturerobotics_bifrost_stream_drpc_server_server_proto_depIdxs = nil -} diff --git a/stream/drpc/server/server.pb.ts b/stream/drpc/server/server.pb.ts deleted file mode 100644 index 982e294a..00000000 --- a/stream/drpc/server/server.pb.ts +++ /dev/null @@ -1,177 +0,0 @@ -/* eslint-disable */ -import Long from 'long' -import _m0 from 'protobufjs/minimal.js' -import { DrpcOpts } from '../drpc.pb.js' - -export const protobufPackage = 'stream.drpc.server' - -/** Config configures the server for the drpc service. */ -export interface Config { - /** - * PeerIds are the list of peer IDs to listen on. - * If empty, allows any incoming peer id w/ the protocol id. - */ - peerIds: string[] - /** DrpcOpts are options passed to drpc. */ - drpcOpts: DrpcOpts | undefined -} - -function createBaseConfig(): Config { - return { peerIds: [], drpcOpts: undefined } -} - -export const Config = { - encode( - message: Config, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - for (const v of message.peerIds) { - writer.uint32(10).string(v!) - } - if (message.drpcOpts !== undefined) { - DrpcOpts.encode(message.drpcOpts, writer.uint32(18).fork()).ldelim() - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Config { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseConfig() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break - } - - message.peerIds.push(reader.string()) - continue - case 2: - if (tag !== 18) { - break - } - - message.drpcOpts = DrpcOpts.decode(reader, reader.uint32()) - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: AsyncIterable | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config.encode(p).finish()] - } - } else { - yield* [Config.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config.decode(p)] - } - } else { - yield* [Config.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): Config { - return { - peerIds: globalThis.Array.isArray(object?.peerIds) - ? object.peerIds.map((e: any) => globalThis.String(e)) - : [], - drpcOpts: isSet(object.drpcOpts) - ? DrpcOpts.fromJSON(object.drpcOpts) - : undefined, - } - }, - - toJSON(message: Config): unknown { - const obj: any = {} - if (message.peerIds?.length) { - obj.peerIds = message.peerIds - } - if (message.drpcOpts !== undefined) { - obj.drpcOpts = DrpcOpts.toJSON(message.drpcOpts) - } - return obj - }, - - create, I>>(base?: I): Config { - return Config.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>(object: I): Config { - const message = createBaseConfig() - message.peerIds = object.peerIds?.map((e) => e) || [] - message.drpcOpts = - object.drpcOpts !== undefined && object.drpcOpts !== null - ? DrpcOpts.fromPartial(object.drpcOpts) - : undefined - return message - }, -} - -type Builtin = - | Date - | Function - | Uint8Array - | string - | number - | boolean - | undefined - -export type DeepPartial = T extends Builtin - ? T - : T extends Long - ? string | number | Long - : T extends globalThis.Array - ? globalThis.Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends { $case: string } - ? { [K in keyof Omit]?: DeepPartial } & { - $case: T['$case'] - } - : T extends {} - ? { [K in keyof T]?: DeepPartial } - : Partial - -type KeysOfUnion = T extends T ? keyof T : never -export type Exact = P extends Builtin - ? P - : P & { [K in keyof P]: Exact } & { - [K in Exclude>]: never - } - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any - _m0.configure() -} - -function isSet(value: any): boolean { - return value !== null && value !== undefined -} diff --git a/stream/drpc/server/server.proto b/stream/drpc/server/server.proto deleted file mode 100644 index c5ec44e3..00000000 --- a/stream/drpc/server/server.proto +++ /dev/null @@ -1,13 +0,0 @@ -syntax = "proto3"; -package stream.drpc.server; - -import "github.com/aperturerobotics/bifrost/stream/drpc/drpc.proto"; - -// Config configures the server for the drpc service. -message Config { - // PeerIds are the list of peer IDs to listen on. - // If empty, allows any incoming peer id w/ the protocol id. - repeated string peer_ids = 1; - // DrpcOpts are options passed to drpc. - .stream.drpc.DrpcOpts drpc_opts = 2; -} \ No newline at end of file diff --git a/stream/drpc/server/server_vtproto.pb.go b/stream/drpc/server/server_vtproto.pb.go deleted file mode 100644 index f7dad0b6..00000000 --- a/stream/drpc/server/server_vtproto.pb.go +++ /dev/null @@ -1,300 +0,0 @@ -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// protoc-gen-go-vtproto version: v0.6.0 -// source: github.com/aperturerobotics/bifrost/stream/drpc/server/server.proto - -package stream_drpc_server - -import ( - fmt "fmt" - io "io" - - drpc "github.com/aperturerobotics/bifrost/stream/drpc" - protohelpers "github.com/planetscale/vtprotobuf/protohelpers" - proto "google.golang.org/protobuf/proto" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) -) - -func (m *Config) CloneVT() *Config { - if m == nil { - return (*Config)(nil) - } - r := new(Config) - if rhs := m.PeerIds; rhs != nil { - tmpContainer := make([]string, len(rhs)) - copy(tmpContainer, rhs) - r.PeerIds = tmpContainer - } - if rhs := m.DrpcOpts; rhs != nil { - if vtpb, ok := interface{}(rhs).(interface{ CloneVT() *drpc.DrpcOpts }); ok { - r.DrpcOpts = vtpb.CloneVT() - } else { - r.DrpcOpts = proto.Clone(rhs).(*drpc.DrpcOpts) - } - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Config) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (this *Config) EqualVT(that *Config) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if len(this.PeerIds) != len(that.PeerIds) { - return false - } - for i, vx := range this.PeerIds { - vy := that.PeerIds[i] - if vx != vy { - return false - } - } - if equal, ok := interface{}(this.DrpcOpts).(interface{ EqualVT(*drpc.DrpcOpts) bool }); ok { - if !equal.EqualVT(that.DrpcOpts) { - return false - } - } else if !proto.Equal(this.DrpcOpts, that.DrpcOpts) { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Config) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Config) - if !ok { - return false - } - return this.EqualVT(that) -} -func (m *Config) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Config) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.DrpcOpts != nil { - if vtmsg, ok := interface{}(m.DrpcOpts).(interface { - MarshalToSizedBufferVT([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.DrpcOpts) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0x12 - } - if len(m.PeerIds) > 0 { - for iNdEx := len(m.PeerIds) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.PeerIds[iNdEx]) - copy(dAtA[i:], m.PeerIds[iNdEx]) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.PeerIds[iNdEx]))) - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *Config) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.PeerIds) > 0 { - for _, s := range m.PeerIds { - l = len(s) - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - } - if m.DrpcOpts != nil { - if size, ok := interface{}(m.DrpcOpts).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.DrpcOpts) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *Config) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Config: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Config: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PeerIds", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PeerIds = append(m.PeerIds, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DrpcOpts", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.DrpcOpts == nil { - m.DrpcOpts = &drpc.DrpcOpts{} - } - if unmarshal, ok := interface{}(m.DrpcOpts).(interface { - UnmarshalVT([]byte) error - }); ok { - if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - } else { - if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.DrpcOpts); err != nil { - return err - } - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} diff --git a/stream/echo/echo.pb.go b/stream/echo/echo.pb.go index c583339b..bdeb1732 100644 --- a/stream/echo/echo.pb.go +++ b/stream/echo/echo.pb.go @@ -1,71 +1,33 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0-devel -// protoc v5.26.1 +// Code generated by protoc-gen-go-lite. DO NOT EDIT. +// protoc-gen-go-lite version: v0.4.5 // source: github.com/aperturerobotics/bifrost/stream/echo/echo.proto package stream_echo import ( - reflect "reflect" - sync "sync" + io "io" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) + protobuf_go_lite "github.com/aperturerobotics/protobuf-go-lite" + json "github.com/aperturerobotics/protobuf-go-lite/json" + errors "github.com/pkg/errors" ) // Config configures the echo controller. type Config struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + unknownFields []byte // PeerId is the peer ID to echo for. // Can be empty. - PeerId string `protobuf:"bytes,1,opt,name=peer_id,json=peerId,proto3" json:"peer_id,omitempty"` + PeerId string `protobuf:"bytes,1,opt,name=peer_id,json=peerId,proto3" json:"peerId,omitempty"` // ProtocolId is the protocol ID to echo on. - ProtocolId string `protobuf:"bytes,2,opt,name=protocol_id,json=protocolId,proto3" json:"protocol_id,omitempty"` + ProtocolId string `protobuf:"bytes,2,opt,name=protocol_id,json=protocolId,proto3" json:"protocolId,omitempty"` } func (x *Config) Reset() { *x = Config{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_stream_echo_echo_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Config) String() string { - return protoimpl.X.MessageStringOf(x) } func (*Config) ProtoMessage() {} -func (x *Config) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_stream_echo_echo_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 Config.ProtoReflect.Descriptor instead. -func (*Config) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_stream_echo_echo_proto_rawDescGZIP(), []int{0} -} - func (x *Config) GetPeerId() string { if x != nil { return x.PeerId @@ -80,80 +42,274 @@ func (x *Config) GetProtocolId() string { return "" } -var File_github_com_aperturerobotics_bifrost_stream_echo_echo_proto protoreflect.FileDescriptor +func (m *Config) CloneVT() *Config { + if m == nil { + return (*Config)(nil) + } + r := new(Config) + r.PeerId = m.PeerId + r.ProtocolId = m.ProtocolId + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} -var file_github_com_aperturerobotics_bifrost_stream_echo_echo_proto_rawDesc = []byte{ - 0x0a, 0x3a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, - 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x62, 0x69, - 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2f, 0x65, 0x63, 0x68, - 0x6f, 0x2f, 0x65, 0x63, 0x68, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x73, 0x74, - 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x65, 0x63, 0x68, 0x6f, 0x22, 0x42, 0x0a, 0x06, 0x43, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x12, 0x17, 0x0a, 0x07, 0x70, 0x65, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x65, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0a, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x49, 0x64, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, +func (m *Config) CloneMessageVT() any { + return m.CloneVT() } -var ( - file_github_com_aperturerobotics_bifrost_stream_echo_echo_proto_rawDescOnce sync.Once - file_github_com_aperturerobotics_bifrost_stream_echo_echo_proto_rawDescData = file_github_com_aperturerobotics_bifrost_stream_echo_echo_proto_rawDesc -) +func (this *Config) EqualVT(that *Config) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.PeerId != that.PeerId { + return false + } + if this.ProtocolId != that.ProtocolId { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} -func file_github_com_aperturerobotics_bifrost_stream_echo_echo_proto_rawDescGZIP() []byte { - file_github_com_aperturerobotics_bifrost_stream_echo_echo_proto_rawDescOnce.Do(func() { - file_github_com_aperturerobotics_bifrost_stream_echo_echo_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_aperturerobotics_bifrost_stream_echo_echo_proto_rawDescData) - }) - return file_github_com_aperturerobotics_bifrost_stream_echo_echo_proto_rawDescData +func (this *Config) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*Config) + if !ok { + return false + } + return this.EqualVT(that) } -var file_github_com_aperturerobotics_bifrost_stream_echo_echo_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_github_com_aperturerobotics_bifrost_stream_echo_echo_proto_goTypes = []interface{}{ - (*Config)(nil), // 0: stream.echo.Config +// MarshalProtoJSON marshals the Config message to JSON. +func (x *Config) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return + } + s.WriteObjectStart() + var wroteField bool + if x.PeerId != "" || s.HasField("peerId") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("peerId") + s.WriteString(x.PeerId) + } + if x.ProtocolId != "" || s.HasField("protocolId") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("protocolId") + s.WriteString(x.ProtocolId) + } + s.WriteObjectEnd() } -var file_github_com_aperturerobotics_bifrost_stream_echo_echo_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] 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 + +// MarshalJSON marshals the Config to JSON. +func (x *Config) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) } -func init() { file_github_com_aperturerobotics_bifrost_stream_echo_echo_proto_init() } -func file_github_com_aperturerobotics_bifrost_stream_echo_echo_proto_init() { - if File_github_com_aperturerobotics_bifrost_stream_echo_echo_proto != nil { +// UnmarshalProtoJSON unmarshals the Config message from JSON. +func (x *Config) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { return } - if !protoimpl.UnsafeEnabled { - file_github_com_aperturerobotics_bifrost_stream_echo_echo_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Config); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "peer_id", "peerId": + s.AddField("peer_id") + x.PeerId = s.ReadString() + case "protocol_id", "protocolId": + s.AddField("protocol_id") + x.ProtocolId = s.ReadString() + } + }) +} + +// UnmarshalJSON unmarshals the Config from JSON. +func (x *Config) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +func (m *Config) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Config) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.ProtocolId) > 0 { + i -= len(m.ProtocolId) + copy(dAtA[i:], m.ProtocolId) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.ProtocolId))) + i-- + dAtA[i] = 0x12 + } + if len(m.PeerId) > 0 { + i -= len(m.PeerId) + copy(dAtA[i:], m.PeerId) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.PeerId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Config) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.PeerId) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + l = len(m.ProtocolId) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *Config) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: Config: wiretype end group for non-group") } + if fieldNum <= 0 { + return errors.Errorf("proto: Config: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field PeerId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PeerId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field ProtocolId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ProtocolId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_github_com_aperturerobotics_bifrost_stream_echo_echo_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_github_com_aperturerobotics_bifrost_stream_echo_echo_proto_goTypes, - DependencyIndexes: file_github_com_aperturerobotics_bifrost_stream_echo_echo_proto_depIdxs, - MessageInfos: file_github_com_aperturerobotics_bifrost_stream_echo_echo_proto_msgTypes, - }.Build() - File_github_com_aperturerobotics_bifrost_stream_echo_echo_proto = out.File - file_github_com_aperturerobotics_bifrost_stream_echo_echo_proto_rawDesc = nil - file_github_com_aperturerobotics_bifrost_stream_echo_echo_proto_goTypes = nil - file_github_com_aperturerobotics_bifrost_stream_echo_echo_proto_depIdxs = nil + return nil } diff --git a/stream/echo/echo.pb.ts b/stream/echo/echo.pb.ts deleted file mode 100644 index 64ce83e4..00000000 --- a/stream/echo/echo.pb.ts +++ /dev/null @@ -1,171 +0,0 @@ -/* eslint-disable */ -import Long from 'long' -import _m0 from 'protobufjs/minimal.js' - -export const protobufPackage = 'stream.echo' - -/** Config configures the echo controller. */ -export interface Config { - /** - * PeerId is the peer ID to echo for. - * Can be empty. - */ - peerId: string - /** ProtocolId is the protocol ID to echo on. */ - protocolId: string -} - -function createBaseConfig(): Config { - return { peerId: '', protocolId: '' } -} - -export const Config = { - encode( - message: Config, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.peerId !== '') { - writer.uint32(10).string(message.peerId) - } - if (message.protocolId !== '') { - writer.uint32(18).string(message.protocolId) - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Config { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseConfig() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break - } - - message.peerId = reader.string() - continue - case 2: - if (tag !== 18) { - break - } - - message.protocolId = reader.string() - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: AsyncIterable | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config.encode(p).finish()] - } - } else { - yield* [Config.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config.decode(p)] - } - } else { - yield* [Config.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): Config { - return { - peerId: isSet(object.peerId) ? globalThis.String(object.peerId) : '', - protocolId: isSet(object.protocolId) - ? globalThis.String(object.protocolId) - : '', - } - }, - - toJSON(message: Config): unknown { - const obj: any = {} - if (message.peerId !== '') { - obj.peerId = message.peerId - } - if (message.protocolId !== '') { - obj.protocolId = message.protocolId - } - return obj - }, - - create, I>>(base?: I): Config { - return Config.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>(object: I): Config { - const message = createBaseConfig() - message.peerId = object.peerId ?? '' - message.protocolId = object.protocolId ?? '' - return message - }, -} - -type Builtin = - | Date - | Function - | Uint8Array - | string - | number - | boolean - | undefined - -export type DeepPartial = T extends Builtin - ? T - : T extends Long - ? string | number | Long - : T extends globalThis.Array - ? globalThis.Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends { $case: string } - ? { [K in keyof Omit]?: DeepPartial } & { - $case: T['$case'] - } - : T extends {} - ? { [K in keyof T]?: DeepPartial } - : Partial - -type KeysOfUnion = T extends T ? keyof T : never -export type Exact = P extends Builtin - ? P - : P & { [K in keyof P]: Exact } & { - [K in Exclude>]: never - } - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any - _m0.configure() -} - -function isSet(value: any): boolean { - return value !== null && value !== undefined -} diff --git a/stream/echo/echo_pb.ts b/stream/echo/echo_pb.ts new file mode 100644 index 00000000..a6219a6e --- /dev/null +++ b/stream/echo/echo_pb.ts @@ -0,0 +1,80 @@ +// @generated by protoc-gen-es v1.8.0 with parameter "target=ts,ts_nocheck=false" +// @generated from file github.com/aperturerobotics/bifrost/stream/echo/echo.proto (package stream.echo, syntax proto3) +/* eslint-disable */ + +import type { + BinaryReadOptions, + FieldList, + JsonReadOptions, + JsonValue, + PartialMessage, + PlainMessage, +} from '@bufbuild/protobuf' +import { Message, proto3 } from '@bufbuild/protobuf' + +/** + * Config configures the echo controller. + * + * @generated from message stream.echo.Config + */ +export class Config extends Message { + /** + * PeerId is the peer ID to echo for. + * Can be empty. + * + * @generated from field: string peer_id = 1; + */ + peerId = '' + + /** + * ProtocolId is the protocol ID to echo on. + * + * @generated from field: string protocol_id = 2; + */ + protocolId = '' + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'stream.echo.Config' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: 'peer_id', kind: 'scalar', T: 9 /* ScalarType.STRING */ }, + { + no: 2, + name: 'protocol_id', + kind: 'scalar', + T: 9 /* ScalarType.STRING */, + }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): Config { + return new Config().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): Config { + return new Config().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): Config { + return new Config().fromJsonString(jsonString, options) + } + + static equals( + a: Config | PlainMessage | undefined, + b: Config | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(Config, a, b) + } +} diff --git a/stream/echo/echo_vtproto.pb.go b/stream/echo/echo_vtproto.pb.go deleted file mode 100644 index 9ec53b16..00000000 --- a/stream/echo/echo_vtproto.pb.go +++ /dev/null @@ -1,242 +0,0 @@ -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// protoc-gen-go-vtproto version: v0.6.0 -// source: github.com/aperturerobotics/bifrost/stream/echo/echo.proto - -package stream_echo - -import ( - fmt "fmt" - io "io" - - protohelpers "github.com/planetscale/vtprotobuf/protohelpers" - proto "google.golang.org/protobuf/proto" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) -) - -func (m *Config) CloneVT() *Config { - if m == nil { - return (*Config)(nil) - } - r := new(Config) - r.PeerId = m.PeerId - r.ProtocolId = m.ProtocolId - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Config) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (this *Config) EqualVT(that *Config) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.PeerId != that.PeerId { - return false - } - if this.ProtocolId != that.ProtocolId { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Config) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Config) - if !ok { - return false - } - return this.EqualVT(that) -} -func (m *Config) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Config) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.ProtocolId) > 0 { - i -= len(m.ProtocolId) - copy(dAtA[i:], m.ProtocolId) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.ProtocolId))) - i-- - dAtA[i] = 0x12 - } - if len(m.PeerId) > 0 { - i -= len(m.PeerId) - copy(dAtA[i:], m.PeerId) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.PeerId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Config) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.PeerId) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - l = len(m.ProtocolId) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *Config) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Config: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Config: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PeerId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PeerId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ProtocolId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ProtocolId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} diff --git a/stream/forwarding/forwarding.pb.go b/stream/forwarding/forwarding.pb.go index 3b1044f9..e4a18c17 100644 --- a/stream/forwarding/forwarding.pb.go +++ b/stream/forwarding/forwarding.pb.go @@ -1,73 +1,35 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0-devel -// protoc v5.26.1 +// Code generated by protoc-gen-go-lite. DO NOT EDIT. +// protoc-gen-go-lite version: v0.4.5 // source: github.com/aperturerobotics/bifrost/stream/forwarding/forwarding.proto package stream_forwarding import ( - reflect "reflect" - sync "sync" + io "io" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) + protobuf_go_lite "github.com/aperturerobotics/protobuf-go-lite" + json "github.com/aperturerobotics/protobuf-go-lite/json" + errors "github.com/pkg/errors" ) // Config configures the forwarding controller. type Config struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + unknownFields []byte // PeerId is the peer ID to forward for. // Can be empty. - PeerId string `protobuf:"bytes,1,opt,name=peer_id,json=peerId,proto3" json:"peer_id,omitempty"` + PeerId string `protobuf:"bytes,1,opt,name=peer_id,json=peerId,proto3" json:"peerId,omitempty"` // ProtocolId is the protocol ID to forward for. - ProtocolId string `protobuf:"bytes,2,opt,name=protocol_id,json=protocolId,proto3" json:"protocol_id,omitempty"` + ProtocolId string `protobuf:"bytes,2,opt,name=protocol_id,json=protocolId,proto3" json:"protocolId,omitempty"` // TargetMultiaddr is the target multiaddress to dial. - TargetMultiaddr string `protobuf:"bytes,3,opt,name=target_multiaddr,json=targetMultiaddr,proto3" json:"target_multiaddr,omitempty"` + TargetMultiaddr string `protobuf:"bytes,3,opt,name=target_multiaddr,json=targetMultiaddr,proto3" json:"targetMultiaddr,omitempty"` } func (x *Config) Reset() { *x = Config{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_stream_forwarding_forwarding_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Config) String() string { - return protoimpl.X.MessageStringOf(x) } func (*Config) ProtoMessage() {} -func (x *Config) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_stream_forwarding_forwarding_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 Config.ProtoReflect.Descriptor instead. -func (*Config) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_stream_forwarding_forwarding_proto_rawDescGZIP(), []int{0} -} - func (x *Config) GetPeerId() string { if x != nil { return x.PeerId @@ -89,84 +51,329 @@ func (x *Config) GetTargetMultiaddr() string { return "" } -var File_github_com_aperturerobotics_bifrost_stream_forwarding_forwarding_proto protoreflect.FileDescriptor - -var file_github_com_aperturerobotics_bifrost_stream_forwarding_forwarding_proto_rawDesc = []byte{ - 0x0a, 0x46, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, - 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x62, 0x69, - 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2f, 0x66, 0x6f, 0x72, - 0x77, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x67, 0x2f, 0x66, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, 0x69, - 0x6e, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x11, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, - 0x2e, 0x66, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x67, 0x22, 0x6d, 0x0a, 0x06, 0x43, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x17, 0x0a, 0x07, 0x70, 0x65, 0x65, 0x72, 0x5f, 0x69, 0x64, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x65, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1f, - 0x0a, 0x0b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x49, 0x64, 0x12, - 0x29, 0x0a, 0x10, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x5f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x61, - 0x64, 0x64, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x74, 0x61, 0x72, 0x67, 0x65, - 0x74, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x61, 0x64, 0x64, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, -} - -var ( - file_github_com_aperturerobotics_bifrost_stream_forwarding_forwarding_proto_rawDescOnce sync.Once - file_github_com_aperturerobotics_bifrost_stream_forwarding_forwarding_proto_rawDescData = file_github_com_aperturerobotics_bifrost_stream_forwarding_forwarding_proto_rawDesc -) +func (m *Config) CloneVT() *Config { + if m == nil { + return (*Config)(nil) + } + r := new(Config) + r.PeerId = m.PeerId + r.ProtocolId = m.ProtocolId + r.TargetMultiaddr = m.TargetMultiaddr + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} -func file_github_com_aperturerobotics_bifrost_stream_forwarding_forwarding_proto_rawDescGZIP() []byte { - file_github_com_aperturerobotics_bifrost_stream_forwarding_forwarding_proto_rawDescOnce.Do(func() { - file_github_com_aperturerobotics_bifrost_stream_forwarding_forwarding_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_aperturerobotics_bifrost_stream_forwarding_forwarding_proto_rawDescData) - }) - return file_github_com_aperturerobotics_bifrost_stream_forwarding_forwarding_proto_rawDescData +func (m *Config) CloneMessageVT() any { + return m.CloneVT() } -var file_github_com_aperturerobotics_bifrost_stream_forwarding_forwarding_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_github_com_aperturerobotics_bifrost_stream_forwarding_forwarding_proto_goTypes = []interface{}{ - (*Config)(nil), // 0: stream.forwarding.Config +func (this *Config) EqualVT(that *Config) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.PeerId != that.PeerId { + return false + } + if this.ProtocolId != that.ProtocolId { + return false + } + if this.TargetMultiaddr != that.TargetMultiaddr { + return false + } + return string(this.unknownFields) == string(that.unknownFields) } -var file_github_com_aperturerobotics_bifrost_stream_forwarding_forwarding_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] 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 (this *Config) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*Config) + if !ok { + return false + } + return this.EqualVT(that) +} + +// MarshalProtoJSON marshals the Config message to JSON. +func (x *Config) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return + } + s.WriteObjectStart() + var wroteField bool + if x.PeerId != "" || s.HasField("peerId") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("peerId") + s.WriteString(x.PeerId) + } + if x.ProtocolId != "" || s.HasField("protocolId") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("protocolId") + s.WriteString(x.ProtocolId) + } + if x.TargetMultiaddr != "" || s.HasField("targetMultiaddr") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("targetMultiaddr") + s.WriteString(x.TargetMultiaddr) + } + s.WriteObjectEnd() +} + +// MarshalJSON marshals the Config to JSON. +func (x *Config) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) } -func init() { file_github_com_aperturerobotics_bifrost_stream_forwarding_forwarding_proto_init() } -func file_github_com_aperturerobotics_bifrost_stream_forwarding_forwarding_proto_init() { - if File_github_com_aperturerobotics_bifrost_stream_forwarding_forwarding_proto != nil { +// UnmarshalProtoJSON unmarshals the Config message from JSON. +func (x *Config) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { return } - if !protoimpl.UnsafeEnabled { - file_github_com_aperturerobotics_bifrost_stream_forwarding_forwarding_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Config); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "peer_id", "peerId": + s.AddField("peer_id") + x.PeerId = s.ReadString() + case "protocol_id", "protocolId": + s.AddField("protocol_id") + x.ProtocolId = s.ReadString() + case "target_multiaddr", "targetMultiaddr": + s.AddField("target_multiaddr") + x.TargetMultiaddr = s.ReadString() + } + }) +} + +// UnmarshalJSON unmarshals the Config from JSON. +func (x *Config) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +func (m *Config) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Config) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.TargetMultiaddr) > 0 { + i -= len(m.TargetMultiaddr) + copy(dAtA[i:], m.TargetMultiaddr) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.TargetMultiaddr))) + i-- + dAtA[i] = 0x1a + } + if len(m.ProtocolId) > 0 { + i -= len(m.ProtocolId) + copy(dAtA[i:], m.ProtocolId) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.ProtocolId))) + i-- + dAtA[i] = 0x12 + } + if len(m.PeerId) > 0 { + i -= len(m.PeerId) + copy(dAtA[i:], m.PeerId) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.PeerId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Config) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.PeerId) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + l = len(m.ProtocolId) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + l = len(m.TargetMultiaddr) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *Config) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: Config: wiretype end group for non-group") } + if fieldNum <= 0 { + return errors.Errorf("proto: Config: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field PeerId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PeerId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field ProtocolId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ProtocolId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field TargetMultiaddr", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TargetMultiaddr = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_github_com_aperturerobotics_bifrost_stream_forwarding_forwarding_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_github_com_aperturerobotics_bifrost_stream_forwarding_forwarding_proto_goTypes, - DependencyIndexes: file_github_com_aperturerobotics_bifrost_stream_forwarding_forwarding_proto_depIdxs, - MessageInfos: file_github_com_aperturerobotics_bifrost_stream_forwarding_forwarding_proto_msgTypes, - }.Build() - File_github_com_aperturerobotics_bifrost_stream_forwarding_forwarding_proto = out.File - file_github_com_aperturerobotics_bifrost_stream_forwarding_forwarding_proto_rawDesc = nil - file_github_com_aperturerobotics_bifrost_stream_forwarding_forwarding_proto_goTypes = nil - file_github_com_aperturerobotics_bifrost_stream_forwarding_forwarding_proto_depIdxs = nil + return nil } diff --git a/stream/forwarding/forwarding.pb.ts b/stream/forwarding/forwarding.pb.ts deleted file mode 100644 index 3d6af9c1..00000000 --- a/stream/forwarding/forwarding.pb.ts +++ /dev/null @@ -1,190 +0,0 @@ -/* eslint-disable */ -import Long from 'long' -import _m0 from 'protobufjs/minimal.js' - -export const protobufPackage = 'stream.forwarding' - -/** Config configures the forwarding controller. */ -export interface Config { - /** - * PeerId is the peer ID to forward for. - * Can be empty. - */ - peerId: string - /** ProtocolId is the protocol ID to forward for. */ - protocolId: string - /** TargetMultiaddr is the target multiaddress to dial. */ - targetMultiaddr: string -} - -function createBaseConfig(): Config { - return { peerId: '', protocolId: '', targetMultiaddr: '' } -} - -export const Config = { - encode( - message: Config, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.peerId !== '') { - writer.uint32(10).string(message.peerId) - } - if (message.protocolId !== '') { - writer.uint32(18).string(message.protocolId) - } - if (message.targetMultiaddr !== '') { - writer.uint32(26).string(message.targetMultiaddr) - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Config { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseConfig() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break - } - - message.peerId = reader.string() - continue - case 2: - if (tag !== 18) { - break - } - - message.protocolId = reader.string() - continue - case 3: - if (tag !== 26) { - break - } - - message.targetMultiaddr = reader.string() - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: AsyncIterable | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config.encode(p).finish()] - } - } else { - yield* [Config.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config.decode(p)] - } - } else { - yield* [Config.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): Config { - return { - peerId: isSet(object.peerId) ? globalThis.String(object.peerId) : '', - protocolId: isSet(object.protocolId) - ? globalThis.String(object.protocolId) - : '', - targetMultiaddr: isSet(object.targetMultiaddr) - ? globalThis.String(object.targetMultiaddr) - : '', - } - }, - - toJSON(message: Config): unknown { - const obj: any = {} - if (message.peerId !== '') { - obj.peerId = message.peerId - } - if (message.protocolId !== '') { - obj.protocolId = message.protocolId - } - if (message.targetMultiaddr !== '') { - obj.targetMultiaddr = message.targetMultiaddr - } - return obj - }, - - create, I>>(base?: I): Config { - return Config.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>(object: I): Config { - const message = createBaseConfig() - message.peerId = object.peerId ?? '' - message.protocolId = object.protocolId ?? '' - message.targetMultiaddr = object.targetMultiaddr ?? '' - return message - }, -} - -type Builtin = - | Date - | Function - | Uint8Array - | string - | number - | boolean - | undefined - -export type DeepPartial = T extends Builtin - ? T - : T extends Long - ? string | number | Long - : T extends globalThis.Array - ? globalThis.Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends { $case: string } - ? { [K in keyof Omit]?: DeepPartial } & { - $case: T['$case'] - } - : T extends {} - ? { [K in keyof T]?: DeepPartial } - : Partial - -type KeysOfUnion = T extends T ? keyof T : never -export type Exact = P extends Builtin - ? P - : P & { [K in keyof P]: Exact } & { - [K in Exclude>]: never - } - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any - _m0.configure() -} - -function isSet(value: any): boolean { - return value !== null && value !== undefined -} diff --git a/stream/forwarding/forwarding_pb.ts b/stream/forwarding/forwarding_pb.ts new file mode 100644 index 00000000..3f7949e0 --- /dev/null +++ b/stream/forwarding/forwarding_pb.ts @@ -0,0 +1,93 @@ +// @generated by protoc-gen-es v1.8.0 with parameter "target=ts,ts_nocheck=false" +// @generated from file github.com/aperturerobotics/bifrost/stream/forwarding/forwarding.proto (package stream.forwarding, syntax proto3) +/* eslint-disable */ + +import type { + BinaryReadOptions, + FieldList, + JsonReadOptions, + JsonValue, + PartialMessage, + PlainMessage, +} from '@bufbuild/protobuf' +import { Message, proto3 } from '@bufbuild/protobuf' + +/** + * Config configures the forwarding controller. + * + * @generated from message stream.forwarding.Config + */ +export class Config extends Message { + /** + * PeerId is the peer ID to forward for. + * Can be empty. + * + * @generated from field: string peer_id = 1; + */ + peerId = '' + + /** + * ProtocolId is the protocol ID to forward for. + * + * @generated from field: string protocol_id = 2; + */ + protocolId = '' + + /** + * TargetMultiaddr is the target multiaddress to dial. + * + * @generated from field: string target_multiaddr = 3; + */ + targetMultiaddr = '' + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'stream.forwarding.Config' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: 'peer_id', kind: 'scalar', T: 9 /* ScalarType.STRING */ }, + { + no: 2, + name: 'protocol_id', + kind: 'scalar', + T: 9 /* ScalarType.STRING */, + }, + { + no: 3, + name: 'target_multiaddr', + kind: 'scalar', + T: 9 /* ScalarType.STRING */, + }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): Config { + return new Config().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): Config { + return new Config().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): Config { + return new Config().fromJsonString(jsonString, options) + } + + static equals( + a: Config | PlainMessage | undefined, + b: Config | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(Config, a, b) + } +} diff --git a/stream/forwarding/forwarding_vtproto.pb.go b/stream/forwarding/forwarding_vtproto.pb.go deleted file mode 100644 index 2f5e5648..00000000 --- a/stream/forwarding/forwarding_vtproto.pb.go +++ /dev/null @@ -1,289 +0,0 @@ -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// protoc-gen-go-vtproto version: v0.6.0 -// source: github.com/aperturerobotics/bifrost/stream/forwarding/forwarding.proto - -package stream_forwarding - -import ( - fmt "fmt" - io "io" - - protohelpers "github.com/planetscale/vtprotobuf/protohelpers" - proto "google.golang.org/protobuf/proto" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) -) - -func (m *Config) CloneVT() *Config { - if m == nil { - return (*Config)(nil) - } - r := new(Config) - r.PeerId = m.PeerId - r.ProtocolId = m.ProtocolId - r.TargetMultiaddr = m.TargetMultiaddr - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Config) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (this *Config) EqualVT(that *Config) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.PeerId != that.PeerId { - return false - } - if this.ProtocolId != that.ProtocolId { - return false - } - if this.TargetMultiaddr != that.TargetMultiaddr { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Config) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Config) - if !ok { - return false - } - return this.EqualVT(that) -} -func (m *Config) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Config) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.TargetMultiaddr) > 0 { - i -= len(m.TargetMultiaddr) - copy(dAtA[i:], m.TargetMultiaddr) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.TargetMultiaddr))) - i-- - dAtA[i] = 0x1a - } - if len(m.ProtocolId) > 0 { - i -= len(m.ProtocolId) - copy(dAtA[i:], m.ProtocolId) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.ProtocolId))) - i-- - dAtA[i] = 0x12 - } - if len(m.PeerId) > 0 { - i -= len(m.PeerId) - copy(dAtA[i:], m.PeerId) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.PeerId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Config) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.PeerId) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - l = len(m.ProtocolId) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - l = len(m.TargetMultiaddr) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *Config) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Config: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Config: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PeerId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PeerId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ProtocolId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ProtocolId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TargetMultiaddr", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TargetMultiaddr = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} diff --git a/stream/listening/listening.pb.go b/stream/listening/listening.pb.go index a6a6c28d..d3bb762f 100644 --- a/stream/listening/listening.pb.go +++ b/stream/listening/listening.pb.go @@ -1,44 +1,32 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0-devel -// protoc v5.26.1 +// Code generated by protoc-gen-go-lite. DO NOT EDIT. +// protoc-gen-go-lite version: v0.4.5 // source: github.com/aperturerobotics/bifrost/stream/listening/listening.proto package stream_listening import ( - reflect "reflect" - sync "sync" + io "io" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) + protobuf_go_lite "github.com/aperturerobotics/protobuf-go-lite" + json "github.com/aperturerobotics/protobuf-go-lite/json" + errors "github.com/pkg/errors" ) // Config configures the listening controller. type Config struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + unknownFields []byte // LocalPeerId is the peer ID to forward incoming connections with. // Can be empty. - LocalPeerId string `protobuf:"bytes,1,opt,name=local_peer_id,json=localPeerId,proto3" json:"local_peer_id,omitempty"` + LocalPeerId string `protobuf:"bytes,1,opt,name=local_peer_id,json=localPeerId,proto3" json:"localPeerId,omitempty"` // RemotePeerId is the peer ID to forward incoming connections to. - RemotePeerId string `protobuf:"bytes,2,opt,name=remote_peer_id,json=remotePeerId,proto3" json:"remote_peer_id,omitempty"` + RemotePeerId string `protobuf:"bytes,2,opt,name=remote_peer_id,json=remotePeerId,proto3" json:"remotePeerId,omitempty"` // ProtocolId is the protocol ID to assign to incoming connections. - ProtocolId string `protobuf:"bytes,3,opt,name=protocol_id,json=protocolId,proto3" json:"protocol_id,omitempty"` + ProtocolId string `protobuf:"bytes,3,opt,name=protocol_id,json=protocolId,proto3" json:"protocolId,omitempty"` // ListenMultiaddr is the listening multiaddress. - ListenMultiaddr string `protobuf:"bytes,4,opt,name=listen_multiaddr,json=listenMultiaddr,proto3" json:"listen_multiaddr,omitempty"` + ListenMultiaddr string `protobuf:"bytes,4,opt,name=listen_multiaddr,json=listenMultiaddr,proto3" json:"listenMultiaddr,omitempty"` // TransportId sets a transport ID constraint. // Can be empty. - TransportId uint64 `protobuf:"varint,5,opt,name=transport_id,json=transportId,proto3" json:"transport_id,omitempty"` + TransportId uint64 `protobuf:"varint,5,opt,name=transport_id,json=transportId,proto3" json:"transportId,omitempty"` // Reliable indicates the stream should be reliable. Reliable bool `protobuf:"varint,6,opt,name=reliable,proto3" json:"reliable,omitempty"` // Encrypted indicates the stream should be encrypted. @@ -47,36 +35,10 @@ type Config struct { func (x *Config) Reset() { *x = Config{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_stream_listening_listening_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Config) String() string { - return protoimpl.X.MessageStringOf(x) } func (*Config) ProtoMessage() {} -func (x *Config) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_stream_listening_listening_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 Config.ProtoReflect.Descriptor instead. -func (*Config) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_stream_listening_listening_proto_rawDescGZIP(), []int{0} -} - func (x *Config) GetLocalPeerId() string { if x != nil { return x.LocalPeerId @@ -126,92 +88,513 @@ func (x *Config) GetEncrypted() bool { return false } -var File_github_com_aperturerobotics_bifrost_stream_listening_listening_proto protoreflect.FileDescriptor - -var file_github_com_aperturerobotics_bifrost_stream_listening_listening_proto_rawDesc = []byte{ - 0x0a, 0x44, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, - 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x62, 0x69, - 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2f, 0x6c, 0x69, 0x73, - 0x74, 0x65, 0x6e, 0x69, 0x6e, 0x67, 0x2f, 0x6c, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x69, 0x6e, 0x67, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x10, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x6c, - 0x69, 0x73, 0x74, 0x65, 0x6e, 0x69, 0x6e, 0x67, 0x22, 0xfb, 0x01, 0x0a, 0x06, 0x43, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x12, 0x22, 0x0a, 0x0d, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x5f, 0x70, 0x65, 0x65, - 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6c, 0x6f, 0x63, 0x61, - 0x6c, 0x50, 0x65, 0x65, 0x72, 0x49, 0x64, 0x12, 0x24, 0x0a, 0x0e, 0x72, 0x65, 0x6d, 0x6f, 0x74, - 0x65, 0x5f, 0x70, 0x65, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x0c, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x50, 0x65, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1f, 0x0a, - 0x0b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0a, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x49, 0x64, 0x12, 0x29, - 0x0a, 0x10, 0x6c, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x5f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x61, 0x64, - 0x64, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x6c, 0x69, 0x73, 0x74, 0x65, 0x6e, - 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x61, 0x64, 0x64, 0x72, 0x12, 0x21, 0x0a, 0x0c, 0x74, 0x72, 0x61, - 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, - 0x0b, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, - 0x72, 0x65, 0x6c, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, - 0x72, 0x65, 0x6c, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x65, 0x6e, 0x63, 0x72, - 0x79, 0x70, 0x74, 0x65, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x65, 0x6e, 0x63, - 0x72, 0x79, 0x70, 0x74, 0x65, 0x64, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_github_com_aperturerobotics_bifrost_stream_listening_listening_proto_rawDescOnce sync.Once - file_github_com_aperturerobotics_bifrost_stream_listening_listening_proto_rawDescData = file_github_com_aperturerobotics_bifrost_stream_listening_listening_proto_rawDesc -) +func (m *Config) CloneVT() *Config { + if m == nil { + return (*Config)(nil) + } + r := new(Config) + r.LocalPeerId = m.LocalPeerId + r.RemotePeerId = m.RemotePeerId + r.ProtocolId = m.ProtocolId + r.ListenMultiaddr = m.ListenMultiaddr + r.TransportId = m.TransportId + r.Reliable = m.Reliable + r.Encrypted = m.Encrypted + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} -func file_github_com_aperturerobotics_bifrost_stream_listening_listening_proto_rawDescGZIP() []byte { - file_github_com_aperturerobotics_bifrost_stream_listening_listening_proto_rawDescOnce.Do(func() { - file_github_com_aperturerobotics_bifrost_stream_listening_listening_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_aperturerobotics_bifrost_stream_listening_listening_proto_rawDescData) - }) - return file_github_com_aperturerobotics_bifrost_stream_listening_listening_proto_rawDescData +func (m *Config) CloneMessageVT() any { + return m.CloneVT() +} + +func (this *Config) EqualVT(that *Config) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.LocalPeerId != that.LocalPeerId { + return false + } + if this.RemotePeerId != that.RemotePeerId { + return false + } + if this.ProtocolId != that.ProtocolId { + return false + } + if this.ListenMultiaddr != that.ListenMultiaddr { + return false + } + if this.TransportId != that.TransportId { + return false + } + if this.Reliable != that.Reliable { + return false + } + if this.Encrypted != that.Encrypted { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *Config) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*Config) + if !ok { + return false + } + return this.EqualVT(that) } -var file_github_com_aperturerobotics_bifrost_stream_listening_listening_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_github_com_aperturerobotics_bifrost_stream_listening_listening_proto_goTypes = []interface{}{ - (*Config)(nil), // 0: stream.listening.Config +// MarshalProtoJSON marshals the Config message to JSON. +func (x *Config) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return + } + s.WriteObjectStart() + var wroteField bool + if x.LocalPeerId != "" || s.HasField("localPeerId") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("localPeerId") + s.WriteString(x.LocalPeerId) + } + if x.RemotePeerId != "" || s.HasField("remotePeerId") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("remotePeerId") + s.WriteString(x.RemotePeerId) + } + if x.ProtocolId != "" || s.HasField("protocolId") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("protocolId") + s.WriteString(x.ProtocolId) + } + if x.ListenMultiaddr != "" || s.HasField("listenMultiaddr") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("listenMultiaddr") + s.WriteString(x.ListenMultiaddr) + } + if x.TransportId != 0 || s.HasField("transportId") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("transportId") + s.WriteUint64(x.TransportId) + } + if x.Reliable || s.HasField("reliable") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("reliable") + s.WriteBool(x.Reliable) + } + if x.Encrypted || s.HasField("encrypted") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("encrypted") + s.WriteBool(x.Encrypted) + } + s.WriteObjectEnd() } -var file_github_com_aperturerobotics_bifrost_stream_listening_listening_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] 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 + +// MarshalJSON marshals the Config to JSON. +func (x *Config) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) } -func init() { file_github_com_aperturerobotics_bifrost_stream_listening_listening_proto_init() } -func file_github_com_aperturerobotics_bifrost_stream_listening_listening_proto_init() { - if File_github_com_aperturerobotics_bifrost_stream_listening_listening_proto != nil { +// UnmarshalProtoJSON unmarshals the Config message from JSON. +func (x *Config) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { return } - if !protoimpl.UnsafeEnabled { - file_github_com_aperturerobotics_bifrost_stream_listening_listening_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Config); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "local_peer_id", "localPeerId": + s.AddField("local_peer_id") + x.LocalPeerId = s.ReadString() + case "remote_peer_id", "remotePeerId": + s.AddField("remote_peer_id") + x.RemotePeerId = s.ReadString() + case "protocol_id", "protocolId": + s.AddField("protocol_id") + x.ProtocolId = s.ReadString() + case "listen_multiaddr", "listenMultiaddr": + s.AddField("listen_multiaddr") + x.ListenMultiaddr = s.ReadString() + case "transport_id", "transportId": + s.AddField("transport_id") + x.TransportId = s.ReadUint64() + case "reliable": + s.AddField("reliable") + x.Reliable = s.ReadBool() + case "encrypted": + s.AddField("encrypted") + x.Encrypted = s.ReadBool() + } + }) +} + +// UnmarshalJSON unmarshals the Config from JSON. +func (x *Config) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +func (m *Config) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Config) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.Encrypted { + i-- + if m.Encrypted { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x38 + } + if m.Reliable { + i-- + if m.Reliable { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x30 + } + if m.TransportId != 0 { + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(m.TransportId)) + i-- + dAtA[i] = 0x28 + } + if len(m.ListenMultiaddr) > 0 { + i -= len(m.ListenMultiaddr) + copy(dAtA[i:], m.ListenMultiaddr) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.ListenMultiaddr))) + i-- + dAtA[i] = 0x22 + } + if len(m.ProtocolId) > 0 { + i -= len(m.ProtocolId) + copy(dAtA[i:], m.ProtocolId) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.ProtocolId))) + i-- + dAtA[i] = 0x1a + } + if len(m.RemotePeerId) > 0 { + i -= len(m.RemotePeerId) + copy(dAtA[i:], m.RemotePeerId) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.RemotePeerId))) + i-- + dAtA[i] = 0x12 + } + if len(m.LocalPeerId) > 0 { + i -= len(m.LocalPeerId) + copy(dAtA[i:], m.LocalPeerId) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.LocalPeerId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Config) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.LocalPeerId) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + l = len(m.RemotePeerId) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + l = len(m.ProtocolId) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + l = len(m.ListenMultiaddr) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + if m.TransportId != 0 { + n += 1 + protobuf_go_lite.SizeOfVarint(uint64(m.TransportId)) + } + if m.Reliable { + n += 2 + } + if m.Encrypted { + n += 2 + } + n += len(m.unknownFields) + return n +} + +func (m *Config) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break } } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: Config: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: Config: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field LocalPeerId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.LocalPeerId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field RemotePeerId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RemotePeerId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field ProtocolId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ProtocolId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field ListenMultiaddr", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ListenMultiaddr = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 0 { + return errors.Errorf("proto: wrong wireType = %d for field TransportId", wireType) + } + m.TransportId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TransportId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 0 { + return errors.Errorf("proto: wrong wireType = %d for field Reliable", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Reliable = bool(v != 0) + case 7: + if wireType != 0 { + return errors.Errorf("proto: wrong wireType = %d for field Encrypted", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Encrypted = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_github_com_aperturerobotics_bifrost_stream_listening_listening_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_github_com_aperturerobotics_bifrost_stream_listening_listening_proto_goTypes, - DependencyIndexes: file_github_com_aperturerobotics_bifrost_stream_listening_listening_proto_depIdxs, - MessageInfos: file_github_com_aperturerobotics_bifrost_stream_listening_listening_proto_msgTypes, - }.Build() - File_github_com_aperturerobotics_bifrost_stream_listening_listening_proto = out.File - file_github_com_aperturerobotics_bifrost_stream_listening_listening_proto_rawDesc = nil - file_github_com_aperturerobotics_bifrost_stream_listening_listening_proto_goTypes = nil - file_github_com_aperturerobotics_bifrost_stream_listening_listening_proto_depIdxs = nil + return nil } diff --git a/stream/listening/listening.pb.ts b/stream/listening/listening.pb.ts deleted file mode 100644 index b758ed2c..00000000 --- a/stream/listening/listening.pb.ts +++ /dev/null @@ -1,282 +0,0 @@ -/* eslint-disable */ -import Long from 'long' -import _m0 from 'protobufjs/minimal.js' - -export const protobufPackage = 'stream.listening' - -/** Config configures the listening controller. */ -export interface Config { - /** - * LocalPeerId is the peer ID to forward incoming connections with. - * Can be empty. - */ - localPeerId: string - /** RemotePeerId is the peer ID to forward incoming connections to. */ - remotePeerId: string - /** ProtocolId is the protocol ID to assign to incoming connections. */ - protocolId: string - /** ListenMultiaddr is the listening multiaddress. */ - listenMultiaddr: string - /** - * TransportId sets a transport ID constraint. - * Can be empty. - */ - transportId: Long - /** Reliable indicates the stream should be reliable. */ - reliable: boolean - /** Encrypted indicates the stream should be encrypted. */ - encrypted: boolean -} - -function createBaseConfig(): Config { - return { - localPeerId: '', - remotePeerId: '', - protocolId: '', - listenMultiaddr: '', - transportId: Long.UZERO, - reliable: false, - encrypted: false, - } -} - -export const Config = { - encode( - message: Config, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.localPeerId !== '') { - writer.uint32(10).string(message.localPeerId) - } - if (message.remotePeerId !== '') { - writer.uint32(18).string(message.remotePeerId) - } - if (message.protocolId !== '') { - writer.uint32(26).string(message.protocolId) - } - if (message.listenMultiaddr !== '') { - writer.uint32(34).string(message.listenMultiaddr) - } - if (!message.transportId.equals(Long.UZERO)) { - writer.uint32(40).uint64(message.transportId) - } - if (message.reliable !== false) { - writer.uint32(48).bool(message.reliable) - } - if (message.encrypted !== false) { - writer.uint32(56).bool(message.encrypted) - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Config { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseConfig() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break - } - - message.localPeerId = reader.string() - continue - case 2: - if (tag !== 18) { - break - } - - message.remotePeerId = reader.string() - continue - case 3: - if (tag !== 26) { - break - } - - message.protocolId = reader.string() - continue - case 4: - if (tag !== 34) { - break - } - - message.listenMultiaddr = reader.string() - continue - case 5: - if (tag !== 40) { - break - } - - message.transportId = reader.uint64() as Long - continue - case 6: - if (tag !== 48) { - break - } - - message.reliable = reader.bool() - continue - case 7: - if (tag !== 56) { - break - } - - message.encrypted = reader.bool() - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: AsyncIterable | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config.encode(p).finish()] - } - } else { - yield* [Config.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config.decode(p)] - } - } else { - yield* [Config.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): Config { - return { - localPeerId: isSet(object.localPeerId) - ? globalThis.String(object.localPeerId) - : '', - remotePeerId: isSet(object.remotePeerId) - ? globalThis.String(object.remotePeerId) - : '', - protocolId: isSet(object.protocolId) - ? globalThis.String(object.protocolId) - : '', - listenMultiaddr: isSet(object.listenMultiaddr) - ? globalThis.String(object.listenMultiaddr) - : '', - transportId: isSet(object.transportId) - ? Long.fromValue(object.transportId) - : Long.UZERO, - reliable: isSet(object.reliable) - ? globalThis.Boolean(object.reliable) - : false, - encrypted: isSet(object.encrypted) - ? globalThis.Boolean(object.encrypted) - : false, - } - }, - - toJSON(message: Config): unknown { - const obj: any = {} - if (message.localPeerId !== '') { - obj.localPeerId = message.localPeerId - } - if (message.remotePeerId !== '') { - obj.remotePeerId = message.remotePeerId - } - if (message.protocolId !== '') { - obj.protocolId = message.protocolId - } - if (message.listenMultiaddr !== '') { - obj.listenMultiaddr = message.listenMultiaddr - } - if (!message.transportId.equals(Long.UZERO)) { - obj.transportId = (message.transportId || Long.UZERO).toString() - } - if (message.reliable !== false) { - obj.reliable = message.reliable - } - if (message.encrypted !== false) { - obj.encrypted = message.encrypted - } - return obj - }, - - create, I>>(base?: I): Config { - return Config.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>(object: I): Config { - const message = createBaseConfig() - message.localPeerId = object.localPeerId ?? '' - message.remotePeerId = object.remotePeerId ?? '' - message.protocolId = object.protocolId ?? '' - message.listenMultiaddr = object.listenMultiaddr ?? '' - message.transportId = - object.transportId !== undefined && object.transportId !== null - ? Long.fromValue(object.transportId) - : Long.UZERO - message.reliable = object.reliable ?? false - message.encrypted = object.encrypted ?? false - return message - }, -} - -type Builtin = - | Date - | Function - | Uint8Array - | string - | number - | boolean - | undefined - -export type DeepPartial = T extends Builtin - ? T - : T extends Long - ? string | number | Long - : T extends globalThis.Array - ? globalThis.Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends { $case: string } - ? { [K in keyof Omit]?: DeepPartial } & { - $case: T['$case'] - } - : T extends {} - ? { [K in keyof T]?: DeepPartial } - : Partial - -type KeysOfUnion = T extends T ? keyof T : never -export type Exact = P extends Builtin - ? P - : P & { [K in keyof P]: Exact } & { - [K in Exclude>]: never - } - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any - _m0.configure() -} - -function isSet(value: any): boolean { - return value !== null && value !== undefined -} diff --git a/stream/listening/listening_pb.ts b/stream/listening/listening_pb.ts new file mode 100644 index 00000000..64f09a2a --- /dev/null +++ b/stream/listening/listening_pb.ts @@ -0,0 +1,141 @@ +// @generated by protoc-gen-es v1.8.0 with parameter "target=ts,ts_nocheck=false" +// @generated from file github.com/aperturerobotics/bifrost/stream/listening/listening.proto (package stream.listening, syntax proto3) +/* eslint-disable */ + +import type { + BinaryReadOptions, + FieldList, + JsonReadOptions, + JsonValue, + PartialMessage, + PlainMessage, +} from '@bufbuild/protobuf' +import { Message, proto3, protoInt64 } from '@bufbuild/protobuf' + +/** + * Config configures the listening controller. + * + * @generated from message stream.listening.Config + */ +export class Config extends Message { + /** + * LocalPeerId is the peer ID to forward incoming connections with. + * Can be empty. + * + * @generated from field: string local_peer_id = 1; + */ + localPeerId = '' + + /** + * RemotePeerId is the peer ID to forward incoming connections to. + * + * @generated from field: string remote_peer_id = 2; + */ + remotePeerId = '' + + /** + * ProtocolId is the protocol ID to assign to incoming connections. + * + * @generated from field: string protocol_id = 3; + */ + protocolId = '' + + /** + * ListenMultiaddr is the listening multiaddress. + * + * @generated from field: string listen_multiaddr = 4; + */ + listenMultiaddr = '' + + /** + * TransportId sets a transport ID constraint. + * Can be empty. + * + * @generated from field: uint64 transport_id = 5; + */ + transportId = protoInt64.zero + + /** + * Reliable indicates the stream should be reliable. + * + * @generated from field: bool reliable = 6; + */ + reliable = false + + /** + * Encrypted indicates the stream should be encrypted. + * + * @generated from field: bool encrypted = 7; + */ + encrypted = false + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'stream.listening.Config' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { + no: 1, + name: 'local_peer_id', + kind: 'scalar', + T: 9 /* ScalarType.STRING */, + }, + { + no: 2, + name: 'remote_peer_id', + kind: 'scalar', + T: 9 /* ScalarType.STRING */, + }, + { + no: 3, + name: 'protocol_id', + kind: 'scalar', + T: 9 /* ScalarType.STRING */, + }, + { + no: 4, + name: 'listen_multiaddr', + kind: 'scalar', + T: 9 /* ScalarType.STRING */, + }, + { + no: 5, + name: 'transport_id', + kind: 'scalar', + T: 4 /* ScalarType.UINT64 */, + }, + { no: 6, name: 'reliable', kind: 'scalar', T: 8 /* ScalarType.BOOL */ }, + { no: 7, name: 'encrypted', kind: 'scalar', T: 8 /* ScalarType.BOOL */ }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): Config { + return new Config().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): Config { + return new Config().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): Config { + return new Config().fromJsonString(jsonString, options) + } + + static equals( + a: Config | PlainMessage | undefined, + b: Config | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(Config, a, b) + } +} diff --git a/stream/listening/listening_vtproto.pb.go b/stream/listening/listening_vtproto.pb.go deleted file mode 100644 index 6f4f6184..00000000 --- a/stream/listening/listening_vtproto.pb.go +++ /dev/null @@ -1,441 +0,0 @@ -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// protoc-gen-go-vtproto version: v0.6.0 -// source: github.com/aperturerobotics/bifrost/stream/listening/listening.proto - -package stream_listening - -import ( - fmt "fmt" - io "io" - - protohelpers "github.com/planetscale/vtprotobuf/protohelpers" - proto "google.golang.org/protobuf/proto" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) -) - -func (m *Config) CloneVT() *Config { - if m == nil { - return (*Config)(nil) - } - r := new(Config) - r.LocalPeerId = m.LocalPeerId - r.RemotePeerId = m.RemotePeerId - r.ProtocolId = m.ProtocolId - r.ListenMultiaddr = m.ListenMultiaddr - r.TransportId = m.TransportId - r.Reliable = m.Reliable - r.Encrypted = m.Encrypted - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Config) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (this *Config) EqualVT(that *Config) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.LocalPeerId != that.LocalPeerId { - return false - } - if this.RemotePeerId != that.RemotePeerId { - return false - } - if this.ProtocolId != that.ProtocolId { - return false - } - if this.ListenMultiaddr != that.ListenMultiaddr { - return false - } - if this.TransportId != that.TransportId { - return false - } - if this.Reliable != that.Reliable { - return false - } - if this.Encrypted != that.Encrypted { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Config) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Config) - if !ok { - return false - } - return this.EqualVT(that) -} -func (m *Config) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Config) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Encrypted { - i-- - if m.Encrypted { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x38 - } - if m.Reliable { - i-- - if m.Reliable { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x30 - } - if m.TransportId != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.TransportId)) - i-- - dAtA[i] = 0x28 - } - if len(m.ListenMultiaddr) > 0 { - i -= len(m.ListenMultiaddr) - copy(dAtA[i:], m.ListenMultiaddr) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.ListenMultiaddr))) - i-- - dAtA[i] = 0x22 - } - if len(m.ProtocolId) > 0 { - i -= len(m.ProtocolId) - copy(dAtA[i:], m.ProtocolId) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.ProtocolId))) - i-- - dAtA[i] = 0x1a - } - if len(m.RemotePeerId) > 0 { - i -= len(m.RemotePeerId) - copy(dAtA[i:], m.RemotePeerId) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.RemotePeerId))) - i-- - dAtA[i] = 0x12 - } - if len(m.LocalPeerId) > 0 { - i -= len(m.LocalPeerId) - copy(dAtA[i:], m.LocalPeerId) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.LocalPeerId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Config) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.LocalPeerId) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - l = len(m.RemotePeerId) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - l = len(m.ProtocolId) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - l = len(m.ListenMultiaddr) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.TransportId != 0 { - n += 1 + protohelpers.SizeOfVarint(uint64(m.TransportId)) - } - if m.Reliable { - n += 2 - } - if m.Encrypted { - n += 2 - } - n += len(m.unknownFields) - return n -} - -func (m *Config) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Config: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Config: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LocalPeerId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.LocalPeerId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RemotePeerId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.RemotePeerId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ProtocolId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ProtocolId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListenMultiaddr", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ListenMultiaddr = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TransportId", wireType) - } - m.TransportId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TransportId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Reliable", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Reliable = bool(v != 0) - case 7: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Encrypted", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Encrypted = bool(v != 0) - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} diff --git a/stream/packet/packet.go b/stream/packet/packet.go index 89482f4e..94f80e00 100644 --- a/stream/packet/packet.go +++ b/stream/packet/packet.go @@ -5,8 +5,8 @@ import ( "io" "sync" + protobuf_go_lite "github.com/aperturerobotics/protobuf-go-lite" "github.com/pkg/errors" - "google.golang.org/protobuf/proto" ) // Session wraps a stream in a session. @@ -29,8 +29,8 @@ func NewSession( } // SendMsg tries to send a message on the wire. -func (s *Session) SendMsg(msg proto.Message) error { - data, err := proto.Marshal(msg) +func (s *Session) SendMsg(msg protobuf_go_lite.Message) error { + data, err := msg.MarshalVT() if err != nil { return err } @@ -50,7 +50,7 @@ func (s *Session) SendMsg(msg proto.Message) error { } // RecvMsg tries to receive a message on the wire. -func (s *Session) RecvMsg(msg proto.Message) error { +func (s *Session) RecvMsg(msg protobuf_go_lite.Message) error { data := make([]byte, 4) s.readMtx.Lock() defer s.readMtx.Unlock() @@ -70,9 +70,9 @@ func (s *Session) RecvMsg(msg proto.Message) error { return err } - return proto.Unmarshal(data, msg) + return msg.UnmarshalVT(data) } - proto.Reset(msg) + msg.Reset() return nil } diff --git a/stream/srpc/client/client.pb.go b/stream/srpc/client/client.pb.go index ca340102..055e57b2 100644 --- a/stream/srpc/client/client.pb.go +++ b/stream/srpc/client/client.pb.go @@ -1,81 +1,43 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0-devel -// protoc v5.26.1 +// Code generated by protoc-gen-go-lite. DO NOT EDIT. +// protoc-gen-go-lite version: v0.4.5 // source: github.com/aperturerobotics/bifrost/stream/srpc/client/client.proto package stream_srpc_client import ( - reflect "reflect" - sync "sync" + io "io" + protobuf_go_lite "github.com/aperturerobotics/protobuf-go-lite" + json "github.com/aperturerobotics/protobuf-go-lite/json" backoff "github.com/aperturerobotics/util/backoff" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) + errors "github.com/pkg/errors" ) // Config configures a client for a srpc service. type Config struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + unknownFields []byte // ServerPeerIds are the static list of peer IDs to contact. - ServerPeerIds []string `protobuf:"bytes,1,rep,name=server_peer_ids,json=serverPeerIds,proto3" json:"server_peer_ids,omitempty"` + ServerPeerIds []string `protobuf:"bytes,1,rep,name=server_peer_ids,json=serverPeerIds,proto3" json:"serverPeerIds,omitempty"` // PerServerBackoff is the server peer error backoff configuration. // Can be empty. - PerServerBackoff *backoff.Backoff `protobuf:"bytes,2,opt,name=per_server_backoff,json=perServerBackoff,proto3" json:"per_server_backoff,omitempty"` + PerServerBackoff *backoff.Backoff `protobuf:"bytes,2,opt,name=per_server_backoff,json=perServerBackoff,proto3" json:"perServerBackoff,omitempty"` // SrcPeerId is the source peer id to contact from. // Can be empty. - SrcPeerId string `protobuf:"bytes,3,opt,name=src_peer_id,json=srcPeerId,proto3" json:"src_peer_id,omitempty"` + SrcPeerId string `protobuf:"bytes,3,opt,name=src_peer_id,json=srcPeerId,proto3" json:"srcPeerId,omitempty"` // TransportId restricts which transport we can dial out from. - TransportId uint64 `protobuf:"varint,4,opt,name=transport_id,json=transportId,proto3" json:"transport_id,omitempty"` + TransportId uint64 `protobuf:"varint,4,opt,name=transport_id,json=transportId,proto3" json:"transportId,omitempty"` // TimeoutDur sets the per-server establish timeout. // If unset, no timeout. // Example: 15s - TimeoutDur string `protobuf:"bytes,5,opt,name=timeout_dur,json=timeoutDur,proto3" json:"timeout_dur,omitempty"` + TimeoutDur string `protobuf:"bytes,5,opt,name=timeout_dur,json=timeoutDur,proto3" json:"timeoutDur,omitempty"` } func (x *Config) Reset() { *x = Config{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_stream_srpc_client_client_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Config) String() string { - return protoimpl.X.MessageStringOf(x) } func (*Config) ProtoMessage() {} -func (x *Config) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_stream_srpc_client_client_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 Config.ProtoReflect.Descriptor instead. -func (*Config) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_stream_srpc_client_client_proto_rawDescGZIP(), []int{0} -} - func (x *Config) GetServerPeerIds() []string { if x != nil { return x.ServerPeerIds @@ -111,95 +73,454 @@ func (x *Config) GetTimeoutDur() string { return "" } -var File_github_com_aperturerobotics_bifrost_stream_srpc_client_client_proto protoreflect.FileDescriptor - -var file_github_com_aperturerobotics_bifrost_stream_srpc_client_client_proto_rawDesc = []byte{ - 0x0a, 0x43, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, - 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x62, 0x69, - 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2f, 0x73, 0x72, 0x70, - 0x63, 0x2f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x73, 0x72, - 0x70, 0x63, 0x2e, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x1a, 0x36, 0x67, 0x69, 0x74, 0x68, 0x75, - 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, - 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x75, 0x74, 0x69, 0x6c, 0x2f, 0x62, 0x61, 0x63, 0x6b, - 0x6f, 0x66, 0x66, 0x2f, 0x62, 0x61, 0x63, 0x6b, 0x6f, 0x66, 0x66, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x22, 0xd4, 0x01, 0x0a, 0x06, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x26, 0x0a, 0x0f, - 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x5f, 0x70, 0x65, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x73, 0x18, - 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0d, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x50, 0x65, 0x65, - 0x72, 0x49, 0x64, 0x73, 0x12, 0x3e, 0x0a, 0x12, 0x70, 0x65, 0x72, 0x5f, 0x73, 0x65, 0x72, 0x76, - 0x65, 0x72, 0x5f, 0x62, 0x61, 0x63, 0x6b, 0x6f, 0x66, 0x66, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x10, 0x2e, 0x62, 0x61, 0x63, 0x6b, 0x6f, 0x66, 0x66, 0x2e, 0x42, 0x61, 0x63, 0x6b, 0x6f, - 0x66, 0x66, 0x52, 0x10, 0x70, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x42, 0x61, 0x63, - 0x6b, 0x6f, 0x66, 0x66, 0x12, 0x1e, 0x0a, 0x0b, 0x73, 0x72, 0x63, 0x5f, 0x70, 0x65, 0x65, 0x72, - 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x72, 0x63, 0x50, 0x65, - 0x65, 0x72, 0x49, 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, - 0x74, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x74, 0x72, 0x61, 0x6e, - 0x73, 0x70, 0x6f, 0x72, 0x74, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x74, 0x69, 0x6d, 0x65, 0x6f, - 0x75, 0x74, 0x5f, 0x64, 0x75, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x74, 0x69, - 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x44, 0x75, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_github_com_aperturerobotics_bifrost_stream_srpc_client_client_proto_rawDescOnce sync.Once - file_github_com_aperturerobotics_bifrost_stream_srpc_client_client_proto_rawDescData = file_github_com_aperturerobotics_bifrost_stream_srpc_client_client_proto_rawDesc -) +func (m *Config) CloneVT() *Config { + if m == nil { + return (*Config)(nil) + } + r := new(Config) + r.SrcPeerId = m.SrcPeerId + r.TransportId = m.TransportId + r.TimeoutDur = m.TimeoutDur + if rhs := m.ServerPeerIds; rhs != nil { + tmpContainer := make([]string, len(rhs)) + copy(tmpContainer, rhs) + r.ServerPeerIds = tmpContainer + } + if rhs := m.PerServerBackoff; rhs != nil { + r.PerServerBackoff = rhs.CloneVT() + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} -func file_github_com_aperturerobotics_bifrost_stream_srpc_client_client_proto_rawDescGZIP() []byte { - file_github_com_aperturerobotics_bifrost_stream_srpc_client_client_proto_rawDescOnce.Do(func() { - file_github_com_aperturerobotics_bifrost_stream_srpc_client_client_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_aperturerobotics_bifrost_stream_srpc_client_client_proto_rawDescData) - }) - return file_github_com_aperturerobotics_bifrost_stream_srpc_client_client_proto_rawDescData +func (m *Config) CloneMessageVT() any { + return m.CloneVT() } -var file_github_com_aperturerobotics_bifrost_stream_srpc_client_client_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_github_com_aperturerobotics_bifrost_stream_srpc_client_client_proto_goTypes = []interface{}{ - (*Config)(nil), // 0: stream.srpc.client.Config - (*backoff.Backoff)(nil), // 1: backoff.Backoff +func (this *Config) EqualVT(that *Config) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if len(this.ServerPeerIds) != len(that.ServerPeerIds) { + return false + } + for i, vx := range this.ServerPeerIds { + vy := that.ServerPeerIds[i] + if vx != vy { + return false + } + } + if !this.PerServerBackoff.EqualVT(that.PerServerBackoff) { + return false + } + if this.SrcPeerId != that.SrcPeerId { + return false + } + if this.TransportId != that.TransportId { + return false + } + if this.TimeoutDur != that.TimeoutDur { + return false + } + return string(this.unknownFields) == string(that.unknownFields) } -var file_github_com_aperturerobotics_bifrost_stream_srpc_client_client_proto_depIdxs = []int32{ - 1, // 0: stream.srpc.client.Config.per_server_backoff:type_name -> backoff.Backoff - 1, // [1:1] is the sub-list for method output_type - 1, // [1:1] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name + +func (this *Config) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*Config) + if !ok { + return false + } + return this.EqualVT(that) +} + +// MarshalProtoJSON marshals the Config message to JSON. +func (x *Config) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return + } + s.WriteObjectStart() + var wroteField bool + if len(x.ServerPeerIds) > 0 || s.HasField("serverPeerIds") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("serverPeerIds") + s.WriteStringArray(x.ServerPeerIds) + } + if x.PerServerBackoff != nil || s.HasField("perServerBackoff") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("perServerBackoff") + x.PerServerBackoff.MarshalProtoJSON(s.WithField("perServerBackoff")) + } + if x.SrcPeerId != "" || s.HasField("srcPeerId") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("srcPeerId") + s.WriteString(x.SrcPeerId) + } + if x.TransportId != 0 || s.HasField("transportId") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("transportId") + s.WriteUint64(x.TransportId) + } + if x.TimeoutDur != "" || s.HasField("timeoutDur") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("timeoutDur") + s.WriteString(x.TimeoutDur) + } + s.WriteObjectEnd() } -func init() { file_github_com_aperturerobotics_bifrost_stream_srpc_client_client_proto_init() } -func file_github_com_aperturerobotics_bifrost_stream_srpc_client_client_proto_init() { - if File_github_com_aperturerobotics_bifrost_stream_srpc_client_client_proto != nil { +// MarshalJSON marshals the Config to JSON. +func (x *Config) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) +} + +// UnmarshalProtoJSON unmarshals the Config message from JSON. +func (x *Config) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { return } - if !protoimpl.UnsafeEnabled { - file_github_com_aperturerobotics_bifrost_stream_srpc_client_client_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Config); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "server_peer_ids", "serverPeerIds": + s.AddField("server_peer_ids") + if s.ReadNil() { + x.ServerPeerIds = nil + return + } + x.ServerPeerIds = s.ReadStringArray() + case "per_server_backoff", "perServerBackoff": + if s.ReadNil() { + x.PerServerBackoff = nil + return } + x.PerServerBackoff = &backoff.Backoff{} + x.PerServerBackoff.UnmarshalProtoJSON(s.WithField("per_server_backoff", true)) + case "src_peer_id", "srcPeerId": + s.AddField("src_peer_id") + x.SrcPeerId = s.ReadString() + case "transport_id", "transportId": + s.AddField("transport_id") + x.TransportId = s.ReadUint64() + case "timeout_dur", "timeoutDur": + s.AddField("timeout_dur") + x.TimeoutDur = s.ReadString() } + }) +} + +// UnmarshalJSON unmarshals the Config from JSON. +func (x *Config) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +func (m *Config) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Config) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.TimeoutDur) > 0 { + i -= len(m.TimeoutDur) + copy(dAtA[i:], m.TimeoutDur) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.TimeoutDur))) + i-- + dAtA[i] = 0x2a + } + if m.TransportId != 0 { + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(m.TransportId)) + i-- + dAtA[i] = 0x20 } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_github_com_aperturerobotics_bifrost_stream_srpc_client_client_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_github_com_aperturerobotics_bifrost_stream_srpc_client_client_proto_goTypes, - DependencyIndexes: file_github_com_aperturerobotics_bifrost_stream_srpc_client_client_proto_depIdxs, - MessageInfos: file_github_com_aperturerobotics_bifrost_stream_srpc_client_client_proto_msgTypes, - }.Build() - File_github_com_aperturerobotics_bifrost_stream_srpc_client_client_proto = out.File - file_github_com_aperturerobotics_bifrost_stream_srpc_client_client_proto_rawDesc = nil - file_github_com_aperturerobotics_bifrost_stream_srpc_client_client_proto_goTypes = nil - file_github_com_aperturerobotics_bifrost_stream_srpc_client_client_proto_depIdxs = nil + if len(m.SrcPeerId) > 0 { + i -= len(m.SrcPeerId) + copy(dAtA[i:], m.SrcPeerId) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.SrcPeerId))) + i-- + dAtA[i] = 0x1a + } + if m.PerServerBackoff != nil { + size, err := m.PerServerBackoff.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x12 + } + if len(m.ServerPeerIds) > 0 { + for iNdEx := len(m.ServerPeerIds) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.ServerPeerIds[iNdEx]) + copy(dAtA[i:], m.ServerPeerIds[iNdEx]) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.ServerPeerIds[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *Config) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.ServerPeerIds) > 0 { + for _, s := range m.ServerPeerIds { + l = len(s) + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + } + if m.PerServerBackoff != nil { + l = m.PerServerBackoff.SizeVT() + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + l = len(m.SrcPeerId) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + if m.TransportId != 0 { + n += 1 + protobuf_go_lite.SizeOfVarint(uint64(m.TransportId)) + } + l = len(m.TimeoutDur) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *Config) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: Config: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: Config: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field ServerPeerIds", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ServerPeerIds = append(m.ServerPeerIds, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 2: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field PerServerBackoff", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.PerServerBackoff == nil { + m.PerServerBackoff = &backoff.Backoff{} + } + if err := m.PerServerBackoff.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field SrcPeerId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SrcPeerId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 0 { + return errors.Errorf("proto: wrong wireType = %d for field TransportId", wireType) + } + m.TransportId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TransportId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field TimeoutDur", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TimeoutDur = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil } diff --git a/stream/srpc/client/client.pb.ts b/stream/srpc/client/client.pb.ts deleted file mode 100644 index 1bacb32d..00000000 --- a/stream/srpc/client/client.pb.ts +++ /dev/null @@ -1,253 +0,0 @@ -/* eslint-disable */ -import { Backoff } from '@go/github.com/aperturerobotics/util/backoff/backoff.pb.js' -import Long from 'long' -import _m0 from 'protobufjs/minimal.js' - -export const protobufPackage = 'stream.srpc.client' - -/** Config configures a client for a srpc service. */ -export interface Config { - /** ServerPeerIds are the static list of peer IDs to contact. */ - serverPeerIds: string[] - /** - * PerServerBackoff is the server peer error backoff configuration. - * Can be empty. - */ - perServerBackoff: Backoff | undefined - /** - * SrcPeerId is the source peer id to contact from. - * Can be empty. - */ - srcPeerId: string - /** TransportId restricts which transport we can dial out from. */ - transportId: Long - /** - * TimeoutDur sets the per-server establish timeout. - * If unset, no timeout. - * Example: 15s - */ - timeoutDur: string -} - -function createBaseConfig(): Config { - return { - serverPeerIds: [], - perServerBackoff: undefined, - srcPeerId: '', - transportId: Long.UZERO, - timeoutDur: '', - } -} - -export const Config = { - encode( - message: Config, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - for (const v of message.serverPeerIds) { - writer.uint32(10).string(v!) - } - if (message.perServerBackoff !== undefined) { - Backoff.encode( - message.perServerBackoff, - writer.uint32(18).fork(), - ).ldelim() - } - if (message.srcPeerId !== '') { - writer.uint32(26).string(message.srcPeerId) - } - if (!message.transportId.equals(Long.UZERO)) { - writer.uint32(32).uint64(message.transportId) - } - if (message.timeoutDur !== '') { - writer.uint32(42).string(message.timeoutDur) - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Config { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseConfig() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break - } - - message.serverPeerIds.push(reader.string()) - continue - case 2: - if (tag !== 18) { - break - } - - message.perServerBackoff = Backoff.decode(reader, reader.uint32()) - continue - case 3: - if (tag !== 26) { - break - } - - message.srcPeerId = reader.string() - continue - case 4: - if (tag !== 32) { - break - } - - message.transportId = reader.uint64() as Long - continue - case 5: - if (tag !== 42) { - break - } - - message.timeoutDur = reader.string() - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: AsyncIterable | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config.encode(p).finish()] - } - } else { - yield* [Config.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config.decode(p)] - } - } else { - yield* [Config.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): Config { - return { - serverPeerIds: globalThis.Array.isArray(object?.serverPeerIds) - ? object.serverPeerIds.map((e: any) => globalThis.String(e)) - : [], - perServerBackoff: isSet(object.perServerBackoff) - ? Backoff.fromJSON(object.perServerBackoff) - : undefined, - srcPeerId: isSet(object.srcPeerId) - ? globalThis.String(object.srcPeerId) - : '', - transportId: isSet(object.transportId) - ? Long.fromValue(object.transportId) - : Long.UZERO, - timeoutDur: isSet(object.timeoutDur) - ? globalThis.String(object.timeoutDur) - : '', - } - }, - - toJSON(message: Config): unknown { - const obj: any = {} - if (message.serverPeerIds?.length) { - obj.serverPeerIds = message.serverPeerIds - } - if (message.perServerBackoff !== undefined) { - obj.perServerBackoff = Backoff.toJSON(message.perServerBackoff) - } - if (message.srcPeerId !== '') { - obj.srcPeerId = message.srcPeerId - } - if (!message.transportId.equals(Long.UZERO)) { - obj.transportId = (message.transportId || Long.UZERO).toString() - } - if (message.timeoutDur !== '') { - obj.timeoutDur = message.timeoutDur - } - return obj - }, - - create, I>>(base?: I): Config { - return Config.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>(object: I): Config { - const message = createBaseConfig() - message.serverPeerIds = object.serverPeerIds?.map((e) => e) || [] - message.perServerBackoff = - object.perServerBackoff !== undefined && object.perServerBackoff !== null - ? Backoff.fromPartial(object.perServerBackoff) - : undefined - message.srcPeerId = object.srcPeerId ?? '' - message.transportId = - object.transportId !== undefined && object.transportId !== null - ? Long.fromValue(object.transportId) - : Long.UZERO - message.timeoutDur = object.timeoutDur ?? '' - return message - }, -} - -type Builtin = - | Date - | Function - | Uint8Array - | string - | number - | boolean - | undefined - -export type DeepPartial = T extends Builtin - ? T - : T extends Long - ? string | number | Long - : T extends globalThis.Array - ? globalThis.Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends { $case: string } - ? { [K in keyof Omit]?: DeepPartial } & { - $case: T['$case'] - } - : T extends {} - ? { [K in keyof T]?: DeepPartial } - : Partial - -type KeysOfUnion = T extends T ? keyof T : never -export type Exact = P extends Builtin - ? P - : P & { [K in keyof P]: Exact } & { - [K in Exclude>]: never - } - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any - _m0.configure() -} - -function isSet(value: any): boolean { - return value !== null && value !== undefined -} diff --git a/stream/srpc/client/client_pb.ts b/stream/srpc/client/client_pb.ts new file mode 100644 index 00000000..542a5bb2 --- /dev/null +++ b/stream/srpc/client/client_pb.ts @@ -0,0 +1,124 @@ +// @generated by protoc-gen-es v1.8.0 with parameter "target=ts,ts_nocheck=false" +// @generated from file github.com/aperturerobotics/bifrost/stream/srpc/client/client.proto (package stream.srpc.client, syntax proto3) +/* eslint-disable */ + +import type { + BinaryReadOptions, + FieldList, + JsonReadOptions, + JsonValue, + PartialMessage, + PlainMessage, +} from '@bufbuild/protobuf' +import { Message, proto3, protoInt64 } from '@bufbuild/protobuf' +import { Backoff } from '../../../../util/backoff/backoff_pb.js' + +/** + * Config configures a client for a srpc service. + * + * @generated from message stream.srpc.client.Config + */ +export class Config extends Message { + /** + * ServerPeerIds are the static list of peer IDs to contact. + * + * @generated from field: repeated string server_peer_ids = 1; + */ + serverPeerIds: string[] = [] + + /** + * PerServerBackoff is the server peer error backoff configuration. + * Can be empty. + * + * @generated from field: backoff.Backoff per_server_backoff = 2; + */ + perServerBackoff?: Backoff + + /** + * SrcPeerId is the source peer id to contact from. + * Can be empty. + * + * @generated from field: string src_peer_id = 3; + */ + srcPeerId = '' + + /** + * TransportId restricts which transport we can dial out from. + * + * @generated from field: uint64 transport_id = 4; + */ + transportId = protoInt64.zero + + /** + * TimeoutDur sets the per-server establish timeout. + * If unset, no timeout. + * Example: 15s + * + * @generated from field: string timeout_dur = 5; + */ + timeoutDur = '' + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'stream.srpc.client.Config' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { + no: 1, + name: 'server_peer_ids', + kind: 'scalar', + T: 9 /* ScalarType.STRING */, + repeated: true, + }, + { no: 2, name: 'per_server_backoff', kind: 'message', T: Backoff }, + { + no: 3, + name: 'src_peer_id', + kind: 'scalar', + T: 9 /* ScalarType.STRING */, + }, + { + no: 4, + name: 'transport_id', + kind: 'scalar', + T: 4 /* ScalarType.UINT64 */, + }, + { + no: 5, + name: 'timeout_dur', + kind: 'scalar', + T: 9 /* ScalarType.STRING */, + }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): Config { + return new Config().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): Config { + return new Config().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): Config { + return new Config().fromJsonString(jsonString, options) + } + + static equals( + a: Config | PlainMessage | undefined, + b: Config | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(Config, a, b) + } +} diff --git a/stream/srpc/client/client_vtproto.pb.go b/stream/srpc/client/client_vtproto.pb.go deleted file mode 100644 index bf81190e..00000000 --- a/stream/srpc/client/client_vtproto.pb.go +++ /dev/null @@ -1,425 +0,0 @@ -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// protoc-gen-go-vtproto version: v0.6.0 -// source: github.com/aperturerobotics/bifrost/stream/srpc/client/client.proto - -package stream_srpc_client - -import ( - fmt "fmt" - io "io" - - backoff "github.com/aperturerobotics/util/backoff" - protohelpers "github.com/planetscale/vtprotobuf/protohelpers" - proto "google.golang.org/protobuf/proto" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) -) - -func (m *Config) CloneVT() *Config { - if m == nil { - return (*Config)(nil) - } - r := new(Config) - r.SrcPeerId = m.SrcPeerId - r.TransportId = m.TransportId - r.TimeoutDur = m.TimeoutDur - if rhs := m.ServerPeerIds; rhs != nil { - tmpContainer := make([]string, len(rhs)) - copy(tmpContainer, rhs) - r.ServerPeerIds = tmpContainer - } - if rhs := m.PerServerBackoff; rhs != nil { - if vtpb, ok := interface{}(rhs).(interface{ CloneVT() *backoff.Backoff }); ok { - r.PerServerBackoff = vtpb.CloneVT() - } else { - r.PerServerBackoff = proto.Clone(rhs).(*backoff.Backoff) - } - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Config) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (this *Config) EqualVT(that *Config) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if len(this.ServerPeerIds) != len(that.ServerPeerIds) { - return false - } - for i, vx := range this.ServerPeerIds { - vy := that.ServerPeerIds[i] - if vx != vy { - return false - } - } - if equal, ok := interface{}(this.PerServerBackoff).(interface{ EqualVT(*backoff.Backoff) bool }); ok { - if !equal.EqualVT(that.PerServerBackoff) { - return false - } - } else if !proto.Equal(this.PerServerBackoff, that.PerServerBackoff) { - return false - } - if this.SrcPeerId != that.SrcPeerId { - return false - } - if this.TransportId != that.TransportId { - return false - } - if this.TimeoutDur != that.TimeoutDur { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Config) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Config) - if !ok { - return false - } - return this.EqualVT(that) -} -func (m *Config) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Config) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.TimeoutDur) > 0 { - i -= len(m.TimeoutDur) - copy(dAtA[i:], m.TimeoutDur) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.TimeoutDur))) - i-- - dAtA[i] = 0x2a - } - if m.TransportId != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.TransportId)) - i-- - dAtA[i] = 0x20 - } - if len(m.SrcPeerId) > 0 { - i -= len(m.SrcPeerId) - copy(dAtA[i:], m.SrcPeerId) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.SrcPeerId))) - i-- - dAtA[i] = 0x1a - } - if m.PerServerBackoff != nil { - if vtmsg, ok := interface{}(m.PerServerBackoff).(interface { - MarshalToSizedBufferVT([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.PerServerBackoff) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0x12 - } - if len(m.ServerPeerIds) > 0 { - for iNdEx := len(m.ServerPeerIds) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.ServerPeerIds[iNdEx]) - copy(dAtA[i:], m.ServerPeerIds[iNdEx]) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.ServerPeerIds[iNdEx]))) - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *Config) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.ServerPeerIds) > 0 { - for _, s := range m.ServerPeerIds { - l = len(s) - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - } - if m.PerServerBackoff != nil { - if size, ok := interface{}(m.PerServerBackoff).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.PerServerBackoff) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - l = len(m.SrcPeerId) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.TransportId != 0 { - n += 1 + protohelpers.SizeOfVarint(uint64(m.TransportId)) - } - l = len(m.TimeoutDur) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *Config) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Config: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Config: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ServerPeerIds", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ServerPeerIds = append(m.ServerPeerIds, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PerServerBackoff", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.PerServerBackoff == nil { - m.PerServerBackoff = &backoff.Backoff{} - } - if unmarshal, ok := interface{}(m.PerServerBackoff).(interface { - UnmarshalVT([]byte) error - }); ok { - if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - } else { - if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.PerServerBackoff); err != nil { - return err - } - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SrcPeerId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SrcPeerId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TransportId", wireType) - } - m.TransportId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TransportId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TimeoutDur", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TimeoutDur = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} diff --git a/stream/srpc/client/controller/config.pb.go b/stream/srpc/client/controller/config.pb.go index 143b4afd..ca52c99f 100644 --- a/stream/srpc/client/controller/config.pb.go +++ b/stream/srpc/client/controller/config.pb.go @@ -1,80 +1,42 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0-devel -// protoc v5.26.1 +// Code generated by protoc-gen-go-lite. DO NOT EDIT. +// protoc-gen-go-lite version: v0.4.5 // source: github.com/aperturerobotics/bifrost/stream/srpc/client/controller/config.proto package stream_srpc_client_controller import ( - reflect "reflect" - sync "sync" + io "io" client "github.com/aperturerobotics/bifrost/stream/srpc/client" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) + protobuf_go_lite "github.com/aperturerobotics/protobuf-go-lite" + json "github.com/aperturerobotics/protobuf-go-lite/json" + errors "github.com/pkg/errors" ) // Config configures mounting a bifrost srpc RPC client to a bus. // Resolves the LookupRpcClient directive. type Config struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + unknownFields []byte // Client contains srpc.client configuration for the RPC client. Client *client.Config `protobuf:"bytes,1,opt,name=client,proto3" json:"client,omitempty"` // ProtocolId is the protocol ID to use to contact the remote RPC service. // Must be set. - ProtocolId string `protobuf:"bytes,2,opt,name=protocol_id,json=protocolId,proto3" json:"protocol_id,omitempty"` + ProtocolId string `protobuf:"bytes,2,opt,name=protocol_id,json=protocolId,proto3" json:"protocolId,omitempty"` // ServiceIdPrefixes are the service ID prefixes to match. // The prefix will be stripped from the service id before being passed to the client. // This is used like: LookupRpcClient -> my/service. // // If empty slice or empty string: matches all LookupRpcClient calls ignoring service ID. // Optional. - ServiceIdPrefixes []string `protobuf:"bytes,3,rep,name=service_id_prefixes,json=serviceIdPrefixes,proto3" json:"service_id_prefixes,omitempty"` + ServiceIdPrefixes []string `protobuf:"bytes,3,rep,name=service_id_prefixes,json=serviceIdPrefixes,proto3" json:"serviceIdPrefixes,omitempty"` } func (x *Config) Reset() { *x = Config{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_stream_srpc_client_controller_config_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Config) String() string { - return protoimpl.X.MessageStringOf(x) } func (*Config) ProtoMessage() {} -func (x *Config) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_stream_srpc_client_controller_config_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 Config.ProtoReflect.Descriptor instead. -func (*Config) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_stream_srpc_client_controller_config_proto_rawDescGZIP(), []int{0} -} - func (x *Config) GetClient() *client.Config { if x != nil { return x.Client @@ -96,95 +58,360 @@ func (x *Config) GetServiceIdPrefixes() []string { return nil } -var File_github_com_aperturerobotics_bifrost_stream_srpc_client_controller_config_proto protoreflect.FileDescriptor - -var file_github_com_aperturerobotics_bifrost_stream_srpc_client_controller_config_proto_rawDesc = []byte{ - 0x0a, 0x4e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, - 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x62, 0x69, - 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2f, 0x73, 0x72, 0x70, - 0x63, 0x2f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, - 0x6c, 0x65, 0x72, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x12, 0x1d, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x73, 0x72, 0x70, 0x63, 0x2e, 0x63, 0x6c, - 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x1a, - 0x43, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, 0x72, - 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x62, 0x69, 0x66, - 0x72, 0x6f, 0x73, 0x74, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2f, 0x73, 0x72, 0x70, 0x63, - 0x2f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x8d, 0x01, 0x0a, 0x06, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, - 0x32, 0x0a, 0x06, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x1a, 0x2e, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x73, 0x72, 0x70, 0x63, 0x2e, 0x63, 0x6c, - 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x06, 0x63, 0x6c, 0x69, - 0x65, 0x6e, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x5f, - 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, - 0x6f, 0x6c, 0x49, 0x64, 0x12, 0x2e, 0x0a, 0x13, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, - 0x69, 0x64, 0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, - 0x09, 0x52, 0x11, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x50, 0x72, 0x65, 0x66, - 0x69, 0x78, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_github_com_aperturerobotics_bifrost_stream_srpc_client_controller_config_proto_rawDescOnce sync.Once - file_github_com_aperturerobotics_bifrost_stream_srpc_client_controller_config_proto_rawDescData = file_github_com_aperturerobotics_bifrost_stream_srpc_client_controller_config_proto_rawDesc -) +func (m *Config) CloneVT() *Config { + if m == nil { + return (*Config)(nil) + } + r := new(Config) + r.ProtocolId = m.ProtocolId + if rhs := m.Client; rhs != nil { + r.Client = rhs.CloneVT() + } + if rhs := m.ServiceIdPrefixes; rhs != nil { + tmpContainer := make([]string, len(rhs)) + copy(tmpContainer, rhs) + r.ServiceIdPrefixes = tmpContainer + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} -func file_github_com_aperturerobotics_bifrost_stream_srpc_client_controller_config_proto_rawDescGZIP() []byte { - file_github_com_aperturerobotics_bifrost_stream_srpc_client_controller_config_proto_rawDescOnce.Do(func() { - file_github_com_aperturerobotics_bifrost_stream_srpc_client_controller_config_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_aperturerobotics_bifrost_stream_srpc_client_controller_config_proto_rawDescData) - }) - return file_github_com_aperturerobotics_bifrost_stream_srpc_client_controller_config_proto_rawDescData +func (m *Config) CloneMessageVT() any { + return m.CloneVT() } -var file_github_com_aperturerobotics_bifrost_stream_srpc_client_controller_config_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_github_com_aperturerobotics_bifrost_stream_srpc_client_controller_config_proto_goTypes = []interface{}{ - (*Config)(nil), // 0: stream.srpc.client.controller.Config - (*client.Config)(nil), // 1: stream.srpc.client.Config +func (this *Config) EqualVT(that *Config) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if !this.Client.EqualVT(that.Client) { + return false + } + if this.ProtocolId != that.ProtocolId { + return false + } + if len(this.ServiceIdPrefixes) != len(that.ServiceIdPrefixes) { + return false + } + for i, vx := range this.ServiceIdPrefixes { + vy := that.ServiceIdPrefixes[i] + if vx != vy { + return false + } + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *Config) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*Config) + if !ok { + return false + } + return this.EqualVT(that) } -var file_github_com_aperturerobotics_bifrost_stream_srpc_client_controller_config_proto_depIdxs = []int32{ - 1, // 0: stream.srpc.client.controller.Config.client:type_name -> stream.srpc.client.Config - 1, // [1:1] is the sub-list for method output_type - 1, // [1:1] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name + +// MarshalProtoJSON marshals the Config message to JSON. +func (x *Config) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return + } + s.WriteObjectStart() + var wroteField bool + if x.Client != nil || s.HasField("client") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("client") + x.Client.MarshalProtoJSON(s.WithField("client")) + } + if x.ProtocolId != "" || s.HasField("protocolId") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("protocolId") + s.WriteString(x.ProtocolId) + } + if len(x.ServiceIdPrefixes) > 0 || s.HasField("serviceIdPrefixes") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("serviceIdPrefixes") + s.WriteStringArray(x.ServiceIdPrefixes) + } + s.WriteObjectEnd() } -func init() { - file_github_com_aperturerobotics_bifrost_stream_srpc_client_controller_config_proto_init() +// MarshalJSON marshals the Config to JSON. +func (x *Config) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) } -func file_github_com_aperturerobotics_bifrost_stream_srpc_client_controller_config_proto_init() { - if File_github_com_aperturerobotics_bifrost_stream_srpc_client_controller_config_proto != nil { + +// UnmarshalProtoJSON unmarshals the Config message from JSON. +func (x *Config) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { return } - if !protoimpl.UnsafeEnabled { - file_github_com_aperturerobotics_bifrost_stream_srpc_client_controller_config_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Config); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "client": + if s.ReadNil() { + x.Client = nil + return + } + x.Client = &client.Config{} + x.Client.UnmarshalProtoJSON(s.WithField("client", true)) + case "protocol_id", "protocolId": + s.AddField("protocol_id") + x.ProtocolId = s.ReadString() + case "service_id_prefixes", "serviceIdPrefixes": + s.AddField("service_id_prefixes") + if s.ReadNil() { + x.ServiceIdPrefixes = nil + return } + x.ServiceIdPrefixes = s.ReadStringArray() } + }) +} + +// UnmarshalJSON unmarshals the Config from JSON. +func (x *Config) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +func (m *Config) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Config) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_github_com_aperturerobotics_bifrost_stream_srpc_client_controller_config_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_github_com_aperturerobotics_bifrost_stream_srpc_client_controller_config_proto_goTypes, - DependencyIndexes: file_github_com_aperturerobotics_bifrost_stream_srpc_client_controller_config_proto_depIdxs, - MessageInfos: file_github_com_aperturerobotics_bifrost_stream_srpc_client_controller_config_proto_msgTypes, - }.Build() - File_github_com_aperturerobotics_bifrost_stream_srpc_client_controller_config_proto = out.File - file_github_com_aperturerobotics_bifrost_stream_srpc_client_controller_config_proto_rawDesc = nil - file_github_com_aperturerobotics_bifrost_stream_srpc_client_controller_config_proto_goTypes = nil - file_github_com_aperturerobotics_bifrost_stream_srpc_client_controller_config_proto_depIdxs = nil + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.ServiceIdPrefixes) > 0 { + for iNdEx := len(m.ServiceIdPrefixes) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.ServiceIdPrefixes[iNdEx]) + copy(dAtA[i:], m.ServiceIdPrefixes[iNdEx]) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.ServiceIdPrefixes[iNdEx]))) + i-- + dAtA[i] = 0x1a + } + } + if len(m.ProtocolId) > 0 { + i -= len(m.ProtocolId) + copy(dAtA[i:], m.ProtocolId) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.ProtocolId))) + i-- + dAtA[i] = 0x12 + } + if m.Client != nil { + size, err := m.Client.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Config) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Client != nil { + l = m.Client.SizeVT() + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + l = len(m.ProtocolId) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + if len(m.ServiceIdPrefixes) > 0 { + for _, s := range m.ServiceIdPrefixes { + l = len(s) + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + } + n += len(m.unknownFields) + return n +} + +func (m *Config) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: Config: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: Config: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field Client", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Client == nil { + m.Client = &client.Config{} + } + if err := m.Client.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field ProtocolId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ProtocolId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field ServiceIdPrefixes", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ServiceIdPrefixes = append(m.ServiceIdPrefixes, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil } diff --git a/stream/srpc/client/controller/config.pb.ts b/stream/srpc/client/controller/config.pb.ts deleted file mode 100644 index e63839e0..00000000 --- a/stream/srpc/client/controller/config.pb.ts +++ /dev/null @@ -1,206 +0,0 @@ -/* eslint-disable */ -import Long from 'long' -import _m0 from 'protobufjs/minimal.js' -import { Config as Config1 } from '../client.pb.js' - -export const protobufPackage = 'stream.srpc.client.controller' - -/** - * Config configures mounting a bifrost srpc RPC client to a bus. - * Resolves the LookupRpcClient directive. - */ -export interface Config { - /** Client contains srpc.client configuration for the RPC client. */ - client: Config1 | undefined - /** - * ProtocolId is the protocol ID to use to contact the remote RPC service. - * Must be set. - */ - protocolId: string - /** - * ServiceIdPrefixes are the service ID prefixes to match. - * The prefix will be stripped from the service id before being passed to the client. - * This is used like: LookupRpcClient -> my/service. - * - * If empty slice or empty string: matches all LookupRpcClient calls ignoring service ID. - * Optional. - */ - serviceIdPrefixes: string[] -} - -function createBaseConfig(): Config { - return { client: undefined, protocolId: '', serviceIdPrefixes: [] } -} - -export const Config = { - encode( - message: Config, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.client !== undefined) { - Config1.encode(message.client, writer.uint32(10).fork()).ldelim() - } - if (message.protocolId !== '') { - writer.uint32(18).string(message.protocolId) - } - for (const v of message.serviceIdPrefixes) { - writer.uint32(26).string(v!) - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Config { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseConfig() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break - } - - message.client = Config1.decode(reader, reader.uint32()) - continue - case 2: - if (tag !== 18) { - break - } - - message.protocolId = reader.string() - continue - case 3: - if (tag !== 26) { - break - } - - message.serviceIdPrefixes.push(reader.string()) - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: AsyncIterable | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config.encode(p).finish()] - } - } else { - yield* [Config.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config.decode(p)] - } - } else { - yield* [Config.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): Config { - return { - client: isSet(object.client) - ? Config1.fromJSON(object.client) - : undefined, - protocolId: isSet(object.protocolId) - ? globalThis.String(object.protocolId) - : '', - serviceIdPrefixes: globalThis.Array.isArray(object?.serviceIdPrefixes) - ? object.serviceIdPrefixes.map((e: any) => globalThis.String(e)) - : [], - } - }, - - toJSON(message: Config): unknown { - const obj: any = {} - if (message.client !== undefined) { - obj.client = Config1.toJSON(message.client) - } - if (message.protocolId !== '') { - obj.protocolId = message.protocolId - } - if (message.serviceIdPrefixes?.length) { - obj.serviceIdPrefixes = message.serviceIdPrefixes - } - return obj - }, - - create, I>>(base?: I): Config { - return Config.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>(object: I): Config { - const message = createBaseConfig() - message.client = - object.client !== undefined && object.client !== null - ? Config1.fromPartial(object.client) - : undefined - message.protocolId = object.protocolId ?? '' - message.serviceIdPrefixes = object.serviceIdPrefixes?.map((e) => e) || [] - return message - }, -} - -type Builtin = - | Date - | Function - | Uint8Array - | string - | number - | boolean - | undefined - -export type DeepPartial = T extends Builtin - ? T - : T extends Long - ? string | number | Long - : T extends globalThis.Array - ? globalThis.Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends { $case: string } - ? { [K in keyof Omit]?: DeepPartial } & { - $case: T['$case'] - } - : T extends {} - ? { [K in keyof T]?: DeepPartial } - : Partial - -type KeysOfUnion = T extends T ? keyof T : never -export type Exact = P extends Builtin - ? P - : P & { [K in keyof P]: Exact } & { - [K in Exclude>]: never - } - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any - _m0.configure() -} - -function isSet(value: any): boolean { - return value !== null && value !== undefined -} diff --git a/stream/srpc/client/controller/config_pb.ts b/stream/srpc/client/controller/config_pb.ts new file mode 100644 index 00000000..6c375626 --- /dev/null +++ b/stream/srpc/client/controller/config_pb.ts @@ -0,0 +1,101 @@ +// @generated by protoc-gen-es v1.8.0 with parameter "target=ts,ts_nocheck=false" +// @generated from file github.com/aperturerobotics/bifrost/stream/srpc/client/controller/config.proto (package stream.srpc.client.controller, syntax proto3) +/* eslint-disable */ + +import type { + BinaryReadOptions, + FieldList, + JsonReadOptions, + JsonValue, + PartialMessage, + PlainMessage, +} from '@bufbuild/protobuf' +import { Message, proto3 } from '@bufbuild/protobuf' +import { Config as Config$1 } from '../client_pb.js' + +/** + * Config configures mounting a bifrost srpc RPC client to a bus. + * Resolves the LookupRpcClient directive. + * + * @generated from message stream.srpc.client.controller.Config + */ +export class Config extends Message { + /** + * Client contains srpc.client configuration for the RPC client. + * + * @generated from field: stream.srpc.client.Config client = 1; + */ + client?: Config$1 + + /** + * ProtocolId is the protocol ID to use to contact the remote RPC service. + * Must be set. + * + * @generated from field: string protocol_id = 2; + */ + protocolId = '' + + /** + * ServiceIdPrefixes are the service ID prefixes to match. + * The prefix will be stripped from the service id before being passed to the client. + * This is used like: LookupRpcClient -> my/service. + * + * If empty slice or empty string: matches all LookupRpcClient calls ignoring service ID. + * Optional. + * + * @generated from field: repeated string service_id_prefixes = 3; + */ + serviceIdPrefixes: string[] = [] + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'stream.srpc.client.controller.Config' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: 'client', kind: 'message', T: Config$1 }, + { + no: 2, + name: 'protocol_id', + kind: 'scalar', + T: 9 /* ScalarType.STRING */, + }, + { + no: 3, + name: 'service_id_prefixes', + kind: 'scalar', + T: 9 /* ScalarType.STRING */, + repeated: true, + }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): Config { + return new Config().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): Config { + return new Config().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): Config { + return new Config().fromJsonString(jsonString, options) + } + + static equals( + a: Config | PlainMessage | undefined, + b: Config | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(Config, a, b) + } +} diff --git a/stream/srpc/client/controller/config_vtproto.pb.go b/stream/srpc/client/controller/config_vtproto.pb.go deleted file mode 100644 index 64109dce..00000000 --- a/stream/srpc/client/controller/config_vtproto.pb.go +++ /dev/null @@ -1,347 +0,0 @@ -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// protoc-gen-go-vtproto version: v0.6.0 -// source: github.com/aperturerobotics/bifrost/stream/srpc/client/controller/config.proto - -package stream_srpc_client_controller - -import ( - fmt "fmt" - io "io" - - client "github.com/aperturerobotics/bifrost/stream/srpc/client" - protohelpers "github.com/planetscale/vtprotobuf/protohelpers" - proto "google.golang.org/protobuf/proto" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) -) - -func (m *Config) CloneVT() *Config { - if m == nil { - return (*Config)(nil) - } - r := new(Config) - r.ProtocolId = m.ProtocolId - if rhs := m.Client; rhs != nil { - if vtpb, ok := interface{}(rhs).(interface{ CloneVT() *client.Config }); ok { - r.Client = vtpb.CloneVT() - } else { - r.Client = proto.Clone(rhs).(*client.Config) - } - } - if rhs := m.ServiceIdPrefixes; rhs != nil { - tmpContainer := make([]string, len(rhs)) - copy(tmpContainer, rhs) - r.ServiceIdPrefixes = tmpContainer - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Config) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (this *Config) EqualVT(that *Config) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if equal, ok := interface{}(this.Client).(interface{ EqualVT(*client.Config) bool }); ok { - if !equal.EqualVT(that.Client) { - return false - } - } else if !proto.Equal(this.Client, that.Client) { - return false - } - if this.ProtocolId != that.ProtocolId { - return false - } - if len(this.ServiceIdPrefixes) != len(that.ServiceIdPrefixes) { - return false - } - for i, vx := range this.ServiceIdPrefixes { - vy := that.ServiceIdPrefixes[i] - if vx != vy { - return false - } - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Config) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Config) - if !ok { - return false - } - return this.EqualVT(that) -} -func (m *Config) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Config) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.ServiceIdPrefixes) > 0 { - for iNdEx := len(m.ServiceIdPrefixes) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.ServiceIdPrefixes[iNdEx]) - copy(dAtA[i:], m.ServiceIdPrefixes[iNdEx]) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.ServiceIdPrefixes[iNdEx]))) - i-- - dAtA[i] = 0x1a - } - } - if len(m.ProtocolId) > 0 { - i -= len(m.ProtocolId) - copy(dAtA[i:], m.ProtocolId) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.ProtocolId))) - i-- - dAtA[i] = 0x12 - } - if m.Client != nil { - if vtmsg, ok := interface{}(m.Client).(interface { - MarshalToSizedBufferVT([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.Client) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Config) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Client != nil { - if size, ok := interface{}(m.Client).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.Client) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - l = len(m.ProtocolId) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if len(m.ServiceIdPrefixes) > 0 { - for _, s := range m.ServiceIdPrefixes { - l = len(s) - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - } - n += len(m.unknownFields) - return n -} - -func (m *Config) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Config: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Config: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Client", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Client == nil { - m.Client = &client.Config{} - } - if unmarshal, ok := interface{}(m.Client).(interface { - UnmarshalVT([]byte) error - }); ok { - if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - } else { - if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.Client); err != nil { - return err - } - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ProtocolId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ProtocolId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ServiceIdPrefixes", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ServiceIdPrefixes = append(m.ServiceIdPrefixes, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} diff --git a/stream/srpc/server/server.pb.go b/stream/srpc/server/server.pb.go index 1dc60c23..4bca8eb1 100644 --- a/stream/srpc/server/server.pb.go +++ b/stream/srpc/server/server.pb.go @@ -1,74 +1,36 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0-devel -// protoc v5.26.1 +// Code generated by protoc-gen-go-lite. DO NOT EDIT. +// protoc-gen-go-lite version: v0.4.5 // source: github.com/aperturerobotics/bifrost/stream/srpc/server/server.proto package stream_srpc_server import ( - reflect "reflect" - sync "sync" + io "io" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) + protobuf_go_lite "github.com/aperturerobotics/protobuf-go-lite" + json "github.com/aperturerobotics/protobuf-go-lite/json" + errors "github.com/pkg/errors" ) // Config configures the server for the srpc service. type Config struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + unknownFields []byte // PeerIds are the list of peer IDs to listen on. // If empty, allows any incoming peer id w/ the protocol id(s). - PeerIds []string `protobuf:"bytes,1,rep,name=peer_ids,json=peerIds,proto3" json:"peer_ids,omitempty"` + PeerIds []string `protobuf:"bytes,1,rep,name=peer_ids,json=peerIds,proto3" json:"peerIds,omitempty"` // ProtocolIds is the list of protocol ids to listen on. // If empty, no incoming streams will be accepted. - ProtocolIds []string `protobuf:"bytes,2,rep,name=protocol_ids,json=protocolIds,proto3" json:"protocol_ids,omitempty"` + ProtocolIds []string `protobuf:"bytes,2,rep,name=protocol_ids,json=protocolIds,proto3" json:"protocolIds,omitempty"` // DisableEstablishLink disables adding an EstablishLink directive for each incoming peer. - DisableEstablishLink bool `protobuf:"varint,3,opt,name=disable_establish_link,json=disableEstablishLink,proto3" json:"disable_establish_link,omitempty"` + DisableEstablishLink bool `protobuf:"varint,3,opt,name=disable_establish_link,json=disableEstablishLink,proto3" json:"disableEstablishLink,omitempty"` } func (x *Config) Reset() { *x = Config{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_stream_srpc_server_server_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Config) String() string { - return protoimpl.X.MessageStringOf(x) } func (*Config) ProtoMessage() {} -func (x *Config) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_stream_srpc_server_server_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 Config.ProtoReflect.Descriptor instead. -func (*Config) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_stream_srpc_server_server_proto_rawDescGZIP(), []int{0} -} - func (x *Config) GetPeerIds() []string { if x != nil { return x.PeerIds @@ -90,84 +52,355 @@ func (x *Config) GetDisableEstablishLink() bool { return false } -var File_github_com_aperturerobotics_bifrost_stream_srpc_server_server_proto protoreflect.FileDescriptor - -var file_github_com_aperturerobotics_bifrost_stream_srpc_server_server_proto_rawDesc = []byte{ - 0x0a, 0x43, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, - 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x62, 0x69, - 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2f, 0x73, 0x72, 0x70, - 0x63, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2e, 0x73, 0x72, - 0x70, 0x63, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x22, 0x7c, 0x0a, 0x06, 0x43, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x12, 0x19, 0x0a, 0x08, 0x70, 0x65, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x73, 0x18, - 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x70, 0x65, 0x65, 0x72, 0x49, 0x64, 0x73, 0x12, 0x21, - 0x0a, 0x0c, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x02, - 0x20, 0x03, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x49, 0x64, - 0x73, 0x12, 0x34, 0x0a, 0x16, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x65, 0x73, 0x74, - 0x61, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x5f, 0x6c, 0x69, 0x6e, 0x6b, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x14, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x45, 0x73, 0x74, 0x61, 0x62, 0x6c, - 0x69, 0x73, 0x68, 0x4c, 0x69, 0x6e, 0x6b, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_github_com_aperturerobotics_bifrost_stream_srpc_server_server_proto_rawDescOnce sync.Once - file_github_com_aperturerobotics_bifrost_stream_srpc_server_server_proto_rawDescData = file_github_com_aperturerobotics_bifrost_stream_srpc_server_server_proto_rawDesc -) +func (m *Config) CloneVT() *Config { + if m == nil { + return (*Config)(nil) + } + r := new(Config) + r.DisableEstablishLink = m.DisableEstablishLink + if rhs := m.PeerIds; rhs != nil { + tmpContainer := make([]string, len(rhs)) + copy(tmpContainer, rhs) + r.PeerIds = tmpContainer + } + if rhs := m.ProtocolIds; rhs != nil { + tmpContainer := make([]string, len(rhs)) + copy(tmpContainer, rhs) + r.ProtocolIds = tmpContainer + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} -func file_github_com_aperturerobotics_bifrost_stream_srpc_server_server_proto_rawDescGZIP() []byte { - file_github_com_aperturerobotics_bifrost_stream_srpc_server_server_proto_rawDescOnce.Do(func() { - file_github_com_aperturerobotics_bifrost_stream_srpc_server_server_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_aperturerobotics_bifrost_stream_srpc_server_server_proto_rawDescData) - }) - return file_github_com_aperturerobotics_bifrost_stream_srpc_server_server_proto_rawDescData +func (m *Config) CloneMessageVT() any { + return m.CloneVT() } -var file_github_com_aperturerobotics_bifrost_stream_srpc_server_server_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_github_com_aperturerobotics_bifrost_stream_srpc_server_server_proto_goTypes = []interface{}{ - (*Config)(nil), // 0: stream.srpc.server.Config +func (this *Config) EqualVT(that *Config) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if len(this.PeerIds) != len(that.PeerIds) { + return false + } + for i, vx := range this.PeerIds { + vy := that.PeerIds[i] + if vx != vy { + return false + } + } + if len(this.ProtocolIds) != len(that.ProtocolIds) { + return false + } + for i, vx := range this.ProtocolIds { + vy := that.ProtocolIds[i] + if vx != vy { + return false + } + } + if this.DisableEstablishLink != that.DisableEstablishLink { + return false + } + return string(this.unknownFields) == string(that.unknownFields) } -var file_github_com_aperturerobotics_bifrost_stream_srpc_server_server_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] 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 (this *Config) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*Config) + if !ok { + return false + } + return this.EqualVT(that) } -func init() { file_github_com_aperturerobotics_bifrost_stream_srpc_server_server_proto_init() } -func file_github_com_aperturerobotics_bifrost_stream_srpc_server_server_proto_init() { - if File_github_com_aperturerobotics_bifrost_stream_srpc_server_server_proto != nil { +// MarshalProtoJSON marshals the Config message to JSON. +func (x *Config) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() return } - if !protoimpl.UnsafeEnabled { - file_github_com_aperturerobotics_bifrost_stream_srpc_server_server_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Config); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil + s.WriteObjectStart() + var wroteField bool + if len(x.PeerIds) > 0 || s.HasField("peerIds") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("peerIds") + s.WriteStringArray(x.PeerIds) + } + if len(x.ProtocolIds) > 0 || s.HasField("protocolIds") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("protocolIds") + s.WriteStringArray(x.ProtocolIds) + } + if x.DisableEstablishLink || s.HasField("disableEstablishLink") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("disableEstablishLink") + s.WriteBool(x.DisableEstablishLink) + } + s.WriteObjectEnd() +} + +// MarshalJSON marshals the Config to JSON. +func (x *Config) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) +} + +// UnmarshalProtoJSON unmarshals the Config message from JSON. +func (x *Config) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { + return + } + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "peer_ids", "peerIds": + s.AddField("peer_ids") + if s.ReadNil() { + x.PeerIds = nil + return + } + x.PeerIds = s.ReadStringArray() + case "protocol_ids", "protocolIds": + s.AddField("protocol_ids") + if s.ReadNil() { + x.ProtocolIds = nil + return } + x.ProtocolIds = s.ReadStringArray() + case "disable_establish_link", "disableEstablishLink": + s.AddField("disable_establish_link") + x.DisableEstablishLink = s.ReadBool() } + }) +} + +// UnmarshalJSON unmarshals the Config from JSON. +func (x *Config) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +func (m *Config) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_github_com_aperturerobotics_bifrost_stream_srpc_server_server_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_github_com_aperturerobotics_bifrost_stream_srpc_server_server_proto_goTypes, - DependencyIndexes: file_github_com_aperturerobotics_bifrost_stream_srpc_server_server_proto_depIdxs, - MessageInfos: file_github_com_aperturerobotics_bifrost_stream_srpc_server_server_proto_msgTypes, - }.Build() - File_github_com_aperturerobotics_bifrost_stream_srpc_server_server_proto = out.File - file_github_com_aperturerobotics_bifrost_stream_srpc_server_server_proto_rawDesc = nil - file_github_com_aperturerobotics_bifrost_stream_srpc_server_server_proto_goTypes = nil - file_github_com_aperturerobotics_bifrost_stream_srpc_server_server_proto_depIdxs = nil + return dAtA[:n], nil +} + +func (m *Config) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.DisableEstablishLink { + i-- + if m.DisableEstablishLink { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x18 + } + if len(m.ProtocolIds) > 0 { + for iNdEx := len(m.ProtocolIds) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.ProtocolIds[iNdEx]) + copy(dAtA[i:], m.ProtocolIds[iNdEx]) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.ProtocolIds[iNdEx]))) + i-- + dAtA[i] = 0x12 + } + } + if len(m.PeerIds) > 0 { + for iNdEx := len(m.PeerIds) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.PeerIds[iNdEx]) + copy(dAtA[i:], m.PeerIds[iNdEx]) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.PeerIds[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *Config) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.PeerIds) > 0 { + for _, s := range m.PeerIds { + l = len(s) + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + } + if len(m.ProtocolIds) > 0 { + for _, s := range m.ProtocolIds { + l = len(s) + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + } + if m.DisableEstablishLink { + n += 2 + } + n += len(m.unknownFields) + return n +} + +func (m *Config) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: Config: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: Config: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field PeerIds", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PeerIds = append(m.PeerIds, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 2: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field ProtocolIds", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ProtocolIds = append(m.ProtocolIds, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 3: + if wireType != 0 { + return errors.Errorf("proto: wrong wireType = %d for field DisableEstablishLink", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.DisableEstablishLink = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil } diff --git a/stream/srpc/server/server.pb.ts b/stream/srpc/server/server.pb.ts deleted file mode 100644 index 09e891af..00000000 --- a/stream/srpc/server/server.pb.ts +++ /dev/null @@ -1,195 +0,0 @@ -/* eslint-disable */ -import Long from 'long' -import _m0 from 'protobufjs/minimal.js' - -export const protobufPackage = 'stream.srpc.server' - -/** Config configures the server for the srpc service. */ -export interface Config { - /** - * PeerIds are the list of peer IDs to listen on. - * If empty, allows any incoming peer id w/ the protocol id(s). - */ - peerIds: string[] - /** - * ProtocolIds is the list of protocol ids to listen on. - * If empty, no incoming streams will be accepted. - */ - protocolIds: string[] - /** DisableEstablishLink disables adding an EstablishLink directive for each incoming peer. */ - disableEstablishLink: boolean -} - -function createBaseConfig(): Config { - return { peerIds: [], protocolIds: [], disableEstablishLink: false } -} - -export const Config = { - encode( - message: Config, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - for (const v of message.peerIds) { - writer.uint32(10).string(v!) - } - for (const v of message.protocolIds) { - writer.uint32(18).string(v!) - } - if (message.disableEstablishLink !== false) { - writer.uint32(24).bool(message.disableEstablishLink) - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Config { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseConfig() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break - } - - message.peerIds.push(reader.string()) - continue - case 2: - if (tag !== 18) { - break - } - - message.protocolIds.push(reader.string()) - continue - case 3: - if (tag !== 24) { - break - } - - message.disableEstablishLink = reader.bool() - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: AsyncIterable | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config.encode(p).finish()] - } - } else { - yield* [Config.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config.decode(p)] - } - } else { - yield* [Config.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): Config { - return { - peerIds: globalThis.Array.isArray(object?.peerIds) - ? object.peerIds.map((e: any) => globalThis.String(e)) - : [], - protocolIds: globalThis.Array.isArray(object?.protocolIds) - ? object.protocolIds.map((e: any) => globalThis.String(e)) - : [], - disableEstablishLink: isSet(object.disableEstablishLink) - ? globalThis.Boolean(object.disableEstablishLink) - : false, - } - }, - - toJSON(message: Config): unknown { - const obj: any = {} - if (message.peerIds?.length) { - obj.peerIds = message.peerIds - } - if (message.protocolIds?.length) { - obj.protocolIds = message.protocolIds - } - if (message.disableEstablishLink !== false) { - obj.disableEstablishLink = message.disableEstablishLink - } - return obj - }, - - create, I>>(base?: I): Config { - return Config.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>(object: I): Config { - const message = createBaseConfig() - message.peerIds = object.peerIds?.map((e) => e) || [] - message.protocolIds = object.protocolIds?.map((e) => e) || [] - message.disableEstablishLink = object.disableEstablishLink ?? false - return message - }, -} - -type Builtin = - | Date - | Function - | Uint8Array - | string - | number - | boolean - | undefined - -export type DeepPartial = T extends Builtin - ? T - : T extends Long - ? string | number | Long - : T extends globalThis.Array - ? globalThis.Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends { $case: string } - ? { [K in keyof Omit]?: DeepPartial } & { - $case: T['$case'] - } - : T extends {} - ? { [K in keyof T]?: DeepPartial } - : Partial - -type KeysOfUnion = T extends T ? keyof T : never -export type Exact = P extends Builtin - ? P - : P & { [K in keyof P]: Exact } & { - [K in Exclude>]: never - } - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any - _m0.configure() -} - -function isSet(value: any): boolean { - return value !== null && value !== undefined -} diff --git a/stream/srpc/server/server_pb.ts b/stream/srpc/server/server_pb.ts new file mode 100644 index 00000000..d0fc1224 --- /dev/null +++ b/stream/srpc/server/server_pb.ts @@ -0,0 +1,101 @@ +// @generated by protoc-gen-es v1.8.0 with parameter "target=ts,ts_nocheck=false" +// @generated from file github.com/aperturerobotics/bifrost/stream/srpc/server/server.proto (package stream.srpc.server, syntax proto3) +/* eslint-disable */ + +import type { + BinaryReadOptions, + FieldList, + JsonReadOptions, + JsonValue, + PartialMessage, + PlainMessage, +} from '@bufbuild/protobuf' +import { Message, proto3 } from '@bufbuild/protobuf' + +/** + * Config configures the server for the srpc service. + * + * @generated from message stream.srpc.server.Config + */ +export class Config extends Message { + /** + * PeerIds are the list of peer IDs to listen on. + * If empty, allows any incoming peer id w/ the protocol id(s). + * + * @generated from field: repeated string peer_ids = 1; + */ + peerIds: string[] = [] + + /** + * ProtocolIds is the list of protocol ids to listen on. + * If empty, no incoming streams will be accepted. + * + * @generated from field: repeated string protocol_ids = 2; + */ + protocolIds: string[] = [] + + /** + * DisableEstablishLink disables adding an EstablishLink directive for each incoming peer. + * + * @generated from field: bool disable_establish_link = 3; + */ + disableEstablishLink = false + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'stream.srpc.server.Config' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { + no: 1, + name: 'peer_ids', + kind: 'scalar', + T: 9 /* ScalarType.STRING */, + repeated: true, + }, + { + no: 2, + name: 'protocol_ids', + kind: 'scalar', + T: 9 /* ScalarType.STRING */, + repeated: true, + }, + { + no: 3, + name: 'disable_establish_link', + kind: 'scalar', + T: 8 /* ScalarType.BOOL */, + }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): Config { + return new Config().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): Config { + return new Config().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): Config { + return new Config().fromJsonString(jsonString, options) + } + + static equals( + a: Config | PlainMessage | undefined, + b: Config | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(Config, a, b) + } +} diff --git a/stream/srpc/server/server_vtproto.pb.go b/stream/srpc/server/server_vtproto.pb.go deleted file mode 100644 index ebe5f2ed..00000000 --- a/stream/srpc/server/server_vtproto.pb.go +++ /dev/null @@ -1,307 +0,0 @@ -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// protoc-gen-go-vtproto version: v0.6.0 -// source: github.com/aperturerobotics/bifrost/stream/srpc/server/server.proto - -package stream_srpc_server - -import ( - fmt "fmt" - io "io" - - protohelpers "github.com/planetscale/vtprotobuf/protohelpers" - proto "google.golang.org/protobuf/proto" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) -) - -func (m *Config) CloneVT() *Config { - if m == nil { - return (*Config)(nil) - } - r := new(Config) - r.DisableEstablishLink = m.DisableEstablishLink - if rhs := m.PeerIds; rhs != nil { - tmpContainer := make([]string, len(rhs)) - copy(tmpContainer, rhs) - r.PeerIds = tmpContainer - } - if rhs := m.ProtocolIds; rhs != nil { - tmpContainer := make([]string, len(rhs)) - copy(tmpContainer, rhs) - r.ProtocolIds = tmpContainer - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Config) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (this *Config) EqualVT(that *Config) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if len(this.PeerIds) != len(that.PeerIds) { - return false - } - for i, vx := range this.PeerIds { - vy := that.PeerIds[i] - if vx != vy { - return false - } - } - if len(this.ProtocolIds) != len(that.ProtocolIds) { - return false - } - for i, vx := range this.ProtocolIds { - vy := that.ProtocolIds[i] - if vx != vy { - return false - } - } - if this.DisableEstablishLink != that.DisableEstablishLink { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Config) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Config) - if !ok { - return false - } - return this.EqualVT(that) -} -func (m *Config) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Config) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.DisableEstablishLink { - i-- - if m.DisableEstablishLink { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x18 - } - if len(m.ProtocolIds) > 0 { - for iNdEx := len(m.ProtocolIds) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.ProtocolIds[iNdEx]) - copy(dAtA[i:], m.ProtocolIds[iNdEx]) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.ProtocolIds[iNdEx]))) - i-- - dAtA[i] = 0x12 - } - } - if len(m.PeerIds) > 0 { - for iNdEx := len(m.PeerIds) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.PeerIds[iNdEx]) - copy(dAtA[i:], m.PeerIds[iNdEx]) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.PeerIds[iNdEx]))) - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *Config) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.PeerIds) > 0 { - for _, s := range m.PeerIds { - l = len(s) - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - } - if len(m.ProtocolIds) > 0 { - for _, s := range m.ProtocolIds { - l = len(s) - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - } - if m.DisableEstablishLink { - n += 2 - } - n += len(m.unknownFields) - return n -} - -func (m *Config) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Config: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Config: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PeerIds", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PeerIds = append(m.PeerIds, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ProtocolIds", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ProtocolIds = append(m.ProtocolIds, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field DisableEstablishLink", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.DisableEstablishLink = bool(v != 0) - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} diff --git a/tptaddr/controller/config.pb.go b/tptaddr/controller/config.pb.go index f7142d98..e7a65708 100644 --- a/tptaddr/controller/config.pb.go +++ b/tptaddr/controller/config.pb.go @@ -1,24 +1,15 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0-devel -// protoc v5.26.1 +// Code generated by protoc-gen-go-lite. DO NOT EDIT. +// protoc-gen-go-lite version: v0.4.5 // source: github.com/aperturerobotics/bifrost/tptaddr/controller/config.proto package tptaddr_controller import ( - reflect "reflect" - sync "sync" + io "io" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) + protobuf_go_lite "github.com/aperturerobotics/protobuf-go-lite" + json "github.com/aperturerobotics/protobuf-go-lite/json" + errors "github.com/pkg/errors" ) // Config configures the tptaddr dialer controller. @@ -26,114 +17,166 @@ const ( // Handles EstablishLinkWithPeer directives by creating LookupTptAddr and // DialTptAddr directives. type Config struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields + unknownFields []byte } func (x *Config) Reset() { *x = Config{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_tptaddr_controller_config_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) +} + +func (*Config) ProtoMessage() {} + +func (m *Config) CloneVT() *Config { + if m == nil { + return (*Config)(nil) + } + r := new(Config) + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) } + return r } -func (x *Config) String() string { - return protoimpl.X.MessageStringOf(x) +func (m *Config) CloneMessageVT() any { + return m.CloneVT() } -func (*Config) ProtoMessage() {} +func (this *Config) EqualVT(that *Config) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} -func (x *Config) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_tptaddr_controller_config_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms +func (this *Config) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*Config) + if !ok { + return false } - return mi.MessageOf(x) + return this.EqualVT(that) } -// Deprecated: Use Config.ProtoReflect.Descriptor instead. -func (*Config) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_tptaddr_controller_config_proto_rawDescGZIP(), []int{0} +// MarshalProtoJSON marshals the Config message to JSON. +func (x *Config) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return + } + s.WriteObjectStart() + s.WriteObjectEnd() } -var File_github_com_aperturerobotics_bifrost_tptaddr_controller_config_proto protoreflect.FileDescriptor +// MarshalJSON marshals the Config to JSON. +func (x *Config) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) +} -var file_github_com_aperturerobotics_bifrost_tptaddr_controller_config_proto_rawDesc = []byte{ - 0x0a, 0x43, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, - 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x62, 0x69, - 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2f, 0x74, 0x70, 0x74, 0x61, 0x64, 0x64, 0x72, 0x2f, 0x63, 0x6f, - 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x74, 0x70, 0x74, 0x61, 0x64, 0x64, 0x72, 0x2e, 0x63, - 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x22, 0x08, 0x0a, 0x06, 0x43, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +// UnmarshalProtoJSON unmarshals the Config message from JSON. +func (x *Config) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { + return + } } -var ( - file_github_com_aperturerobotics_bifrost_tptaddr_controller_config_proto_rawDescOnce sync.Once - file_github_com_aperturerobotics_bifrost_tptaddr_controller_config_proto_rawDescData = file_github_com_aperturerobotics_bifrost_tptaddr_controller_config_proto_rawDesc -) +// UnmarshalJSON unmarshals the Config from JSON. +func (x *Config) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} -func file_github_com_aperturerobotics_bifrost_tptaddr_controller_config_proto_rawDescGZIP() []byte { - file_github_com_aperturerobotics_bifrost_tptaddr_controller_config_proto_rawDescOnce.Do(func() { - file_github_com_aperturerobotics_bifrost_tptaddr_controller_config_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_aperturerobotics_bifrost_tptaddr_controller_config_proto_rawDescData) - }) - return file_github_com_aperturerobotics_bifrost_tptaddr_controller_config_proto_rawDescData +func (m *Config) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil } -var file_github_com_aperturerobotics_bifrost_tptaddr_controller_config_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_github_com_aperturerobotics_bifrost_tptaddr_controller_config_proto_goTypes = []interface{}{ - (*Config)(nil), // 0: tptaddr.controller.Config +func (m *Config) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) } -var file_github_com_aperturerobotics_bifrost_tptaddr_controller_config_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] 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 (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + return len(dAtA) - i, nil } -func init() { file_github_com_aperturerobotics_bifrost_tptaddr_controller_config_proto_init() } -func file_github_com_aperturerobotics_bifrost_tptaddr_controller_config_proto_init() { - if File_github_com_aperturerobotics_bifrost_tptaddr_controller_config_proto != nil { - return +func (m *Config) SizeVT() (n int) { + if m == nil { + return 0 } - if !protoimpl.UnsafeEnabled { - file_github_com_aperturerobotics_bifrost_tptaddr_controller_config_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Config); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil + var l int + _ = l + n += len(m.unknownFields) + return n +} + +func (m *Config) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: Config: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: Config: illegal tag %d (wire type %d)", fieldNum, wire) } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_github_com_aperturerobotics_bifrost_tptaddr_controller_config_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_github_com_aperturerobotics_bifrost_tptaddr_controller_config_proto_goTypes, - DependencyIndexes: file_github_com_aperturerobotics_bifrost_tptaddr_controller_config_proto_depIdxs, - MessageInfos: file_github_com_aperturerobotics_bifrost_tptaddr_controller_config_proto_msgTypes, - }.Build() - File_github_com_aperturerobotics_bifrost_tptaddr_controller_config_proto = out.File - file_github_com_aperturerobotics_bifrost_tptaddr_controller_config_proto_rawDesc = nil - file_github_com_aperturerobotics_bifrost_tptaddr_controller_config_proto_goTypes = nil - file_github_com_aperturerobotics_bifrost_tptaddr_controller_config_proto_depIdxs = nil + return nil } diff --git a/tptaddr/controller/config.pb.ts b/tptaddr/controller/config.pb.ts deleted file mode 100644 index 77eb0cfb..00000000 --- a/tptaddr/controller/config.pb.ts +++ /dev/null @@ -1,128 +0,0 @@ -/* eslint-disable */ -import Long from 'long' -import _m0 from 'protobufjs/minimal.js' - -export const protobufPackage = 'tptaddr.controller' - -/** - * Config configures the tptaddr dialer controller. - * - * Handles EstablishLinkWithPeer directives by creating LookupTptAddr and - * DialTptAddr directives. - */ -export interface Config {} - -function createBaseConfig(): Config { - return {} -} - -export const Config = { - encode(_: Config, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Config { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseConfig() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: AsyncIterable | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config.encode(p).finish()] - } - } else { - yield* [Config.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config.decode(p)] - } - } else { - yield* [Config.decode(pkt as any)] - } - } - }, - - fromJSON(_: any): Config { - return {} - }, - - toJSON(_: Config): unknown { - const obj: any = {} - return obj - }, - - create, I>>(base?: I): Config { - return Config.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>(_: I): Config { - const message = createBaseConfig() - return message - }, -} - -type Builtin = - | Date - | Function - | Uint8Array - | string - | number - | boolean - | undefined - -export type DeepPartial = T extends Builtin - ? T - : T extends Long - ? string | number | Long - : T extends globalThis.Array - ? globalThis.Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends { $case: string } - ? { [K in keyof Omit]?: DeepPartial } & { - $case: T['$case'] - } - : T extends {} - ? { [K in keyof T]?: DeepPartial } - : Partial - -type KeysOfUnion = T extends T ? keyof T : never -export type Exact = P extends Builtin - ? P - : P & { [K in keyof P]: Exact } & { - [K in Exclude>]: never - } - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any - _m0.configure() -} diff --git a/tptaddr/controller/config_pb.ts b/tptaddr/controller/config_pb.ts new file mode 100644 index 00000000..5e0f8867 --- /dev/null +++ b/tptaddr/controller/config_pb.ts @@ -0,0 +1,60 @@ +// @generated by protoc-gen-es v1.8.0 with parameter "target=ts,ts_nocheck=false" +// @generated from file github.com/aperturerobotics/bifrost/tptaddr/controller/config.proto (package tptaddr.controller, syntax proto3) +/* eslint-disable */ + +import type { + BinaryReadOptions, + FieldList, + JsonReadOptions, + JsonValue, + PartialMessage, + PlainMessage, +} from '@bufbuild/protobuf' +import { Message, proto3 } from '@bufbuild/protobuf' + +/** + * Config configures the tptaddr dialer controller. + * + * Handles EstablishLinkWithPeer directives by creating LookupTptAddr and + * DialTptAddr directives. + * + * @generated from message tptaddr.controller.Config + */ +export class Config extends Message { + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'tptaddr.controller.Config' + static readonly fields: FieldList = proto3.util.newFieldList(() => []) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): Config { + return new Config().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): Config { + return new Config().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): Config { + return new Config().fromJsonString(jsonString, options) + } + + static equals( + a: Config | PlainMessage | undefined, + b: Config | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(Config, a, b) + } +} diff --git a/tptaddr/controller/config_vtproto.pb.go b/tptaddr/controller/config_vtproto.pb.go deleted file mode 100644 index 88a78091..00000000 --- a/tptaddr/controller/config_vtproto.pb.go +++ /dev/null @@ -1,148 +0,0 @@ -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// protoc-gen-go-vtproto version: v0.6.0 -// source: github.com/aperturerobotics/bifrost/tptaddr/controller/config.proto - -package tptaddr_controller - -import ( - fmt "fmt" - io "io" - - protohelpers "github.com/planetscale/vtprotobuf/protohelpers" - proto "google.golang.org/protobuf/proto" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) -) - -func (m *Config) CloneVT() *Config { - if m == nil { - return (*Config)(nil) - } - r := new(Config) - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Config) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (this *Config) EqualVT(that *Config) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Config) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Config) - if !ok { - return false - } - return this.EqualVT(that) -} -func (m *Config) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Config) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - return len(dAtA) - i, nil -} - -func (m *Config) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - n += len(m.unknownFields) - return n -} - -func (m *Config) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Config: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Config: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} diff --git a/tptaddr/static/static.pb.go b/tptaddr/static/static.pb.go index 8bb065f2..841d38a1 100644 --- a/tptaddr/static/static.pb.go +++ b/tptaddr/static/static.pb.go @@ -1,34 +1,22 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0-devel -// protoc v5.26.1 +// Code generated by protoc-gen-go-lite. DO NOT EDIT. +// protoc-gen-go-lite version: v0.4.5 // source: github.com/aperturerobotics/bifrost/tptaddr/static/static.proto package tptaddr_static import ( - reflect "reflect" - sync "sync" + io "io" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) + protobuf_go_lite "github.com/aperturerobotics/protobuf-go-lite" + json "github.com/aperturerobotics/protobuf-go-lite/json" + errors "github.com/pkg/errors" ) // Config configures the static controller. // // Handles LookupTptAddr directives with a static list of addresses. type Config struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + unknownFields []byte // Addresses is the mapping of peer id to address list. // // Format: {peer-id}|{transport-id}|{address} @@ -38,116 +26,248 @@ type Config struct { func (x *Config) Reset() { *x = Config{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_tptaddr_static_static_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) +} + +func (*Config) ProtoMessage() {} + +func (x *Config) GetAddresses() []string { + if x != nil { + return x.Addresses } + return nil } -func (x *Config) String() string { - return protoimpl.X.MessageStringOf(x) +func (m *Config) CloneVT() *Config { + if m == nil { + return (*Config)(nil) + } + r := new(Config) + if rhs := m.Addresses; rhs != nil { + tmpContainer := make([]string, len(rhs)) + copy(tmpContainer, rhs) + r.Addresses = tmpContainer + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r } -func (*Config) ProtoMessage() {} +func (m *Config) CloneMessageVT() any { + return m.CloneVT() +} -func (x *Config) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_tptaddr_static_static_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) +func (this *Config) EqualVT(that *Config) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if len(this.Addresses) != len(that.Addresses) { + return false + } + for i, vx := range this.Addresses { + vy := that.Addresses[i] + if vx != vy { + return false } - return ms } - return mi.MessageOf(x) + return string(this.unknownFields) == string(that.unknownFields) } -// Deprecated: Use Config.ProtoReflect.Descriptor instead. -func (*Config) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_tptaddr_static_static_proto_rawDescGZIP(), []int{0} +func (this *Config) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*Config) + if !ok { + return false + } + return this.EqualVT(that) } -func (x *Config) GetAddresses() []string { - if x != nil { - return x.Addresses +// MarshalProtoJSON marshals the Config message to JSON. +func (x *Config) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return } - return nil + s.WriteObjectStart() + var wroteField bool + if len(x.Addresses) > 0 || s.HasField("addresses") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("addresses") + s.WriteStringArray(x.Addresses) + } + s.WriteObjectEnd() } -var File_github_com_aperturerobotics_bifrost_tptaddr_static_static_proto protoreflect.FileDescriptor +// MarshalJSON marshals the Config to JSON. +func (x *Config) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) +} -var file_github_com_aperturerobotics_bifrost_tptaddr_static_static_proto_rawDesc = []byte{ - 0x0a, 0x3f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, - 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x62, 0x69, - 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2f, 0x74, 0x70, 0x74, 0x61, 0x64, 0x64, 0x72, 0x2f, 0x73, 0x74, - 0x61, 0x74, 0x69, 0x63, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x12, 0x0e, 0x74, 0x70, 0x74, 0x61, 0x64, 0x64, 0x72, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x69, - 0x63, 0x22, 0x26, 0x0a, 0x06, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x1c, 0x0a, 0x09, 0x61, - 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, - 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, +// UnmarshalProtoJSON unmarshals the Config message from JSON. +func (x *Config) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { + return + } + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "addresses": + s.AddField("addresses") + if s.ReadNil() { + x.Addresses = nil + return + } + x.Addresses = s.ReadStringArray() + } + }) } -var ( - file_github_com_aperturerobotics_bifrost_tptaddr_static_static_proto_rawDescOnce sync.Once - file_github_com_aperturerobotics_bifrost_tptaddr_static_static_proto_rawDescData = file_github_com_aperturerobotics_bifrost_tptaddr_static_static_proto_rawDesc -) +// UnmarshalJSON unmarshals the Config from JSON. +func (x *Config) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} -func file_github_com_aperturerobotics_bifrost_tptaddr_static_static_proto_rawDescGZIP() []byte { - file_github_com_aperturerobotics_bifrost_tptaddr_static_static_proto_rawDescOnce.Do(func() { - file_github_com_aperturerobotics_bifrost_tptaddr_static_static_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_aperturerobotics_bifrost_tptaddr_static_static_proto_rawDescData) - }) - return file_github_com_aperturerobotics_bifrost_tptaddr_static_static_proto_rawDescData +func (m *Config) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil } -var file_github_com_aperturerobotics_bifrost_tptaddr_static_static_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_github_com_aperturerobotics_bifrost_tptaddr_static_static_proto_goTypes = []interface{}{ - (*Config)(nil), // 0: tptaddr.static.Config +func (m *Config) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) } -var file_github_com_aperturerobotics_bifrost_tptaddr_static_static_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] 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 (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.Addresses) > 0 { + for iNdEx := len(m.Addresses) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Addresses[iNdEx]) + copy(dAtA[i:], m.Addresses[iNdEx]) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.Addresses[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil } -func init() { file_github_com_aperturerobotics_bifrost_tptaddr_static_static_proto_init() } -func file_github_com_aperturerobotics_bifrost_tptaddr_static_static_proto_init() { - if File_github_com_aperturerobotics_bifrost_tptaddr_static_static_proto != nil { - return +func (m *Config) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Addresses) > 0 { + for _, s := range m.Addresses { + l = len(s) + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } } - if !protoimpl.UnsafeEnabled { - file_github_com_aperturerobotics_bifrost_tptaddr_static_static_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Config); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil + n += len(m.unknownFields) + return n +} + +func (m *Config) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: Config: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: Config: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field Addresses", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Addresses = append(m.Addresses, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy } } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_github_com_aperturerobotics_bifrost_tptaddr_static_static_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_github_com_aperturerobotics_bifrost_tptaddr_static_static_proto_goTypes, - DependencyIndexes: file_github_com_aperturerobotics_bifrost_tptaddr_static_static_proto_depIdxs, - MessageInfos: file_github_com_aperturerobotics_bifrost_tptaddr_static_static_proto_msgTypes, - }.Build() - File_github_com_aperturerobotics_bifrost_tptaddr_static_static_proto = out.File - file_github_com_aperturerobotics_bifrost_tptaddr_static_static_proto_rawDesc = nil - file_github_com_aperturerobotics_bifrost_tptaddr_static_static_proto_goTypes = nil - file_github_com_aperturerobotics_bifrost_tptaddr_static_static_proto_depIdxs = nil + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil } diff --git a/tptaddr/static/static.pb.ts b/tptaddr/static/static.pb.ts deleted file mode 100644 index e6003442..00000000 --- a/tptaddr/static/static.pb.ts +++ /dev/null @@ -1,156 +0,0 @@ -/* eslint-disable */ -import Long from 'long' -import _m0 from 'protobufjs/minimal.js' - -export const protobufPackage = 'tptaddr.static' - -/** - * Config configures the static controller. - * - * Handles LookupTptAddr directives with a static list of addresses. - */ -export interface Config { - /** - * Addresses is the mapping of peer id to address list. - * - * Format: {peer-id}|{transport-id}|{address} - * Anything after the second | is treated as part of the address. - */ - addresses: string[] -} - -function createBaseConfig(): Config { - return { addresses: [] } -} - -export const Config = { - encode( - message: Config, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - for (const v of message.addresses) { - writer.uint32(10).string(v!) - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Config { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseConfig() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break - } - - message.addresses.push(reader.string()) - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: AsyncIterable | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config.encode(p).finish()] - } - } else { - yield* [Config.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config.decode(p)] - } - } else { - yield* [Config.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): Config { - return { - addresses: globalThis.Array.isArray(object?.addresses) - ? object.addresses.map((e: any) => globalThis.String(e)) - : [], - } - }, - - toJSON(message: Config): unknown { - const obj: any = {} - if (message.addresses?.length) { - obj.addresses = message.addresses - } - return obj - }, - - create, I>>(base?: I): Config { - return Config.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>(object: I): Config { - const message = createBaseConfig() - message.addresses = object.addresses?.map((e) => e) || [] - return message - }, -} - -type Builtin = - | Date - | Function - | Uint8Array - | string - | number - | boolean - | undefined - -export type DeepPartial = T extends Builtin - ? T - : T extends Long - ? string | number | Long - : T extends globalThis.Array - ? globalThis.Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends { $case: string } - ? { [K in keyof Omit]?: DeepPartial } & { - $case: T['$case'] - } - : T extends {} - ? { [K in keyof T]?: DeepPartial } - : Partial - -type KeysOfUnion = T extends T ? keyof T : never -export type Exact = P extends Builtin - ? P - : P & { [K in keyof P]: Exact } & { - [K in Exclude>]: never - } - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any - _m0.configure() -} diff --git a/tptaddr/static/static_pb.ts b/tptaddr/static/static_pb.ts new file mode 100644 index 00000000..53c9c80a --- /dev/null +++ b/tptaddr/static/static_pb.ts @@ -0,0 +1,77 @@ +// @generated by protoc-gen-es v1.8.0 with parameter "target=ts,ts_nocheck=false" +// @generated from file github.com/aperturerobotics/bifrost/tptaddr/static/static.proto (package tptaddr.static, syntax proto3) +/* eslint-disable */ + +import type { + BinaryReadOptions, + FieldList, + JsonReadOptions, + JsonValue, + PartialMessage, + PlainMessage, +} from '@bufbuild/protobuf' +import { Message, proto3 } from '@bufbuild/protobuf' + +/** + * Config configures the static controller. + * + * Handles LookupTptAddr directives with a static list of addresses. + * + * @generated from message tptaddr.static.Config + */ +export class Config extends Message { + /** + * Addresses is the mapping of peer id to address list. + * + * Format: {peer-id}|{transport-id}|{address} + * Anything after the second | is treated as part of the address. + * + * @generated from field: repeated string addresses = 1; + */ + addresses: string[] = [] + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'tptaddr.static.Config' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { + no: 1, + name: 'addresses', + kind: 'scalar', + T: 9 /* ScalarType.STRING */, + repeated: true, + }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): Config { + return new Config().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): Config { + return new Config().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): Config { + return new Config().fromJsonString(jsonString, options) + } + + static equals( + a: Config | PlainMessage | undefined, + b: Config | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(Config, a, b) + } +} diff --git a/tptaddr/static/static_vtproto.pb.go b/tptaddr/static/static_vtproto.pb.go deleted file mode 100644 index 223dd39c..00000000 --- a/tptaddr/static/static_vtproto.pb.go +++ /dev/null @@ -1,209 +0,0 @@ -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// protoc-gen-go-vtproto version: v0.6.0 -// source: github.com/aperturerobotics/bifrost/tptaddr/static/static.proto - -package tptaddr_static - -import ( - fmt "fmt" - io "io" - - protohelpers "github.com/planetscale/vtprotobuf/protohelpers" - proto "google.golang.org/protobuf/proto" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) -) - -func (m *Config) CloneVT() *Config { - if m == nil { - return (*Config)(nil) - } - r := new(Config) - if rhs := m.Addresses; rhs != nil { - tmpContainer := make([]string, len(rhs)) - copy(tmpContainer, rhs) - r.Addresses = tmpContainer - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Config) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (this *Config) EqualVT(that *Config) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if len(this.Addresses) != len(that.Addresses) { - return false - } - for i, vx := range this.Addresses { - vy := that.Addresses[i] - if vx != vy { - return false - } - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Config) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Config) - if !ok { - return false - } - return this.EqualVT(that) -} -func (m *Config) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Config) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Addresses) > 0 { - for iNdEx := len(m.Addresses) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Addresses[iNdEx]) - copy(dAtA[i:], m.Addresses[iNdEx]) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Addresses[iNdEx]))) - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *Config) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Addresses) > 0 { - for _, s := range m.Addresses { - l = len(s) - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - } - n += len(m.unknownFields) - return n -} - -func (m *Config) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Config: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Config: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Addresses", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Addresses = append(m.Addresses, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} diff --git a/transport/common/conn/conn.pb.go b/transport/common/conn/conn.pb.go index 91303893..eb32e740 100644 --- a/transport/common/conn/conn.pb.go +++ b/transport/common/conn/conn.pb.go @@ -1,33 +1,21 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0-devel -// protoc v5.26.1 +// Code generated by protoc-gen-go-lite. DO NOT EDIT. +// protoc-gen-go-lite version: v0.4.5 // source: github.com/aperturerobotics/bifrost/transport/common/conn/conn.proto package conn import ( - reflect "reflect" - sync "sync" + io "io" quic "github.com/aperturerobotics/bifrost/transport/common/quic" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) + protobuf_go_lite "github.com/aperturerobotics/protobuf-go-lite" + json "github.com/aperturerobotics/protobuf-go-lite/json" + errors "github.com/pkg/errors" ) // Opts are extra options for the reliable conn. type Opts struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + unknownFields []byte // Quic are the quic protocol options. Quic *quic.Opts `protobuf:"bytes,1,opt,name=quic,proto3" json:"quic,omitempty"` // Verbose turns on verbose debug logging. @@ -39,41 +27,15 @@ type Opts struct { // // Total memory cap is mtu * bufSize. // Defaults to 10. - BufSize uint32 `protobuf:"varint,4,opt,name=buf_size,json=bufSize,proto3" json:"buf_size,omitempty"` + BufSize uint32 `protobuf:"varint,4,opt,name=buf_size,json=bufSize,proto3" json:"bufSize,omitempty"` } func (x *Opts) Reset() { *x = Opts{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_transport_common_conn_conn_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Opts) String() string { - return protoimpl.X.MessageStringOf(x) } func (*Opts) ProtoMessage() {} -func (x *Opts) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_transport_common_conn_conn_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 Opts.ProtoReflect.Descriptor instead. -func (*Opts) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_transport_common_conn_conn_proto_rawDescGZIP(), []int{0} -} - func (x *Opts) GetQuic() *quic.Opts { if x != nil { return x.Quic @@ -102,90 +64,355 @@ func (x *Opts) GetBufSize() uint32 { return 0 } -var File_github_com_aperturerobotics_bifrost_transport_common_conn_conn_proto protoreflect.FileDescriptor - -var file_github_com_aperturerobotics_bifrost_transport_common_conn_conn_proto_rawDesc = []byte{ - 0x0a, 0x44, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, - 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x62, 0x69, - 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x2f, - 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x63, 0x6f, 0x6e, 0x6e, 0x2f, 0x63, 0x6f, 0x6e, 0x6e, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x04, 0x63, 0x6f, 0x6e, 0x6e, 0x1a, 0x44, 0x67, 0x69, - 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, - 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x62, 0x69, 0x66, 0x72, 0x6f, 0x73, - 0x74, 0x2f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, - 0x6f, 0x6e, 0x2f, 0x71, 0x75, 0x69, 0x63, 0x2f, 0x71, 0x75, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x22, 0x77, 0x0a, 0x04, 0x4f, 0x70, 0x74, 0x73, 0x12, 0x28, 0x0a, 0x04, 0x71, 0x75, - 0x69, 0x63, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x74, 0x72, 0x61, 0x6e, 0x73, - 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x71, 0x75, 0x69, 0x63, 0x2e, 0x4f, 0x70, 0x74, 0x73, 0x52, 0x04, - 0x71, 0x75, 0x69, 0x63, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x62, 0x6f, 0x73, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x76, 0x65, 0x72, 0x62, 0x6f, 0x73, 0x65, 0x12, 0x10, - 0x0a, 0x03, 0x6d, 0x74, 0x75, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x6d, 0x74, 0x75, - 0x12, 0x19, 0x0a, 0x08, 0x62, 0x75, 0x66, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x0d, 0x52, 0x07, 0x62, 0x75, 0x66, 0x53, 0x69, 0x7a, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, -} - -var ( - file_github_com_aperturerobotics_bifrost_transport_common_conn_conn_proto_rawDescOnce sync.Once - file_github_com_aperturerobotics_bifrost_transport_common_conn_conn_proto_rawDescData = file_github_com_aperturerobotics_bifrost_transport_common_conn_conn_proto_rawDesc -) +func (m *Opts) CloneVT() *Opts { + if m == nil { + return (*Opts)(nil) + } + r := new(Opts) + r.Verbose = m.Verbose + r.Mtu = m.Mtu + r.BufSize = m.BufSize + if rhs := m.Quic; rhs != nil { + r.Quic = rhs.CloneVT() + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} -func file_github_com_aperturerobotics_bifrost_transport_common_conn_conn_proto_rawDescGZIP() []byte { - file_github_com_aperturerobotics_bifrost_transport_common_conn_conn_proto_rawDescOnce.Do(func() { - file_github_com_aperturerobotics_bifrost_transport_common_conn_conn_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_aperturerobotics_bifrost_transport_common_conn_conn_proto_rawDescData) - }) - return file_github_com_aperturerobotics_bifrost_transport_common_conn_conn_proto_rawDescData +func (m *Opts) CloneMessageVT() any { + return m.CloneVT() } -var file_github_com_aperturerobotics_bifrost_transport_common_conn_conn_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_github_com_aperturerobotics_bifrost_transport_common_conn_conn_proto_goTypes = []interface{}{ - (*Opts)(nil), // 0: conn.Opts - (*quic.Opts)(nil), // 1: transport.quic.Opts +func (this *Opts) EqualVT(that *Opts) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if !this.Quic.EqualVT(that.Quic) { + return false + } + if this.Verbose != that.Verbose { + return false + } + if this.Mtu != that.Mtu { + return false + } + if this.BufSize != that.BufSize { + return false + } + return string(this.unknownFields) == string(that.unknownFields) } -var file_github_com_aperturerobotics_bifrost_transport_common_conn_conn_proto_depIdxs = []int32{ - 1, // 0: conn.Opts.quic:type_name -> transport.quic.Opts - 1, // [1:1] is the sub-list for method output_type - 1, // [1:1] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name + +func (this *Opts) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*Opts) + if !ok { + return false + } + return this.EqualVT(that) +} + +// MarshalProtoJSON marshals the Opts message to JSON. +func (x *Opts) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return + } + s.WriteObjectStart() + var wroteField bool + if x.Quic != nil || s.HasField("quic") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("quic") + x.Quic.MarshalProtoJSON(s.WithField("quic")) + } + if x.Verbose || s.HasField("verbose") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("verbose") + s.WriteBool(x.Verbose) + } + if x.Mtu != 0 || s.HasField("mtu") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("mtu") + s.WriteUint32(x.Mtu) + } + if x.BufSize != 0 || s.HasField("bufSize") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("bufSize") + s.WriteUint32(x.BufSize) + } + s.WriteObjectEnd() +} + +// MarshalJSON marshals the Opts to JSON. +func (x *Opts) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) } -func init() { file_github_com_aperturerobotics_bifrost_transport_common_conn_conn_proto_init() } -func file_github_com_aperturerobotics_bifrost_transport_common_conn_conn_proto_init() { - if File_github_com_aperturerobotics_bifrost_transport_common_conn_conn_proto != nil { +// UnmarshalProtoJSON unmarshals the Opts message from JSON. +func (x *Opts) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { return } - if !protoimpl.UnsafeEnabled { - file_github_com_aperturerobotics_bifrost_transport_common_conn_conn_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Opts); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "quic": + if s.ReadNil() { + x.Quic = nil + return } + x.Quic = &quic.Opts{} + x.Quic.UnmarshalProtoJSON(s.WithField("quic", true)) + case "verbose": + s.AddField("verbose") + x.Verbose = s.ReadBool() + case "mtu": + s.AddField("mtu") + x.Mtu = s.ReadUint32() + case "buf_size", "bufSize": + s.AddField("buf_size") + x.BufSize = s.ReadUint32() } + }) +} + +// UnmarshalJSON unmarshals the Opts from JSON. +func (x *Opts) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +func (m *Opts) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_github_com_aperturerobotics_bifrost_transport_common_conn_conn_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_github_com_aperturerobotics_bifrost_transport_common_conn_conn_proto_goTypes, - DependencyIndexes: file_github_com_aperturerobotics_bifrost_transport_common_conn_conn_proto_depIdxs, - MessageInfos: file_github_com_aperturerobotics_bifrost_transport_common_conn_conn_proto_msgTypes, - }.Build() - File_github_com_aperturerobotics_bifrost_transport_common_conn_conn_proto = out.File - file_github_com_aperturerobotics_bifrost_transport_common_conn_conn_proto_rawDesc = nil - file_github_com_aperturerobotics_bifrost_transport_common_conn_conn_proto_goTypes = nil - file_github_com_aperturerobotics_bifrost_transport_common_conn_conn_proto_depIdxs = nil + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Opts) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *Opts) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.BufSize != 0 { + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(m.BufSize)) + i-- + dAtA[i] = 0x20 + } + if m.Mtu != 0 { + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(m.Mtu)) + i-- + dAtA[i] = 0x18 + } + if m.Verbose { + i-- + if m.Verbose { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x10 + } + if m.Quic != nil { + size, err := m.Quic.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Opts) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Quic != nil { + l = m.Quic.SizeVT() + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + if m.Verbose { + n += 2 + } + if m.Mtu != 0 { + n += 1 + protobuf_go_lite.SizeOfVarint(uint64(m.Mtu)) + } + if m.BufSize != 0 { + n += 1 + protobuf_go_lite.SizeOfVarint(uint64(m.BufSize)) + } + n += len(m.unknownFields) + return n +} + +func (m *Opts) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: Opts: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: Opts: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field Quic", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Quic == nil { + m.Quic = &quic.Opts{} + } + if err := m.Quic.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return errors.Errorf("proto: wrong wireType = %d for field Verbose", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Verbose = bool(v != 0) + case 3: + if wireType != 0 { + return errors.Errorf("proto: wrong wireType = %d for field Mtu", wireType) + } + m.Mtu = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Mtu |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return errors.Errorf("proto: wrong wireType = %d for field BufSize", wireType) + } + m.BufSize = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BufSize |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil } diff --git a/transport/common/conn/conn.pb.ts b/transport/common/conn/conn.pb.ts deleted file mode 100644 index da1d01d0..00000000 --- a/transport/common/conn/conn.pb.ts +++ /dev/null @@ -1,211 +0,0 @@ -/* eslint-disable */ -import Long from 'long' -import _m0 from 'protobufjs/minimal.js' -import { Opts as Opts1 } from '../quic/quic.pb.js' - -export const protobufPackage = 'conn' - -/** Opts are extra options for the reliable conn. */ -export interface Opts { - /** Quic are the quic protocol options. */ - quic: Opts1 | undefined - /** Verbose turns on verbose debug logging. */ - verbose: boolean - /** - * Mtu sets the maximum size for a single packet. - * Defaults to 65000. - */ - mtu: number - /** - * BufSize is the number of packets to buffer. - * - * Total memory cap is mtu * bufSize. - * Defaults to 10. - */ - bufSize: number -} - -function createBaseOpts(): Opts { - return { quic: undefined, verbose: false, mtu: 0, bufSize: 0 } -} - -export const Opts = { - encode(message: Opts, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.quic !== undefined) { - Opts1.encode(message.quic, writer.uint32(10).fork()).ldelim() - } - if (message.verbose !== false) { - writer.uint32(16).bool(message.verbose) - } - if (message.mtu !== 0) { - writer.uint32(24).uint32(message.mtu) - } - if (message.bufSize !== 0) { - writer.uint32(32).uint32(message.bufSize) - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Opts { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseOpts() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break - } - - message.quic = Opts1.decode(reader, reader.uint32()) - continue - case 2: - if (tag !== 16) { - break - } - - message.verbose = reader.bool() - continue - case 3: - if (tag !== 24) { - break - } - - message.mtu = reader.uint32() - continue - case 4: - if (tag !== 32) { - break - } - - message.bufSize = reader.uint32() - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: AsyncIterable | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Opts.encode(p).finish()] - } - } else { - yield* [Opts.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Opts.decode(p)] - } - } else { - yield* [Opts.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): Opts { - return { - quic: isSet(object.quic) ? Opts1.fromJSON(object.quic) : undefined, - verbose: isSet(object.verbose) - ? globalThis.Boolean(object.verbose) - : false, - mtu: isSet(object.mtu) ? globalThis.Number(object.mtu) : 0, - bufSize: isSet(object.bufSize) ? globalThis.Number(object.bufSize) : 0, - } - }, - - toJSON(message: Opts): unknown { - const obj: any = {} - if (message.quic !== undefined) { - obj.quic = Opts1.toJSON(message.quic) - } - if (message.verbose !== false) { - obj.verbose = message.verbose - } - if (message.mtu !== 0) { - obj.mtu = Math.round(message.mtu) - } - if (message.bufSize !== 0) { - obj.bufSize = Math.round(message.bufSize) - } - return obj - }, - - create, I>>(base?: I): Opts { - return Opts.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>(object: I): Opts { - const message = createBaseOpts() - message.quic = - object.quic !== undefined && object.quic !== null - ? Opts1.fromPartial(object.quic) - : undefined - message.verbose = object.verbose ?? false - message.mtu = object.mtu ?? 0 - message.bufSize = object.bufSize ?? 0 - return message - }, -} - -type Builtin = - | Date - | Function - | Uint8Array - | string - | number - | boolean - | undefined - -export type DeepPartial = T extends Builtin - ? T - : T extends Long - ? string | number | Long - : T extends globalThis.Array - ? globalThis.Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends { $case: string } - ? { [K in keyof Omit]?: DeepPartial } & { - $case: T['$case'] - } - : T extends {} - ? { [K in keyof T]?: DeepPartial } - : Partial - -type KeysOfUnion = T extends T ? keyof T : never -export type Exact = P extends Builtin - ? P - : P & { [K in keyof P]: Exact } & { - [K in Exclude>]: never - } - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any - _m0.configure() -} - -function isSet(value: any): boolean { - return value !== null && value !== undefined -} diff --git a/transport/common/conn/conn_pb.ts b/transport/common/conn/conn_pb.ts new file mode 100644 index 00000000..9adfbbd7 --- /dev/null +++ b/transport/common/conn/conn_pb.ts @@ -0,0 +1,95 @@ +// @generated by protoc-gen-es v1.8.0 with parameter "target=ts,ts_nocheck=false" +// @generated from file github.com/aperturerobotics/bifrost/transport/common/conn/conn.proto (package conn, syntax proto3) +/* eslint-disable */ + +import type { + BinaryReadOptions, + FieldList, + JsonReadOptions, + JsonValue, + PartialMessage, + PlainMessage, +} from '@bufbuild/protobuf' +import { Message, proto3 } from '@bufbuild/protobuf' +import { Opts as Opts$1 } from '../quic/quic_pb.js' + +/** + * Opts are extra options for the reliable conn. + * + * @generated from message conn.Opts + */ +export class Opts extends Message { + /** + * Quic are the quic protocol options. + * + * @generated from field: transport.quic.Opts quic = 1; + */ + quic?: Opts$1 + + /** + * Verbose turns on verbose debug logging. + * + * @generated from field: bool verbose = 2; + */ + verbose = false + + /** + * Mtu sets the maximum size for a single packet. + * Defaults to 65000. + * + * @generated from field: uint32 mtu = 3; + */ + mtu = 0 + + /** + * BufSize is the number of packets to buffer. + * + * Total memory cap is mtu * bufSize. + * Defaults to 10. + * + * @generated from field: uint32 buf_size = 4; + */ + bufSize = 0 + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'conn.Opts' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: 'quic', kind: 'message', T: Opts$1 }, + { no: 2, name: 'verbose', kind: 'scalar', T: 8 /* ScalarType.BOOL */ }, + { no: 3, name: 'mtu', kind: 'scalar', T: 13 /* ScalarType.UINT32 */ }, + { no: 4, name: 'buf_size', kind: 'scalar', T: 13 /* ScalarType.UINT32 */ }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): Opts { + return new Opts().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): Opts { + return new Opts().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): Opts { + return new Opts().fromJsonString(jsonString, options) + } + + static equals( + a: Opts | PlainMessage | undefined, + b: Opts | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(Opts, a, b) + } +} diff --git a/transport/common/conn/conn_vtproto.pb.go b/transport/common/conn/conn_vtproto.pb.go deleted file mode 100644 index 84207443..00000000 --- a/transport/common/conn/conn_vtproto.pb.go +++ /dev/null @@ -1,338 +0,0 @@ -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// protoc-gen-go-vtproto version: v0.6.0 -// source: github.com/aperturerobotics/bifrost/transport/common/conn/conn.proto - -package conn - -import ( - fmt "fmt" - io "io" - - quic "github.com/aperturerobotics/bifrost/transport/common/quic" - protohelpers "github.com/planetscale/vtprotobuf/protohelpers" - proto "google.golang.org/protobuf/proto" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) -) - -func (m *Opts) CloneVT() *Opts { - if m == nil { - return (*Opts)(nil) - } - r := new(Opts) - r.Verbose = m.Verbose - r.Mtu = m.Mtu - r.BufSize = m.BufSize - if rhs := m.Quic; rhs != nil { - if vtpb, ok := interface{}(rhs).(interface{ CloneVT() *quic.Opts }); ok { - r.Quic = vtpb.CloneVT() - } else { - r.Quic = proto.Clone(rhs).(*quic.Opts) - } - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Opts) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (this *Opts) EqualVT(that *Opts) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if equal, ok := interface{}(this.Quic).(interface{ EqualVT(*quic.Opts) bool }); ok { - if !equal.EqualVT(that.Quic) { - return false - } - } else if !proto.Equal(this.Quic, that.Quic) { - return false - } - if this.Verbose != that.Verbose { - return false - } - if this.Mtu != that.Mtu { - return false - } - if this.BufSize != that.BufSize { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Opts) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Opts) - if !ok { - return false - } - return this.EqualVT(that) -} -func (m *Opts) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Opts) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Opts) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.BufSize != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.BufSize)) - i-- - dAtA[i] = 0x20 - } - if m.Mtu != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.Mtu)) - i-- - dAtA[i] = 0x18 - } - if m.Verbose { - i-- - if m.Verbose { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x10 - } - if m.Quic != nil { - if vtmsg, ok := interface{}(m.Quic).(interface { - MarshalToSizedBufferVT([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.Quic) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Opts) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Quic != nil { - if size, ok := interface{}(m.Quic).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.Quic) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.Verbose { - n += 2 - } - if m.Mtu != 0 { - n += 1 + protohelpers.SizeOfVarint(uint64(m.Mtu)) - } - if m.BufSize != 0 { - n += 1 + protohelpers.SizeOfVarint(uint64(m.BufSize)) - } - n += len(m.unknownFields) - return n -} - -func (m *Opts) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Opts: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Opts: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Quic", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Quic == nil { - m.Quic = &quic.Opts{} - } - if unmarshal, ok := interface{}(m.Quic).(interface { - UnmarshalVT([]byte) error - }); ok { - if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - } else { - if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.Quic); err != nil { - return err - } - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Verbose", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Verbose = bool(v != 0) - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Mtu", wireType) - } - m.Mtu = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Mtu |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BufSize", wireType) - } - m.BufSize = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.BufSize |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} diff --git a/transport/common/dialer/dialer.pb.go b/transport/common/dialer/dialer.pb.go index bd4f7157..790e1c62 100644 --- a/transport/common/dialer/dialer.pb.go +++ b/transport/common/dialer/dialer.pb.go @@ -1,33 +1,21 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0-devel -// protoc v5.26.1 +// Code generated by protoc-gen-go-lite. DO NOT EDIT. +// protoc-gen-go-lite version: v0.4.5 // source: github.com/aperturerobotics/bifrost/transport/common/dialer/dialer.proto package dialer import ( - reflect "reflect" - sync "sync" + io "io" + protobuf_go_lite "github.com/aperturerobotics/protobuf-go-lite" + json "github.com/aperturerobotics/protobuf-go-lite/json" backoff "github.com/aperturerobotics/util/backoff" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) + errors "github.com/pkg/errors" ) // DialerOpts contains options relating to dialing a statically configured peer. type DialerOpts struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + unknownFields []byte // Address is the address of the peer, in the format expected by the transport. Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // Backoff is the dialing backoff configuration. @@ -37,36 +25,10 @@ type DialerOpts struct { func (x *DialerOpts) Reset() { *x = DialerOpts{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_transport_common_dialer_dialer_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DialerOpts) String() string { - return protoimpl.X.MessageStringOf(x) } func (*DialerOpts) ProtoMessage() {} -func (x *DialerOpts) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_transport_common_dialer_dialer_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 DialerOpts.ProtoReflect.Descriptor instead. -func (*DialerOpts) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_transport_common_dialer_dialer_proto_rawDescGZIP(), []int{0} -} - func (x *DialerOpts) GetAddress() string { if x != nil { return x.Address @@ -81,87 +43,287 @@ func (x *DialerOpts) GetBackoff() *backoff.Backoff { return nil } -var File_github_com_aperturerobotics_bifrost_transport_common_dialer_dialer_proto protoreflect.FileDescriptor - -var file_github_com_aperturerobotics_bifrost_transport_common_dialer_dialer_proto_rawDesc = []byte{ - 0x0a, 0x48, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, - 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x62, 0x69, - 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x2f, - 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x64, 0x69, 0x61, 0x6c, 0x65, 0x72, 0x2f, 0x64, 0x69, - 0x61, 0x6c, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x64, 0x69, 0x61, 0x6c, - 0x65, 0x72, 0x1a, 0x36, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, - 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, - 0x75, 0x74, 0x69, 0x6c, 0x2f, 0x62, 0x61, 0x63, 0x6b, 0x6f, 0x66, 0x66, 0x2f, 0x62, 0x61, 0x63, - 0x6b, 0x6f, 0x66, 0x66, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x52, 0x0a, 0x0a, 0x44, 0x69, - 0x61, 0x6c, 0x65, 0x72, 0x4f, 0x70, 0x74, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, - 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, - 0x73, 0x73, 0x12, 0x2a, 0x0a, 0x07, 0x62, 0x61, 0x63, 0x6b, 0x6f, 0x66, 0x66, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x62, 0x61, 0x63, 0x6b, 0x6f, 0x66, 0x66, 0x2e, 0x42, 0x61, - 0x63, 0x6b, 0x6f, 0x66, 0x66, 0x52, 0x07, 0x62, 0x61, 0x63, 0x6b, 0x6f, 0x66, 0x66, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_github_com_aperturerobotics_bifrost_transport_common_dialer_dialer_proto_rawDescOnce sync.Once - file_github_com_aperturerobotics_bifrost_transport_common_dialer_dialer_proto_rawDescData = file_github_com_aperturerobotics_bifrost_transport_common_dialer_dialer_proto_rawDesc -) +func (m *DialerOpts) CloneVT() *DialerOpts { + if m == nil { + return (*DialerOpts)(nil) + } + r := new(DialerOpts) + r.Address = m.Address + if rhs := m.Backoff; rhs != nil { + r.Backoff = rhs.CloneVT() + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} -func file_github_com_aperturerobotics_bifrost_transport_common_dialer_dialer_proto_rawDescGZIP() []byte { - file_github_com_aperturerobotics_bifrost_transport_common_dialer_dialer_proto_rawDescOnce.Do(func() { - file_github_com_aperturerobotics_bifrost_transport_common_dialer_dialer_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_aperturerobotics_bifrost_transport_common_dialer_dialer_proto_rawDescData) - }) - return file_github_com_aperturerobotics_bifrost_transport_common_dialer_dialer_proto_rawDescData +func (m *DialerOpts) CloneMessageVT() any { + return m.CloneVT() +} + +func (this *DialerOpts) EqualVT(that *DialerOpts) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.Address != that.Address { + return false + } + if !this.Backoff.EqualVT(that.Backoff) { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *DialerOpts) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*DialerOpts) + if !ok { + return false + } + return this.EqualVT(that) } -var file_github_com_aperturerobotics_bifrost_transport_common_dialer_dialer_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_github_com_aperturerobotics_bifrost_transport_common_dialer_dialer_proto_goTypes = []interface{}{ - (*DialerOpts)(nil), // 0: dialer.DialerOpts - (*backoff.Backoff)(nil), // 1: backoff.Backoff +// MarshalProtoJSON marshals the DialerOpts message to JSON. +func (x *DialerOpts) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return + } + s.WriteObjectStart() + var wroteField bool + if x.Address != "" || s.HasField("address") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("address") + s.WriteString(x.Address) + } + if x.Backoff != nil || s.HasField("backoff") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("backoff") + x.Backoff.MarshalProtoJSON(s.WithField("backoff")) + } + s.WriteObjectEnd() } -var file_github_com_aperturerobotics_bifrost_transport_common_dialer_dialer_proto_depIdxs = []int32{ - 1, // 0: dialer.DialerOpts.backoff:type_name -> backoff.Backoff - 1, // [1:1] is the sub-list for method output_type - 1, // [1:1] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name + +// MarshalJSON marshals the DialerOpts to JSON. +func (x *DialerOpts) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) } -func init() { file_github_com_aperturerobotics_bifrost_transport_common_dialer_dialer_proto_init() } -func file_github_com_aperturerobotics_bifrost_transport_common_dialer_dialer_proto_init() { - if File_github_com_aperturerobotics_bifrost_transport_common_dialer_dialer_proto != nil { +// UnmarshalProtoJSON unmarshals the DialerOpts message from JSON. +func (x *DialerOpts) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { return } - if !protoimpl.UnsafeEnabled { - file_github_com_aperturerobotics_bifrost_transport_common_dialer_dialer_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DialerOpts); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "address": + s.AddField("address") + x.Address = s.ReadString() + case "backoff": + if s.ReadNil() { + x.Backoff = nil + return } + x.Backoff = &backoff.Backoff{} + x.Backoff.UnmarshalProtoJSON(s.WithField("backoff", true)) } + }) +} + +// UnmarshalJSON unmarshals the DialerOpts from JSON. +func (x *DialerOpts) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +func (m *DialerOpts) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_github_com_aperturerobotics_bifrost_transport_common_dialer_dialer_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_github_com_aperturerobotics_bifrost_transport_common_dialer_dialer_proto_goTypes, - DependencyIndexes: file_github_com_aperturerobotics_bifrost_transport_common_dialer_dialer_proto_depIdxs, - MessageInfos: file_github_com_aperturerobotics_bifrost_transport_common_dialer_dialer_proto_msgTypes, - }.Build() - File_github_com_aperturerobotics_bifrost_transport_common_dialer_dialer_proto = out.File - file_github_com_aperturerobotics_bifrost_transport_common_dialer_dialer_proto_rawDesc = nil - file_github_com_aperturerobotics_bifrost_transport_common_dialer_dialer_proto_goTypes = nil - file_github_com_aperturerobotics_bifrost_transport_common_dialer_dialer_proto_depIdxs = nil + return dAtA[:n], nil +} + +func (m *DialerOpts) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *DialerOpts) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.Backoff != nil { + size, err := m.Backoff.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x12 + } + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *DialerOpts) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + if m.Backoff != nil { + l = m.Backoff.SizeVT() + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *DialerOpts) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: DialerOpts: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: DialerOpts: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field Backoff", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Backoff == nil { + m.Backoff = &backoff.Backoff{} + } + if err := m.Backoff.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil } diff --git a/transport/common/dialer/dialer.pb.ts b/transport/common/dialer/dialer.pb.ts deleted file mode 100644 index 975a4570..00000000 --- a/transport/common/dialer/dialer.pb.ts +++ /dev/null @@ -1,179 +0,0 @@ -/* eslint-disable */ -import { Backoff } from '@go/github.com/aperturerobotics/util/backoff/backoff.pb.js' -import Long from 'long' -import _m0 from 'protobufjs/minimal.js' - -export const protobufPackage = 'dialer' - -/** DialerOpts contains options relating to dialing a statically configured peer. */ -export interface DialerOpts { - /** Address is the address of the peer, in the format expected by the transport. */ - address: string - /** - * Backoff is the dialing backoff configuration. - * Can be empty. - */ - backoff: Backoff | undefined -} - -function createBaseDialerOpts(): DialerOpts { - return { address: '', backoff: undefined } -} - -export const DialerOpts = { - encode( - message: DialerOpts, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.address !== '') { - writer.uint32(10).string(message.address) - } - if (message.backoff !== undefined) { - Backoff.encode(message.backoff, writer.uint32(18).fork()).ldelim() - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): DialerOpts { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseDialerOpts() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break - } - - message.address = reader.string() - continue - case 2: - if (tag !== 18) { - break - } - - message.backoff = Backoff.decode(reader, reader.uint32()) - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [DialerOpts.encode(p).finish()] - } - } else { - yield* [DialerOpts.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [DialerOpts.decode(p)] - } - } else { - yield* [DialerOpts.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): DialerOpts { - return { - address: isSet(object.address) ? globalThis.String(object.address) : '', - backoff: isSet(object.backoff) - ? Backoff.fromJSON(object.backoff) - : undefined, - } - }, - - toJSON(message: DialerOpts): unknown { - const obj: any = {} - if (message.address !== '') { - obj.address = message.address - } - if (message.backoff !== undefined) { - obj.backoff = Backoff.toJSON(message.backoff) - } - return obj - }, - - create, I>>(base?: I): DialerOpts { - return DialerOpts.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>( - object: I, - ): DialerOpts { - const message = createBaseDialerOpts() - message.address = object.address ?? '' - message.backoff = - object.backoff !== undefined && object.backoff !== null - ? Backoff.fromPartial(object.backoff) - : undefined - return message - }, -} - -type Builtin = - | Date - | Function - | Uint8Array - | string - | number - | boolean - | undefined - -export type DeepPartial = T extends Builtin - ? T - : T extends Long - ? string | number | Long - : T extends globalThis.Array - ? globalThis.Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends { $case: string } - ? { [K in keyof Omit]?: DeepPartial } & { - $case: T['$case'] - } - : T extends {} - ? { [K in keyof T]?: DeepPartial } - : Partial - -type KeysOfUnion = T extends T ? keyof T : never -export type Exact = P extends Builtin - ? P - : P & { [K in keyof P]: Exact } & { - [K in Exclude>]: never - } - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any - _m0.configure() -} - -function isSet(value: any): boolean { - return value !== null && value !== undefined -} diff --git a/transport/common/dialer/dialer_pb.ts b/transport/common/dialer/dialer_pb.ts new file mode 100644 index 00000000..84e29d27 --- /dev/null +++ b/transport/common/dialer/dialer_pb.ts @@ -0,0 +1,76 @@ +// @generated by protoc-gen-es v1.8.0 with parameter "target=ts,ts_nocheck=false" +// @generated from file github.com/aperturerobotics/bifrost/transport/common/dialer/dialer.proto (package dialer, syntax proto3) +/* eslint-disable */ + +import type { + BinaryReadOptions, + FieldList, + JsonReadOptions, + JsonValue, + PartialMessage, + PlainMessage, +} from '@bufbuild/protobuf' +import { Message, proto3 } from '@bufbuild/protobuf' +import { Backoff } from '../../../../util/backoff/backoff_pb.js' + +/** + * DialerOpts contains options relating to dialing a statically configured peer. + * + * @generated from message dialer.DialerOpts + */ +export class DialerOpts extends Message { + /** + * Address is the address of the peer, in the format expected by the transport. + * + * @generated from field: string address = 1; + */ + address = '' + + /** + * Backoff is the dialing backoff configuration. + * Can be empty. + * + * @generated from field: backoff.Backoff backoff = 2; + */ + backoff?: Backoff + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'dialer.DialerOpts' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: 'address', kind: 'scalar', T: 9 /* ScalarType.STRING */ }, + { no: 2, name: 'backoff', kind: 'message', T: Backoff }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): DialerOpts { + return new DialerOpts().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): DialerOpts { + return new DialerOpts().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): DialerOpts { + return new DialerOpts().fromJsonString(jsonString, options) + } + + static equals( + a: DialerOpts | PlainMessage | undefined, + b: DialerOpts | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(DialerOpts, a, b) + } +} diff --git a/transport/common/dialer/dialer_vtproto.pb.go b/transport/common/dialer/dialer_vtproto.pb.go deleted file mode 100644 index bb9add8b..00000000 --- a/transport/common/dialer/dialer_vtproto.pb.go +++ /dev/null @@ -1,286 +0,0 @@ -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// protoc-gen-go-vtproto version: v0.6.0 -// source: github.com/aperturerobotics/bifrost/transport/common/dialer/dialer.proto - -package dialer - -import ( - fmt "fmt" - io "io" - - backoff "github.com/aperturerobotics/util/backoff" - protohelpers "github.com/planetscale/vtprotobuf/protohelpers" - proto "google.golang.org/protobuf/proto" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) -) - -func (m *DialerOpts) CloneVT() *DialerOpts { - if m == nil { - return (*DialerOpts)(nil) - } - r := new(DialerOpts) - r.Address = m.Address - if rhs := m.Backoff; rhs != nil { - if vtpb, ok := interface{}(rhs).(interface{ CloneVT() *backoff.Backoff }); ok { - r.Backoff = vtpb.CloneVT() - } else { - r.Backoff = proto.Clone(rhs).(*backoff.Backoff) - } - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *DialerOpts) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (this *DialerOpts) EqualVT(that *DialerOpts) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.Address != that.Address { - return false - } - if equal, ok := interface{}(this.Backoff).(interface{ EqualVT(*backoff.Backoff) bool }); ok { - if !equal.EqualVT(that.Backoff) { - return false - } - } else if !proto.Equal(this.Backoff, that.Backoff) { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *DialerOpts) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*DialerOpts) - if !ok { - return false - } - return this.EqualVT(that) -} -func (m *DialerOpts) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *DialerOpts) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *DialerOpts) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Backoff != nil { - if vtmsg, ok := interface{}(m.Backoff).(interface { - MarshalToSizedBufferVT([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.Backoff) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0x12 - } - if len(m.Address) > 0 { - i -= len(m.Address) - copy(dAtA[i:], m.Address) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Address))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *DialerOpts) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Address) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.Backoff != nil { - if size, ok := interface{}(m.Backoff).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.Backoff) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *DialerOpts) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: DialerOpts: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DialerOpts: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Address = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Backoff", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Backoff == nil { - m.Backoff = &backoff.Backoff{} - } - if unmarshal, ok := interface{}(m.Backoff).(interface { - UnmarshalVT([]byte) error - }); ok { - if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - } else { - if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.Backoff); err != nil { - return err - } - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} diff --git a/transport/common/pconn/pconn.pb.go b/transport/common/pconn/pconn.pb.go index 8cc04b89..54060708 100644 --- a/transport/common/pconn/pconn.pb.go +++ b/transport/common/pconn/pconn.pb.go @@ -1,33 +1,21 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0-devel -// protoc v5.26.1 +// Code generated by protoc-gen-go-lite. DO NOT EDIT. +// protoc-gen-go-lite version: v0.4.5 // source: github.com/aperturerobotics/bifrost/transport/common/pconn/pconn.proto package pconn import ( - reflect "reflect" - sync "sync" + io "io" quic "github.com/aperturerobotics/bifrost/transport/common/quic" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) + protobuf_go_lite "github.com/aperturerobotics/protobuf-go-lite" + json "github.com/aperturerobotics/protobuf-go-lite/json" + errors "github.com/pkg/errors" ) // Opts are extra options for the packet conn. type Opts struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + unknownFields []byte // Quic are the quic protocol options. Quic *quic.Opts `protobuf:"bytes,1,opt,name=quic,proto3" json:"quic,omitempty"` // Verbose turns on verbose debug logging. @@ -36,36 +24,10 @@ type Opts struct { func (x *Opts) Reset() { *x = Opts{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_transport_common_pconn_pconn_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Opts) String() string { - return protoimpl.X.MessageStringOf(x) } func (*Opts) ProtoMessage() {} -func (x *Opts) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_transport_common_pconn_pconn_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 Opts.ProtoReflect.Descriptor instead. -func (*Opts) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_transport_common_pconn_pconn_proto_rawDescGZIP(), []int{0} -} - func (x *Opts) GetQuic() *quic.Opts { if x != nil { return x.Quic @@ -80,87 +42,277 @@ func (x *Opts) GetVerbose() bool { return false } -var File_github_com_aperturerobotics_bifrost_transport_common_pconn_pconn_proto protoreflect.FileDescriptor - -var file_github_com_aperturerobotics_bifrost_transport_common_pconn_pconn_proto_rawDesc = []byte{ - 0x0a, 0x46, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, - 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x62, 0x69, - 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x2f, - 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x63, 0x6f, 0x6e, 0x6e, 0x2f, 0x70, 0x63, 0x6f, - 0x6e, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x70, 0x63, 0x6f, 0x6e, 0x6e, 0x1a, - 0x44, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, 0x72, - 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x62, 0x69, 0x66, - 0x72, 0x6f, 0x73, 0x74, 0x2f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x2f, 0x63, - 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x71, 0x75, 0x69, 0x63, 0x2f, 0x71, 0x75, 0x69, 0x63, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x4a, 0x0a, 0x04, 0x4f, 0x70, 0x74, 0x73, 0x12, 0x28, 0x0a, - 0x04, 0x71, 0x75, 0x69, 0x63, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x74, 0x72, - 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x71, 0x75, 0x69, 0x63, 0x2e, 0x4f, 0x70, 0x74, - 0x73, 0x52, 0x04, 0x71, 0x75, 0x69, 0x63, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x62, 0x6f, - 0x73, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x76, 0x65, 0x72, 0x62, 0x6f, 0x73, - 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_github_com_aperturerobotics_bifrost_transport_common_pconn_pconn_proto_rawDescOnce sync.Once - file_github_com_aperturerobotics_bifrost_transport_common_pconn_pconn_proto_rawDescData = file_github_com_aperturerobotics_bifrost_transport_common_pconn_pconn_proto_rawDesc -) +func (m *Opts) CloneVT() *Opts { + if m == nil { + return (*Opts)(nil) + } + r := new(Opts) + r.Verbose = m.Verbose + if rhs := m.Quic; rhs != nil { + r.Quic = rhs.CloneVT() + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} -func file_github_com_aperturerobotics_bifrost_transport_common_pconn_pconn_proto_rawDescGZIP() []byte { - file_github_com_aperturerobotics_bifrost_transport_common_pconn_pconn_proto_rawDescOnce.Do(func() { - file_github_com_aperturerobotics_bifrost_transport_common_pconn_pconn_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_aperturerobotics_bifrost_transport_common_pconn_pconn_proto_rawDescData) - }) - return file_github_com_aperturerobotics_bifrost_transport_common_pconn_pconn_proto_rawDescData +func (m *Opts) CloneMessageVT() any { + return m.CloneVT() } -var file_github_com_aperturerobotics_bifrost_transport_common_pconn_pconn_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_github_com_aperturerobotics_bifrost_transport_common_pconn_pconn_proto_goTypes = []interface{}{ - (*Opts)(nil), // 0: pconn.Opts - (*quic.Opts)(nil), // 1: transport.quic.Opts +func (this *Opts) EqualVT(that *Opts) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if !this.Quic.EqualVT(that.Quic) { + return false + } + if this.Verbose != that.Verbose { + return false + } + return string(this.unknownFields) == string(that.unknownFields) } -var file_github_com_aperturerobotics_bifrost_transport_common_pconn_pconn_proto_depIdxs = []int32{ - 1, // 0: pconn.Opts.quic:type_name -> transport.quic.Opts - 1, // [1:1] is the sub-list for method output_type - 1, // [1:1] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name + +func (this *Opts) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*Opts) + if !ok { + return false + } + return this.EqualVT(that) } -func init() { file_github_com_aperturerobotics_bifrost_transport_common_pconn_pconn_proto_init() } -func file_github_com_aperturerobotics_bifrost_transport_common_pconn_pconn_proto_init() { - if File_github_com_aperturerobotics_bifrost_transport_common_pconn_pconn_proto != nil { +// MarshalProtoJSON marshals the Opts message to JSON. +func (x *Opts) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() return } - if !protoimpl.UnsafeEnabled { - file_github_com_aperturerobotics_bifrost_transport_common_pconn_pconn_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Opts); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil + s.WriteObjectStart() + var wroteField bool + if x.Quic != nil || s.HasField("quic") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("quic") + x.Quic.MarshalProtoJSON(s.WithField("quic")) + } + if x.Verbose || s.HasField("verbose") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("verbose") + s.WriteBool(x.Verbose) + } + s.WriteObjectEnd() +} + +// MarshalJSON marshals the Opts to JSON. +func (x *Opts) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) +} + +// UnmarshalProtoJSON unmarshals the Opts message from JSON. +func (x *Opts) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { + return + } + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "quic": + if s.ReadNil() { + x.Quic = nil + return } + x.Quic = &quic.Opts{} + x.Quic.UnmarshalProtoJSON(s.WithField("quic", true)) + case "verbose": + s.AddField("verbose") + x.Verbose = s.ReadBool() } + }) +} + +// UnmarshalJSON unmarshals the Opts from JSON. +func (x *Opts) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +func (m *Opts) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_github_com_aperturerobotics_bifrost_transport_common_pconn_pconn_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_github_com_aperturerobotics_bifrost_transport_common_pconn_pconn_proto_goTypes, - DependencyIndexes: file_github_com_aperturerobotics_bifrost_transport_common_pconn_pconn_proto_depIdxs, - MessageInfos: file_github_com_aperturerobotics_bifrost_transport_common_pconn_pconn_proto_msgTypes, - }.Build() - File_github_com_aperturerobotics_bifrost_transport_common_pconn_pconn_proto = out.File - file_github_com_aperturerobotics_bifrost_transport_common_pconn_pconn_proto_rawDesc = nil - file_github_com_aperturerobotics_bifrost_transport_common_pconn_pconn_proto_goTypes = nil - file_github_com_aperturerobotics_bifrost_transport_common_pconn_pconn_proto_depIdxs = nil + return dAtA[:n], nil +} + +func (m *Opts) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *Opts) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.Verbose { + i-- + if m.Verbose { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x10 + } + if m.Quic != nil { + size, err := m.Quic.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Opts) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Quic != nil { + l = m.Quic.SizeVT() + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + if m.Verbose { + n += 2 + } + n += len(m.unknownFields) + return n +} + +func (m *Opts) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: Opts: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: Opts: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field Quic", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Quic == nil { + m.Quic = &quic.Opts{} + } + if err := m.Quic.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return errors.Errorf("proto: wrong wireType = %d for field Verbose", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Verbose = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil } diff --git a/transport/common/pconn/pconn.pb.ts b/transport/common/pconn/pconn.pb.ts deleted file mode 100644 index a60f5ea4..00000000 --- a/transport/common/pconn/pconn.pb.ts +++ /dev/null @@ -1,169 +0,0 @@ -/* eslint-disable */ -import Long from 'long' -import _m0 from 'protobufjs/minimal.js' -import { Opts as Opts1 } from '../quic/quic.pb.js' - -export const protobufPackage = 'pconn' - -/** Opts are extra options for the packet conn. */ -export interface Opts { - /** Quic are the quic protocol options. */ - quic: Opts1 | undefined - /** Verbose turns on verbose debug logging. */ - verbose: boolean -} - -function createBaseOpts(): Opts { - return { quic: undefined, verbose: false } -} - -export const Opts = { - encode(message: Opts, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.quic !== undefined) { - Opts1.encode(message.quic, writer.uint32(10).fork()).ldelim() - } - if (message.verbose !== false) { - writer.uint32(16).bool(message.verbose) - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Opts { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseOpts() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break - } - - message.quic = Opts1.decode(reader, reader.uint32()) - continue - case 2: - if (tag !== 16) { - break - } - - message.verbose = reader.bool() - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: AsyncIterable | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Opts.encode(p).finish()] - } - } else { - yield* [Opts.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Opts.decode(p)] - } - } else { - yield* [Opts.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): Opts { - return { - quic: isSet(object.quic) ? Opts1.fromJSON(object.quic) : undefined, - verbose: isSet(object.verbose) - ? globalThis.Boolean(object.verbose) - : false, - } - }, - - toJSON(message: Opts): unknown { - const obj: any = {} - if (message.quic !== undefined) { - obj.quic = Opts1.toJSON(message.quic) - } - if (message.verbose !== false) { - obj.verbose = message.verbose - } - return obj - }, - - create, I>>(base?: I): Opts { - return Opts.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>(object: I): Opts { - const message = createBaseOpts() - message.quic = - object.quic !== undefined && object.quic !== null - ? Opts1.fromPartial(object.quic) - : undefined - message.verbose = object.verbose ?? false - return message - }, -} - -type Builtin = - | Date - | Function - | Uint8Array - | string - | number - | boolean - | undefined - -export type DeepPartial = T extends Builtin - ? T - : T extends Long - ? string | number | Long - : T extends globalThis.Array - ? globalThis.Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends { $case: string } - ? { [K in keyof Omit]?: DeepPartial } & { - $case: T['$case'] - } - : T extends {} - ? { [K in keyof T]?: DeepPartial } - : Partial - -type KeysOfUnion = T extends T ? keyof T : never -export type Exact = P extends Builtin - ? P - : P & { [K in keyof P]: Exact } & { - [K in Exclude>]: never - } - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any - _m0.configure() -} - -function isSet(value: any): boolean { - return value !== null && value !== undefined -} diff --git a/transport/common/pconn/pconn_pb.ts b/transport/common/pconn/pconn_pb.ts new file mode 100644 index 00000000..f40ca86e --- /dev/null +++ b/transport/common/pconn/pconn_pb.ts @@ -0,0 +1,75 @@ +// @generated by protoc-gen-es v1.8.0 with parameter "target=ts,ts_nocheck=false" +// @generated from file github.com/aperturerobotics/bifrost/transport/common/pconn/pconn.proto (package pconn, syntax proto3) +/* eslint-disable */ + +import type { + BinaryReadOptions, + FieldList, + JsonReadOptions, + JsonValue, + PartialMessage, + PlainMessage, +} from '@bufbuild/protobuf' +import { Message, proto3 } from '@bufbuild/protobuf' +import { Opts as Opts$1 } from '../quic/quic_pb.js' + +/** + * Opts are extra options for the packet conn. + * + * @generated from message pconn.Opts + */ +export class Opts extends Message { + /** + * Quic are the quic protocol options. + * + * @generated from field: transport.quic.Opts quic = 1; + */ + quic?: Opts$1 + + /** + * Verbose turns on verbose debug logging. + * + * @generated from field: bool verbose = 2; + */ + verbose = false + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'pconn.Opts' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: 'quic', kind: 'message', T: Opts$1 }, + { no: 2, name: 'verbose', kind: 'scalar', T: 8 /* ScalarType.BOOL */ }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): Opts { + return new Opts().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): Opts { + return new Opts().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): Opts { + return new Opts().fromJsonString(jsonString, options) + } + + static equals( + a: Opts | PlainMessage | undefined, + b: Opts | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(Opts, a, b) + } +} diff --git a/transport/common/pconn/pconn_vtproto.pb.go b/transport/common/pconn/pconn_vtproto.pb.go deleted file mode 100644 index cf1d1b70..00000000 --- a/transport/common/pconn/pconn_vtproto.pb.go +++ /dev/null @@ -1,276 +0,0 @@ -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// protoc-gen-go-vtproto version: v0.6.0 -// source: github.com/aperturerobotics/bifrost/transport/common/pconn/pconn.proto - -package pconn - -import ( - fmt "fmt" - io "io" - - quic "github.com/aperturerobotics/bifrost/transport/common/quic" - protohelpers "github.com/planetscale/vtprotobuf/protohelpers" - proto "google.golang.org/protobuf/proto" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) -) - -func (m *Opts) CloneVT() *Opts { - if m == nil { - return (*Opts)(nil) - } - r := new(Opts) - r.Verbose = m.Verbose - if rhs := m.Quic; rhs != nil { - if vtpb, ok := interface{}(rhs).(interface{ CloneVT() *quic.Opts }); ok { - r.Quic = vtpb.CloneVT() - } else { - r.Quic = proto.Clone(rhs).(*quic.Opts) - } - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Opts) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (this *Opts) EqualVT(that *Opts) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if equal, ok := interface{}(this.Quic).(interface{ EqualVT(*quic.Opts) bool }); ok { - if !equal.EqualVT(that.Quic) { - return false - } - } else if !proto.Equal(this.Quic, that.Quic) { - return false - } - if this.Verbose != that.Verbose { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Opts) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Opts) - if !ok { - return false - } - return this.EqualVT(that) -} -func (m *Opts) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Opts) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Opts) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Verbose { - i-- - if m.Verbose { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x10 - } - if m.Quic != nil { - if vtmsg, ok := interface{}(m.Quic).(interface { - MarshalToSizedBufferVT([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.Quic) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Opts) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Quic != nil { - if size, ok := interface{}(m.Quic).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.Quic) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.Verbose { - n += 2 - } - n += len(m.unknownFields) - return n -} - -func (m *Opts) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Opts: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Opts: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Quic", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Quic == nil { - m.Quic = &quic.Opts{} - } - if unmarshal, ok := interface{}(m.Quic).(interface { - UnmarshalVT([]byte) error - }); ok { - if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - } else { - if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.Quic); err != nil { - return err - } - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Verbose", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Verbose = bool(v != 0) - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} diff --git a/transport/common/quic/quic.pb.go b/transport/common/quic/quic.pb.go index 1f90e1cd..02d04bcb 100644 --- a/transport/common/quic/quic.pb.go +++ b/transport/common/quic/quic.pb.go @@ -1,52 +1,40 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0-devel -// protoc v5.26.1 +// Code generated by protoc-gen-go-lite. DO NOT EDIT. +// protoc-gen-go-lite version: v0.4.5 // source: github.com/aperturerobotics/bifrost/transport/common/quic/quic.proto package transport_quic import ( - reflect "reflect" - sync "sync" + io "io" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) + protobuf_go_lite "github.com/aperturerobotics/protobuf-go-lite" + json "github.com/aperturerobotics/protobuf-go-lite/json" + errors "github.com/pkg/errors" ) type Opts struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + unknownFields []byte // MaxIdleTimeoutDur is the duration of idle after which conn is closed. // // Defaults to 10s. - MaxIdleTimeoutDur string `protobuf:"bytes,1,opt,name=max_idle_timeout_dur,json=maxIdleTimeoutDur,proto3" json:"max_idle_timeout_dur,omitempty"` + MaxIdleTimeoutDur string `protobuf:"bytes,1,opt,name=max_idle_timeout_dur,json=maxIdleTimeoutDur,proto3" json:"maxIdleTimeoutDur,omitempty"` // MaxIncomingStreams is the maximum number of concurrent bidirectional // streams that a peer is allowed to open. // // If unset or negative, defaults to 100000. - MaxIncomingStreams int32 `protobuf:"varint,2,opt,name=max_incoming_streams,json=maxIncomingStreams,proto3" json:"max_incoming_streams,omitempty"` + MaxIncomingStreams int32 `protobuf:"varint,2,opt,name=max_incoming_streams,json=maxIncomingStreams,proto3" json:"maxIncomingStreams,omitempty"` // DisableKeepAlive disables the keep alive packets. - DisableKeepAlive bool `protobuf:"varint,3,opt,name=disable_keep_alive,json=disableKeepAlive,proto3" json:"disable_keep_alive,omitempty"` + DisableKeepAlive bool `protobuf:"varint,3,opt,name=disable_keep_alive,json=disableKeepAlive,proto3" json:"disableKeepAlive,omitempty"` // KeepAliveDur is the duration between keep-alive pings. // // If disable_keep_alive is set, this value is ignored. // If unset, sets keep-alive to half of MaxIdleTimeout. - KeepAliveDur string `protobuf:"bytes,7,opt,name=keep_alive_dur,json=keepAliveDur,proto3" json:"keep_alive_dur,omitempty"` + KeepAliveDur string `protobuf:"bytes,7,opt,name=keep_alive_dur,json=keepAliveDur,proto3" json:"keepAliveDur,omitempty"` // DisableDatagrams disables the unreliable datagrams feature. // Both peers must support it for it to be enabled, regardless of this flag. - DisableDatagrams bool `protobuf:"varint,4,opt,name=disable_datagrams,json=disableDatagrams,proto3" json:"disable_datagrams,omitempty"` + DisableDatagrams bool `protobuf:"varint,4,opt,name=disable_datagrams,json=disableDatagrams,proto3" json:"disableDatagrams,omitempty"` // DisablePathMtuDiscovery disables sending packets to discover max packet size. - DisablePathMtuDiscovery bool `protobuf:"varint,5,opt,name=disable_path_mtu_discovery,json=disablePathMtuDiscovery,proto3" json:"disable_path_mtu_discovery,omitempty"` + DisablePathMtuDiscovery bool `protobuf:"varint,5,opt,name=disable_path_mtu_discovery,json=disablePathMtuDiscovery,proto3" json:"disablePathMtuDiscovery,omitempty"` // Verbose indicates to use verbose logging. // Note: this is VERY verbose, logs every packet sent. Verbose bool `protobuf:"varint,6,opt,name=verbose,proto3" json:"verbose,omitempty"` @@ -54,36 +42,10 @@ type Opts struct { func (x *Opts) Reset() { *x = Opts{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_transport_common_quic_quic_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Opts) String() string { - return protoimpl.X.MessageStringOf(x) } func (*Opts) ProtoMessage() {} -func (x *Opts) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_transport_common_quic_quic_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 Opts.ProtoReflect.Descriptor instead. -func (*Opts) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_transport_common_quic_quic_proto_rawDescGZIP(), []int{0} -} - func (x *Opts) GetMaxIdleTimeoutDur() string { if x != nil { return x.MaxIdleTimeoutDur @@ -133,97 +95,493 @@ func (x *Opts) GetVerbose() bool { return false } -var File_github_com_aperturerobotics_bifrost_transport_common_quic_quic_proto protoreflect.FileDescriptor - -var file_github_com_aperturerobotics_bifrost_transport_common_quic_quic_proto_rawDesc = []byte{ - 0x0a, 0x44, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, - 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x62, 0x69, - 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x2f, - 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x71, 0x75, 0x69, 0x63, 0x2f, 0x71, 0x75, 0x69, 0x63, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, - 0x74, 0x2e, 0x71, 0x75, 0x69, 0x63, 0x22, 0xc1, 0x02, 0x0a, 0x04, 0x4f, 0x70, 0x74, 0x73, 0x12, - 0x2f, 0x0a, 0x14, 0x6d, 0x61, 0x78, 0x5f, 0x69, 0x64, 0x6c, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, - 0x6f, 0x75, 0x74, 0x5f, 0x64, 0x75, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x6d, - 0x61, 0x78, 0x49, 0x64, 0x6c, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x44, 0x75, 0x72, - 0x12, 0x30, 0x0a, 0x14, 0x6d, 0x61, 0x78, 0x5f, 0x69, 0x6e, 0x63, 0x6f, 0x6d, 0x69, 0x6e, 0x67, - 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x12, - 0x6d, 0x61, 0x78, 0x49, 0x6e, 0x63, 0x6f, 0x6d, 0x69, 0x6e, 0x67, 0x53, 0x74, 0x72, 0x65, 0x61, - 0x6d, 0x73, 0x12, 0x2c, 0x0a, 0x12, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x6b, 0x65, - 0x65, 0x70, 0x5f, 0x61, 0x6c, 0x69, 0x76, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, - 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x4b, 0x65, 0x65, 0x70, 0x41, 0x6c, 0x69, 0x76, 0x65, - 0x12, 0x24, 0x0a, 0x0e, 0x6b, 0x65, 0x65, 0x70, 0x5f, 0x61, 0x6c, 0x69, 0x76, 0x65, 0x5f, 0x64, - 0x75, 0x72, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x6b, 0x65, 0x65, 0x70, 0x41, 0x6c, - 0x69, 0x76, 0x65, 0x44, 0x75, 0x72, 0x12, 0x2b, 0x0a, 0x11, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, - 0x65, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x67, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x10, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x44, 0x61, 0x74, 0x61, 0x67, 0x72, - 0x61, 0x6d, 0x73, 0x12, 0x3b, 0x0a, 0x1a, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x70, - 0x61, 0x74, 0x68, 0x5f, 0x6d, 0x74, 0x75, 0x5f, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, - 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x17, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, - 0x50, 0x61, 0x74, 0x68, 0x4d, 0x74, 0x75, 0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, - 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x62, 0x6f, 0x73, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x07, 0x76, 0x65, 0x72, 0x62, 0x6f, 0x73, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, -} - -var ( - file_github_com_aperturerobotics_bifrost_transport_common_quic_quic_proto_rawDescOnce sync.Once - file_github_com_aperturerobotics_bifrost_transport_common_quic_quic_proto_rawDescData = file_github_com_aperturerobotics_bifrost_transport_common_quic_quic_proto_rawDesc -) +func (m *Opts) CloneVT() *Opts { + if m == nil { + return (*Opts)(nil) + } + r := new(Opts) + r.MaxIdleTimeoutDur = m.MaxIdleTimeoutDur + r.MaxIncomingStreams = m.MaxIncomingStreams + r.DisableKeepAlive = m.DisableKeepAlive + r.KeepAliveDur = m.KeepAliveDur + r.DisableDatagrams = m.DisableDatagrams + r.DisablePathMtuDiscovery = m.DisablePathMtuDiscovery + r.Verbose = m.Verbose + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} -func file_github_com_aperturerobotics_bifrost_transport_common_quic_quic_proto_rawDescGZIP() []byte { - file_github_com_aperturerobotics_bifrost_transport_common_quic_quic_proto_rawDescOnce.Do(func() { - file_github_com_aperturerobotics_bifrost_transport_common_quic_quic_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_aperturerobotics_bifrost_transport_common_quic_quic_proto_rawDescData) - }) - return file_github_com_aperturerobotics_bifrost_transport_common_quic_quic_proto_rawDescData +func (m *Opts) CloneMessageVT() any { + return m.CloneVT() +} + +func (this *Opts) EqualVT(that *Opts) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.MaxIdleTimeoutDur != that.MaxIdleTimeoutDur { + return false + } + if this.MaxIncomingStreams != that.MaxIncomingStreams { + return false + } + if this.DisableKeepAlive != that.DisableKeepAlive { + return false + } + if this.DisableDatagrams != that.DisableDatagrams { + return false + } + if this.DisablePathMtuDiscovery != that.DisablePathMtuDiscovery { + return false + } + if this.Verbose != that.Verbose { + return false + } + if this.KeepAliveDur != that.KeepAliveDur { + return false + } + return string(this.unknownFields) == string(that.unknownFields) } -var file_github_com_aperturerobotics_bifrost_transport_common_quic_quic_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_github_com_aperturerobotics_bifrost_transport_common_quic_quic_proto_goTypes = []interface{}{ - (*Opts)(nil), // 0: transport.quic.Opts +func (this *Opts) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*Opts) + if !ok { + return false + } + return this.EqualVT(that) +} + +// MarshalProtoJSON marshals the Opts message to JSON. +func (x *Opts) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return + } + s.WriteObjectStart() + var wroteField bool + if x.MaxIdleTimeoutDur != "" || s.HasField("maxIdleTimeoutDur") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("maxIdleTimeoutDur") + s.WriteString(x.MaxIdleTimeoutDur) + } + if x.MaxIncomingStreams != 0 || s.HasField("maxIncomingStreams") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("maxIncomingStreams") + s.WriteInt32(x.MaxIncomingStreams) + } + if x.DisableKeepAlive || s.HasField("disableKeepAlive") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("disableKeepAlive") + s.WriteBool(x.DisableKeepAlive) + } + if x.DisableDatagrams || s.HasField("disableDatagrams") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("disableDatagrams") + s.WriteBool(x.DisableDatagrams) + } + if x.DisablePathMtuDiscovery || s.HasField("disablePathMtuDiscovery") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("disablePathMtuDiscovery") + s.WriteBool(x.DisablePathMtuDiscovery) + } + if x.Verbose || s.HasField("verbose") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("verbose") + s.WriteBool(x.Verbose) + } + if x.KeepAliveDur != "" || s.HasField("keepAliveDur") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("keepAliveDur") + s.WriteString(x.KeepAliveDur) + } + s.WriteObjectEnd() } -var file_github_com_aperturerobotics_bifrost_transport_common_quic_quic_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] 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 + +// MarshalJSON marshals the Opts to JSON. +func (x *Opts) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) } -func init() { file_github_com_aperturerobotics_bifrost_transport_common_quic_quic_proto_init() } -func file_github_com_aperturerobotics_bifrost_transport_common_quic_quic_proto_init() { - if File_github_com_aperturerobotics_bifrost_transport_common_quic_quic_proto != nil { +// UnmarshalProtoJSON unmarshals the Opts message from JSON. +func (x *Opts) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { return } - if !protoimpl.UnsafeEnabled { - file_github_com_aperturerobotics_bifrost_transport_common_quic_quic_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Opts); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "max_idle_timeout_dur", "maxIdleTimeoutDur": + s.AddField("max_idle_timeout_dur") + x.MaxIdleTimeoutDur = s.ReadString() + case "max_incoming_streams", "maxIncomingStreams": + s.AddField("max_incoming_streams") + x.MaxIncomingStreams = s.ReadInt32() + case "disable_keep_alive", "disableKeepAlive": + s.AddField("disable_keep_alive") + x.DisableKeepAlive = s.ReadBool() + case "disable_datagrams", "disableDatagrams": + s.AddField("disable_datagrams") + x.DisableDatagrams = s.ReadBool() + case "disable_path_mtu_discovery", "disablePathMtuDiscovery": + s.AddField("disable_path_mtu_discovery") + x.DisablePathMtuDiscovery = s.ReadBool() + case "verbose": + s.AddField("verbose") + x.Verbose = s.ReadBool() + case "keep_alive_dur", "keepAliveDur": + s.AddField("keep_alive_dur") + x.KeepAliveDur = s.ReadString() + } + }) +} + +// UnmarshalJSON unmarshals the Opts from JSON. +func (x *Opts) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +func (m *Opts) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Opts) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *Opts) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.KeepAliveDur) > 0 { + i -= len(m.KeepAliveDur) + copy(dAtA[i:], m.KeepAliveDur) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.KeepAliveDur))) + i-- + dAtA[i] = 0x3a + } + if m.Verbose { + i-- + if m.Verbose { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x30 + } + if m.DisablePathMtuDiscovery { + i-- + if m.DisablePathMtuDiscovery { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x28 + } + if m.DisableDatagrams { + i-- + if m.DisableDatagrams { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x20 + } + if m.DisableKeepAlive { + i-- + if m.DisableKeepAlive { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x18 + } + if m.MaxIncomingStreams != 0 { + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(m.MaxIncomingStreams)) + i-- + dAtA[i] = 0x10 + } + if len(m.MaxIdleTimeoutDur) > 0 { + i -= len(m.MaxIdleTimeoutDur) + copy(dAtA[i:], m.MaxIdleTimeoutDur) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.MaxIdleTimeoutDur))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Opts) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.MaxIdleTimeoutDur) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + if m.MaxIncomingStreams != 0 { + n += 1 + protobuf_go_lite.SizeOfVarint(uint64(m.MaxIncomingStreams)) + } + if m.DisableKeepAlive { + n += 2 + } + if m.DisableDatagrams { + n += 2 + } + if m.DisablePathMtuDiscovery { + n += 2 + } + if m.Verbose { + n += 2 + } + l = len(m.KeepAliveDur) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *Opts) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: Opts: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: Opts: illegal tag %d (wire type %d)", fieldNum, wire) } + switch fieldNum { + case 1: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field MaxIdleTimeoutDur", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.MaxIdleTimeoutDur = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return errors.Errorf("proto: wrong wireType = %d for field MaxIncomingStreams", wireType) + } + m.MaxIncomingStreams = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MaxIncomingStreams |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return errors.Errorf("proto: wrong wireType = %d for field DisableKeepAlive", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.DisableKeepAlive = bool(v != 0) + case 4: + if wireType != 0 { + return errors.Errorf("proto: wrong wireType = %d for field DisableDatagrams", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.DisableDatagrams = bool(v != 0) + case 5: + if wireType != 0 { + return errors.Errorf("proto: wrong wireType = %d for field DisablePathMtuDiscovery", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.DisablePathMtuDiscovery = bool(v != 0) + case 6: + if wireType != 0 { + return errors.Errorf("proto: wrong wireType = %d for field Verbose", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Verbose = bool(v != 0) + case 7: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field KeepAliveDur", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.KeepAliveDur = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_github_com_aperturerobotics_bifrost_transport_common_quic_quic_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_github_com_aperturerobotics_bifrost_transport_common_quic_quic_proto_goTypes, - DependencyIndexes: file_github_com_aperturerobotics_bifrost_transport_common_quic_quic_proto_depIdxs, - MessageInfos: file_github_com_aperturerobotics_bifrost_transport_common_quic_quic_proto_msgTypes, - }.Build() - File_github_com_aperturerobotics_bifrost_transport_common_quic_quic_proto = out.File - file_github_com_aperturerobotics_bifrost_transport_common_quic_quic_proto_rawDesc = nil - file_github_com_aperturerobotics_bifrost_transport_common_quic_quic_proto_goTypes = nil - file_github_com_aperturerobotics_bifrost_transport_common_quic_quic_proto_depIdxs = nil + return nil } diff --git a/transport/common/quic/quic.pb.ts b/transport/common/quic/quic.pb.ts deleted file mode 100644 index c5b58e7a..00000000 --- a/transport/common/quic/quic.pb.ts +++ /dev/null @@ -1,289 +0,0 @@ -/* eslint-disable */ -import Long from 'long' -import _m0 from 'protobufjs/minimal.js' - -export const protobufPackage = 'transport.quic' - -export interface Opts { - /** - * MaxIdleTimeoutDur is the duration of idle after which conn is closed. - * - * Defaults to 10s. - */ - maxIdleTimeoutDur: string - /** - * MaxIncomingStreams is the maximum number of concurrent bidirectional - * streams that a peer is allowed to open. - * - * If unset or negative, defaults to 100000. - */ - maxIncomingStreams: number - /** DisableKeepAlive disables the keep alive packets. */ - disableKeepAlive: boolean - /** - * KeepAliveDur is the duration between keep-alive pings. - * - * If disable_keep_alive is set, this value is ignored. - * If unset, sets keep-alive to half of MaxIdleTimeout. - */ - keepAliveDur: string - /** - * DisableDatagrams disables the unreliable datagrams feature. - * Both peers must support it for it to be enabled, regardless of this flag. - */ - disableDatagrams: boolean - /** DisablePathMtuDiscovery disables sending packets to discover max packet size. */ - disablePathMtuDiscovery: boolean - /** - * Verbose indicates to use verbose logging. - * Note: this is VERY verbose, logs every packet sent. - */ - verbose: boolean -} - -function createBaseOpts(): Opts { - return { - maxIdleTimeoutDur: '', - maxIncomingStreams: 0, - disableKeepAlive: false, - keepAliveDur: '', - disableDatagrams: false, - disablePathMtuDiscovery: false, - verbose: false, - } -} - -export const Opts = { - encode(message: Opts, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - if (message.maxIdleTimeoutDur !== '') { - writer.uint32(10).string(message.maxIdleTimeoutDur) - } - if (message.maxIncomingStreams !== 0) { - writer.uint32(16).int32(message.maxIncomingStreams) - } - if (message.disableKeepAlive !== false) { - writer.uint32(24).bool(message.disableKeepAlive) - } - if (message.keepAliveDur !== '') { - writer.uint32(58).string(message.keepAliveDur) - } - if (message.disableDatagrams !== false) { - writer.uint32(32).bool(message.disableDatagrams) - } - if (message.disablePathMtuDiscovery !== false) { - writer.uint32(40).bool(message.disablePathMtuDiscovery) - } - if (message.verbose !== false) { - writer.uint32(48).bool(message.verbose) - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Opts { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseOpts() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break - } - - message.maxIdleTimeoutDur = reader.string() - continue - case 2: - if (tag !== 16) { - break - } - - message.maxIncomingStreams = reader.int32() - continue - case 3: - if (tag !== 24) { - break - } - - message.disableKeepAlive = reader.bool() - continue - case 7: - if (tag !== 58) { - break - } - - message.keepAliveDur = reader.string() - continue - case 4: - if (tag !== 32) { - break - } - - message.disableDatagrams = reader.bool() - continue - case 5: - if (tag !== 40) { - break - } - - message.disablePathMtuDiscovery = reader.bool() - continue - case 6: - if (tag !== 48) { - break - } - - message.verbose = reader.bool() - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: AsyncIterable | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Opts.encode(p).finish()] - } - } else { - yield* [Opts.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Opts.decode(p)] - } - } else { - yield* [Opts.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): Opts { - return { - maxIdleTimeoutDur: isSet(object.maxIdleTimeoutDur) - ? globalThis.String(object.maxIdleTimeoutDur) - : '', - maxIncomingStreams: isSet(object.maxIncomingStreams) - ? globalThis.Number(object.maxIncomingStreams) - : 0, - disableKeepAlive: isSet(object.disableKeepAlive) - ? globalThis.Boolean(object.disableKeepAlive) - : false, - keepAliveDur: isSet(object.keepAliveDur) - ? globalThis.String(object.keepAliveDur) - : '', - disableDatagrams: isSet(object.disableDatagrams) - ? globalThis.Boolean(object.disableDatagrams) - : false, - disablePathMtuDiscovery: isSet(object.disablePathMtuDiscovery) - ? globalThis.Boolean(object.disablePathMtuDiscovery) - : false, - verbose: isSet(object.verbose) - ? globalThis.Boolean(object.verbose) - : false, - } - }, - - toJSON(message: Opts): unknown { - const obj: any = {} - if (message.maxIdleTimeoutDur !== '') { - obj.maxIdleTimeoutDur = message.maxIdleTimeoutDur - } - if (message.maxIncomingStreams !== 0) { - obj.maxIncomingStreams = Math.round(message.maxIncomingStreams) - } - if (message.disableKeepAlive !== false) { - obj.disableKeepAlive = message.disableKeepAlive - } - if (message.keepAliveDur !== '') { - obj.keepAliveDur = message.keepAliveDur - } - if (message.disableDatagrams !== false) { - obj.disableDatagrams = message.disableDatagrams - } - if (message.disablePathMtuDiscovery !== false) { - obj.disablePathMtuDiscovery = message.disablePathMtuDiscovery - } - if (message.verbose !== false) { - obj.verbose = message.verbose - } - return obj - }, - - create, I>>(base?: I): Opts { - return Opts.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>(object: I): Opts { - const message = createBaseOpts() - message.maxIdleTimeoutDur = object.maxIdleTimeoutDur ?? '' - message.maxIncomingStreams = object.maxIncomingStreams ?? 0 - message.disableKeepAlive = object.disableKeepAlive ?? false - message.keepAliveDur = object.keepAliveDur ?? '' - message.disableDatagrams = object.disableDatagrams ?? false - message.disablePathMtuDiscovery = object.disablePathMtuDiscovery ?? false - message.verbose = object.verbose ?? false - return message - }, -} - -type Builtin = - | Date - | Function - | Uint8Array - | string - | number - | boolean - | undefined - -export type DeepPartial = T extends Builtin - ? T - : T extends Long - ? string | number | Long - : T extends globalThis.Array - ? globalThis.Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends { $case: string } - ? { [K in keyof Omit]?: DeepPartial } & { - $case: T['$case'] - } - : T extends {} - ? { [K in keyof T]?: DeepPartial } - : Partial - -type KeysOfUnion = T extends T ? keyof T : never -export type Exact = P extends Builtin - ? P - : P & { [K in keyof P]: Exact } & { - [K in Exclude>]: never - } - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any - _m0.configure() -} - -function isSet(value: any): boolean { - return value !== null && value !== undefined -} diff --git a/transport/common/quic/quic_pb.ts b/transport/common/quic/quic_pb.ts new file mode 100644 index 00000000..41a093c6 --- /dev/null +++ b/transport/common/quic/quic_pb.ts @@ -0,0 +1,153 @@ +// @generated by protoc-gen-es v1.8.0 with parameter "target=ts,ts_nocheck=false" +// @generated from file github.com/aperturerobotics/bifrost/transport/common/quic/quic.proto (package transport.quic, syntax proto3) +/* eslint-disable */ + +import type { + BinaryReadOptions, + FieldList, + JsonReadOptions, + JsonValue, + PartialMessage, + PlainMessage, +} from '@bufbuild/protobuf' +import { Message, proto3 } from '@bufbuild/protobuf' + +/** + * @generated from message transport.quic.Opts + */ +export class Opts extends Message { + /** + * MaxIdleTimeoutDur is the duration of idle after which conn is closed. + * + * Defaults to 10s. + * + * @generated from field: string max_idle_timeout_dur = 1; + */ + maxIdleTimeoutDur = '' + + /** + * MaxIncomingStreams is the maximum number of concurrent bidirectional + * streams that a peer is allowed to open. + * + * If unset or negative, defaults to 100000. + * + * @generated from field: int32 max_incoming_streams = 2; + */ + maxIncomingStreams = 0 + + /** + * DisableKeepAlive disables the keep alive packets. + * + * + * @generated from field: bool disable_keep_alive = 3; + */ + disableKeepAlive = false + + /** + * KeepAliveDur is the duration between keep-alive pings. + * + * If disable_keep_alive is set, this value is ignored. + * If unset, sets keep-alive to half of MaxIdleTimeout. + * + * @generated from field: string keep_alive_dur = 7; + */ + keepAliveDur = '' + + /** + * DisableDatagrams disables the unreliable datagrams feature. + * Both peers must support it for it to be enabled, regardless of this flag. + * + * @generated from field: bool disable_datagrams = 4; + */ + disableDatagrams = false + + /** + * DisablePathMtuDiscovery disables sending packets to discover max packet size. + * + * @generated from field: bool disable_path_mtu_discovery = 5; + */ + disablePathMtuDiscovery = false + + /** + * Verbose indicates to use verbose logging. + * Note: this is VERY verbose, logs every packet sent. + * + * @generated from field: bool verbose = 6; + */ + verbose = false + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'transport.quic.Opts' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { + no: 1, + name: 'max_idle_timeout_dur', + kind: 'scalar', + T: 9 /* ScalarType.STRING */, + }, + { + no: 2, + name: 'max_incoming_streams', + kind: 'scalar', + T: 5 /* ScalarType.INT32 */, + }, + { + no: 3, + name: 'disable_keep_alive', + kind: 'scalar', + T: 8 /* ScalarType.BOOL */, + }, + { + no: 7, + name: 'keep_alive_dur', + kind: 'scalar', + T: 9 /* ScalarType.STRING */, + }, + { + no: 4, + name: 'disable_datagrams', + kind: 'scalar', + T: 8 /* ScalarType.BOOL */, + }, + { + no: 5, + name: 'disable_path_mtu_discovery', + kind: 'scalar', + T: 8 /* ScalarType.BOOL */, + }, + { no: 6, name: 'verbose', kind: 'scalar', T: 8 /* ScalarType.BOOL */ }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): Opts { + return new Opts().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): Opts { + return new Opts().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): Opts { + return new Opts().fromJsonString(jsonString, options) + } + + static equals( + a: Opts | PlainMessage | undefined, + b: Opts | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(Opts, a, b) + } +} diff --git a/transport/common/quic/quic_vtproto.pb.go b/transport/common/quic/quic_vtproto.pb.go deleted file mode 100644 index bd08a5ed..00000000 --- a/transport/common/quic/quic_vtproto.pb.go +++ /dev/null @@ -1,421 +0,0 @@ -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// protoc-gen-go-vtproto version: v0.6.0 -// source: github.com/aperturerobotics/bifrost/transport/common/quic/quic.proto - -package transport_quic - -import ( - fmt "fmt" - io "io" - - protohelpers "github.com/planetscale/vtprotobuf/protohelpers" - proto "google.golang.org/protobuf/proto" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) -) - -func (m *Opts) CloneVT() *Opts { - if m == nil { - return (*Opts)(nil) - } - r := new(Opts) - r.MaxIdleTimeoutDur = m.MaxIdleTimeoutDur - r.MaxIncomingStreams = m.MaxIncomingStreams - r.DisableKeepAlive = m.DisableKeepAlive - r.KeepAliveDur = m.KeepAliveDur - r.DisableDatagrams = m.DisableDatagrams - r.DisablePathMtuDiscovery = m.DisablePathMtuDiscovery - r.Verbose = m.Verbose - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Opts) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (this *Opts) EqualVT(that *Opts) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.MaxIdleTimeoutDur != that.MaxIdleTimeoutDur { - return false - } - if this.MaxIncomingStreams != that.MaxIncomingStreams { - return false - } - if this.DisableKeepAlive != that.DisableKeepAlive { - return false - } - if this.DisableDatagrams != that.DisableDatagrams { - return false - } - if this.DisablePathMtuDiscovery != that.DisablePathMtuDiscovery { - return false - } - if this.Verbose != that.Verbose { - return false - } - if this.KeepAliveDur != that.KeepAliveDur { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Opts) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Opts) - if !ok { - return false - } - return this.EqualVT(that) -} -func (m *Opts) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Opts) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Opts) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.KeepAliveDur) > 0 { - i -= len(m.KeepAliveDur) - copy(dAtA[i:], m.KeepAliveDur) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.KeepAliveDur))) - i-- - dAtA[i] = 0x3a - } - if m.Verbose { - i-- - if m.Verbose { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x30 - } - if m.DisablePathMtuDiscovery { - i-- - if m.DisablePathMtuDiscovery { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x28 - } - if m.DisableDatagrams { - i-- - if m.DisableDatagrams { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x20 - } - if m.DisableKeepAlive { - i-- - if m.DisableKeepAlive { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x18 - } - if m.MaxIncomingStreams != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.MaxIncomingStreams)) - i-- - dAtA[i] = 0x10 - } - if len(m.MaxIdleTimeoutDur) > 0 { - i -= len(m.MaxIdleTimeoutDur) - copy(dAtA[i:], m.MaxIdleTimeoutDur) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.MaxIdleTimeoutDur))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Opts) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.MaxIdleTimeoutDur) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.MaxIncomingStreams != 0 { - n += 1 + protohelpers.SizeOfVarint(uint64(m.MaxIncomingStreams)) - } - if m.DisableKeepAlive { - n += 2 - } - if m.DisableDatagrams { - n += 2 - } - if m.DisablePathMtuDiscovery { - n += 2 - } - if m.Verbose { - n += 2 - } - l = len(m.KeepAliveDur) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *Opts) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Opts: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Opts: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxIdleTimeoutDur", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.MaxIdleTimeoutDur = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxIncomingStreams", wireType) - } - m.MaxIncomingStreams = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MaxIncomingStreams |= int32(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field DisableKeepAlive", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.DisableKeepAlive = bool(v != 0) - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field DisableDatagrams", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.DisableDatagrams = bool(v != 0) - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field DisablePathMtuDiscovery", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.DisablePathMtuDiscovery = bool(v != 0) - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Verbose", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Verbose = bool(v != 0) - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field KeepAliveDur", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.KeepAliveDur = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} diff --git a/transport/controller/controller.pb.go b/transport/controller/controller.pb.go index 7a3ca307..c9153d94 100644 --- a/transport/controller/controller.pb.go +++ b/transport/controller/controller.pb.go @@ -1,151 +1,252 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0-devel -// protoc v5.26.1 +// Code generated by protoc-gen-go-lite. DO NOT EDIT. +// protoc-gen-go-lite version: v0.4.5 // source: github.com/aperturerobotics/bifrost/transport/controller/controller.proto package transport_controller import ( - reflect "reflect" - sync "sync" + io "io" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) + protobuf_go_lite "github.com/aperturerobotics/protobuf-go-lite" + json "github.com/aperturerobotics/protobuf-go-lite/json" + errors "github.com/pkg/errors" ) // StreamEstablish is the first message sent by the initiator of a stream. // Prefixed by a uint32 length. // Max size: 100kb type StreamEstablish struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + unknownFields []byte // ProtocolID is the protocol identifier string for the stream. - ProtocolId string `protobuf:"bytes,1,opt,name=protocol_id,json=protocolId,proto3" json:"protocol_id,omitempty"` + ProtocolId string `protobuf:"bytes,1,opt,name=protocol_id,json=protocolId,proto3" json:"protocolId,omitempty"` } func (x *StreamEstablish) Reset() { *x = StreamEstablish{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_transport_controller_controller_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) +} + +func (*StreamEstablish) ProtoMessage() {} + +func (x *StreamEstablish) GetProtocolId() string { + if x != nil { + return x.ProtocolId } + return "" } -func (x *StreamEstablish) String() string { - return protoimpl.X.MessageStringOf(x) +func (m *StreamEstablish) CloneVT() *StreamEstablish { + if m == nil { + return (*StreamEstablish)(nil) + } + r := new(StreamEstablish) + r.ProtocolId = m.ProtocolId + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r } -func (*StreamEstablish) ProtoMessage() {} +func (m *StreamEstablish) CloneMessageVT() any { + return m.CloneVT() +} -func (x *StreamEstablish) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_transport_controller_controller_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms +func (this *StreamEstablish) EqualVT(that *StreamEstablish) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.ProtocolId != that.ProtocolId { + return false } - return mi.MessageOf(x) + return string(this.unknownFields) == string(that.unknownFields) } -// Deprecated: Use StreamEstablish.ProtoReflect.Descriptor instead. -func (*StreamEstablish) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_transport_controller_controller_proto_rawDescGZIP(), []int{0} +func (this *StreamEstablish) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*StreamEstablish) + if !ok { + return false + } + return this.EqualVT(that) } -func (x *StreamEstablish) GetProtocolId() string { - if x != nil { - return x.ProtocolId +// MarshalProtoJSON marshals the StreamEstablish message to JSON. +func (x *StreamEstablish) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return } - return "" + s.WriteObjectStart() + var wroteField bool + if x.ProtocolId != "" || s.HasField("protocolId") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("protocolId") + s.WriteString(x.ProtocolId) + } + s.WriteObjectEnd() } -var File_github_com_aperturerobotics_bifrost_transport_controller_controller_proto protoreflect.FileDescriptor +// MarshalJSON marshals the StreamEstablish to JSON. +func (x *StreamEstablish) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) +} -var file_github_com_aperturerobotics_bifrost_transport_controller_controller_proto_rawDesc = []byte{ - 0x0a, 0x49, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, - 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x62, 0x69, - 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x2f, - 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, - 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x14, 0x74, 0x72, 0x61, - 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, - 0x72, 0x22, 0x32, 0x0a, 0x0f, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x45, 0x73, 0x74, 0x61, 0x62, - 0x6c, 0x69, 0x73, 0x68, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, - 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x63, 0x6f, 0x6c, 0x49, 0x64, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +// UnmarshalProtoJSON unmarshals the StreamEstablish message from JSON. +func (x *StreamEstablish) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { + return + } + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "protocol_id", "protocolId": + s.AddField("protocol_id") + x.ProtocolId = s.ReadString() + } + }) } -var ( - file_github_com_aperturerobotics_bifrost_transport_controller_controller_proto_rawDescOnce sync.Once - file_github_com_aperturerobotics_bifrost_transport_controller_controller_proto_rawDescData = file_github_com_aperturerobotics_bifrost_transport_controller_controller_proto_rawDesc -) +// UnmarshalJSON unmarshals the StreamEstablish from JSON. +func (x *StreamEstablish) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} -func file_github_com_aperturerobotics_bifrost_transport_controller_controller_proto_rawDescGZIP() []byte { - file_github_com_aperturerobotics_bifrost_transport_controller_controller_proto_rawDescOnce.Do(func() { - file_github_com_aperturerobotics_bifrost_transport_controller_controller_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_aperturerobotics_bifrost_transport_controller_controller_proto_rawDescData) - }) - return file_github_com_aperturerobotics_bifrost_transport_controller_controller_proto_rawDescData +func (m *StreamEstablish) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil } -var file_github_com_aperturerobotics_bifrost_transport_controller_controller_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_github_com_aperturerobotics_bifrost_transport_controller_controller_proto_goTypes = []interface{}{ - (*StreamEstablish)(nil), // 0: transport.controller.StreamEstablish +func (m *StreamEstablish) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) } -var file_github_com_aperturerobotics_bifrost_transport_controller_controller_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] 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 (m *StreamEstablish) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.ProtocolId) > 0 { + i -= len(m.ProtocolId) + copy(dAtA[i:], m.ProtocolId) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.ProtocolId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } -func init() { file_github_com_aperturerobotics_bifrost_transport_controller_controller_proto_init() } -func file_github_com_aperturerobotics_bifrost_transport_controller_controller_proto_init() { - if File_github_com_aperturerobotics_bifrost_transport_controller_controller_proto != nil { - return +func (m *StreamEstablish) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ProtocolId) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) } - if !protoimpl.UnsafeEnabled { - file_github_com_aperturerobotics_bifrost_transport_controller_controller_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StreamEstablish); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil + n += len(m.unknownFields) + return n +} + +func (m *StreamEstablish) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: StreamEstablish: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: StreamEstablish: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field ProtocolId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ProtocolId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy } } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_github_com_aperturerobotics_bifrost_transport_controller_controller_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_github_com_aperturerobotics_bifrost_transport_controller_controller_proto_goTypes, - DependencyIndexes: file_github_com_aperturerobotics_bifrost_transport_controller_controller_proto_depIdxs, - MessageInfos: file_github_com_aperturerobotics_bifrost_transport_controller_controller_proto_msgTypes, - }.Build() - File_github_com_aperturerobotics_bifrost_transport_controller_controller_proto = out.File - file_github_com_aperturerobotics_bifrost_transport_controller_controller_proto_rawDesc = nil - file_github_com_aperturerobotics_bifrost_transport_controller_controller_proto_goTypes = nil - file_github_com_aperturerobotics_bifrost_transport_controller_controller_proto_depIdxs = nil + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil } diff --git a/transport/controller/controller.pb.ts b/transport/controller/controller.pb.ts deleted file mode 100644 index c69d409e..00000000 --- a/transport/controller/controller.pb.ts +++ /dev/null @@ -1,161 +0,0 @@ -/* eslint-disable */ -import Long from 'long' -import _m0 from 'protobufjs/minimal.js' - -export const protobufPackage = 'transport.controller' - -/** - * StreamEstablish is the first message sent by the initiator of a stream. - * Prefixed by a uint32 length. - * Max size: 100kb - */ -export interface StreamEstablish { - /** ProtocolID is the protocol identifier string for the stream. */ - protocolId: string -} - -function createBaseStreamEstablish(): StreamEstablish { - return { protocolId: '' } -} - -export const StreamEstablish = { - encode( - message: StreamEstablish, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.protocolId !== '') { - writer.uint32(10).string(message.protocolId) - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): StreamEstablish { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseStreamEstablish() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break - } - - message.protocolId = reader.string() - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [StreamEstablish.encode(p).finish()] - } - } else { - yield* [StreamEstablish.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [StreamEstablish.decode(p)] - } - } else { - yield* [StreamEstablish.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): StreamEstablish { - return { - protocolId: isSet(object.protocolId) - ? globalThis.String(object.protocolId) - : '', - } - }, - - toJSON(message: StreamEstablish): unknown { - const obj: any = {} - if (message.protocolId !== '') { - obj.protocolId = message.protocolId - } - return obj - }, - - create, I>>( - base?: I, - ): StreamEstablish { - return StreamEstablish.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>( - object: I, - ): StreamEstablish { - const message = createBaseStreamEstablish() - message.protocolId = object.protocolId ?? '' - return message - }, -} - -type Builtin = - | Date - | Function - | Uint8Array - | string - | number - | boolean - | undefined - -export type DeepPartial = T extends Builtin - ? T - : T extends Long - ? string | number | Long - : T extends globalThis.Array - ? globalThis.Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends { $case: string } - ? { [K in keyof Omit]?: DeepPartial } & { - $case: T['$case'] - } - : T extends {} - ? { [K in keyof T]?: DeepPartial } - : Partial - -type KeysOfUnion = T extends T ? keyof T : never -export type Exact = P extends Builtin - ? P - : P & { [K in keyof P]: Exact } & { - [K in Exclude>]: never - } - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any - _m0.configure() -} - -function isSet(value: any): boolean { - return value !== null && value !== undefined -} diff --git a/transport/controller/controller_pb.ts b/transport/controller/controller_pb.ts new file mode 100644 index 00000000..bf5fbe93 --- /dev/null +++ b/transport/controller/controller_pb.ts @@ -0,0 +1,73 @@ +// @generated by protoc-gen-es v1.8.0 with parameter "target=ts,ts_nocheck=false" +// @generated from file github.com/aperturerobotics/bifrost/transport/controller/controller.proto (package transport.controller, syntax proto3) +/* eslint-disable */ + +import type { + BinaryReadOptions, + FieldList, + JsonReadOptions, + JsonValue, + PartialMessage, + PlainMessage, +} from '@bufbuild/protobuf' +import { Message, proto3 } from '@bufbuild/protobuf' + +/** + * StreamEstablish is the first message sent by the initiator of a stream. + * Prefixed by a uint32 length. + * Max size: 100kb + * + * @generated from message transport.controller.StreamEstablish + */ +export class StreamEstablish extends Message { + /** + * ProtocolID is the protocol identifier string for the stream. + * + * @generated from field: string protocol_id = 1; + */ + protocolId = '' + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'transport.controller.StreamEstablish' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { + no: 1, + name: 'protocol_id', + kind: 'scalar', + T: 9 /* ScalarType.STRING */, + }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): StreamEstablish { + return new StreamEstablish().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): StreamEstablish { + return new StreamEstablish().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): StreamEstablish { + return new StreamEstablish().fromJsonString(jsonString, options) + } + + static equals( + a: StreamEstablish | PlainMessage | undefined, + b: StreamEstablish | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(StreamEstablish, a, b) + } +} diff --git a/transport/controller/controller_vtproto.pb.go b/transport/controller/controller_vtproto.pb.go deleted file mode 100644 index 87fb136f..00000000 --- a/transport/controller/controller_vtproto.pb.go +++ /dev/null @@ -1,195 +0,0 @@ -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// protoc-gen-go-vtproto version: v0.6.0 -// source: github.com/aperturerobotics/bifrost/transport/controller/controller.proto - -package transport_controller - -import ( - fmt "fmt" - io "io" - - protohelpers "github.com/planetscale/vtprotobuf/protohelpers" - proto "google.golang.org/protobuf/proto" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) -) - -func (m *StreamEstablish) CloneVT() *StreamEstablish { - if m == nil { - return (*StreamEstablish)(nil) - } - r := new(StreamEstablish) - r.ProtocolId = m.ProtocolId - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *StreamEstablish) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (this *StreamEstablish) EqualVT(that *StreamEstablish) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.ProtocolId != that.ProtocolId { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *StreamEstablish) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*StreamEstablish) - if !ok { - return false - } - return this.EqualVT(that) -} -func (m *StreamEstablish) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *StreamEstablish) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *StreamEstablish) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.ProtocolId) > 0 { - i -= len(m.ProtocolId) - copy(dAtA[i:], m.ProtocolId) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.ProtocolId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *StreamEstablish) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ProtocolId) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *StreamEstablish) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: StreamEstablish: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: StreamEstablish: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ProtocolId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ProtocolId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} diff --git a/transport/controller/establish-header.go b/transport/controller/establish-header.go index 6f7462c9..e21aea31 100644 --- a/transport/controller/establish-header.go +++ b/transport/controller/establish-header.go @@ -4,9 +4,8 @@ import ( "io" "github.com/aperturerobotics/bifrost/protocol" + protobuf_go_lite "github.com/aperturerobotics/protobuf-go-lite" "github.com/pkg/errors" - "google.golang.org/protobuf/encoding/protowire" - "google.golang.org/protobuf/proto" ) // NewStreamEstablish constructs a new StreamEstablish message. @@ -17,7 +16,7 @@ func NewStreamEstablish(protocolID protocol.ID) *StreamEstablish { func marshalStreamEstablishHeader(msg *StreamEstablish) []byte { datLen := msg.SizeVT() outBuf := make([]byte, 0, datLen+9) - outBuf = protowire.AppendVarint(outBuf, uint64(datLen)) + outBuf = protobuf_go_lite.AppendVarint(outBuf, uint64(datLen)) prefixLen := len(outBuf) outBuf = outBuf[:len(outBuf)+datLen] msgFinalLen, _ := msg.MarshalToVT(outBuf[prefixLen:]) @@ -48,7 +47,7 @@ func readStreamEstablishHeader(r io.Reader) (*StreamEstablish, error) { } // Read the header length varint - headerLen, headerLenBytes := protowire.ConsumeVarint(b) + headerLen, headerLenBytes := protobuf_go_lite.ConsumeVarint(b) if headerLenBytes <= 0 { return nil, errors.New("invalid stream establish varint prefix") } @@ -74,7 +73,7 @@ func readStreamEstablishHeader(r io.Reader) (*StreamEstablish, error) { // decode stream establish header estHeader := &StreamEstablish{} - if err := proto.Unmarshal(headerBuf, estHeader); err != nil { + if err := estHeader.UnmarshalVT(headerBuf); err != nil { return nil, err } diff --git a/transport/inproc/inproc.pb.go b/transport/inproc/inproc.pb.go index c39400d3..190758ce 100644 --- a/transport/inproc/inproc.pb.go +++ b/transport/inproc/inproc.pb.go @@ -1,75 +1,37 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0-devel -// protoc v5.26.1 +// Code generated by protoc-gen-go-lite. DO NOT EDIT. +// protoc-gen-go-lite version: v0.4.5 // source: github.com/aperturerobotics/bifrost/transport/inproc/inproc.proto package inproc import ( - reflect "reflect" - sync "sync" + io "io" dialer "github.com/aperturerobotics/bifrost/transport/common/dialer" pconn "github.com/aperturerobotics/bifrost/transport/common/pconn" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) + protobuf_go_lite "github.com/aperturerobotics/protobuf-go-lite" + json "github.com/aperturerobotics/protobuf-go-lite/json" + errors "github.com/pkg/errors" ) // Config is the configuration for the inproc testing transport. type Config struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + unknownFields []byte // TransportPeerID sets the peer ID to attach the transport to. // If unset, attaches to any running peer with a private key. - TransportPeerId string `protobuf:"bytes,1,opt,name=transport_peer_id,json=transportPeerId,proto3" json:"transport_peer_id,omitempty"` + TransportPeerId string `protobuf:"bytes,1,opt,name=transport_peer_id,json=transportPeerId,proto3" json:"transportPeerId,omitempty"` // PacketOpts are options to set on the packet connection. - PacketOpts *pconn.Opts `protobuf:"bytes,2,opt,name=packet_opts,json=packetOpts,proto3" json:"packet_opts,omitempty"` + PacketOpts *pconn.Opts `protobuf:"bytes,2,opt,name=packet_opts,json=packetOpts,proto3" json:"packetOpts,omitempty"` // Dialers maps peer IDs to dialers. Dialers map[string]*dialer.DialerOpts `protobuf:"bytes,3,rep,name=dialers,proto3" json:"dialers,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } func (x *Config) Reset() { *x = Config{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_transport_inproc_inproc_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Config) String() string { - return protoimpl.X.MessageStringOf(x) } func (*Config) ProtoMessage() {} -func (x *Config) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_transport_inproc_inproc_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 Config.ProtoReflect.Descriptor instead. -func (*Config) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_transport_inproc_inproc_proto_rawDescGZIP(), []int{0} -} - func (x *Config) GetTransportPeerId() string { if x != nil { return x.TransportPeerId @@ -91,106 +53,582 @@ func (x *Config) GetDialers() map[string]*dialer.DialerOpts { return nil } -var File_github_com_aperturerobotics_bifrost_transport_inproc_inproc_proto protoreflect.FileDescriptor - -var file_github_com_aperturerobotics_bifrost_transport_inproc_inproc_proto_rawDesc = []byte{ - 0x0a, 0x41, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, - 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x62, 0x69, - 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x2f, - 0x69, 0x6e, 0x70, 0x72, 0x6f, 0x63, 0x2f, 0x69, 0x6e, 0x70, 0x72, 0x6f, 0x63, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x69, 0x6e, 0x70, 0x72, 0x6f, 0x63, 0x1a, 0x48, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, - 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x62, 0x69, 0x66, 0x72, 0x6f, 0x73, 0x74, - 0x2f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, - 0x6e, 0x2f, 0x64, 0x69, 0x61, 0x6c, 0x65, 0x72, 0x2f, 0x64, 0x69, 0x61, 0x6c, 0x65, 0x72, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x46, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, - 0x6d, 0x2f, 0x61, 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, - 0x63, 0x73, 0x2f, 0x62, 0x69, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2f, 0x74, 0x72, 0x61, 0x6e, 0x73, - 0x70, 0x6f, 0x72, 0x74, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x63, 0x6f, 0x6e, - 0x6e, 0x2f, 0x70, 0x63, 0x6f, 0x6e, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe9, 0x01, - 0x0a, 0x06, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x2a, 0x0a, 0x11, 0x74, 0x72, 0x61, 0x6e, - 0x73, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x70, 0x65, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x0f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x50, 0x65, - 0x65, 0x72, 0x49, 0x64, 0x12, 0x2c, 0x0a, 0x0b, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x5f, 0x6f, - 0x70, 0x74, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x70, 0x63, 0x6f, 0x6e, - 0x6e, 0x2e, 0x4f, 0x70, 0x74, 0x73, 0x52, 0x0a, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x4f, 0x70, - 0x74, 0x73, 0x12, 0x35, 0x0a, 0x07, 0x64, 0x69, 0x61, 0x6c, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x69, 0x6e, 0x70, 0x72, 0x6f, 0x63, 0x2e, 0x43, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x2e, 0x44, 0x69, 0x61, 0x6c, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, - 0x52, 0x07, 0x64, 0x69, 0x61, 0x6c, 0x65, 0x72, 0x73, 0x1a, 0x4e, 0x0a, 0x0c, 0x44, 0x69, 0x61, - 0x6c, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x28, 0x0a, 0x05, 0x76, - 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x64, 0x69, 0x61, - 0x6c, 0x65, 0x72, 0x2e, 0x44, 0x69, 0x61, 0x6c, 0x65, 0x72, 0x4f, 0x70, 0x74, 0x73, 0x52, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, -} - -var ( - file_github_com_aperturerobotics_bifrost_transport_inproc_inproc_proto_rawDescOnce sync.Once - file_github_com_aperturerobotics_bifrost_transport_inproc_inproc_proto_rawDescData = file_github_com_aperturerobotics_bifrost_transport_inproc_inproc_proto_rawDesc -) +type Config_DialersEntry struct { + unknownFields []byte + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Value *dialer.DialerOpts `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` +} + +func (x *Config_DialersEntry) Reset() { + *x = Config_DialersEntry{} +} + +func (*Config_DialersEntry) ProtoMessage() {} + +func (x *Config_DialersEntry) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +func (x *Config_DialersEntry) GetValue() *dialer.DialerOpts { + if x != nil { + return x.Value + } + return nil +} + +func (m *Config) CloneVT() *Config { + if m == nil { + return (*Config)(nil) + } + r := new(Config) + r.TransportPeerId = m.TransportPeerId + if rhs := m.PacketOpts; rhs != nil { + r.PacketOpts = rhs.CloneVT() + } + if rhs := m.Dialers; rhs != nil { + tmpContainer := make(map[string]*dialer.DialerOpts, len(rhs)) + for k, v := range rhs { + tmpContainer[k] = v.CloneVT() + } + r.Dialers = tmpContainer + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *Config) CloneMessageVT() any { + return m.CloneVT() +} + +func (this *Config) EqualVT(that *Config) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.TransportPeerId != that.TransportPeerId { + return false + } + if !this.PacketOpts.EqualVT(that.PacketOpts) { + return false + } + if len(this.Dialers) != len(that.Dialers) { + return false + } + for i, vx := range this.Dialers { + vy, ok := that.Dialers[i] + if !ok { + return false + } + if p, q := vx, vy; p != q { + if p == nil { + p = &dialer.DialerOpts{} + } + if q == nil { + q = &dialer.DialerOpts{} + } + if !p.EqualVT(q) { + return false + } + } + } + return string(this.unknownFields) == string(that.unknownFields) +} -func file_github_com_aperturerobotics_bifrost_transport_inproc_inproc_proto_rawDescGZIP() []byte { - file_github_com_aperturerobotics_bifrost_transport_inproc_inproc_proto_rawDescOnce.Do(func() { - file_github_com_aperturerobotics_bifrost_transport_inproc_inproc_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_aperturerobotics_bifrost_transport_inproc_inproc_proto_rawDescData) +func (this *Config) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*Config) + if !ok { + return false + } + return this.EqualVT(that) +} + +// MarshalProtoJSON marshals the Config_DialersEntry message to JSON. +func (x *Config_DialersEntry) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return + } + s.WriteObjectStart() + var wroteField bool + if x.Key != "" || s.HasField("key") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("key") + s.WriteString(x.Key) + } + if x.Value != nil || s.HasField("value") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("value") + x.Value.MarshalProtoJSON(s.WithField("value")) + } + s.WriteObjectEnd() +} + +// MarshalJSON marshals the Config_DialersEntry to JSON. +func (x *Config_DialersEntry) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) +} + +// UnmarshalProtoJSON unmarshals the Config_DialersEntry message from JSON. +func (x *Config_DialersEntry) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { + return + } + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "key": + s.AddField("key") + x.Key = s.ReadString() + case "value": + if s.ReadNil() { + x.Value = nil + return + } + x.Value = &dialer.DialerOpts{} + x.Value.UnmarshalProtoJSON(s.WithField("value", true)) + } }) - return file_github_com_aperturerobotics_bifrost_transport_inproc_inproc_proto_rawDescData -} - -var file_github_com_aperturerobotics_bifrost_transport_inproc_inproc_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_github_com_aperturerobotics_bifrost_transport_inproc_inproc_proto_goTypes = []interface{}{ - (*Config)(nil), // 0: inproc.Config - nil, // 1: inproc.Config.DialersEntry - (*pconn.Opts)(nil), // 2: pconn.Opts - (*dialer.DialerOpts)(nil), // 3: dialer.DialerOpts -} -var file_github_com_aperturerobotics_bifrost_transport_inproc_inproc_proto_depIdxs = []int32{ - 2, // 0: inproc.Config.packet_opts:type_name -> pconn.Opts - 1, // 1: inproc.Config.dialers:type_name -> inproc.Config.DialersEntry - 3, // 2: inproc.Config.DialersEntry.value:type_name -> dialer.DialerOpts - 3, // [3:3] is the sub-list for method output_type - 3, // [3:3] is the sub-list for method input_type - 3, // [3:3] is the sub-list for extension type_name - 3, // [3:3] is the sub-list for extension extendee - 0, // [0:3] is the sub-list for field type_name -} - -func init() { file_github_com_aperturerobotics_bifrost_transport_inproc_inproc_proto_init() } -func file_github_com_aperturerobotics_bifrost_transport_inproc_inproc_proto_init() { - if File_github_com_aperturerobotics_bifrost_transport_inproc_inproc_proto != nil { +} + +// UnmarshalJSON unmarshals the Config_DialersEntry from JSON. +func (x *Config_DialersEntry) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +// MarshalProtoJSON marshals the Config message to JSON. +func (x *Config) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() return } - if !protoimpl.UnsafeEnabled { - file_github_com_aperturerobotics_bifrost_transport_inproc_inproc_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Config); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil + s.WriteObjectStart() + var wroteField bool + if x.TransportPeerId != "" || s.HasField("transportPeerId") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("transportPeerId") + s.WriteString(x.TransportPeerId) + } + if x.PacketOpts != nil || s.HasField("packetOpts") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("packetOpts") + x.PacketOpts.MarshalProtoJSON(s.WithField("packetOpts")) + } + if x.Dialers != nil || s.HasField("dialers") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("dialers") + s.WriteObjectStart() + var wroteElement bool + for k, v := range x.Dialers { + s.WriteMoreIf(&wroteElement) + s.WriteObjectStringField(k) + v.MarshalProtoJSON(s.WithField("dialers")) + } + s.WriteObjectEnd() + } + s.WriteObjectEnd() +} + +// MarshalJSON marshals the Config to JSON. +func (x *Config) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) +} + +// UnmarshalProtoJSON unmarshals the Config message from JSON. +func (x *Config) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { + return + } + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "transport_peer_id", "transportPeerId": + s.AddField("transport_peer_id") + x.TransportPeerId = s.ReadString() + case "packet_opts", "packetOpts": + if s.ReadNil() { + x.PacketOpts = nil + return } + x.PacketOpts = &pconn.Opts{} + x.PacketOpts.UnmarshalProtoJSON(s.WithField("packet_opts", true)) + case "dialers": + s.AddField("dialers") + if s.ReadNil() { + x.Dialers = nil + return + } + x.Dialers = make(map[string]*dialer.DialerOpts) + s.ReadStringMap(func(key string) { + var v dialer.DialerOpts + v.UnmarshalProtoJSON(s) + x.Dialers[key] = &v + }) } + }) +} + +// UnmarshalJSON unmarshals the Config from JSON. +func (x *Config) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +func (m *Config) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_github_com_aperturerobotics_bifrost_transport_inproc_inproc_proto_rawDesc, - NumEnums: 0, - NumMessages: 2, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_github_com_aperturerobotics_bifrost_transport_inproc_inproc_proto_goTypes, - DependencyIndexes: file_github_com_aperturerobotics_bifrost_transport_inproc_inproc_proto_depIdxs, - MessageInfos: file_github_com_aperturerobotics_bifrost_transport_inproc_inproc_proto_msgTypes, - }.Build() - File_github_com_aperturerobotics_bifrost_transport_inproc_inproc_proto = out.File - file_github_com_aperturerobotics_bifrost_transport_inproc_inproc_proto_rawDesc = nil - file_github_com_aperturerobotics_bifrost_transport_inproc_inproc_proto_goTypes = nil - file_github_com_aperturerobotics_bifrost_transport_inproc_inproc_proto_depIdxs = nil + return dAtA[:n], nil +} + +func (m *Config) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.Dialers) > 0 { + for k := range m.Dialers { + v := m.Dialers[k] + baseI := i + size, err := v.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x12 + i -= len(k) + copy(dAtA[i:], k) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(k))) + i-- + dAtA[i] = 0xa + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0x1a + } + } + if m.PacketOpts != nil { + size, err := m.PacketOpts.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x12 + } + if len(m.TransportPeerId) > 0 { + i -= len(m.TransportPeerId) + copy(dAtA[i:], m.TransportPeerId) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.TransportPeerId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Config) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.TransportPeerId) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + if m.PacketOpts != nil { + l = m.PacketOpts.SizeVT() + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + if len(m.Dialers) > 0 { + for k, v := range m.Dialers { + _ = k + _ = v + l = 0 + if v != nil { + l = v.SizeVT() + } + l += 1 + protobuf_go_lite.SizeOfVarint(uint64(l)) + mapEntrySize := 1 + len(k) + protobuf_go_lite.SizeOfVarint(uint64(len(k))) + l + n += mapEntrySize + 1 + protobuf_go_lite.SizeOfVarint(uint64(mapEntrySize)) + } + } + n += len(m.unknownFields) + return n +} + +func (m *Config) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: Config: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: Config: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field TransportPeerId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TransportPeerId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field PacketOpts", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.PacketOpts == nil { + m.PacketOpts = &pconn.Opts{} + } + if err := m.PacketOpts.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field Dialers", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Dialers == nil { + m.Dialers = make(map[string]*dialer.DialerOpts) + } + var mapkey string + var mapvalue *dialer.DialerOpts + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var mapmsglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapmsglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if mapmsglen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postmsgIndex := iNdEx + mapmsglen + if postmsgIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postmsgIndex > l { + return io.ErrUnexpectedEOF + } + mapvalue = &dialer.DialerOpts{} + if err := mapvalue.UnmarshalVT(dAtA[iNdEx:postmsgIndex]); err != nil { + return err + } + iNdEx = postmsgIndex + } else { + iNdEx = entryPreIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.Dialers[mapkey] = mapvalue + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil } diff --git a/transport/inproc/inproc.pb.ts b/transport/inproc/inproc.pb.ts deleted file mode 100644 index 14f2d4a2..00000000 --- a/transport/inproc/inproc.pb.ts +++ /dev/null @@ -1,354 +0,0 @@ -/* eslint-disable */ -import Long from 'long' -import _m0 from 'protobufjs/minimal.js' -import { DialerOpts } from '../common/dialer/dialer.pb.js' -import { Opts } from '../common/pconn/pconn.pb.js' - -export const protobufPackage = 'inproc' - -/** Config is the configuration for the inproc testing transport. */ -export interface Config { - /** - * TransportPeerID sets the peer ID to attach the transport to. - * If unset, attaches to any running peer with a private key. - */ - transportPeerId: string - /** PacketOpts are options to set on the packet connection. */ - packetOpts: Opts | undefined - /** Dialers maps peer IDs to dialers. */ - dialers: { [key: string]: DialerOpts } -} - -export interface Config_DialersEntry { - key: string - value: DialerOpts | undefined -} - -function createBaseConfig(): Config { - return { transportPeerId: '', packetOpts: undefined, dialers: {} } -} - -export const Config = { - encode( - message: Config, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.transportPeerId !== '') { - writer.uint32(10).string(message.transportPeerId) - } - if (message.packetOpts !== undefined) { - Opts.encode(message.packetOpts, writer.uint32(18).fork()).ldelim() - } - Object.entries(message.dialers).forEach(([key, value]) => { - Config_DialersEntry.encode( - { key: key as any, value }, - writer.uint32(26).fork(), - ).ldelim() - }) - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Config { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseConfig() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break - } - - message.transportPeerId = reader.string() - continue - case 2: - if (tag !== 18) { - break - } - - message.packetOpts = Opts.decode(reader, reader.uint32()) - continue - case 3: - if (tag !== 26) { - break - } - - const entry3 = Config_DialersEntry.decode(reader, reader.uint32()) - if (entry3.value !== undefined) { - message.dialers[entry3.key] = entry3.value - } - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: AsyncIterable | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config.encode(p).finish()] - } - } else { - yield* [Config.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config.decode(p)] - } - } else { - yield* [Config.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): Config { - return { - transportPeerId: isSet(object.transportPeerId) - ? globalThis.String(object.transportPeerId) - : '', - packetOpts: isSet(object.packetOpts) - ? Opts.fromJSON(object.packetOpts) - : undefined, - dialers: isObject(object.dialers) - ? Object.entries(object.dialers).reduce<{ [key: string]: DialerOpts }>( - (acc, [key, value]) => { - acc[key] = DialerOpts.fromJSON(value) - return acc - }, - {}, - ) - : {}, - } - }, - - toJSON(message: Config): unknown { - const obj: any = {} - if (message.transportPeerId !== '') { - obj.transportPeerId = message.transportPeerId - } - if (message.packetOpts !== undefined) { - obj.packetOpts = Opts.toJSON(message.packetOpts) - } - if (message.dialers) { - const entries = Object.entries(message.dialers) - if (entries.length > 0) { - obj.dialers = {} - entries.forEach(([k, v]) => { - obj.dialers[k] = DialerOpts.toJSON(v) - }) - } - } - return obj - }, - - create, I>>(base?: I): Config { - return Config.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>(object: I): Config { - const message = createBaseConfig() - message.transportPeerId = object.transportPeerId ?? '' - message.packetOpts = - object.packetOpts !== undefined && object.packetOpts !== null - ? Opts.fromPartial(object.packetOpts) - : undefined - message.dialers = Object.entries(object.dialers ?? {}).reduce<{ - [key: string]: DialerOpts - }>((acc, [key, value]) => { - if (value !== undefined) { - acc[key] = DialerOpts.fromPartial(value) - } - return acc - }, {}) - return message - }, -} - -function createBaseConfig_DialersEntry(): Config_DialersEntry { - return { key: '', value: undefined } -} - -export const Config_DialersEntry = { - encode( - message: Config_DialersEntry, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.key !== '') { - writer.uint32(10).string(message.key) - } - if (message.value !== undefined) { - DialerOpts.encode(message.value, writer.uint32(18).fork()).ldelim() - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Config_DialersEntry { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseConfig_DialersEntry() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break - } - - message.key = reader.string() - continue - case 2: - if (tag !== 18) { - break - } - - message.value = DialerOpts.decode(reader, reader.uint32()) - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config_DialersEntry.encode(p).finish()] - } - } else { - yield* [Config_DialersEntry.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config_DialersEntry.decode(p)] - } - } else { - yield* [Config_DialersEntry.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): Config_DialersEntry { - return { - key: isSet(object.key) ? globalThis.String(object.key) : '', - value: isSet(object.value) - ? DialerOpts.fromJSON(object.value) - : undefined, - } - }, - - toJSON(message: Config_DialersEntry): unknown { - const obj: any = {} - if (message.key !== '') { - obj.key = message.key - } - if (message.value !== undefined) { - obj.value = DialerOpts.toJSON(message.value) - } - return obj - }, - - create, I>>( - base?: I, - ): Config_DialersEntry { - return Config_DialersEntry.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>( - object: I, - ): Config_DialersEntry { - const message = createBaseConfig_DialersEntry() - message.key = object.key ?? '' - message.value = - object.value !== undefined && object.value !== null - ? DialerOpts.fromPartial(object.value) - : undefined - return message - }, -} - -type Builtin = - | Date - | Function - | Uint8Array - | string - | number - | boolean - | undefined - -export type DeepPartial = T extends Builtin - ? T - : T extends Long - ? string | number | Long - : T extends globalThis.Array - ? globalThis.Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends { $case: string } - ? { [K in keyof Omit]?: DeepPartial } & { - $case: T['$case'] - } - : T extends {} - ? { [K in keyof T]?: DeepPartial } - : Partial - -type KeysOfUnion = T extends T ? keyof T : never -export type Exact = P extends Builtin - ? P - : P & { [K in keyof P]: Exact } & { - [K in Exclude>]: never - } - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any - _m0.configure() -} - -function isObject(value: any): boolean { - return typeof value === 'object' && value !== null -} - -function isSet(value: any): boolean { - return value !== null && value !== undefined -} diff --git a/transport/inproc/inproc_pb.ts b/transport/inproc/inproc_pb.ts new file mode 100644 index 00000000..aaa1d965 --- /dev/null +++ b/transport/inproc/inproc_pb.ts @@ -0,0 +1,96 @@ +// @generated by protoc-gen-es v1.8.0 with parameter "target=ts,ts_nocheck=false" +// @generated from file github.com/aperturerobotics/bifrost/transport/inproc/inproc.proto (package inproc, syntax proto3) +/* eslint-disable */ + +import type { + BinaryReadOptions, + FieldList, + JsonReadOptions, + JsonValue, + PartialMessage, + PlainMessage, +} from '@bufbuild/protobuf' +import { Message, proto3 } from '@bufbuild/protobuf' +import { Opts } from '../common/pconn/pconn_pb.js' +import { DialerOpts } from '../common/dialer/dialer_pb.js' + +/** + * Config is the configuration for the inproc testing transport. + * + * @generated from message inproc.Config + */ +export class Config extends Message { + /** + * TransportPeerID sets the peer ID to attach the transport to. + * If unset, attaches to any running peer with a private key. + * + * @generated from field: string transport_peer_id = 1; + */ + transportPeerId = '' + + /** + * PacketOpts are options to set on the packet connection. + * + * @generated from field: pconn.Opts packet_opts = 2; + */ + packetOpts?: Opts + + /** + * Dialers maps peer IDs to dialers. + * + * @generated from field: map dialers = 3; + */ + dialers: { [key: string]: DialerOpts } = {} + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'inproc.Config' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { + no: 1, + name: 'transport_peer_id', + kind: 'scalar', + T: 9 /* ScalarType.STRING */, + }, + { no: 2, name: 'packet_opts', kind: 'message', T: Opts }, + { + no: 3, + name: 'dialers', + kind: 'map', + K: 9 /* ScalarType.STRING */, + V: { kind: 'message', T: DialerOpts }, + }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): Config { + return new Config().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): Config { + return new Config().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): Config { + return new Config().fromJsonString(jsonString, options) + } + + static equals( + a: Config | PlainMessage | undefined, + b: Config | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(Config, a, b) + } +} diff --git a/transport/inproc/inproc_vtproto.pb.go b/transport/inproc/inproc_vtproto.pb.go deleted file mode 100644 index 67fb4def..00000000 --- a/transport/inproc/inproc_vtproto.pb.go +++ /dev/null @@ -1,512 +0,0 @@ -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// protoc-gen-go-vtproto version: v0.6.0 -// source: github.com/aperturerobotics/bifrost/transport/inproc/inproc.proto - -package inproc - -import ( - fmt "fmt" - io "io" - - dialer "github.com/aperturerobotics/bifrost/transport/common/dialer" - pconn "github.com/aperturerobotics/bifrost/transport/common/pconn" - protohelpers "github.com/planetscale/vtprotobuf/protohelpers" - proto "google.golang.org/protobuf/proto" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) -) - -func (m *Config) CloneVT() *Config { - if m == nil { - return (*Config)(nil) - } - r := new(Config) - r.TransportPeerId = m.TransportPeerId - if rhs := m.PacketOpts; rhs != nil { - if vtpb, ok := interface{}(rhs).(interface{ CloneVT() *pconn.Opts }); ok { - r.PacketOpts = vtpb.CloneVT() - } else { - r.PacketOpts = proto.Clone(rhs).(*pconn.Opts) - } - } - if rhs := m.Dialers; rhs != nil { - tmpContainer := make(map[string]*dialer.DialerOpts, len(rhs)) - for k, v := range rhs { - if vtpb, ok := interface{}(v).(interface{ CloneVT() *dialer.DialerOpts }); ok { - tmpContainer[k] = vtpb.CloneVT() - } else { - tmpContainer[k] = proto.Clone(v).(*dialer.DialerOpts) - } - } - r.Dialers = tmpContainer - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Config) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (this *Config) EqualVT(that *Config) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.TransportPeerId != that.TransportPeerId { - return false - } - if equal, ok := interface{}(this.PacketOpts).(interface{ EqualVT(*pconn.Opts) bool }); ok { - if !equal.EqualVT(that.PacketOpts) { - return false - } - } else if !proto.Equal(this.PacketOpts, that.PacketOpts) { - return false - } - if len(this.Dialers) != len(that.Dialers) { - return false - } - for i, vx := range this.Dialers { - vy, ok := that.Dialers[i] - if !ok { - return false - } - if p, q := vx, vy; p != q { - if p == nil { - p = &dialer.DialerOpts{} - } - if q == nil { - q = &dialer.DialerOpts{} - } - if equal, ok := interface{}(p).(interface{ EqualVT(*dialer.DialerOpts) bool }); ok { - if !equal.EqualVT(q) { - return false - } - } else if !proto.Equal(p, q) { - return false - } - } - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Config) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Config) - if !ok { - return false - } - return this.EqualVT(that) -} -func (m *Config) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Config) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Dialers) > 0 { - for k := range m.Dialers { - v := m.Dialers[k] - baseI := i - if vtmsg, ok := interface{}(v).(interface { - MarshalToSizedBufferVT([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(v) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0x12 - i -= len(k) - copy(dAtA[i:], k) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(k))) - i-- - dAtA[i] = 0xa - i = protohelpers.EncodeVarint(dAtA, i, uint64(baseI-i)) - i-- - dAtA[i] = 0x1a - } - } - if m.PacketOpts != nil { - if vtmsg, ok := interface{}(m.PacketOpts).(interface { - MarshalToSizedBufferVT([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.PacketOpts) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0x12 - } - if len(m.TransportPeerId) > 0 { - i -= len(m.TransportPeerId) - copy(dAtA[i:], m.TransportPeerId) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.TransportPeerId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Config) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.TransportPeerId) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.PacketOpts != nil { - if size, ok := interface{}(m.PacketOpts).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.PacketOpts) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if len(m.Dialers) > 0 { - for k, v := range m.Dialers { - _ = k - _ = v - l = 0 - if v != nil { - if size, ok := interface{}(v).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(v) - } - } - l += 1 + protohelpers.SizeOfVarint(uint64(l)) - mapEntrySize := 1 + len(k) + protohelpers.SizeOfVarint(uint64(len(k))) + l - n += mapEntrySize + 1 + protohelpers.SizeOfVarint(uint64(mapEntrySize)) - } - } - n += len(m.unknownFields) - return n -} - -func (m *Config) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Config: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Config: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TransportPeerId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TransportPeerId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PacketOpts", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.PacketOpts == nil { - m.PacketOpts = &pconn.Opts{} - } - if unmarshal, ok := interface{}(m.PacketOpts).(interface { - UnmarshalVT([]byte) error - }); ok { - if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - } else { - if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.PacketOpts); err != nil { - return err - } - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Dialers", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Dialers == nil { - m.Dialers = make(map[string]*dialer.DialerOpts) - } - var mapkey string - var mapvalue *dialer.DialerOpts - for iNdEx < postIndex { - entryPreIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - if fieldNum == 1 { - var stringLenmapkey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapkey |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapkey := int(stringLenmapkey) - if intStringLenmapkey < 0 { - return protohelpers.ErrInvalidLength - } - postStringIndexmapkey := iNdEx + intStringLenmapkey - if postStringIndexmapkey < 0 { - return protohelpers.ErrInvalidLength - } - if postStringIndexmapkey > l { - return io.ErrUnexpectedEOF - } - mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) - iNdEx = postStringIndexmapkey - } else if fieldNum == 2 { - var mapmsglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - mapmsglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if mapmsglen < 0 { - return protohelpers.ErrInvalidLength - } - postmsgIndex := iNdEx + mapmsglen - if postmsgIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postmsgIndex > l { - return io.ErrUnexpectedEOF - } - mapvalue = &dialer.DialerOpts{} - if unmarshal, ok := interface{}(mapvalue).(interface { - UnmarshalVT([]byte) error - }); ok { - if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postmsgIndex]); err != nil { - return err - } - } else { - if err := proto.Unmarshal(dAtA[iNdEx:postmsgIndex], mapvalue); err != nil { - return err - } - } - iNdEx = postmsgIndex - } else { - iNdEx = entryPreIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > postIndex { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - m.Dialers[mapkey] = mapvalue - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} diff --git a/transport/udp/udp.pb.go b/transport/udp/udp.pb.go index 726134a6..2ef9f7a9 100644 --- a/transport/udp/udp.pb.go +++ b/transport/udp/udp.pb.go @@ -1,78 +1,40 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0-devel -// protoc v5.26.1 +// Code generated by protoc-gen-go-lite. DO NOT EDIT. +// protoc-gen-go-lite version: v0.4.5 // source: github.com/aperturerobotics/bifrost/transport/udp/udp.proto package udp import ( - reflect "reflect" - sync "sync" + io "io" dialer "github.com/aperturerobotics/bifrost/transport/common/dialer" pconn "github.com/aperturerobotics/bifrost/transport/common/pconn" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) + protobuf_go_lite "github.com/aperturerobotics/protobuf-go-lite" + json "github.com/aperturerobotics/protobuf-go-lite/json" + errors "github.com/pkg/errors" ) // Config is the configuration for the udp transport. type Config struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + unknownFields []byte // TransportPeerID sets the peer ID to attach the transport to. // If unset, attaches to any running peer with a private key. - TransportPeerId string `protobuf:"bytes,1,opt,name=transport_peer_id,json=transportPeerId,proto3" json:"transport_peer_id,omitempty"` + TransportPeerId string `protobuf:"bytes,1,opt,name=transport_peer_id,json=transportPeerId,proto3" json:"transportPeerId,omitempty"` // ListenAddr contains the address to listen on. // Has no effect in the browser. - ListenAddr string `protobuf:"bytes,2,opt,name=listen_addr,json=listenAddr,proto3" json:"listen_addr,omitempty"` + ListenAddr string `protobuf:"bytes,2,opt,name=listen_addr,json=listenAddr,proto3" json:"listenAddr,omitempty"` // PacketOpts are options to set on the packet connection. - PacketOpts *pconn.Opts `protobuf:"bytes,4,opt,name=packet_opts,json=packetOpts,proto3" json:"packet_opts,omitempty"` + PacketOpts *pconn.Opts `protobuf:"bytes,4,opt,name=packet_opts,json=packetOpts,proto3" json:"packetOpts,omitempty"` // Dialers maps peer IDs to dialers. Dialers map[string]*dialer.DialerOpts `protobuf:"bytes,5,rep,name=dialers,proto3" json:"dialers,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } func (x *Config) Reset() { *x = Config{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_transport_udp_udp_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Config) String() string { - return protoimpl.X.MessageStringOf(x) } func (*Config) ProtoMessage() {} -func (x *Config) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_transport_udp_udp_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 Config.ProtoReflect.Descriptor instead. -func (*Config) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_transport_udp_udp_proto_rawDescGZIP(), []int{0} -} - func (x *Config) GetTransportPeerId() string { if x != nil { return x.TransportPeerId @@ -101,107 +63,637 @@ func (x *Config) GetDialers() map[string]*dialer.DialerOpts { return nil } -var File_github_com_aperturerobotics_bifrost_transport_udp_udp_proto protoreflect.FileDescriptor - -var file_github_com_aperturerobotics_bifrost_transport_udp_udp_proto_rawDesc = []byte{ - 0x0a, 0x3b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, - 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x62, 0x69, - 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x2f, - 0x75, 0x64, 0x70, 0x2f, 0x75, 0x64, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x03, 0x75, - 0x64, 0x70, 0x1a, 0x46, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, - 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, - 0x62, 0x69, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, - 0x74, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x63, 0x6f, 0x6e, 0x6e, 0x2f, 0x70, - 0x63, 0x6f, 0x6e, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x48, 0x67, 0x69, 0x74, 0x68, - 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, - 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x62, 0x69, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2f, - 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, - 0x2f, 0x64, 0x69, 0x61, 0x6c, 0x65, 0x72, 0x2f, 0x64, 0x69, 0x61, 0x6c, 0x65, 0x72, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x87, 0x02, 0x0a, 0x06, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, - 0x2a, 0x0a, 0x11, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x70, 0x65, 0x65, - 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x74, 0x72, 0x61, 0x6e, - 0x73, 0x70, 0x6f, 0x72, 0x74, 0x50, 0x65, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x6c, - 0x69, 0x73, 0x74, 0x65, 0x6e, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0a, 0x6c, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x41, 0x64, 0x64, 0x72, 0x12, 0x2c, 0x0a, 0x0b, - 0x70, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x5f, 0x6f, 0x70, 0x74, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x0b, 0x2e, 0x70, 0x63, 0x6f, 0x6e, 0x6e, 0x2e, 0x4f, 0x70, 0x74, 0x73, 0x52, 0x0a, - 0x70, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x4f, 0x70, 0x74, 0x73, 0x12, 0x32, 0x0a, 0x07, 0x64, 0x69, - 0x61, 0x6c, 0x65, 0x72, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x75, 0x64, - 0x70, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x44, 0x69, 0x61, 0x6c, 0x65, 0x72, 0x73, - 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x64, 0x69, 0x61, 0x6c, 0x65, 0x72, 0x73, 0x1a, 0x4e, - 0x0a, 0x0c, 0x44, 0x69, 0x61, 0x6c, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, - 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, - 0x12, 0x28, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x12, 0x2e, 0x64, 0x69, 0x61, 0x6c, 0x65, 0x72, 0x2e, 0x44, 0x69, 0x61, 0x6c, 0x65, 0x72, 0x4f, - 0x70, 0x74, 0x73, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_github_com_aperturerobotics_bifrost_transport_udp_udp_proto_rawDescOnce sync.Once - file_github_com_aperturerobotics_bifrost_transport_udp_udp_proto_rawDescData = file_github_com_aperturerobotics_bifrost_transport_udp_udp_proto_rawDesc -) +type Config_DialersEntry struct { + unknownFields []byte + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Value *dialer.DialerOpts `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` +} + +func (x *Config_DialersEntry) Reset() { + *x = Config_DialersEntry{} +} + +func (*Config_DialersEntry) ProtoMessage() {} + +func (x *Config_DialersEntry) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +func (x *Config_DialersEntry) GetValue() *dialer.DialerOpts { + if x != nil { + return x.Value + } + return nil +} + +func (m *Config) CloneVT() *Config { + if m == nil { + return (*Config)(nil) + } + r := new(Config) + r.TransportPeerId = m.TransportPeerId + r.ListenAddr = m.ListenAddr + if rhs := m.PacketOpts; rhs != nil { + r.PacketOpts = rhs.CloneVT() + } + if rhs := m.Dialers; rhs != nil { + tmpContainer := make(map[string]*dialer.DialerOpts, len(rhs)) + for k, v := range rhs { + tmpContainer[k] = v.CloneVT() + } + r.Dialers = tmpContainer + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *Config) CloneMessageVT() any { + return m.CloneVT() +} + +func (this *Config) EqualVT(that *Config) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.TransportPeerId != that.TransportPeerId { + return false + } + if this.ListenAddr != that.ListenAddr { + return false + } + if !this.PacketOpts.EqualVT(that.PacketOpts) { + return false + } + if len(this.Dialers) != len(that.Dialers) { + return false + } + for i, vx := range this.Dialers { + vy, ok := that.Dialers[i] + if !ok { + return false + } + if p, q := vx, vy; p != q { + if p == nil { + p = &dialer.DialerOpts{} + } + if q == nil { + q = &dialer.DialerOpts{} + } + if !p.EqualVT(q) { + return false + } + } + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *Config) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*Config) + if !ok { + return false + } + return this.EqualVT(that) +} -func file_github_com_aperturerobotics_bifrost_transport_udp_udp_proto_rawDescGZIP() []byte { - file_github_com_aperturerobotics_bifrost_transport_udp_udp_proto_rawDescOnce.Do(func() { - file_github_com_aperturerobotics_bifrost_transport_udp_udp_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_aperturerobotics_bifrost_transport_udp_udp_proto_rawDescData) +// MarshalProtoJSON marshals the Config_DialersEntry message to JSON. +func (x *Config_DialersEntry) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return + } + s.WriteObjectStart() + var wroteField bool + if x.Key != "" || s.HasField("key") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("key") + s.WriteString(x.Key) + } + if x.Value != nil || s.HasField("value") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("value") + x.Value.MarshalProtoJSON(s.WithField("value")) + } + s.WriteObjectEnd() +} + +// MarshalJSON marshals the Config_DialersEntry to JSON. +func (x *Config_DialersEntry) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) +} + +// UnmarshalProtoJSON unmarshals the Config_DialersEntry message from JSON. +func (x *Config_DialersEntry) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { + return + } + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "key": + s.AddField("key") + x.Key = s.ReadString() + case "value": + if s.ReadNil() { + x.Value = nil + return + } + x.Value = &dialer.DialerOpts{} + x.Value.UnmarshalProtoJSON(s.WithField("value", true)) + } }) - return file_github_com_aperturerobotics_bifrost_transport_udp_udp_proto_rawDescData -} - -var file_github_com_aperturerobotics_bifrost_transport_udp_udp_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_github_com_aperturerobotics_bifrost_transport_udp_udp_proto_goTypes = []interface{}{ - (*Config)(nil), // 0: udp.Config - nil, // 1: udp.Config.DialersEntry - (*pconn.Opts)(nil), // 2: pconn.Opts - (*dialer.DialerOpts)(nil), // 3: dialer.DialerOpts -} -var file_github_com_aperturerobotics_bifrost_transport_udp_udp_proto_depIdxs = []int32{ - 2, // 0: udp.Config.packet_opts:type_name -> pconn.Opts - 1, // 1: udp.Config.dialers:type_name -> udp.Config.DialersEntry - 3, // 2: udp.Config.DialersEntry.value:type_name -> dialer.DialerOpts - 3, // [3:3] is the sub-list for method output_type - 3, // [3:3] is the sub-list for method input_type - 3, // [3:3] is the sub-list for extension type_name - 3, // [3:3] is the sub-list for extension extendee - 0, // [0:3] is the sub-list for field type_name -} - -func init() { file_github_com_aperturerobotics_bifrost_transport_udp_udp_proto_init() } -func file_github_com_aperturerobotics_bifrost_transport_udp_udp_proto_init() { - if File_github_com_aperturerobotics_bifrost_transport_udp_udp_proto != nil { +} + +// UnmarshalJSON unmarshals the Config_DialersEntry from JSON. +func (x *Config_DialersEntry) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +// MarshalProtoJSON marshals the Config message to JSON. +func (x *Config) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return + } + s.WriteObjectStart() + var wroteField bool + if x.TransportPeerId != "" || s.HasField("transportPeerId") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("transportPeerId") + s.WriteString(x.TransportPeerId) + } + if x.ListenAddr != "" || s.HasField("listenAddr") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("listenAddr") + s.WriteString(x.ListenAddr) + } + if x.PacketOpts != nil || s.HasField("packetOpts") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("packetOpts") + x.PacketOpts.MarshalProtoJSON(s.WithField("packetOpts")) + } + if x.Dialers != nil || s.HasField("dialers") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("dialers") + s.WriteObjectStart() + var wroteElement bool + for k, v := range x.Dialers { + s.WriteMoreIf(&wroteElement) + s.WriteObjectStringField(k) + v.MarshalProtoJSON(s.WithField("dialers")) + } + s.WriteObjectEnd() + } + s.WriteObjectEnd() +} + +// MarshalJSON marshals the Config to JSON. +func (x *Config) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) +} + +// UnmarshalProtoJSON unmarshals the Config message from JSON. +func (x *Config) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { return } - if !protoimpl.UnsafeEnabled { - file_github_com_aperturerobotics_bifrost_transport_udp_udp_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Config); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "transport_peer_id", "transportPeerId": + s.AddField("transport_peer_id") + x.TransportPeerId = s.ReadString() + case "listen_addr", "listenAddr": + s.AddField("listen_addr") + x.ListenAddr = s.ReadString() + case "packet_opts", "packetOpts": + if s.ReadNil() { + x.PacketOpts = nil + return + } + x.PacketOpts = &pconn.Opts{} + x.PacketOpts.UnmarshalProtoJSON(s.WithField("packet_opts", true)) + case "dialers": + s.AddField("dialers") + if s.ReadNil() { + x.Dialers = nil + return + } + x.Dialers = make(map[string]*dialer.DialerOpts) + s.ReadStringMap(func(key string) { + var v dialer.DialerOpts + v.UnmarshalProtoJSON(s) + x.Dialers[key] = &v + }) + } + }) +} + +// UnmarshalJSON unmarshals the Config from JSON. +func (x *Config) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +func (m *Config) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Config) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.Dialers) > 0 { + for k := range m.Dialers { + v := m.Dialers[k] + baseI := i + size, err := v.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x12 + i -= len(k) + copy(dAtA[i:], k) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(k))) + i-- + dAtA[i] = 0xa + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0x2a + } + } + if m.PacketOpts != nil { + size, err := m.PacketOpts.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x22 + } + if len(m.ListenAddr) > 0 { + i -= len(m.ListenAddr) + copy(dAtA[i:], m.ListenAddr) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.ListenAddr))) + i-- + dAtA[i] = 0x12 + } + if len(m.TransportPeerId) > 0 { + i -= len(m.TransportPeerId) + copy(dAtA[i:], m.TransportPeerId) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.TransportPeerId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Config) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.TransportPeerId) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + l = len(m.ListenAddr) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + if m.PacketOpts != nil { + l = m.PacketOpts.SizeVT() + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + if len(m.Dialers) > 0 { + for k, v := range m.Dialers { + _ = k + _ = v + l = 0 + if v != nil { + l = v.SizeVT() + } + l += 1 + protobuf_go_lite.SizeOfVarint(uint64(l)) + mapEntrySize := 1 + len(k) + protobuf_go_lite.SizeOfVarint(uint64(len(k))) + l + n += mapEntrySize + 1 + protobuf_go_lite.SizeOfVarint(uint64(mapEntrySize)) + } + } + n += len(m.unknownFields) + return n +} + +func (m *Config) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: Config: wiretype end group for non-group") } + if fieldNum <= 0 { + return errors.Errorf("proto: Config: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field TransportPeerId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TransportPeerId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field ListenAddr", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ListenAddr = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field PacketOpts", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.PacketOpts == nil { + m.PacketOpts = &pconn.Opts{} + } + if err := m.PacketOpts.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field Dialers", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Dialers == nil { + m.Dialers = make(map[string]*dialer.DialerOpts) + } + var mapkey string + var mapvalue *dialer.DialerOpts + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var mapmsglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapmsglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if mapmsglen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postmsgIndex := iNdEx + mapmsglen + if postmsgIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postmsgIndex > l { + return io.ErrUnexpectedEOF + } + mapvalue = &dialer.DialerOpts{} + if err := mapvalue.UnmarshalVT(dAtA[iNdEx:postmsgIndex]); err != nil { + return err + } + iNdEx = postmsgIndex + } else { + iNdEx = entryPreIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.Dialers[mapkey] = mapvalue + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_github_com_aperturerobotics_bifrost_transport_udp_udp_proto_rawDesc, - NumEnums: 0, - NumMessages: 2, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_github_com_aperturerobotics_bifrost_transport_udp_udp_proto_goTypes, - DependencyIndexes: file_github_com_aperturerobotics_bifrost_transport_udp_udp_proto_depIdxs, - MessageInfos: file_github_com_aperturerobotics_bifrost_transport_udp_udp_proto_msgTypes, - }.Build() - File_github_com_aperturerobotics_bifrost_transport_udp_udp_proto = out.File - file_github_com_aperturerobotics_bifrost_transport_udp_udp_proto_rawDesc = nil - file_github_com_aperturerobotics_bifrost_transport_udp_udp_proto_goTypes = nil - file_github_com_aperturerobotics_bifrost_transport_udp_udp_proto_depIdxs = nil + return nil } diff --git a/transport/udp/udp.pb.ts b/transport/udp/udp.pb.ts deleted file mode 100644 index 7fe81f29..00000000 --- a/transport/udp/udp.pb.ts +++ /dev/null @@ -1,381 +0,0 @@ -/* eslint-disable */ -import Long from 'long' -import _m0 from 'protobufjs/minimal.js' -import { DialerOpts } from '../common/dialer/dialer.pb.js' -import { Opts } from '../common/pconn/pconn.pb.js' - -export const protobufPackage = 'udp' - -/** Config is the configuration for the udp transport. */ -export interface Config { - /** - * TransportPeerID sets the peer ID to attach the transport to. - * If unset, attaches to any running peer with a private key. - */ - transportPeerId: string - /** - * ListenAddr contains the address to listen on. - * Has no effect in the browser. - */ - listenAddr: string - /** PacketOpts are options to set on the packet connection. */ - packetOpts: Opts | undefined - /** Dialers maps peer IDs to dialers. */ - dialers: { [key: string]: DialerOpts } -} - -export interface Config_DialersEntry { - key: string - value: DialerOpts | undefined -} - -function createBaseConfig(): Config { - return { - transportPeerId: '', - listenAddr: '', - packetOpts: undefined, - dialers: {}, - } -} - -export const Config = { - encode( - message: Config, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.transportPeerId !== '') { - writer.uint32(10).string(message.transportPeerId) - } - if (message.listenAddr !== '') { - writer.uint32(18).string(message.listenAddr) - } - if (message.packetOpts !== undefined) { - Opts.encode(message.packetOpts, writer.uint32(34).fork()).ldelim() - } - Object.entries(message.dialers).forEach(([key, value]) => { - Config_DialersEntry.encode( - { key: key as any, value }, - writer.uint32(42).fork(), - ).ldelim() - }) - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Config { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseConfig() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break - } - - message.transportPeerId = reader.string() - continue - case 2: - if (tag !== 18) { - break - } - - message.listenAddr = reader.string() - continue - case 4: - if (tag !== 34) { - break - } - - message.packetOpts = Opts.decode(reader, reader.uint32()) - continue - case 5: - if (tag !== 42) { - break - } - - const entry5 = Config_DialersEntry.decode(reader, reader.uint32()) - if (entry5.value !== undefined) { - message.dialers[entry5.key] = entry5.value - } - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: AsyncIterable | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config.encode(p).finish()] - } - } else { - yield* [Config.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config.decode(p)] - } - } else { - yield* [Config.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): Config { - return { - transportPeerId: isSet(object.transportPeerId) - ? globalThis.String(object.transportPeerId) - : '', - listenAddr: isSet(object.listenAddr) - ? globalThis.String(object.listenAddr) - : '', - packetOpts: isSet(object.packetOpts) - ? Opts.fromJSON(object.packetOpts) - : undefined, - dialers: isObject(object.dialers) - ? Object.entries(object.dialers).reduce<{ [key: string]: DialerOpts }>( - (acc, [key, value]) => { - acc[key] = DialerOpts.fromJSON(value) - return acc - }, - {}, - ) - : {}, - } - }, - - toJSON(message: Config): unknown { - const obj: any = {} - if (message.transportPeerId !== '') { - obj.transportPeerId = message.transportPeerId - } - if (message.listenAddr !== '') { - obj.listenAddr = message.listenAddr - } - if (message.packetOpts !== undefined) { - obj.packetOpts = Opts.toJSON(message.packetOpts) - } - if (message.dialers) { - const entries = Object.entries(message.dialers) - if (entries.length > 0) { - obj.dialers = {} - entries.forEach(([k, v]) => { - obj.dialers[k] = DialerOpts.toJSON(v) - }) - } - } - return obj - }, - - create, I>>(base?: I): Config { - return Config.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>(object: I): Config { - const message = createBaseConfig() - message.transportPeerId = object.transportPeerId ?? '' - message.listenAddr = object.listenAddr ?? '' - message.packetOpts = - object.packetOpts !== undefined && object.packetOpts !== null - ? Opts.fromPartial(object.packetOpts) - : undefined - message.dialers = Object.entries(object.dialers ?? {}).reduce<{ - [key: string]: DialerOpts - }>((acc, [key, value]) => { - if (value !== undefined) { - acc[key] = DialerOpts.fromPartial(value) - } - return acc - }, {}) - return message - }, -} - -function createBaseConfig_DialersEntry(): Config_DialersEntry { - return { key: '', value: undefined } -} - -export const Config_DialersEntry = { - encode( - message: Config_DialersEntry, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.key !== '') { - writer.uint32(10).string(message.key) - } - if (message.value !== undefined) { - DialerOpts.encode(message.value, writer.uint32(18).fork()).ldelim() - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Config_DialersEntry { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseConfig_DialersEntry() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break - } - - message.key = reader.string() - continue - case 2: - if (tag !== 18) { - break - } - - message.value = DialerOpts.decode(reader, reader.uint32()) - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config_DialersEntry.encode(p).finish()] - } - } else { - yield* [Config_DialersEntry.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config_DialersEntry.decode(p)] - } - } else { - yield* [Config_DialersEntry.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): Config_DialersEntry { - return { - key: isSet(object.key) ? globalThis.String(object.key) : '', - value: isSet(object.value) - ? DialerOpts.fromJSON(object.value) - : undefined, - } - }, - - toJSON(message: Config_DialersEntry): unknown { - const obj: any = {} - if (message.key !== '') { - obj.key = message.key - } - if (message.value !== undefined) { - obj.value = DialerOpts.toJSON(message.value) - } - return obj - }, - - create, I>>( - base?: I, - ): Config_DialersEntry { - return Config_DialersEntry.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>( - object: I, - ): Config_DialersEntry { - const message = createBaseConfig_DialersEntry() - message.key = object.key ?? '' - message.value = - object.value !== undefined && object.value !== null - ? DialerOpts.fromPartial(object.value) - : undefined - return message - }, -} - -type Builtin = - | Date - | Function - | Uint8Array - | string - | number - | boolean - | undefined - -export type DeepPartial = T extends Builtin - ? T - : T extends Long - ? string | number | Long - : T extends globalThis.Array - ? globalThis.Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends { $case: string } - ? { [K in keyof Omit]?: DeepPartial } & { - $case: T['$case'] - } - : T extends {} - ? { [K in keyof T]?: DeepPartial } - : Partial - -type KeysOfUnion = T extends T ? keyof T : never -export type Exact = P extends Builtin - ? P - : P & { [K in keyof P]: Exact } & { - [K in Exclude>]: never - } - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any - _m0.configure() -} - -function isObject(value: any): boolean { - return typeof value === 'object' && value !== null -} - -function isSet(value: any): boolean { - return value !== null && value !== undefined -} diff --git a/transport/udp/udp_pb.ts b/transport/udp/udp_pb.ts new file mode 100644 index 00000000..5637b5be --- /dev/null +++ b/transport/udp/udp_pb.ts @@ -0,0 +1,110 @@ +// @generated by protoc-gen-es v1.8.0 with parameter "target=ts,ts_nocheck=false" +// @generated from file github.com/aperturerobotics/bifrost/transport/udp/udp.proto (package udp, syntax proto3) +/* eslint-disable */ + +import type { + BinaryReadOptions, + FieldList, + JsonReadOptions, + JsonValue, + PartialMessage, + PlainMessage, +} from '@bufbuild/protobuf' +import { Message, proto3 } from '@bufbuild/protobuf' +import { Opts } from '../common/pconn/pconn_pb.js' +import { DialerOpts } from '../common/dialer/dialer_pb.js' + +/** + * Config is the configuration for the udp transport. + * + * @generated from message udp.Config + */ +export class Config extends Message { + /** + * TransportPeerID sets the peer ID to attach the transport to. + * If unset, attaches to any running peer with a private key. + * + * @generated from field: string transport_peer_id = 1; + */ + transportPeerId = '' + + /** + * ListenAddr contains the address to listen on. + * Has no effect in the browser. + * + * @generated from field: string listen_addr = 2; + */ + listenAddr = '' + + /** + * PacketOpts are options to set on the packet connection. + * + * @generated from field: pconn.Opts packet_opts = 4; + */ + packetOpts?: Opts + + /** + * Dialers maps peer IDs to dialers. + * + * @generated from field: map dialers = 5; + */ + dialers: { [key: string]: DialerOpts } = {} + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'udp.Config' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { + no: 1, + name: 'transport_peer_id', + kind: 'scalar', + T: 9 /* ScalarType.STRING */, + }, + { + no: 2, + name: 'listen_addr', + kind: 'scalar', + T: 9 /* ScalarType.STRING */, + }, + { no: 4, name: 'packet_opts', kind: 'message', T: Opts }, + { + no: 5, + name: 'dialers', + kind: 'map', + K: 9 /* ScalarType.STRING */, + V: { kind: 'message', T: DialerOpts }, + }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): Config { + return new Config().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): Config { + return new Config().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): Config { + return new Config().fromJsonString(jsonString, options) + } + + static equals( + a: Config | PlainMessage | undefined, + b: Config | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(Config, a, b) + } +} diff --git a/transport/udp/udp_vtproto.pb.go b/transport/udp/udp_vtproto.pb.go deleted file mode 100644 index 3d563848..00000000 --- a/transport/udp/udp_vtproto.pb.go +++ /dev/null @@ -1,559 +0,0 @@ -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// protoc-gen-go-vtproto version: v0.6.0 -// source: github.com/aperturerobotics/bifrost/transport/udp/udp.proto - -package udp - -import ( - fmt "fmt" - io "io" - - dialer "github.com/aperturerobotics/bifrost/transport/common/dialer" - pconn "github.com/aperturerobotics/bifrost/transport/common/pconn" - protohelpers "github.com/planetscale/vtprotobuf/protohelpers" - proto "google.golang.org/protobuf/proto" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) -) - -func (m *Config) CloneVT() *Config { - if m == nil { - return (*Config)(nil) - } - r := new(Config) - r.TransportPeerId = m.TransportPeerId - r.ListenAddr = m.ListenAddr - if rhs := m.PacketOpts; rhs != nil { - if vtpb, ok := interface{}(rhs).(interface{ CloneVT() *pconn.Opts }); ok { - r.PacketOpts = vtpb.CloneVT() - } else { - r.PacketOpts = proto.Clone(rhs).(*pconn.Opts) - } - } - if rhs := m.Dialers; rhs != nil { - tmpContainer := make(map[string]*dialer.DialerOpts, len(rhs)) - for k, v := range rhs { - if vtpb, ok := interface{}(v).(interface{ CloneVT() *dialer.DialerOpts }); ok { - tmpContainer[k] = vtpb.CloneVT() - } else { - tmpContainer[k] = proto.Clone(v).(*dialer.DialerOpts) - } - } - r.Dialers = tmpContainer - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Config) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (this *Config) EqualVT(that *Config) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.TransportPeerId != that.TransportPeerId { - return false - } - if this.ListenAddr != that.ListenAddr { - return false - } - if equal, ok := interface{}(this.PacketOpts).(interface{ EqualVT(*pconn.Opts) bool }); ok { - if !equal.EqualVT(that.PacketOpts) { - return false - } - } else if !proto.Equal(this.PacketOpts, that.PacketOpts) { - return false - } - if len(this.Dialers) != len(that.Dialers) { - return false - } - for i, vx := range this.Dialers { - vy, ok := that.Dialers[i] - if !ok { - return false - } - if p, q := vx, vy; p != q { - if p == nil { - p = &dialer.DialerOpts{} - } - if q == nil { - q = &dialer.DialerOpts{} - } - if equal, ok := interface{}(p).(interface{ EqualVT(*dialer.DialerOpts) bool }); ok { - if !equal.EqualVT(q) { - return false - } - } else if !proto.Equal(p, q) { - return false - } - } - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Config) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Config) - if !ok { - return false - } - return this.EqualVT(that) -} -func (m *Config) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Config) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Dialers) > 0 { - for k := range m.Dialers { - v := m.Dialers[k] - baseI := i - if vtmsg, ok := interface{}(v).(interface { - MarshalToSizedBufferVT([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(v) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0x12 - i -= len(k) - copy(dAtA[i:], k) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(k))) - i-- - dAtA[i] = 0xa - i = protohelpers.EncodeVarint(dAtA, i, uint64(baseI-i)) - i-- - dAtA[i] = 0x2a - } - } - if m.PacketOpts != nil { - if vtmsg, ok := interface{}(m.PacketOpts).(interface { - MarshalToSizedBufferVT([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.PacketOpts) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0x22 - } - if len(m.ListenAddr) > 0 { - i -= len(m.ListenAddr) - copy(dAtA[i:], m.ListenAddr) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.ListenAddr))) - i-- - dAtA[i] = 0x12 - } - if len(m.TransportPeerId) > 0 { - i -= len(m.TransportPeerId) - copy(dAtA[i:], m.TransportPeerId) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.TransportPeerId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Config) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.TransportPeerId) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - l = len(m.ListenAddr) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.PacketOpts != nil { - if size, ok := interface{}(m.PacketOpts).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.PacketOpts) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if len(m.Dialers) > 0 { - for k, v := range m.Dialers { - _ = k - _ = v - l = 0 - if v != nil { - if size, ok := interface{}(v).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(v) - } - } - l += 1 + protohelpers.SizeOfVarint(uint64(l)) - mapEntrySize := 1 + len(k) + protohelpers.SizeOfVarint(uint64(len(k))) + l - n += mapEntrySize + 1 + protohelpers.SizeOfVarint(uint64(mapEntrySize)) - } - } - n += len(m.unknownFields) - return n -} - -func (m *Config) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Config: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Config: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TransportPeerId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TransportPeerId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListenAddr", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ListenAddr = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PacketOpts", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.PacketOpts == nil { - m.PacketOpts = &pconn.Opts{} - } - if unmarshal, ok := interface{}(m.PacketOpts).(interface { - UnmarshalVT([]byte) error - }); ok { - if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - } else { - if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.PacketOpts); err != nil { - return err - } - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Dialers", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Dialers == nil { - m.Dialers = make(map[string]*dialer.DialerOpts) - } - var mapkey string - var mapvalue *dialer.DialerOpts - for iNdEx < postIndex { - entryPreIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - if fieldNum == 1 { - var stringLenmapkey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapkey |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapkey := int(stringLenmapkey) - if intStringLenmapkey < 0 { - return protohelpers.ErrInvalidLength - } - postStringIndexmapkey := iNdEx + intStringLenmapkey - if postStringIndexmapkey < 0 { - return protohelpers.ErrInvalidLength - } - if postStringIndexmapkey > l { - return io.ErrUnexpectedEOF - } - mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) - iNdEx = postStringIndexmapkey - } else if fieldNum == 2 { - var mapmsglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - mapmsglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if mapmsglen < 0 { - return protohelpers.ErrInvalidLength - } - postmsgIndex := iNdEx + mapmsglen - if postmsgIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postmsgIndex > l { - return io.ErrUnexpectedEOF - } - mapvalue = &dialer.DialerOpts{} - if unmarshal, ok := interface{}(mapvalue).(interface { - UnmarshalVT([]byte) error - }); ok { - if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postmsgIndex]); err != nil { - return err - } - } else { - if err := proto.Unmarshal(dAtA[iNdEx:postmsgIndex], mapvalue); err != nil { - return err - } - } - iNdEx = postmsgIndex - } else { - iNdEx = entryPreIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > postIndex { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - m.Dialers[mapkey] = mapvalue - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} diff --git a/transport/webrtc/handler.go b/transport/webrtc/handler.go index fa5ce6e3..5730f549 100644 --- a/transport/webrtc/handler.go +++ b/transport/webrtc/handler.go @@ -36,7 +36,7 @@ func NewWebRTCSignalHandler(t *WebRTC) *WebRTCSignalHandler { func (c *WebRTCSignalHandler) HandleDirective(ctx context.Context, di directive.Instance) ([]directive.Resolver, error) { switch dir := di.GetDirective().(type) { case signaling.HandleSignalPeer: - return c.resolveHandleSignalPeer(ctx, dir) + return c.resolveHandleSignalPeer(dir) } return nil, nil } @@ -106,9 +106,11 @@ func (r *handleSignalPeerResolver) Resolve(ctx context.Context, handler directiv if err != nil { return err } - if r.t.GetVerbose() { - r.t.le.Debugf("signal rx: %s", sig.String()) - } + /* + if r.t.GetVerbose() { + r.t.le.Debugf("signal rx: %s", sig.String()) + } + */ // Loop until we manage to process this message. ProcessLoop: @@ -156,7 +158,7 @@ func (r *handleSignalPeerResolver) Resolve(ctx context.Context, handler directiv } // resolveHandleSignalPeer resolves the HandleSignalPeer directive. -func (c *WebRTCSignalHandler) resolveHandleSignalPeer(ctx context.Context, dir signaling.HandleSignalPeer) ([]directive.Resolver, error) { +func (c *WebRTCSignalHandler) resolveHandleSignalPeer(dir signaling.HandleSignalPeer) ([]directive.Resolver, error) { // Check signaling id matches if dir.HandleSignalingID() != c.t.conf.GetSignalingId() { return nil, nil diff --git a/transport/webrtc/webrtc.pb.go b/transport/webrtc/webrtc.pb.go index ffa8d0da..47dc5d96 100644 --- a/transport/webrtc/webrtc.pb.go +++ b/transport/webrtc/webrtc.pb.go @@ -1,28 +1,20 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0-devel -// protoc v5.26.1 +// Code generated by protoc-gen-go-lite. DO NOT EDIT. +// protoc-gen-go-lite version: v0.4.5 // source: github.com/aperturerobotics/bifrost/transport/webrtc/webrtc.proto package webrtc import ( - reflect "reflect" - sync "sync" + io "io" + strconv "strconv" _ "github.com/aperturerobotics/bifrost/stream/srpc/client" dialer "github.com/aperturerobotics/bifrost/transport/common/dialer" quic "github.com/aperturerobotics/bifrost/transport/common/quic" + protobuf_go_lite "github.com/aperturerobotics/protobuf-go-lite" + json "github.com/aperturerobotics/protobuf-go-lite/json" backoff "github.com/aperturerobotics/util/backoff" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) + errors "github.com/pkg/errors" ) // IceTransportPolicy contains the set of allowed ICE transport policies. @@ -54,51 +46,35 @@ func (x IceTransportPolicy) Enum() *IceTransportPolicy { } func (x IceTransportPolicy) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (IceTransportPolicy) Descriptor() protoreflect.EnumDescriptor { - return file_github_com_aperturerobotics_bifrost_transport_webrtc_webrtc_proto_enumTypes[0].Descriptor() -} - -func (IceTransportPolicy) Type() protoreflect.EnumType { - return &file_github_com_aperturerobotics_bifrost_transport_webrtc_webrtc_proto_enumTypes[0] -} - -func (x IceTransportPolicy) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use IceTransportPolicy.Descriptor instead. -func (IceTransportPolicy) EnumDescriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_transport_webrtc_webrtc_proto_rawDescGZIP(), []int{0} + name, valid := IceTransportPolicy_name[int32(x)] + if valid { + return name + } + return strconv.Itoa(int(x)) } // Config is the configuration for the WebRTC Signal RPC transport. type Config struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + unknownFields []byte // SignalingId is the signaling channel identifier. // Cannot be empty. - SignalingId string `protobuf:"bytes,1,opt,name=signaling_id,json=signalingId,proto3" json:"signaling_id,omitempty"` + SignalingId string `protobuf:"bytes,1,opt,name=signaling_id,json=signalingId,proto3" json:"signalingId,omitempty"` // TransportPeerId sets the peer ID to attach the transport to. // If unset, attaches to any running peer with a private key. // Must match the transport peer ID of the signaling transport. - TransportPeerId string `protobuf:"bytes,2,opt,name=transport_peer_id,json=transportPeerId,proto3" json:"transport_peer_id,omitempty"` + TransportPeerId string `protobuf:"bytes,2,opt,name=transport_peer_id,json=transportPeerId,proto3" json:"transportPeerId,omitempty"` // TransportType overrides the transport type id for dial addresses. // Defaults to "webrtc" // Configures the scheme for addr matching to this transport. // E.x.: webrtc:// - TransportType string `protobuf:"bytes,3,opt,name=transport_type,json=transportType,proto3" json:"transport_type,omitempty"` + TransportType string `protobuf:"bytes,3,opt,name=transport_type,json=transportType,proto3" json:"transportType,omitempty"` // Quic contains the quic protocol options. // // The WebRTC transport always disables FEC and several other UDP-centric // features which are unnecessary due to the "reliable" nature of WebRTC. Quic *quic.Opts `protobuf:"bytes,4,opt,name=quic,proto3" json:"quic,omitempty"` // WebRtc contains the WebRTC protocol options. - WebRtc *WebRtcConfig `protobuf:"bytes,5,opt,name=web_rtc,json=webRtc,proto3" json:"web_rtc,omitempty"` + WebRtc *WebRtcConfig `protobuf:"bytes,5,opt,name=web_rtc,json=webRtc,proto3" json:"webRtc,omitempty"` // Backoff is the backoff config for connecting to a PeerConnection. // If unset, defaults to reasonable defaults. Backoff *backoff.Backoff `protobuf:"bytes,6,opt,name=backoff,proto3" json:"backoff,omitempty"` @@ -107,48 +83,22 @@ type Config struct { Dialers map[string]*dialer.DialerOpts `protobuf:"bytes,7,rep,name=dialers,proto3" json:"dialers,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` // AllPeers tells the transport to attempt to negotiate a WebRTC session with // any peer, even those not listed in the Dialers map. - AllPeers bool `protobuf:"varint,8,opt,name=all_peers,json=allPeers,proto3" json:"all_peers,omitempty"` + AllPeers bool `protobuf:"varint,8,opt,name=all_peers,json=allPeers,proto3" json:"allPeers,omitempty"` // DisableListen disables listening for incoming Links. // If set, we will only dial out, not accept incoming links. - DisableListen bool `protobuf:"varint,9,opt,name=disable_listen,json=disableListen,proto3" json:"disable_listen,omitempty"` + DisableListen bool `protobuf:"varint,9,opt,name=disable_listen,json=disableListen,proto3" json:"disableListen,omitempty"` // BlockPeers is a list of peer ids that will not be contacted via this transport. - BlockPeers []string `protobuf:"bytes,10,rep,name=block_peers,json=blockPeers,proto3" json:"block_peers,omitempty"` + BlockPeers []string `protobuf:"bytes,10,rep,name=block_peers,json=blockPeers,proto3" json:"blockPeers,omitempty"` // Verbose enables very verbose logging. Verbose bool `protobuf:"varint,11,opt,name=verbose,proto3" json:"verbose,omitempty"` } func (x *Config) Reset() { *x = Config{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_transport_webrtc_webrtc_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Config) String() string { - return protoimpl.X.MessageStringOf(x) } func (*Config) ProtoMessage() {} -func (x *Config) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_transport_webrtc_webrtc_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 Config.ProtoReflect.Descriptor instead. -func (*Config) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_transport_webrtc_webrtc_proto_rawDescGZIP(), []int{0} -} - func (x *Config) GetSignalingId() string { if x != nil { return x.SignalingId @@ -228,52 +178,23 @@ func (x *Config) GetVerbose() bool { // WebRtcConfig configures the WebRTC PeerConnection. type WebRtcConfig struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + unknownFields []byte // IceServers contains the list of ICE servers to use. - IceServers []*IceServerConfig `protobuf:"bytes,1,rep,name=ice_servers,json=iceServers,proto3" json:"ice_servers,omitempty"` + IceServers []*IceServerConfig `protobuf:"bytes,1,rep,name=ice_servers,json=iceServers,proto3" json:"iceServers,omitempty"` // IceTransportPolicy defines the policy for permitted ICE candidates. // Optional. - IceTransportPolicy IceTransportPolicy `protobuf:"varint,2,opt,name=ice_transport_policy,json=iceTransportPolicy,proto3,enum=webrtc.IceTransportPolicy" json:"ice_transport_policy,omitempty"` + IceTransportPolicy IceTransportPolicy `protobuf:"varint,2,opt,name=ice_transport_policy,json=iceTransportPolicy,proto3" json:"iceTransportPolicy,omitempty"` // IceCandidatePoolSize defines the size of the prefetched ICE pool. // Optional. - IceCandidatePoolSize uint32 `protobuf:"varint,3,opt,name=ice_candidate_pool_size,json=iceCandidatePoolSize,proto3" json:"ice_candidate_pool_size,omitempty"` + IceCandidatePoolSize uint32 `protobuf:"varint,3,opt,name=ice_candidate_pool_size,json=iceCandidatePoolSize,proto3" json:"iceCandidatePoolSize,omitempty"` } func (x *WebRtcConfig) Reset() { *x = WebRtcConfig{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_transport_webrtc_webrtc_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *WebRtcConfig) String() string { - return protoimpl.X.MessageStringOf(x) } func (*WebRtcConfig) ProtoMessage() {} -func (x *WebRtcConfig) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_transport_webrtc_webrtc_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 WebRtcConfig.ProtoReflect.Descriptor instead. -func (*WebRtcConfig) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_transport_webrtc_webrtc_proto_rawDescGZIP(), []int{1} -} - func (x *WebRtcConfig) GetIceServers() []*IceServerConfig { if x != nil { return x.IceServers @@ -297,10 +218,7 @@ func (x *WebRtcConfig) GetIceCandidatePoolSize() uint32 { // IceServer is a WebRTC ICE server config. type IceServerConfig struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + unknownFields []byte // Urls is the list of URLs for the ICE server. // // Format: stun:{url} or turn:{url} or turns:{url}?transport=tcp @@ -322,36 +240,10 @@ type IceServerConfig struct { func (x *IceServerConfig) Reset() { *x = IceServerConfig{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_transport_webrtc_webrtc_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *IceServerConfig) String() string { - return protoimpl.X.MessageStringOf(x) } func (*IceServerConfig) ProtoMessage() {} -func (x *IceServerConfig) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_transport_webrtc_webrtc_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 IceServerConfig.ProtoReflect.Descriptor instead. -func (*IceServerConfig) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_transport_webrtc_webrtc_proto_rawDescGZIP(), []int{2} -} - func (x *IceServerConfig) GetUrls() []string { if x != nil { return x.Urls @@ -407,10 +299,7 @@ func (*IceServerConfig_Oauth) isIceServerConfig_Credential() {} // WebRtcSignal is a WebRTC Signaling message sent via the Signaling channel. type WebRtcSignal struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + unknownFields []byte // Body is the body of the message. // // Types that are assignable to Body: @@ -423,36 +312,10 @@ type WebRtcSignal struct { func (x *WebRtcSignal) Reset() { *x = WebRtcSignal{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_transport_webrtc_webrtc_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *WebRtcSignal) String() string { - return protoimpl.X.MessageStringOf(x) } func (*WebRtcSignal) ProtoMessage() {} -func (x *WebRtcSignal) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_transport_webrtc_webrtc_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 WebRtcSignal.ProtoReflect.Descriptor instead. -func (*WebRtcSignal) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_transport_webrtc_webrtc_proto_rawDescGZIP(), []int{3} -} - func (m *WebRtcSignal) GetBody() isWebRtcSignal_Body { if m != nil { return m.Body @@ -509,52 +372,23 @@ func (*WebRtcSignal_Ice) isWebRtcSignal_Body() {} // WebRtcSdp contains the SDP offer or answer. type WebRtcSdp struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + unknownFields []byte // TxSeqno is the sequence number of the transmitting peer. // The receiver should update the local seqno to match. - TxSeqno uint64 `protobuf:"varint,1,opt,name=tx_seqno,json=txSeqno,proto3" json:"tx_seqno,omitempty"` + TxSeqno uint64 `protobuf:"varint,1,opt,name=tx_seqno,json=txSeqno,proto3" json:"txSeqno,omitempty"` // SdpType is the string encoded type of the sdp. // Examples: "offer" "answer" - SdpType string `protobuf:"bytes,2,opt,name=sdp_type,json=sdpType,proto3" json:"sdp_type,omitempty"` + SdpType string `protobuf:"bytes,2,opt,name=sdp_type,json=sdpType,proto3" json:"sdpType,omitempty"` // Sdp contains the WebRTC session description. Sdp string `protobuf:"bytes,3,opt,name=sdp,proto3" json:"sdp,omitempty"` } func (x *WebRtcSdp) Reset() { *x = WebRtcSdp{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_transport_webrtc_webrtc_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *WebRtcSdp) String() string { - return protoimpl.X.MessageStringOf(x) } func (*WebRtcSdp) ProtoMessage() {} -func (x *WebRtcSdp) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_transport_webrtc_webrtc_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 WebRtcSdp.ProtoReflect.Descriptor instead. -func (*WebRtcSdp) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_transport_webrtc_webrtc_proto_rawDescGZIP(), []int{4} -} - func (x *WebRtcSdp) GetTxSeqno() uint64 { if x != nil { return x.TxSeqno @@ -578,97 +412,65 @@ func (x *WebRtcSdp) GetSdp() string { // WebRtcIce contains an ICE candidate. type WebRtcIce struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + unknownFields []byte // Candidate contains the JSON-encoded ICE candidate. Candidate string `protobuf:"bytes,1,opt,name=candidate,proto3" json:"candidate,omitempty"` } func (x *WebRtcIce) Reset() { *x = WebRtcIce{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_transport_webrtc_webrtc_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *WebRtcIce) String() string { - return protoimpl.X.MessageStringOf(x) } func (*WebRtcIce) ProtoMessage() {} -func (x *WebRtcIce) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_transport_webrtc_webrtc_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms +func (x *WebRtcIce) GetCandidate() string { + if x != nil { + return x.Candidate } - return mi.MessageOf(x) + return "" } -// Deprecated: Use WebRtcIce.ProtoReflect.Descriptor instead. -func (*WebRtcIce) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_transport_webrtc_webrtc_proto_rawDescGZIP(), []int{5} +type Config_DialersEntry struct { + unknownFields []byte + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Value *dialer.DialerOpts `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` } -func (x *WebRtcIce) GetCandidate() string { +func (x *Config_DialersEntry) Reset() { + *x = Config_DialersEntry{} +} + +func (*Config_DialersEntry) ProtoMessage() {} + +func (x *Config_DialersEntry) GetKey() string { if x != nil { - return x.Candidate + return x.Key } return "" } +func (x *Config_DialersEntry) GetValue() *dialer.DialerOpts { + if x != nil { + return x.Value + } + return nil +} + // OauthCredential is an OAuth credential information for the ICE server. type IceServerConfig_OauthCredential struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + unknownFields []byte // MacKey is a base64-url format. - MacKey string `protobuf:"bytes,1,opt,name=mac_key,json=macKey,proto3" json:"mac_key,omitempty"` + MacKey string `protobuf:"bytes,1,opt,name=mac_key,json=macKey,proto3" json:"macKey,omitempty"` // AccessToken is the access token in base64-encoded format. - AccessToken string `protobuf:"bytes,2,opt,name=access_token,json=accessToken,proto3" json:"access_token,omitempty"` + AccessToken string `protobuf:"bytes,2,opt,name=access_token,json=accessToken,proto3" json:"accessToken,omitempty"` } func (x *IceServerConfig_OauthCredential) Reset() { *x = IceServerConfig_OauthCredential{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_transport_webrtc_webrtc_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *IceServerConfig_OauthCredential) String() string { - return protoimpl.X.MessageStringOf(x) } func (*IceServerConfig_OauthCredential) ProtoMessage() {} -func (x *IceServerConfig_OauthCredential) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_transport_webrtc_webrtc_proto_msgTypes[7] - 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 IceServerConfig_OauthCredential.ProtoReflect.Descriptor instead. -func (*IceServerConfig_OauthCredential) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_transport_webrtc_webrtc_proto_rawDescGZIP(), []int{2, 0} -} - func (x *IceServerConfig_OauthCredential) GetMacKey() string { if x != nil { return x.MacKey @@ -683,280 +485,3239 @@ func (x *IceServerConfig_OauthCredential) GetAccessToken() string { return "" } -var File_github_com_aperturerobotics_bifrost_transport_webrtc_webrtc_proto protoreflect.FileDescriptor - -var file_github_com_aperturerobotics_bifrost_transport_webrtc_webrtc_proto_rawDesc = []byte{ - 0x0a, 0x41, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, - 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x62, 0x69, - 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x2f, - 0x77, 0x65, 0x62, 0x72, 0x74, 0x63, 0x2f, 0x77, 0x65, 0x62, 0x72, 0x74, 0x63, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x77, 0x65, 0x62, 0x72, 0x74, 0x63, 0x1a, 0x44, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, - 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x62, 0x69, 0x66, 0x72, 0x6f, 0x73, 0x74, - 0x2f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, - 0x6e, 0x2f, 0x71, 0x75, 0x69, 0x63, 0x2f, 0x71, 0x75, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x1a, 0x48, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, - 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x62, - 0x69, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, - 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x64, 0x69, 0x61, 0x6c, 0x65, 0x72, 0x2f, 0x64, - 0x69, 0x61, 0x6c, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x43, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, - 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x62, 0x69, 0x66, 0x72, 0x6f, 0x73, 0x74, - 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x2f, 0x73, 0x72, 0x70, 0x63, 0x2f, 0x63, 0x6c, 0x69, - 0x65, 0x6e, 0x74, 0x2f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x1a, 0x36, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, - 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x75, 0x74, - 0x69, 0x6c, 0x2f, 0x62, 0x61, 0x63, 0x6b, 0x6f, 0x66, 0x66, 0x2f, 0x62, 0x61, 0x63, 0x6b, 0x6f, - 0x66, 0x66, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x89, 0x04, 0x0a, 0x06, 0x43, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x69, 0x6e, 0x67, - 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x69, 0x67, 0x6e, 0x61, - 0x6c, 0x69, 0x6e, 0x67, 0x49, 0x64, 0x12, 0x2a, 0x0a, 0x11, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, - 0x6f, 0x72, 0x74, 0x5f, 0x70, 0x65, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x50, 0x65, 0x65, 0x72, - 0x49, 0x64, 0x12, 0x25, 0x0a, 0x0e, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x5f, - 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x74, 0x72, 0x61, 0x6e, - 0x73, 0x70, 0x6f, 0x72, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x28, 0x0a, 0x04, 0x71, 0x75, 0x69, - 0x63, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, - 0x6f, 0x72, 0x74, 0x2e, 0x71, 0x75, 0x69, 0x63, 0x2e, 0x4f, 0x70, 0x74, 0x73, 0x52, 0x04, 0x71, - 0x75, 0x69, 0x63, 0x12, 0x2d, 0x0a, 0x07, 0x77, 0x65, 0x62, 0x5f, 0x72, 0x74, 0x63, 0x18, 0x05, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x77, 0x65, 0x62, 0x72, 0x74, 0x63, 0x2e, 0x57, 0x65, - 0x62, 0x52, 0x74, 0x63, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x06, 0x77, 0x65, 0x62, 0x52, - 0x74, 0x63, 0x12, 0x2a, 0x0a, 0x07, 0x62, 0x61, 0x63, 0x6b, 0x6f, 0x66, 0x66, 0x18, 0x06, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x62, 0x61, 0x63, 0x6b, 0x6f, 0x66, 0x66, 0x2e, 0x42, 0x61, - 0x63, 0x6b, 0x6f, 0x66, 0x66, 0x52, 0x07, 0x62, 0x61, 0x63, 0x6b, 0x6f, 0x66, 0x66, 0x12, 0x35, - 0x0a, 0x07, 0x64, 0x69, 0x61, 0x6c, 0x65, 0x72, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x1b, 0x2e, 0x77, 0x65, 0x62, 0x72, 0x74, 0x63, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, - 0x44, 0x69, 0x61, 0x6c, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x64, 0x69, - 0x61, 0x6c, 0x65, 0x72, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x61, 0x6c, 0x6c, 0x5f, 0x70, 0x65, 0x65, - 0x72, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x61, 0x6c, 0x6c, 0x50, 0x65, 0x65, - 0x72, 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x6c, 0x69, - 0x73, 0x74, 0x65, 0x6e, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x64, 0x69, 0x73, 0x61, - 0x62, 0x6c, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x12, 0x1f, 0x0a, 0x0b, 0x62, 0x6c, 0x6f, - 0x63, 0x6b, 0x5f, 0x70, 0x65, 0x65, 0x72, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, - 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x50, 0x65, 0x65, 0x72, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, - 0x72, 0x62, 0x6f, 0x73, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x76, 0x65, 0x72, - 0x62, 0x6f, 0x73, 0x65, 0x1a, 0x4e, 0x0a, 0x0c, 0x44, 0x69, 0x61, 0x6c, 0x65, 0x72, 0x73, 0x45, - 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x28, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x64, 0x69, 0x61, 0x6c, 0x65, 0x72, 0x2e, 0x44, - 0x69, 0x61, 0x6c, 0x65, 0x72, 0x4f, 0x70, 0x74, 0x73, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x3a, 0x02, 0x38, 0x01, 0x22, 0xcd, 0x01, 0x0a, 0x0c, 0x57, 0x65, 0x62, 0x52, 0x74, 0x63, 0x43, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x38, 0x0a, 0x0b, 0x69, 0x63, 0x65, 0x5f, 0x73, 0x65, 0x72, - 0x76, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x77, 0x65, 0x62, - 0x72, 0x74, 0x63, 0x2e, 0x49, 0x63, 0x65, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x43, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x52, 0x0a, 0x69, 0x63, 0x65, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x12, - 0x4c, 0x0a, 0x14, 0x69, 0x63, 0x65, 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, - 0x5f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, - 0x77, 0x65, 0x62, 0x72, 0x74, 0x63, 0x2e, 0x49, 0x63, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x70, - 0x6f, 0x72, 0x74, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x12, 0x69, 0x63, 0x65, 0x54, 0x72, - 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x35, 0x0a, - 0x17, 0x69, 0x63, 0x65, 0x5f, 0x63, 0x61, 0x6e, 0x64, 0x69, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x70, - 0x6f, 0x6f, 0x6c, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x14, - 0x69, 0x63, 0x65, 0x43, 0x61, 0x6e, 0x64, 0x69, 0x64, 0x61, 0x74, 0x65, 0x50, 0x6f, 0x6f, 0x6c, - 0x53, 0x69, 0x7a, 0x65, 0x22, 0xfd, 0x01, 0x0a, 0x0f, 0x49, 0x63, 0x65, 0x53, 0x65, 0x72, 0x76, - 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x75, 0x72, 0x6c, 0x73, - 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x75, 0x72, 0x6c, 0x73, 0x12, 0x1a, 0x0a, 0x08, - 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, - 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, - 0x77, 0x6f, 0x72, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x08, 0x70, 0x61, - 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x12, 0x3f, 0x0a, 0x05, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x77, 0x65, 0x62, 0x72, 0x74, 0x63, 0x2e, 0x49, - 0x63, 0x65, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x4f, - 0x61, 0x75, 0x74, 0x68, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x48, 0x00, - 0x52, 0x05, 0x6f, 0x61, 0x75, 0x74, 0x68, 0x1a, 0x4d, 0x0a, 0x0f, 0x4f, 0x61, 0x75, 0x74, 0x68, - 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x12, 0x17, 0x0a, 0x07, 0x6d, 0x61, - 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6d, 0x61, 0x63, - 0x4b, 0x65, 0x79, 0x12, 0x21, 0x0a, 0x0c, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x74, 0x6f, - 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x61, 0x63, 0x63, 0x65, 0x73, - 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x42, 0x0c, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, - 0x74, 0x69, 0x61, 0x6c, 0x22, 0x8b, 0x01, 0x0a, 0x0c, 0x57, 0x65, 0x62, 0x52, 0x74, 0x63, 0x53, - 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x12, 0x25, 0x0a, 0x0d, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x5f, 0x6f, 0x66, 0x66, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x48, 0x00, 0x52, 0x0c, - 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4f, 0x66, 0x66, 0x65, 0x72, 0x12, 0x25, 0x0a, 0x03, - 0x73, 0x64, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x77, 0x65, 0x62, 0x72, - 0x74, 0x63, 0x2e, 0x57, 0x65, 0x62, 0x52, 0x74, 0x63, 0x53, 0x64, 0x70, 0x48, 0x00, 0x52, 0x03, - 0x73, 0x64, 0x70, 0x12, 0x25, 0x0a, 0x03, 0x69, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x11, 0x2e, 0x77, 0x65, 0x62, 0x72, 0x74, 0x63, 0x2e, 0x57, 0x65, 0x62, 0x52, 0x74, 0x63, - 0x49, 0x63, 0x65, 0x48, 0x00, 0x52, 0x03, 0x69, 0x63, 0x65, 0x42, 0x06, 0x0a, 0x04, 0x62, 0x6f, - 0x64, 0x79, 0x22, 0x53, 0x0a, 0x09, 0x57, 0x65, 0x62, 0x52, 0x74, 0x63, 0x53, 0x64, 0x70, 0x12, - 0x19, 0x0a, 0x08, 0x74, 0x78, 0x5f, 0x73, 0x65, 0x71, 0x6e, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x04, 0x52, 0x07, 0x74, 0x78, 0x53, 0x65, 0x71, 0x6e, 0x6f, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x64, - 0x70, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x64, - 0x70, 0x54, 0x79, 0x70, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x64, 0x70, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x03, 0x73, 0x64, 0x70, 0x22, 0x29, 0x0a, 0x09, 0x57, 0x65, 0x62, 0x52, 0x74, - 0x63, 0x49, 0x63, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x61, 0x6e, 0x64, 0x69, 0x64, 0x61, 0x74, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x61, 0x6e, 0x64, 0x69, 0x64, 0x61, - 0x74, 0x65, 0x2a, 0x4e, 0x0a, 0x12, 0x49, 0x63, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, - 0x72, 0x74, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x1a, 0x0a, 0x16, 0x49, 0x63, 0x65, 0x54, - 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x5f, 0x41, - 0x4c, 0x4c, 0x10, 0x00, 0x12, 0x1c, 0x0a, 0x18, 0x49, 0x63, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, - 0x70, 0x6f, 0x72, 0x74, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x5f, 0x52, 0x45, 0x4c, 0x41, 0x59, - 0x10, 0x01, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +func (m *Config) CloneVT() *Config { + if m == nil { + return (*Config)(nil) + } + r := new(Config) + r.SignalingId = m.SignalingId + r.TransportPeerId = m.TransportPeerId + r.TransportType = m.TransportType + r.WebRtc = m.WebRtc.CloneVT() + r.AllPeers = m.AllPeers + r.DisableListen = m.DisableListen + r.Verbose = m.Verbose + if rhs := m.Quic; rhs != nil { + r.Quic = rhs.CloneVT() + } + if rhs := m.Backoff; rhs != nil { + r.Backoff = rhs.CloneVT() + } + if rhs := m.Dialers; rhs != nil { + tmpContainer := make(map[string]*dialer.DialerOpts, len(rhs)) + for k, v := range rhs { + tmpContainer[k] = v.CloneVT() + } + r.Dialers = tmpContainer + } + if rhs := m.BlockPeers; rhs != nil { + tmpContainer := make([]string, len(rhs)) + copy(tmpContainer, rhs) + r.BlockPeers = tmpContainer + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *Config) CloneMessageVT() any { + return m.CloneVT() } -var ( - file_github_com_aperturerobotics_bifrost_transport_webrtc_webrtc_proto_rawDescOnce sync.Once - file_github_com_aperturerobotics_bifrost_transport_webrtc_webrtc_proto_rawDescData = file_github_com_aperturerobotics_bifrost_transport_webrtc_webrtc_proto_rawDesc -) +func (m *WebRtcConfig) CloneVT() *WebRtcConfig { + if m == nil { + return (*WebRtcConfig)(nil) + } + r := new(WebRtcConfig) + r.IceTransportPolicy = m.IceTransportPolicy + r.IceCandidatePoolSize = m.IceCandidatePoolSize + if rhs := m.IceServers; rhs != nil { + tmpContainer := make([]*IceServerConfig, len(rhs)) + for k, v := range rhs { + tmpContainer[k] = v.CloneVT() + } + r.IceServers = tmpContainer + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} -func file_github_com_aperturerobotics_bifrost_transport_webrtc_webrtc_proto_rawDescGZIP() []byte { - file_github_com_aperturerobotics_bifrost_transport_webrtc_webrtc_proto_rawDescOnce.Do(func() { - file_github_com_aperturerobotics_bifrost_transport_webrtc_webrtc_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_aperturerobotics_bifrost_transport_webrtc_webrtc_proto_rawDescData) - }) - return file_github_com_aperturerobotics_bifrost_transport_webrtc_webrtc_proto_rawDescData -} - -var file_github_com_aperturerobotics_bifrost_transport_webrtc_webrtc_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_github_com_aperturerobotics_bifrost_transport_webrtc_webrtc_proto_msgTypes = make([]protoimpl.MessageInfo, 8) -var file_github_com_aperturerobotics_bifrost_transport_webrtc_webrtc_proto_goTypes = []interface{}{ - (IceTransportPolicy)(0), // 0: webrtc.IceTransportPolicy - (*Config)(nil), // 1: webrtc.Config - (*WebRtcConfig)(nil), // 2: webrtc.WebRtcConfig - (*IceServerConfig)(nil), // 3: webrtc.IceServerConfig - (*WebRtcSignal)(nil), // 4: webrtc.WebRtcSignal - (*WebRtcSdp)(nil), // 5: webrtc.WebRtcSdp - (*WebRtcIce)(nil), // 6: webrtc.WebRtcIce - nil, // 7: webrtc.Config.DialersEntry - (*IceServerConfig_OauthCredential)(nil), // 8: webrtc.IceServerConfig.OauthCredential - (*quic.Opts)(nil), // 9: transport.quic.Opts - (*backoff.Backoff)(nil), // 10: backoff.Backoff - (*dialer.DialerOpts)(nil), // 11: dialer.DialerOpts -} -var file_github_com_aperturerobotics_bifrost_transport_webrtc_webrtc_proto_depIdxs = []int32{ - 9, // 0: webrtc.Config.quic:type_name -> transport.quic.Opts - 2, // 1: webrtc.Config.web_rtc:type_name -> webrtc.WebRtcConfig - 10, // 2: webrtc.Config.backoff:type_name -> backoff.Backoff - 7, // 3: webrtc.Config.dialers:type_name -> webrtc.Config.DialersEntry - 3, // 4: webrtc.WebRtcConfig.ice_servers:type_name -> webrtc.IceServerConfig - 0, // 5: webrtc.WebRtcConfig.ice_transport_policy:type_name -> webrtc.IceTransportPolicy - 8, // 6: webrtc.IceServerConfig.oauth:type_name -> webrtc.IceServerConfig.OauthCredential - 5, // 7: webrtc.WebRtcSignal.sdp:type_name -> webrtc.WebRtcSdp - 6, // 8: webrtc.WebRtcSignal.ice:type_name -> webrtc.WebRtcIce - 11, // 9: webrtc.Config.DialersEntry.value:type_name -> dialer.DialerOpts - 10, // [10:10] is the sub-list for method output_type - 10, // [10:10] is the sub-list for method input_type - 10, // [10:10] is the sub-list for extension type_name - 10, // [10:10] is the sub-list for extension extendee - 0, // [0:10] is the sub-list for field type_name -} - -func init() { file_github_com_aperturerobotics_bifrost_transport_webrtc_webrtc_proto_init() } -func file_github_com_aperturerobotics_bifrost_transport_webrtc_webrtc_proto_init() { - if File_github_com_aperturerobotics_bifrost_transport_webrtc_webrtc_proto != nil { - return +func (m *WebRtcConfig) CloneMessageVT() any { + return m.CloneVT() +} + +func (m *IceServerConfig_OauthCredential) CloneVT() *IceServerConfig_OauthCredential { + if m == nil { + return (*IceServerConfig_OauthCredential)(nil) + } + r := new(IceServerConfig_OauthCredential) + r.MacKey = m.MacKey + r.AccessToken = m.AccessToken + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *IceServerConfig_OauthCredential) CloneMessageVT() any { + return m.CloneVT() +} + +func (m *IceServerConfig) CloneVT() *IceServerConfig { + if m == nil { + return (*IceServerConfig)(nil) + } + r := new(IceServerConfig) + r.Username = m.Username + if rhs := m.Urls; rhs != nil { + tmpContainer := make([]string, len(rhs)) + copy(tmpContainer, rhs) + r.Urls = tmpContainer + } + if m.Credential != nil { + r.Credential = m.Credential.(interface { + CloneVT() isIceServerConfig_Credential + }).CloneVT() + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *IceServerConfig) CloneMessageVT() any { + return m.CloneVT() +} + +func (m *IceServerConfig_Password) CloneVT() *IceServerConfig_Password { + if m == nil { + return (*IceServerConfig_Password)(nil) + } + r := new(IceServerConfig_Password) + r.Password = m.Password + return r +} + +func (m *IceServerConfig_Oauth) CloneVT() *IceServerConfig_Oauth { + if m == nil { + return (*IceServerConfig_Oauth)(nil) } - if !protoimpl.UnsafeEnabled { - file_github_com_aperturerobotics_bifrost_transport_webrtc_webrtc_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Config); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_github_com_aperturerobotics_bifrost_transport_webrtc_webrtc_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*WebRtcConfig); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_github_com_aperturerobotics_bifrost_transport_webrtc_webrtc_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*IceServerConfig); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_github_com_aperturerobotics_bifrost_transport_webrtc_webrtc_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*WebRtcSignal); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_github_com_aperturerobotics_bifrost_transport_webrtc_webrtc_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*WebRtcSdp); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_github_com_aperturerobotics_bifrost_transport_webrtc_webrtc_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*WebRtcIce); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_github_com_aperturerobotics_bifrost_transport_webrtc_webrtc_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*IceServerConfig_OauthCredential); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_github_com_aperturerobotics_bifrost_transport_webrtc_webrtc_proto_msgTypes[2].OneofWrappers = []interface{}{ - (*IceServerConfig_Password)(nil), - (*IceServerConfig_Oauth)(nil), - } - file_github_com_aperturerobotics_bifrost_transport_webrtc_webrtc_proto_msgTypes[3].OneofWrappers = []interface{}{ - (*WebRtcSignal_RequestOffer)(nil), - (*WebRtcSignal_Sdp)(nil), - (*WebRtcSignal_Ice)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_github_com_aperturerobotics_bifrost_transport_webrtc_webrtc_proto_rawDesc, - NumEnums: 1, - NumMessages: 8, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_github_com_aperturerobotics_bifrost_transport_webrtc_webrtc_proto_goTypes, - DependencyIndexes: file_github_com_aperturerobotics_bifrost_transport_webrtc_webrtc_proto_depIdxs, - EnumInfos: file_github_com_aperturerobotics_bifrost_transport_webrtc_webrtc_proto_enumTypes, - MessageInfos: file_github_com_aperturerobotics_bifrost_transport_webrtc_webrtc_proto_msgTypes, - }.Build() - File_github_com_aperturerobotics_bifrost_transport_webrtc_webrtc_proto = out.File - file_github_com_aperturerobotics_bifrost_transport_webrtc_webrtc_proto_rawDesc = nil - file_github_com_aperturerobotics_bifrost_transport_webrtc_webrtc_proto_goTypes = nil - file_github_com_aperturerobotics_bifrost_transport_webrtc_webrtc_proto_depIdxs = nil + r := new(IceServerConfig_Oauth) + r.Oauth = m.Oauth.CloneVT() + return r +} + +func (m *WebRtcSignal) CloneVT() *WebRtcSignal { + if m == nil { + return (*WebRtcSignal)(nil) + } + r := new(WebRtcSignal) + if m.Body != nil { + r.Body = m.Body.(interface{ CloneVT() isWebRtcSignal_Body }).CloneVT() + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *WebRtcSignal) CloneMessageVT() any { + return m.CloneVT() +} + +func (m *WebRtcSignal_RequestOffer) CloneVT() *WebRtcSignal_RequestOffer { + if m == nil { + return (*WebRtcSignal_RequestOffer)(nil) + } + r := new(WebRtcSignal_RequestOffer) + r.RequestOffer = m.RequestOffer + return r +} + +func (m *WebRtcSignal_Sdp) CloneVT() *WebRtcSignal_Sdp { + if m == nil { + return (*WebRtcSignal_Sdp)(nil) + } + r := new(WebRtcSignal_Sdp) + r.Sdp = m.Sdp.CloneVT() + return r +} + +func (m *WebRtcSignal_Ice) CloneVT() *WebRtcSignal_Ice { + if m == nil { + return (*WebRtcSignal_Ice)(nil) + } + r := new(WebRtcSignal_Ice) + r.Ice = m.Ice.CloneVT() + return r +} + +func (m *WebRtcSdp) CloneVT() *WebRtcSdp { + if m == nil { + return (*WebRtcSdp)(nil) + } + r := new(WebRtcSdp) + r.TxSeqno = m.TxSeqno + r.SdpType = m.SdpType + r.Sdp = m.Sdp + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *WebRtcSdp) CloneMessageVT() any { + return m.CloneVT() +} + +func (m *WebRtcIce) CloneVT() *WebRtcIce { + if m == nil { + return (*WebRtcIce)(nil) + } + r := new(WebRtcIce) + r.Candidate = m.Candidate + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *WebRtcIce) CloneMessageVT() any { + return m.CloneVT() +} + +func (this *Config) EqualVT(that *Config) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.SignalingId != that.SignalingId { + return false + } + if this.TransportPeerId != that.TransportPeerId { + return false + } + if this.TransportType != that.TransportType { + return false + } + if !this.Quic.EqualVT(that.Quic) { + return false + } + if !this.WebRtc.EqualVT(that.WebRtc) { + return false + } + if !this.Backoff.EqualVT(that.Backoff) { + return false + } + if len(this.Dialers) != len(that.Dialers) { + return false + } + for i, vx := range this.Dialers { + vy, ok := that.Dialers[i] + if !ok { + return false + } + if p, q := vx, vy; p != q { + if p == nil { + p = &dialer.DialerOpts{} + } + if q == nil { + q = &dialer.DialerOpts{} + } + if !p.EqualVT(q) { + return false + } + } + } + if this.AllPeers != that.AllPeers { + return false + } + if this.DisableListen != that.DisableListen { + return false + } + if len(this.BlockPeers) != len(that.BlockPeers) { + return false + } + for i, vx := range this.BlockPeers { + vy := that.BlockPeers[i] + if vx != vy { + return false + } + } + if this.Verbose != that.Verbose { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *Config) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*Config) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *WebRtcConfig) EqualVT(that *WebRtcConfig) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if len(this.IceServers) != len(that.IceServers) { + return false + } + for i, vx := range this.IceServers { + vy := that.IceServers[i] + if p, q := vx, vy; p != q { + if p == nil { + p = &IceServerConfig{} + } + if q == nil { + q = &IceServerConfig{} + } + if !p.EqualVT(q) { + return false + } + } + } + if this.IceTransportPolicy != that.IceTransportPolicy { + return false + } + if this.IceCandidatePoolSize != that.IceCandidatePoolSize { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *WebRtcConfig) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*WebRtcConfig) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *IceServerConfig_OauthCredential) EqualVT(that *IceServerConfig_OauthCredential) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.MacKey != that.MacKey { + return false + } + if this.AccessToken != that.AccessToken { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *IceServerConfig_OauthCredential) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*IceServerConfig_OauthCredential) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *IceServerConfig) EqualVT(that *IceServerConfig) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.Credential == nil && that.Credential != nil { + return false + } else if this.Credential != nil { + if that.Credential == nil { + return false + } + if !this.Credential.(interface { + EqualVT(isIceServerConfig_Credential) bool + }).EqualVT(that.Credential) { + return false + } + } + if len(this.Urls) != len(that.Urls) { + return false + } + for i, vx := range this.Urls { + vy := that.Urls[i] + if vx != vy { + return false + } + } + if this.Username != that.Username { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *IceServerConfig) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*IceServerConfig) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *IceServerConfig_Password) EqualVT(thatIface isIceServerConfig_Credential) bool { + that, ok := thatIface.(*IceServerConfig_Password) + if !ok { + return false + } + if this == that { + return true + } + if this == nil && that != nil || this != nil && that == nil { + return false + } + if this.Password != that.Password { + return false + } + return true +} + +func (this *IceServerConfig_Oauth) EqualVT(thatIface isIceServerConfig_Credential) bool { + that, ok := thatIface.(*IceServerConfig_Oauth) + if !ok { + return false + } + if this == that { + return true + } + if this == nil && that != nil || this != nil && that == nil { + return false + } + if p, q := this.Oauth, that.Oauth; p != q { + if p == nil { + p = &IceServerConfig_OauthCredential{} + } + if q == nil { + q = &IceServerConfig_OauthCredential{} + } + if !p.EqualVT(q) { + return false + } + } + return true +} + +func (this *WebRtcSignal) EqualVT(that *WebRtcSignal) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.Body == nil && that.Body != nil { + return false + } else if this.Body != nil { + if that.Body == nil { + return false + } + if !this.Body.(interface { + EqualVT(isWebRtcSignal_Body) bool + }).EqualVT(that.Body) { + return false + } + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *WebRtcSignal) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*WebRtcSignal) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *WebRtcSignal_RequestOffer) EqualVT(thatIface isWebRtcSignal_Body) bool { + that, ok := thatIface.(*WebRtcSignal_RequestOffer) + if !ok { + return false + } + if this == that { + return true + } + if this == nil && that != nil || this != nil && that == nil { + return false + } + if this.RequestOffer != that.RequestOffer { + return false + } + return true +} + +func (this *WebRtcSignal_Sdp) EqualVT(thatIface isWebRtcSignal_Body) bool { + that, ok := thatIface.(*WebRtcSignal_Sdp) + if !ok { + return false + } + if this == that { + return true + } + if this == nil && that != nil || this != nil && that == nil { + return false + } + if p, q := this.Sdp, that.Sdp; p != q { + if p == nil { + p = &WebRtcSdp{} + } + if q == nil { + q = &WebRtcSdp{} + } + if !p.EqualVT(q) { + return false + } + } + return true +} + +func (this *WebRtcSignal_Ice) EqualVT(thatIface isWebRtcSignal_Body) bool { + that, ok := thatIface.(*WebRtcSignal_Ice) + if !ok { + return false + } + if this == that { + return true + } + if this == nil && that != nil || this != nil && that == nil { + return false + } + if p, q := this.Ice, that.Ice; p != q { + if p == nil { + p = &WebRtcIce{} + } + if q == nil { + q = &WebRtcIce{} + } + if !p.EqualVT(q) { + return false + } + } + return true +} + +func (this *WebRtcSdp) EqualVT(that *WebRtcSdp) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.TxSeqno != that.TxSeqno { + return false + } + if this.SdpType != that.SdpType { + return false + } + if this.Sdp != that.Sdp { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *WebRtcSdp) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*WebRtcSdp) + if !ok { + return false + } + return this.EqualVT(that) +} +func (this *WebRtcIce) EqualVT(that *WebRtcIce) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.Candidate != that.Candidate { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *WebRtcIce) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*WebRtcIce) + if !ok { + return false + } + return this.EqualVT(that) +} + +// MarshalProtoJSON marshals the IceTransportPolicy to JSON. +func (x IceTransportPolicy) MarshalProtoJSON(s *json.MarshalState) { + s.WriteEnumString(int32(x), IceTransportPolicy_name) +} + +// MarshalText marshals the IceTransportPolicy to text. +func (x IceTransportPolicy) MarshalText() ([]byte, error) { + return []byte(json.GetEnumString(int32(x), IceTransportPolicy_name)), nil +} + +// MarshalJSON marshals the IceTransportPolicy to JSON. +func (x IceTransportPolicy) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) +} + +// UnmarshalProtoJSON unmarshals the IceTransportPolicy from JSON. +func (x *IceTransportPolicy) UnmarshalProtoJSON(s *json.UnmarshalState) { + v := s.ReadEnum(IceTransportPolicy_value) + if err := s.Err(); err != nil { + s.SetErrorf("could not read IceTransportPolicy enum: %v", err) + return + } + *x = IceTransportPolicy(v) +} + +// UnmarshalText unmarshals the IceTransportPolicy from text. +func (x *IceTransportPolicy) UnmarshalText(b []byte) error { + i, err := json.ParseEnumString(string(b), IceTransportPolicy_value) + if err != nil { + return err + } + *x = IceTransportPolicy(i) + return nil +} + +// UnmarshalJSON unmarshals the IceTransportPolicy from JSON. +func (x *IceTransportPolicy) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +// MarshalProtoJSON marshals the Config_DialersEntry message to JSON. +func (x *Config_DialersEntry) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return + } + s.WriteObjectStart() + var wroteField bool + if x.Key != "" || s.HasField("key") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("key") + s.WriteString(x.Key) + } + if x.Value != nil || s.HasField("value") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("value") + x.Value.MarshalProtoJSON(s.WithField("value")) + } + s.WriteObjectEnd() +} + +// MarshalJSON marshals the Config_DialersEntry to JSON. +func (x *Config_DialersEntry) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) +} + +// UnmarshalProtoJSON unmarshals the Config_DialersEntry message from JSON. +func (x *Config_DialersEntry) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { + return + } + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "key": + s.AddField("key") + x.Key = s.ReadString() + case "value": + if s.ReadNil() { + x.Value = nil + return + } + x.Value = &dialer.DialerOpts{} + x.Value.UnmarshalProtoJSON(s.WithField("value", true)) + } + }) +} + +// UnmarshalJSON unmarshals the Config_DialersEntry from JSON. +func (x *Config_DialersEntry) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +// MarshalProtoJSON marshals the Config message to JSON. +func (x *Config) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return + } + s.WriteObjectStart() + var wroteField bool + if x.SignalingId != "" || s.HasField("signalingId") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("signalingId") + s.WriteString(x.SignalingId) + } + if x.TransportPeerId != "" || s.HasField("transportPeerId") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("transportPeerId") + s.WriteString(x.TransportPeerId) + } + if x.TransportType != "" || s.HasField("transportType") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("transportType") + s.WriteString(x.TransportType) + } + if x.Quic != nil || s.HasField("quic") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("quic") + x.Quic.MarshalProtoJSON(s.WithField("quic")) + } + if x.WebRtc != nil || s.HasField("webRtc") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("webRtc") + x.WebRtc.MarshalProtoJSON(s.WithField("webRtc")) + } + if x.Backoff != nil || s.HasField("backoff") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("backoff") + x.Backoff.MarshalProtoJSON(s.WithField("backoff")) + } + if x.Dialers != nil || s.HasField("dialers") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("dialers") + s.WriteObjectStart() + var wroteElement bool + for k, v := range x.Dialers { + s.WriteMoreIf(&wroteElement) + s.WriteObjectStringField(k) + v.MarshalProtoJSON(s.WithField("dialers")) + } + s.WriteObjectEnd() + } + if x.AllPeers || s.HasField("allPeers") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("allPeers") + s.WriteBool(x.AllPeers) + } + if x.DisableListen || s.HasField("disableListen") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("disableListen") + s.WriteBool(x.DisableListen) + } + if len(x.BlockPeers) > 0 || s.HasField("blockPeers") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("blockPeers") + s.WriteStringArray(x.BlockPeers) + } + if x.Verbose || s.HasField("verbose") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("verbose") + s.WriteBool(x.Verbose) + } + s.WriteObjectEnd() +} + +// MarshalJSON marshals the Config to JSON. +func (x *Config) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) +} + +// UnmarshalProtoJSON unmarshals the Config message from JSON. +func (x *Config) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { + return + } + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "signaling_id", "signalingId": + s.AddField("signaling_id") + x.SignalingId = s.ReadString() + case "transport_peer_id", "transportPeerId": + s.AddField("transport_peer_id") + x.TransportPeerId = s.ReadString() + case "transport_type", "transportType": + s.AddField("transport_type") + x.TransportType = s.ReadString() + case "quic": + if s.ReadNil() { + x.Quic = nil + return + } + x.Quic = &quic.Opts{} + x.Quic.UnmarshalProtoJSON(s.WithField("quic", true)) + case "web_rtc", "webRtc": + if s.ReadNil() { + x.WebRtc = nil + return + } + x.WebRtc = &WebRtcConfig{} + x.WebRtc.UnmarshalProtoJSON(s.WithField("web_rtc", true)) + case "backoff": + if s.ReadNil() { + x.Backoff = nil + return + } + x.Backoff = &backoff.Backoff{} + x.Backoff.UnmarshalProtoJSON(s.WithField("backoff", true)) + case "dialers": + s.AddField("dialers") + if s.ReadNil() { + x.Dialers = nil + return + } + x.Dialers = make(map[string]*dialer.DialerOpts) + s.ReadStringMap(func(key string) { + var v dialer.DialerOpts + v.UnmarshalProtoJSON(s) + x.Dialers[key] = &v + }) + case "all_peers", "allPeers": + s.AddField("all_peers") + x.AllPeers = s.ReadBool() + case "disable_listen", "disableListen": + s.AddField("disable_listen") + x.DisableListen = s.ReadBool() + case "block_peers", "blockPeers": + s.AddField("block_peers") + if s.ReadNil() { + x.BlockPeers = nil + return + } + x.BlockPeers = s.ReadStringArray() + case "verbose": + s.AddField("verbose") + x.Verbose = s.ReadBool() + } + }) +} + +// UnmarshalJSON unmarshals the Config from JSON. +func (x *Config) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +// MarshalProtoJSON marshals the WebRtcConfig message to JSON. +func (x *WebRtcConfig) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return + } + s.WriteObjectStart() + var wroteField bool + if len(x.IceServers) > 0 || s.HasField("iceServers") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("iceServers") + s.WriteArrayStart() + var wroteElement bool + for _, element := range x.IceServers { + s.WriteMoreIf(&wroteElement) + element.MarshalProtoJSON(s.WithField("iceServers")) + } + s.WriteArrayEnd() + } + if x.IceTransportPolicy != 0 || s.HasField("iceTransportPolicy") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("iceTransportPolicy") + x.IceTransportPolicy.MarshalProtoJSON(s) + } + if x.IceCandidatePoolSize != 0 || s.HasField("iceCandidatePoolSize") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("iceCandidatePoolSize") + s.WriteUint32(x.IceCandidatePoolSize) + } + s.WriteObjectEnd() +} + +// MarshalJSON marshals the WebRtcConfig to JSON. +func (x *WebRtcConfig) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) +} + +// UnmarshalProtoJSON unmarshals the WebRtcConfig message from JSON. +func (x *WebRtcConfig) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { + return + } + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "ice_servers", "iceServers": + s.AddField("ice_servers") + if s.ReadNil() { + x.IceServers = nil + return + } + s.ReadArray(func() { + if s.ReadNil() { + x.IceServers = append(x.IceServers, nil) + return + } + v := &IceServerConfig{} + v.UnmarshalProtoJSON(s.WithField("ice_servers", false)) + if s.Err() != nil { + return + } + x.IceServers = append(x.IceServers, v) + }) + case "ice_transport_policy", "iceTransportPolicy": + s.AddField("ice_transport_policy") + x.IceTransportPolicy.UnmarshalProtoJSON(s) + case "ice_candidate_pool_size", "iceCandidatePoolSize": + s.AddField("ice_candidate_pool_size") + x.IceCandidatePoolSize = s.ReadUint32() + } + }) +} + +// UnmarshalJSON unmarshals the WebRtcConfig from JSON. +func (x *WebRtcConfig) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +// MarshalProtoJSON marshals the IceServerConfig_OauthCredential message to JSON. +func (x *IceServerConfig_OauthCredential) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return + } + s.WriteObjectStart() + var wroteField bool + if x.MacKey != "" || s.HasField("macKey") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("macKey") + s.WriteString(x.MacKey) + } + if x.AccessToken != "" || s.HasField("accessToken") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("accessToken") + s.WriteString(x.AccessToken) + } + s.WriteObjectEnd() +} + +// MarshalJSON marshals the IceServerConfig_OauthCredential to JSON. +func (x *IceServerConfig_OauthCredential) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) +} + +// UnmarshalProtoJSON unmarshals the IceServerConfig_OauthCredential message from JSON. +func (x *IceServerConfig_OauthCredential) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { + return + } + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "mac_key", "macKey": + s.AddField("mac_key") + x.MacKey = s.ReadString() + case "access_token", "accessToken": + s.AddField("access_token") + x.AccessToken = s.ReadString() + } + }) +} + +// UnmarshalJSON unmarshals the IceServerConfig_OauthCredential from JSON. +func (x *IceServerConfig_OauthCredential) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +// MarshalProtoJSON marshals the IceServerConfig message to JSON. +func (x *IceServerConfig) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return + } + s.WriteObjectStart() + var wroteField bool + if len(x.Urls) > 0 || s.HasField("urls") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("urls") + s.WriteStringArray(x.Urls) + } + if x.Username != "" || s.HasField("username") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("username") + s.WriteString(x.Username) + } + if x.Credential != nil { + switch ov := x.Credential.(type) { + case *IceServerConfig_Password: + s.WriteMoreIf(&wroteField) + s.WriteObjectField("password") + s.WriteString(ov.Password) + case *IceServerConfig_Oauth: + s.WriteMoreIf(&wroteField) + s.WriteObjectField("oauth") + ov.Oauth.MarshalProtoJSON(s.WithField("oauth")) + } + } + s.WriteObjectEnd() +} + +// MarshalJSON marshals the IceServerConfig to JSON. +func (x *IceServerConfig) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) +} + +// UnmarshalProtoJSON unmarshals the IceServerConfig message from JSON. +func (x *IceServerConfig) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { + return + } + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "urls": + s.AddField("urls") + if s.ReadNil() { + x.Urls = nil + return + } + x.Urls = s.ReadStringArray() + case "username": + s.AddField("username") + x.Username = s.ReadString() + case "password": + s.AddField("password") + ov := &IceServerConfig_Password{} + x.Credential = ov + ov.Password = s.ReadString() + case "oauth": + ov := &IceServerConfig_Oauth{} + x.Credential = ov + if s.ReadNil() { + ov.Oauth = nil + return + } + ov.Oauth = &IceServerConfig_OauthCredential{} + ov.Oauth.UnmarshalProtoJSON(s.WithField("oauth", true)) + } + }) +} + +// UnmarshalJSON unmarshals the IceServerConfig from JSON. +func (x *IceServerConfig) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +// MarshalProtoJSON marshals the WebRtcSignal message to JSON. +func (x *WebRtcSignal) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return + } + s.WriteObjectStart() + var wroteField bool + if x.Body != nil { + switch ov := x.Body.(type) { + case *WebRtcSignal_RequestOffer: + s.WriteMoreIf(&wroteField) + s.WriteObjectField("requestOffer") + s.WriteUint64(ov.RequestOffer) + case *WebRtcSignal_Sdp: + s.WriteMoreIf(&wroteField) + s.WriteObjectField("sdp") + ov.Sdp.MarshalProtoJSON(s.WithField("sdp")) + case *WebRtcSignal_Ice: + s.WriteMoreIf(&wroteField) + s.WriteObjectField("ice") + ov.Ice.MarshalProtoJSON(s.WithField("ice")) + } + } + s.WriteObjectEnd() +} + +// MarshalJSON marshals the WebRtcSignal to JSON. +func (x *WebRtcSignal) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) +} + +// UnmarshalProtoJSON unmarshals the WebRtcSignal message from JSON. +func (x *WebRtcSignal) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { + return + } + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "request_offer", "requestOffer": + s.AddField("request_offer") + ov := &WebRtcSignal_RequestOffer{} + x.Body = ov + ov.RequestOffer = s.ReadUint64() + case "sdp": + ov := &WebRtcSignal_Sdp{} + x.Body = ov + if s.ReadNil() { + ov.Sdp = nil + return + } + ov.Sdp = &WebRtcSdp{} + ov.Sdp.UnmarshalProtoJSON(s.WithField("sdp", true)) + case "ice": + ov := &WebRtcSignal_Ice{} + x.Body = ov + if s.ReadNil() { + ov.Ice = nil + return + } + ov.Ice = &WebRtcIce{} + ov.Ice.UnmarshalProtoJSON(s.WithField("ice", true)) + } + }) +} + +// UnmarshalJSON unmarshals the WebRtcSignal from JSON. +func (x *WebRtcSignal) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +// MarshalProtoJSON marshals the WebRtcSdp message to JSON. +func (x *WebRtcSdp) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return + } + s.WriteObjectStart() + var wroteField bool + if x.TxSeqno != 0 || s.HasField("txSeqno") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("txSeqno") + s.WriteUint64(x.TxSeqno) + } + if x.SdpType != "" || s.HasField("sdpType") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("sdpType") + s.WriteString(x.SdpType) + } + if x.Sdp != "" || s.HasField("sdp") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("sdp") + s.WriteString(x.Sdp) + } + s.WriteObjectEnd() +} + +// MarshalJSON marshals the WebRtcSdp to JSON. +func (x *WebRtcSdp) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) +} + +// UnmarshalProtoJSON unmarshals the WebRtcSdp message from JSON. +func (x *WebRtcSdp) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { + return + } + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "tx_seqno", "txSeqno": + s.AddField("tx_seqno") + x.TxSeqno = s.ReadUint64() + case "sdp_type", "sdpType": + s.AddField("sdp_type") + x.SdpType = s.ReadString() + case "sdp": + s.AddField("sdp") + x.Sdp = s.ReadString() + } + }) +} + +// UnmarshalJSON unmarshals the WebRtcSdp from JSON. +func (x *WebRtcSdp) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +// MarshalProtoJSON marshals the WebRtcIce message to JSON. +func (x *WebRtcIce) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return + } + s.WriteObjectStart() + var wroteField bool + if x.Candidate != "" || s.HasField("candidate") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("candidate") + s.WriteString(x.Candidate) + } + s.WriteObjectEnd() +} + +// MarshalJSON marshals the WebRtcIce to JSON. +func (x *WebRtcIce) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) +} + +// UnmarshalProtoJSON unmarshals the WebRtcIce message from JSON. +func (x *WebRtcIce) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { + return + } + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "candidate": + s.AddField("candidate") + x.Candidate = s.ReadString() + } + }) +} + +// UnmarshalJSON unmarshals the WebRtcIce from JSON. +func (x *WebRtcIce) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +func (m *Config) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Config) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.Verbose { + i-- + if m.Verbose { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x58 + } + if len(m.BlockPeers) > 0 { + for iNdEx := len(m.BlockPeers) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.BlockPeers[iNdEx]) + copy(dAtA[i:], m.BlockPeers[iNdEx]) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.BlockPeers[iNdEx]))) + i-- + dAtA[i] = 0x52 + } + } + if m.DisableListen { + i-- + if m.DisableListen { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x48 + } + if m.AllPeers { + i-- + if m.AllPeers { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x40 + } + if len(m.Dialers) > 0 { + for k := range m.Dialers { + v := m.Dialers[k] + baseI := i + size, err := v.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x12 + i -= len(k) + copy(dAtA[i:], k) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(k))) + i-- + dAtA[i] = 0xa + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0x3a + } + } + if m.Backoff != nil { + size, err := m.Backoff.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x32 + } + if m.WebRtc != nil { + size, err := m.WebRtc.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x2a + } + if m.Quic != nil { + size, err := m.Quic.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x22 + } + if len(m.TransportType) > 0 { + i -= len(m.TransportType) + copy(dAtA[i:], m.TransportType) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.TransportType))) + i-- + dAtA[i] = 0x1a + } + if len(m.TransportPeerId) > 0 { + i -= len(m.TransportPeerId) + copy(dAtA[i:], m.TransportPeerId) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.TransportPeerId))) + i-- + dAtA[i] = 0x12 + } + if len(m.SignalingId) > 0 { + i -= len(m.SignalingId) + copy(dAtA[i:], m.SignalingId) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.SignalingId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *WebRtcConfig) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *WebRtcConfig) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *WebRtcConfig) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.IceCandidatePoolSize != 0 { + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(m.IceCandidatePoolSize)) + i-- + dAtA[i] = 0x18 + } + if m.IceTransportPolicy != 0 { + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(m.IceTransportPolicy)) + i-- + dAtA[i] = 0x10 + } + if len(m.IceServers) > 0 { + for iNdEx := len(m.IceServers) - 1; iNdEx >= 0; iNdEx-- { + size, err := m.IceServers[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *IceServerConfig_OauthCredential) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *IceServerConfig_OauthCredential) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *IceServerConfig_OauthCredential) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.AccessToken) > 0 { + i -= len(m.AccessToken) + copy(dAtA[i:], m.AccessToken) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.AccessToken))) + i-- + dAtA[i] = 0x12 + } + if len(m.MacKey) > 0 { + i -= len(m.MacKey) + copy(dAtA[i:], m.MacKey) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.MacKey))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *IceServerConfig) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *IceServerConfig) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *IceServerConfig) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if vtmsg, ok := m.Credential.(interface { + MarshalToSizedBufferVT([]byte) (int, error) + }); ok { + size, err := vtmsg.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + } + if len(m.Username) > 0 { + i -= len(m.Username) + copy(dAtA[i:], m.Username) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.Username))) + i-- + dAtA[i] = 0x12 + } + if len(m.Urls) > 0 { + for iNdEx := len(m.Urls) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Urls[iNdEx]) + copy(dAtA[i:], m.Urls[iNdEx]) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.Urls[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *IceServerConfig_Password) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *IceServerConfig_Password) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + i := len(dAtA) + i -= len(m.Password) + copy(dAtA[i:], m.Password) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.Password))) + i-- + dAtA[i] = 0x1a + return len(dAtA) - i, nil +} +func (m *IceServerConfig_Oauth) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *IceServerConfig_Oauth) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + i := len(dAtA) + if m.Oauth != nil { + size, err := m.Oauth.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x22 + } else { + i = protobuf_go_lite.EncodeVarint(dAtA, i, 0) + i-- + dAtA[i] = 0x22 + } + return len(dAtA) - i, nil +} +func (m *WebRtcSignal) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *WebRtcSignal) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *WebRtcSignal) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if vtmsg, ok := m.Body.(interface { + MarshalToSizedBufferVT([]byte) (int, error) + }); ok { + size, err := vtmsg.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + } + return len(dAtA) - i, nil +} + +func (m *WebRtcSignal_RequestOffer) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *WebRtcSignal_RequestOffer) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + i := len(dAtA) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(m.RequestOffer)) + i-- + dAtA[i] = 0x8 + return len(dAtA) - i, nil +} +func (m *WebRtcSignal_Sdp) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *WebRtcSignal_Sdp) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + i := len(dAtA) + if m.Sdp != nil { + size, err := m.Sdp.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x12 + } else { + i = protobuf_go_lite.EncodeVarint(dAtA, i, 0) + i-- + dAtA[i] = 0x12 + } + return len(dAtA) - i, nil +} +func (m *WebRtcSignal_Ice) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *WebRtcSignal_Ice) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + i := len(dAtA) + if m.Ice != nil { + size, err := m.Ice.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x1a + } else { + i = protobuf_go_lite.EncodeVarint(dAtA, i, 0) + i-- + dAtA[i] = 0x1a + } + return len(dAtA) - i, nil +} +func (m *WebRtcSdp) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *WebRtcSdp) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *WebRtcSdp) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.Sdp) > 0 { + i -= len(m.Sdp) + copy(dAtA[i:], m.Sdp) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.Sdp))) + i-- + dAtA[i] = 0x1a + } + if len(m.SdpType) > 0 { + i -= len(m.SdpType) + copy(dAtA[i:], m.SdpType) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.SdpType))) + i-- + dAtA[i] = 0x12 + } + if m.TxSeqno != 0 { + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(m.TxSeqno)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *WebRtcIce) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *WebRtcIce) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *WebRtcIce) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if len(m.Candidate) > 0 { + i -= len(m.Candidate) + copy(dAtA[i:], m.Candidate) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.Candidate))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Config) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.SignalingId) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + l = len(m.TransportPeerId) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + l = len(m.TransportType) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + if m.Quic != nil { + l = m.Quic.SizeVT() + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + if m.WebRtc != nil { + l = m.WebRtc.SizeVT() + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + if m.Backoff != nil { + l = m.Backoff.SizeVT() + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + if len(m.Dialers) > 0 { + for k, v := range m.Dialers { + _ = k + _ = v + l = 0 + if v != nil { + l = v.SizeVT() + } + l += 1 + protobuf_go_lite.SizeOfVarint(uint64(l)) + mapEntrySize := 1 + len(k) + protobuf_go_lite.SizeOfVarint(uint64(len(k))) + l + n += mapEntrySize + 1 + protobuf_go_lite.SizeOfVarint(uint64(mapEntrySize)) + } + } + if m.AllPeers { + n += 2 + } + if m.DisableListen { + n += 2 + } + if len(m.BlockPeers) > 0 { + for _, s := range m.BlockPeers { + l = len(s) + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + } + if m.Verbose { + n += 2 + } + n += len(m.unknownFields) + return n +} + +func (m *WebRtcConfig) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.IceServers) > 0 { + for _, e := range m.IceServers { + l = e.SizeVT() + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + } + if m.IceTransportPolicy != 0 { + n += 1 + protobuf_go_lite.SizeOfVarint(uint64(m.IceTransportPolicy)) + } + if m.IceCandidatePoolSize != 0 { + n += 1 + protobuf_go_lite.SizeOfVarint(uint64(m.IceCandidatePoolSize)) + } + n += len(m.unknownFields) + return n +} + +func (m *IceServerConfig_OauthCredential) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.MacKey) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + l = len(m.AccessToken) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *IceServerConfig) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Urls) > 0 { + for _, s := range m.Urls { + l = len(s) + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + } + l = len(m.Username) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + if vtmsg, ok := m.Credential.(interface{ SizeVT() int }); ok { + n += vtmsg.SizeVT() + } + n += len(m.unknownFields) + return n +} + +func (m *IceServerConfig_Password) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Password) + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + return n +} +func (m *IceServerConfig_Oauth) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Oauth != nil { + l = m.Oauth.SizeVT() + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } else { + n += 2 + } + return n +} +func (m *WebRtcSignal) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if vtmsg, ok := m.Body.(interface{ SizeVT() int }); ok { + n += vtmsg.SizeVT() + } + n += len(m.unknownFields) + return n +} + +func (m *WebRtcSignal_RequestOffer) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + n += 1 + protobuf_go_lite.SizeOfVarint(uint64(m.RequestOffer)) + return n +} +func (m *WebRtcSignal_Sdp) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Sdp != nil { + l = m.Sdp.SizeVT() + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } else { + n += 2 + } + return n +} +func (m *WebRtcSignal_Ice) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Ice != nil { + l = m.Ice.SizeVT() + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } else { + n += 2 + } + return n +} +func (m *WebRtcSdp) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.TxSeqno != 0 { + n += 1 + protobuf_go_lite.SizeOfVarint(uint64(m.TxSeqno)) + } + l = len(m.SdpType) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + l = len(m.Sdp) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *WebRtcIce) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Candidate) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + n += len(m.unknownFields) + return n +} + +func (m *Config) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: Config: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: Config: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field SignalingId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SignalingId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field TransportPeerId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TransportPeerId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field TransportType", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TransportType = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field Quic", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Quic == nil { + m.Quic = &quic.Opts{} + } + if err := m.Quic.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field WebRtc", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.WebRtc == nil { + m.WebRtc = &WebRtcConfig{} + } + if err := m.WebRtc.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field Backoff", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Backoff == nil { + m.Backoff = &backoff.Backoff{} + } + if err := m.Backoff.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field Dialers", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Dialers == nil { + m.Dialers = make(map[string]*dialer.DialerOpts) + } + var mapkey string + var mapvalue *dialer.DialerOpts + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var mapmsglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapmsglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if mapmsglen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postmsgIndex := iNdEx + mapmsglen + if postmsgIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postmsgIndex > l { + return io.ErrUnexpectedEOF + } + mapvalue = &dialer.DialerOpts{} + if err := mapvalue.UnmarshalVT(dAtA[iNdEx:postmsgIndex]); err != nil { + return err + } + iNdEx = postmsgIndex + } else { + iNdEx = entryPreIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.Dialers[mapkey] = mapvalue + iNdEx = postIndex + case 8: + if wireType != 0 { + return errors.Errorf("proto: wrong wireType = %d for field AllPeers", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.AllPeers = bool(v != 0) + case 9: + if wireType != 0 { + return errors.Errorf("proto: wrong wireType = %d for field DisableListen", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.DisableListen = bool(v != 0) + case 10: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field BlockPeers", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BlockPeers = append(m.BlockPeers, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 11: + if wireType != 0 { + return errors.Errorf("proto: wrong wireType = %d for field Verbose", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Verbose = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *WebRtcConfig) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: WebRtcConfig: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: WebRtcConfig: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field IceServers", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.IceServers = append(m.IceServers, &IceServerConfig{}) + if err := m.IceServers[len(m.IceServers)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return errors.Errorf("proto: wrong wireType = %d for field IceTransportPolicy", wireType) + } + m.IceTransportPolicy = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.IceTransportPolicy |= IceTransportPolicy(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return errors.Errorf("proto: wrong wireType = %d for field IceCandidatePoolSize", wireType) + } + m.IceCandidatePoolSize = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.IceCandidatePoolSize |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *IceServerConfig_OauthCredential) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: IceServerConfig_OauthCredential: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: IceServerConfig_OauthCredential: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field MacKey", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.MacKey = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field AccessToken", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AccessToken = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *IceServerConfig) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: IceServerConfig: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: IceServerConfig: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field Urls", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Urls = append(m.Urls, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 2: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field Username", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Username = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field Password", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Credential = &IceServerConfig_Password{Password: string(dAtA[iNdEx:postIndex])} + iNdEx = postIndex + case 4: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field Oauth", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if oneof, ok := m.Credential.(*IceServerConfig_Oauth); ok { + if err := oneof.Oauth.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + } else { + v := &IceServerConfig_OauthCredential{} + if err := v.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Credential = &IceServerConfig_Oauth{Oauth: v} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *WebRtcSignal) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: WebRtcSignal: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: WebRtcSignal: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return errors.Errorf("proto: wrong wireType = %d for field RequestOffer", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Body = &WebRtcSignal_RequestOffer{RequestOffer: v} + case 2: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field Sdp", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if oneof, ok := m.Body.(*WebRtcSignal_Sdp); ok { + if err := oneof.Sdp.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + } else { + v := &WebRtcSdp{} + if err := v.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Body = &WebRtcSignal_Sdp{Sdp: v} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field Ice", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if oneof, ok := m.Body.(*WebRtcSignal_Ice); ok { + if err := oneof.Ice.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + } else { + v := &WebRtcIce{} + if err := v.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + m.Body = &WebRtcSignal_Ice{Ice: v} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *WebRtcSdp) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: WebRtcSdp: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: WebRtcSdp: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return errors.Errorf("proto: wrong wireType = %d for field TxSeqno", wireType) + } + m.TxSeqno = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TxSeqno |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field SdpType", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SdpType = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field Sdp", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sdp = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *WebRtcIce) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: WebRtcIce: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: WebRtcIce: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field Candidate", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Candidate = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil } diff --git a/transport/webrtc/webrtc.pb.ts b/transport/webrtc/webrtc.pb.ts deleted file mode 100644 index 18e19724..00000000 --- a/transport/webrtc/webrtc.pb.ts +++ /dev/null @@ -1,1542 +0,0 @@ -/* eslint-disable */ -import { Backoff } from '@go/github.com/aperturerobotics/util/backoff/backoff.pb.js' -import Long from 'long' -import _m0 from 'protobufjs/minimal.js' -import { DialerOpts } from '../common/dialer/dialer.pb.js' -import { Opts } from '../common/quic/quic.pb.js' - -export const protobufPackage = 'webrtc' - -/** IceTransportPolicy contains the set of allowed ICE transport policies. */ -export enum IceTransportPolicy { - /** IceTransportPolicy_ALL - IceTransportPolicy_ALL allows any kind of ICE candidate. */ - IceTransportPolicy_ALL = 0, - /** IceTransportPolicy_RELAY - IceTransportPolicy_RELAY allows only media relay candidates (TURN). */ - IceTransportPolicy_RELAY = 1, - UNRECOGNIZED = -1, -} - -export function iceTransportPolicyFromJSON(object: any): IceTransportPolicy { - switch (object) { - case 0: - case 'IceTransportPolicy_ALL': - return IceTransportPolicy.IceTransportPolicy_ALL - case 1: - case 'IceTransportPolicy_RELAY': - return IceTransportPolicy.IceTransportPolicy_RELAY - case -1: - case 'UNRECOGNIZED': - default: - return IceTransportPolicy.UNRECOGNIZED - } -} - -export function iceTransportPolicyToJSON(object: IceTransportPolicy): string { - switch (object) { - case IceTransportPolicy.IceTransportPolicy_ALL: - return 'IceTransportPolicy_ALL' - case IceTransportPolicy.IceTransportPolicy_RELAY: - return 'IceTransportPolicy_RELAY' - case IceTransportPolicy.UNRECOGNIZED: - default: - return 'UNRECOGNIZED' - } -} - -/** Config is the configuration for the WebRTC Signal RPC transport. */ -export interface Config { - /** - * SignalingId is the signaling channel identifier. - * Cannot be empty. - */ - signalingId: string - /** - * TransportPeerId sets the peer ID to attach the transport to. - * If unset, attaches to any running peer with a private key. - * Must match the transport peer ID of the signaling transport. - */ - transportPeerId: string - /** - * TransportType overrides the transport type id for dial addresses. - * Defaults to "webrtc" - * Configures the scheme for addr matching to this transport. - * E.x.: webrtc:// - */ - transportType: string - /** - * Quic contains the quic protocol options. - * - * The WebRTC transport always disables FEC and several other UDP-centric - * features which are unnecessary due to the "reliable" nature of WebRTC. - */ - quic: Opts | undefined - /** WebRtc contains the WebRTC protocol options. */ - webRtc: WebRtcConfig | undefined - /** - * Backoff is the backoff config for connecting to a PeerConnection. - * If unset, defaults to reasonable defaults. - */ - backoff: Backoff | undefined - /** - * Dialers maps peer IDs to dialers. - * This allows mapping which peer ID should be dialed via this transport. - */ - dialers: { [key: string]: DialerOpts } - /** - * AllPeers tells the transport to attempt to negotiate a WebRTC session with - * any peer, even those not listed in the Dialers map. - */ - allPeers: boolean - /** - * DisableListen disables listening for incoming Links. - * If set, we will only dial out, not accept incoming links. - */ - disableListen: boolean - /** BlockPeers is a list of peer ids that will not be contacted via this transport. */ - blockPeers: string[] - /** Verbose enables very verbose logging. */ - verbose: boolean -} - -export interface Config_DialersEntry { - key: string - value: DialerOpts | undefined -} - -/** WebRtcConfig configures the WebRTC PeerConnection. */ -export interface WebRtcConfig { - /** IceServers contains the list of ICE servers to use. */ - iceServers: IceServerConfig[] - /** - * IceTransportPolicy defines the policy for permitted ICE candidates. - * Optional. - */ - iceTransportPolicy: IceTransportPolicy - /** - * IceCandidatePoolSize defines the size of the prefetched ICE pool. - * Optional. - */ - iceCandidatePoolSize: number -} - -/** IceServer is a WebRTC ICE server config. */ -export interface IceServerConfig { - /** - * Urls is the list of URLs for the ICE server. - * - * Format: stun:{url} or turn:{url} or turns:{url}?transport=tcp - * Examples: - * - stun:stun.l.google.com:19302 - * - stun:stun.stunprotocol.org:3478 - * - turns:google.de?transport=tcp - */ - urls: string[] - /** Username is the username for the ICE server. */ - username: string - credential?: - | { $case: 'password'; password: string } - | { $case: 'oauth'; oauth: IceServerConfig_OauthCredential } - | undefined -} - -/** OauthCredential is an OAuth credential information for the ICE server. */ -export interface IceServerConfig_OauthCredential { - /** MacKey is a base64-url format. */ - macKey: string - /** AccessToken is the access token in base64-encoded format. */ - accessToken: string -} - -/** WebRtcSignal is a WebRTC Signaling message sent via the Signaling channel. */ -export interface WebRtcSignal { - body?: - | { $case: 'requestOffer'; requestOffer: Long } - | { $case: 'sdp'; sdp: WebRtcSdp } - | { - $case: 'ice' - ice: WebRtcIce - } - | undefined -} - -/** WebRtcSdp contains the SDP offer or answer. */ -export interface WebRtcSdp { - /** - * TxSeqno is the sequence number of the transmitting peer. - * The receiver should update the local seqno to match. - */ - txSeqno: Long - /** - * SdpType is the string encoded type of the sdp. - * Examples: "offer" "answer" - */ - sdpType: string - /** Sdp contains the WebRTC session description. */ - sdp: string -} - -/** WebRtcIce contains an ICE candidate. */ -export interface WebRtcIce { - /** Candidate contains the JSON-encoded ICE candidate. */ - candidate: string -} - -function createBaseConfig(): Config { - return { - signalingId: '', - transportPeerId: '', - transportType: '', - quic: undefined, - webRtc: undefined, - backoff: undefined, - dialers: {}, - allPeers: false, - disableListen: false, - blockPeers: [], - verbose: false, - } -} - -export const Config = { - encode( - message: Config, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.signalingId !== '') { - writer.uint32(10).string(message.signalingId) - } - if (message.transportPeerId !== '') { - writer.uint32(18).string(message.transportPeerId) - } - if (message.transportType !== '') { - writer.uint32(26).string(message.transportType) - } - if (message.quic !== undefined) { - Opts.encode(message.quic, writer.uint32(34).fork()).ldelim() - } - if (message.webRtc !== undefined) { - WebRtcConfig.encode(message.webRtc, writer.uint32(42).fork()).ldelim() - } - if (message.backoff !== undefined) { - Backoff.encode(message.backoff, writer.uint32(50).fork()).ldelim() - } - Object.entries(message.dialers).forEach(([key, value]) => { - Config_DialersEntry.encode( - { key: key as any, value }, - writer.uint32(58).fork(), - ).ldelim() - }) - if (message.allPeers !== false) { - writer.uint32(64).bool(message.allPeers) - } - if (message.disableListen !== false) { - writer.uint32(72).bool(message.disableListen) - } - for (const v of message.blockPeers) { - writer.uint32(82).string(v!) - } - if (message.verbose !== false) { - writer.uint32(88).bool(message.verbose) - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Config { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseConfig() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break - } - - message.signalingId = reader.string() - continue - case 2: - if (tag !== 18) { - break - } - - message.transportPeerId = reader.string() - continue - case 3: - if (tag !== 26) { - break - } - - message.transportType = reader.string() - continue - case 4: - if (tag !== 34) { - break - } - - message.quic = Opts.decode(reader, reader.uint32()) - continue - case 5: - if (tag !== 42) { - break - } - - message.webRtc = WebRtcConfig.decode(reader, reader.uint32()) - continue - case 6: - if (tag !== 50) { - break - } - - message.backoff = Backoff.decode(reader, reader.uint32()) - continue - case 7: - if (tag !== 58) { - break - } - - const entry7 = Config_DialersEntry.decode(reader, reader.uint32()) - if (entry7.value !== undefined) { - message.dialers[entry7.key] = entry7.value - } - continue - case 8: - if (tag !== 64) { - break - } - - message.allPeers = reader.bool() - continue - case 9: - if (tag !== 72) { - break - } - - message.disableListen = reader.bool() - continue - case 10: - if (tag !== 82) { - break - } - - message.blockPeers.push(reader.string()) - continue - case 11: - if (tag !== 88) { - break - } - - message.verbose = reader.bool() - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: AsyncIterable | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config.encode(p).finish()] - } - } else { - yield* [Config.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config.decode(p)] - } - } else { - yield* [Config.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): Config { - return { - signalingId: isSet(object.signalingId) - ? globalThis.String(object.signalingId) - : '', - transportPeerId: isSet(object.transportPeerId) - ? globalThis.String(object.transportPeerId) - : '', - transportType: isSet(object.transportType) - ? globalThis.String(object.transportType) - : '', - quic: isSet(object.quic) ? Opts.fromJSON(object.quic) : undefined, - webRtc: isSet(object.webRtc) - ? WebRtcConfig.fromJSON(object.webRtc) - : undefined, - backoff: isSet(object.backoff) - ? Backoff.fromJSON(object.backoff) - : undefined, - dialers: isObject(object.dialers) - ? Object.entries(object.dialers).reduce<{ [key: string]: DialerOpts }>( - (acc, [key, value]) => { - acc[key] = DialerOpts.fromJSON(value) - return acc - }, - {}, - ) - : {}, - allPeers: isSet(object.allPeers) - ? globalThis.Boolean(object.allPeers) - : false, - disableListen: isSet(object.disableListen) - ? globalThis.Boolean(object.disableListen) - : false, - blockPeers: globalThis.Array.isArray(object?.blockPeers) - ? object.blockPeers.map((e: any) => globalThis.String(e)) - : [], - verbose: isSet(object.verbose) - ? globalThis.Boolean(object.verbose) - : false, - } - }, - - toJSON(message: Config): unknown { - const obj: any = {} - if (message.signalingId !== '') { - obj.signalingId = message.signalingId - } - if (message.transportPeerId !== '') { - obj.transportPeerId = message.transportPeerId - } - if (message.transportType !== '') { - obj.transportType = message.transportType - } - if (message.quic !== undefined) { - obj.quic = Opts.toJSON(message.quic) - } - if (message.webRtc !== undefined) { - obj.webRtc = WebRtcConfig.toJSON(message.webRtc) - } - if (message.backoff !== undefined) { - obj.backoff = Backoff.toJSON(message.backoff) - } - if (message.dialers) { - const entries = Object.entries(message.dialers) - if (entries.length > 0) { - obj.dialers = {} - entries.forEach(([k, v]) => { - obj.dialers[k] = DialerOpts.toJSON(v) - }) - } - } - if (message.allPeers !== false) { - obj.allPeers = message.allPeers - } - if (message.disableListen !== false) { - obj.disableListen = message.disableListen - } - if (message.blockPeers?.length) { - obj.blockPeers = message.blockPeers - } - if (message.verbose !== false) { - obj.verbose = message.verbose - } - return obj - }, - - create, I>>(base?: I): Config { - return Config.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>(object: I): Config { - const message = createBaseConfig() - message.signalingId = object.signalingId ?? '' - message.transportPeerId = object.transportPeerId ?? '' - message.transportType = object.transportType ?? '' - message.quic = - object.quic !== undefined && object.quic !== null - ? Opts.fromPartial(object.quic) - : undefined - message.webRtc = - object.webRtc !== undefined && object.webRtc !== null - ? WebRtcConfig.fromPartial(object.webRtc) - : undefined - message.backoff = - object.backoff !== undefined && object.backoff !== null - ? Backoff.fromPartial(object.backoff) - : undefined - message.dialers = Object.entries(object.dialers ?? {}).reduce<{ - [key: string]: DialerOpts - }>((acc, [key, value]) => { - if (value !== undefined) { - acc[key] = DialerOpts.fromPartial(value) - } - return acc - }, {}) - message.allPeers = object.allPeers ?? false - message.disableListen = object.disableListen ?? false - message.blockPeers = object.blockPeers?.map((e) => e) || [] - message.verbose = object.verbose ?? false - return message - }, -} - -function createBaseConfig_DialersEntry(): Config_DialersEntry { - return { key: '', value: undefined } -} - -export const Config_DialersEntry = { - encode( - message: Config_DialersEntry, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.key !== '') { - writer.uint32(10).string(message.key) - } - if (message.value !== undefined) { - DialerOpts.encode(message.value, writer.uint32(18).fork()).ldelim() - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Config_DialersEntry { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseConfig_DialersEntry() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break - } - - message.key = reader.string() - continue - case 2: - if (tag !== 18) { - break - } - - message.value = DialerOpts.decode(reader, reader.uint32()) - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config_DialersEntry.encode(p).finish()] - } - } else { - yield* [Config_DialersEntry.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config_DialersEntry.decode(p)] - } - } else { - yield* [Config_DialersEntry.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): Config_DialersEntry { - return { - key: isSet(object.key) ? globalThis.String(object.key) : '', - value: isSet(object.value) - ? DialerOpts.fromJSON(object.value) - : undefined, - } - }, - - toJSON(message: Config_DialersEntry): unknown { - const obj: any = {} - if (message.key !== '') { - obj.key = message.key - } - if (message.value !== undefined) { - obj.value = DialerOpts.toJSON(message.value) - } - return obj - }, - - create, I>>( - base?: I, - ): Config_DialersEntry { - return Config_DialersEntry.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>( - object: I, - ): Config_DialersEntry { - const message = createBaseConfig_DialersEntry() - message.key = object.key ?? '' - message.value = - object.value !== undefined && object.value !== null - ? DialerOpts.fromPartial(object.value) - : undefined - return message - }, -} - -function createBaseWebRtcConfig(): WebRtcConfig { - return { iceServers: [], iceTransportPolicy: 0, iceCandidatePoolSize: 0 } -} - -export const WebRtcConfig = { - encode( - message: WebRtcConfig, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - for (const v of message.iceServers) { - IceServerConfig.encode(v!, writer.uint32(10).fork()).ldelim() - } - if (message.iceTransportPolicy !== 0) { - writer.uint32(16).int32(message.iceTransportPolicy) - } - if (message.iceCandidatePoolSize !== 0) { - writer.uint32(24).uint32(message.iceCandidatePoolSize) - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): WebRtcConfig { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseWebRtcConfig() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break - } - - message.iceServers.push( - IceServerConfig.decode(reader, reader.uint32()), - ) - continue - case 2: - if (tag !== 16) { - break - } - - message.iceTransportPolicy = reader.int32() as any - continue - case 3: - if (tag !== 24) { - break - } - - message.iceCandidatePoolSize = reader.uint32() - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [WebRtcConfig.encode(p).finish()] - } - } else { - yield* [WebRtcConfig.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [WebRtcConfig.decode(p)] - } - } else { - yield* [WebRtcConfig.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): WebRtcConfig { - return { - iceServers: globalThis.Array.isArray(object?.iceServers) - ? object.iceServers.map((e: any) => IceServerConfig.fromJSON(e)) - : [], - iceTransportPolicy: isSet(object.iceTransportPolicy) - ? iceTransportPolicyFromJSON(object.iceTransportPolicy) - : 0, - iceCandidatePoolSize: isSet(object.iceCandidatePoolSize) - ? globalThis.Number(object.iceCandidatePoolSize) - : 0, - } - }, - - toJSON(message: WebRtcConfig): unknown { - const obj: any = {} - if (message.iceServers?.length) { - obj.iceServers = message.iceServers.map((e) => IceServerConfig.toJSON(e)) - } - if (message.iceTransportPolicy !== 0) { - obj.iceTransportPolicy = iceTransportPolicyToJSON( - message.iceTransportPolicy, - ) - } - if (message.iceCandidatePoolSize !== 0) { - obj.iceCandidatePoolSize = Math.round(message.iceCandidatePoolSize) - } - return obj - }, - - create, I>>( - base?: I, - ): WebRtcConfig { - return WebRtcConfig.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>( - object: I, - ): WebRtcConfig { - const message = createBaseWebRtcConfig() - message.iceServers = - object.iceServers?.map((e) => IceServerConfig.fromPartial(e)) || [] - message.iceTransportPolicy = object.iceTransportPolicy ?? 0 - message.iceCandidatePoolSize = object.iceCandidatePoolSize ?? 0 - return message - }, -} - -function createBaseIceServerConfig(): IceServerConfig { - return { urls: [], username: '', credential: undefined } -} - -export const IceServerConfig = { - encode( - message: IceServerConfig, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - for (const v of message.urls) { - writer.uint32(10).string(v!) - } - if (message.username !== '') { - writer.uint32(18).string(message.username) - } - switch (message.credential?.$case) { - case 'password': - writer.uint32(26).string(message.credential.password) - break - case 'oauth': - IceServerConfig_OauthCredential.encode( - message.credential.oauth, - writer.uint32(34).fork(), - ).ldelim() - break - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): IceServerConfig { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseIceServerConfig() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break - } - - message.urls.push(reader.string()) - continue - case 2: - if (tag !== 18) { - break - } - - message.username = reader.string() - continue - case 3: - if (tag !== 26) { - break - } - - message.credential = { $case: 'password', password: reader.string() } - continue - case 4: - if (tag !== 34) { - break - } - - message.credential = { - $case: 'oauth', - oauth: IceServerConfig_OauthCredential.decode( - reader, - reader.uint32(), - ), - } - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [IceServerConfig.encode(p).finish()] - } - } else { - yield* [IceServerConfig.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [IceServerConfig.decode(p)] - } - } else { - yield* [IceServerConfig.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): IceServerConfig { - return { - urls: globalThis.Array.isArray(object?.urls) - ? object.urls.map((e: any) => globalThis.String(e)) - : [], - username: isSet(object.username) - ? globalThis.String(object.username) - : '', - credential: isSet(object.password) - ? { $case: 'password', password: globalThis.String(object.password) } - : isSet(object.oauth) - ? { - $case: 'oauth', - oauth: IceServerConfig_OauthCredential.fromJSON(object.oauth), - } - : undefined, - } - }, - - toJSON(message: IceServerConfig): unknown { - const obj: any = {} - if (message.urls?.length) { - obj.urls = message.urls - } - if (message.username !== '') { - obj.username = message.username - } - if (message.credential?.$case === 'password') { - obj.password = message.credential.password - } - if (message.credential?.$case === 'oauth') { - obj.oauth = IceServerConfig_OauthCredential.toJSON( - message.credential.oauth, - ) - } - return obj - }, - - create, I>>( - base?: I, - ): IceServerConfig { - return IceServerConfig.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>( - object: I, - ): IceServerConfig { - const message = createBaseIceServerConfig() - message.urls = object.urls?.map((e) => e) || [] - message.username = object.username ?? '' - if ( - object.credential?.$case === 'password' && - object.credential?.password !== undefined && - object.credential?.password !== null - ) { - message.credential = { - $case: 'password', - password: object.credential.password, - } - } - if ( - object.credential?.$case === 'oauth' && - object.credential?.oauth !== undefined && - object.credential?.oauth !== null - ) { - message.credential = { - $case: 'oauth', - oauth: IceServerConfig_OauthCredential.fromPartial( - object.credential.oauth, - ), - } - } - return message - }, -} - -function createBaseIceServerConfig_OauthCredential(): IceServerConfig_OauthCredential { - return { macKey: '', accessToken: '' } -} - -export const IceServerConfig_OauthCredential = { - encode( - message: IceServerConfig_OauthCredential, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.macKey !== '') { - writer.uint32(10).string(message.macKey) - } - if (message.accessToken !== '') { - writer.uint32(18).string(message.accessToken) - } - return writer - }, - - decode( - input: _m0.Reader | Uint8Array, - length?: number, - ): IceServerConfig_OauthCredential { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseIceServerConfig_OauthCredential() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break - } - - message.macKey = reader.string() - continue - case 2: - if (tag !== 18) { - break - } - - message.accessToken = reader.string() - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: - | AsyncIterable< - IceServerConfig_OauthCredential | IceServerConfig_OauthCredential[] - > - | Iterable< - IceServerConfig_OauthCredential | IceServerConfig_OauthCredential[] - >, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [IceServerConfig_OauthCredential.encode(p).finish()] - } - } else { - yield* [IceServerConfig_OauthCredential.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [IceServerConfig_OauthCredential.decode(p)] - } - } else { - yield* [IceServerConfig_OauthCredential.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): IceServerConfig_OauthCredential { - return { - macKey: isSet(object.macKey) ? globalThis.String(object.macKey) : '', - accessToken: isSet(object.accessToken) - ? globalThis.String(object.accessToken) - : '', - } - }, - - toJSON(message: IceServerConfig_OauthCredential): unknown { - const obj: any = {} - if (message.macKey !== '') { - obj.macKey = message.macKey - } - if (message.accessToken !== '') { - obj.accessToken = message.accessToken - } - return obj - }, - - create, I>>( - base?: I, - ): IceServerConfig_OauthCredential { - return IceServerConfig_OauthCredential.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>( - object: I, - ): IceServerConfig_OauthCredential { - const message = createBaseIceServerConfig_OauthCredential() - message.macKey = object.macKey ?? '' - message.accessToken = object.accessToken ?? '' - return message - }, -} - -function createBaseWebRtcSignal(): WebRtcSignal { - return { body: undefined } -} - -export const WebRtcSignal = { - encode( - message: WebRtcSignal, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - switch (message.body?.$case) { - case 'requestOffer': - writer.uint32(8).uint64(message.body.requestOffer) - break - case 'sdp': - WebRtcSdp.encode(message.body.sdp, writer.uint32(18).fork()).ldelim() - break - case 'ice': - WebRtcIce.encode(message.body.ice, writer.uint32(26).fork()).ldelim() - break - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): WebRtcSignal { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseWebRtcSignal() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 8) { - break - } - - message.body = { - $case: 'requestOffer', - requestOffer: reader.uint64() as Long, - } - continue - case 2: - if (tag !== 18) { - break - } - - message.body = { - $case: 'sdp', - sdp: WebRtcSdp.decode(reader, reader.uint32()), - } - continue - case 3: - if (tag !== 26) { - break - } - - message.body = { - $case: 'ice', - ice: WebRtcIce.decode(reader, reader.uint32()), - } - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [WebRtcSignal.encode(p).finish()] - } - } else { - yield* [WebRtcSignal.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [WebRtcSignal.decode(p)] - } - } else { - yield* [WebRtcSignal.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): WebRtcSignal { - return { - body: isSet(object.requestOffer) - ? { - $case: 'requestOffer', - requestOffer: Long.fromValue(object.requestOffer), - } - : isSet(object.sdp) - ? { $case: 'sdp', sdp: WebRtcSdp.fromJSON(object.sdp) } - : isSet(object.ice) - ? { $case: 'ice', ice: WebRtcIce.fromJSON(object.ice) } - : undefined, - } - }, - - toJSON(message: WebRtcSignal): unknown { - const obj: any = {} - if (message.body?.$case === 'requestOffer') { - obj.requestOffer = (message.body.requestOffer || Long.UZERO).toString() - } - if (message.body?.$case === 'sdp') { - obj.sdp = WebRtcSdp.toJSON(message.body.sdp) - } - if (message.body?.$case === 'ice') { - obj.ice = WebRtcIce.toJSON(message.body.ice) - } - return obj - }, - - create, I>>( - base?: I, - ): WebRtcSignal { - return WebRtcSignal.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>( - object: I, - ): WebRtcSignal { - const message = createBaseWebRtcSignal() - if ( - object.body?.$case === 'requestOffer' && - object.body?.requestOffer !== undefined && - object.body?.requestOffer !== null - ) { - message.body = { - $case: 'requestOffer', - requestOffer: Long.fromValue(object.body.requestOffer), - } - } - if ( - object.body?.$case === 'sdp' && - object.body?.sdp !== undefined && - object.body?.sdp !== null - ) { - message.body = { - $case: 'sdp', - sdp: WebRtcSdp.fromPartial(object.body.sdp), - } - } - if ( - object.body?.$case === 'ice' && - object.body?.ice !== undefined && - object.body?.ice !== null - ) { - message.body = { - $case: 'ice', - ice: WebRtcIce.fromPartial(object.body.ice), - } - } - return message - }, -} - -function createBaseWebRtcSdp(): WebRtcSdp { - return { txSeqno: Long.UZERO, sdpType: '', sdp: '' } -} - -export const WebRtcSdp = { - encode( - message: WebRtcSdp, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (!message.txSeqno.equals(Long.UZERO)) { - writer.uint32(8).uint64(message.txSeqno) - } - if (message.sdpType !== '') { - writer.uint32(18).string(message.sdpType) - } - if (message.sdp !== '') { - writer.uint32(26).string(message.sdp) - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): WebRtcSdp { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseWebRtcSdp() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 8) { - break - } - - message.txSeqno = reader.uint64() as Long - continue - case 2: - if (tag !== 18) { - break - } - - message.sdpType = reader.string() - continue - case 3: - if (tag !== 26) { - break - } - - message.sdp = reader.string() - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [WebRtcSdp.encode(p).finish()] - } - } else { - yield* [WebRtcSdp.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [WebRtcSdp.decode(p)] - } - } else { - yield* [WebRtcSdp.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): WebRtcSdp { - return { - txSeqno: isSet(object.txSeqno) - ? Long.fromValue(object.txSeqno) - : Long.UZERO, - sdpType: isSet(object.sdpType) ? globalThis.String(object.sdpType) : '', - sdp: isSet(object.sdp) ? globalThis.String(object.sdp) : '', - } - }, - - toJSON(message: WebRtcSdp): unknown { - const obj: any = {} - if (!message.txSeqno.equals(Long.UZERO)) { - obj.txSeqno = (message.txSeqno || Long.UZERO).toString() - } - if (message.sdpType !== '') { - obj.sdpType = message.sdpType - } - if (message.sdp !== '') { - obj.sdp = message.sdp - } - return obj - }, - - create, I>>(base?: I): WebRtcSdp { - return WebRtcSdp.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>( - object: I, - ): WebRtcSdp { - const message = createBaseWebRtcSdp() - message.txSeqno = - object.txSeqno !== undefined && object.txSeqno !== null - ? Long.fromValue(object.txSeqno) - : Long.UZERO - message.sdpType = object.sdpType ?? '' - message.sdp = object.sdp ?? '' - return message - }, -} - -function createBaseWebRtcIce(): WebRtcIce { - return { candidate: '' } -} - -export const WebRtcIce = { - encode( - message: WebRtcIce, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.candidate !== '') { - writer.uint32(10).string(message.candidate) - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): WebRtcIce { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseWebRtcIce() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break - } - - message.candidate = reader.string() - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [WebRtcIce.encode(p).finish()] - } - } else { - yield* [WebRtcIce.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [WebRtcIce.decode(p)] - } - } else { - yield* [WebRtcIce.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): WebRtcIce { - return { - candidate: isSet(object.candidate) - ? globalThis.String(object.candidate) - : '', - } - }, - - toJSON(message: WebRtcIce): unknown { - const obj: any = {} - if (message.candidate !== '') { - obj.candidate = message.candidate - } - return obj - }, - - create, I>>(base?: I): WebRtcIce { - return WebRtcIce.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>( - object: I, - ): WebRtcIce { - const message = createBaseWebRtcIce() - message.candidate = object.candidate ?? '' - return message - }, -} - -type Builtin = - | Date - | Function - | Uint8Array - | string - | number - | boolean - | undefined - -export type DeepPartial = T extends Builtin - ? T - : T extends Long - ? string | number | Long - : T extends globalThis.Array - ? globalThis.Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends { $case: string } - ? { [K in keyof Omit]?: DeepPartial } & { - $case: T['$case'] - } - : T extends {} - ? { [K in keyof T]?: DeepPartial } - : Partial - -type KeysOfUnion = T extends T ? keyof T : never -export type Exact = P extends Builtin - ? P - : P & { [K in keyof P]: Exact } & { - [K in Exclude>]: never - } - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any - _m0.configure() -} - -function isObject(value: any): boolean { - return typeof value === 'object' && value !== null -} - -function isSet(value: any): boolean { - return value !== null && value !== undefined -} diff --git a/transport/webrtc/webrtc_pb.ts b/transport/webrtc/webrtc_pb.ts new file mode 100644 index 00000000..4b227ac0 --- /dev/null +++ b/transport/webrtc/webrtc_pb.ts @@ -0,0 +1,709 @@ +// @generated by protoc-gen-es v1.8.0 with parameter "target=ts,ts_nocheck=false" +// @generated from file github.com/aperturerobotics/bifrost/transport/webrtc/webrtc.proto (package webrtc, syntax proto3) +/* eslint-disable */ + +import type { + BinaryReadOptions, + FieldList, + JsonReadOptions, + JsonValue, + PartialMessage, + PlainMessage, +} from '@bufbuild/protobuf' +import { Message, proto3, protoInt64 } from '@bufbuild/protobuf' +import { Opts } from '../common/quic/quic_pb.js' +import { Backoff } from '../../../util/backoff/backoff_pb.js' +import { DialerOpts } from '../common/dialer/dialer_pb.js' + +/** + * IceTransportPolicy contains the set of allowed ICE transport policies. + * + * @generated from enum webrtc.IceTransportPolicy + */ +export enum IceTransportPolicy { + /** + * IceTransportPolicy_ALL allows any kind of ICE candidate. + * + * @generated from enum value: IceTransportPolicy_ALL = 0; + */ + IceTransportPolicy_ALL = 0, + + /** + * IceTransportPolicy_RELAY allows only media relay candidates (TURN). + * + * @generated from enum value: IceTransportPolicy_RELAY = 1; + */ + IceTransportPolicy_RELAY = 1, +} +// Retrieve enum metadata with: proto3.getEnumType(IceTransportPolicy) +proto3.util.setEnumType(IceTransportPolicy, 'webrtc.IceTransportPolicy', [ + { no: 0, name: 'IceTransportPolicy_ALL' }, + { no: 1, name: 'IceTransportPolicy_RELAY' }, +]) + +/** + * Config is the configuration for the WebRTC Signal RPC transport. + * + * @generated from message webrtc.Config + */ +export class Config extends Message { + /** + * SignalingId is the signaling channel identifier. + * Cannot be empty. + * + * @generated from field: string signaling_id = 1; + */ + signalingId = '' + + /** + * TransportPeerId sets the peer ID to attach the transport to. + * If unset, attaches to any running peer with a private key. + * Must match the transport peer ID of the signaling transport. + * + * @generated from field: string transport_peer_id = 2; + */ + transportPeerId = '' + + /** + * TransportType overrides the transport type id for dial addresses. + * Defaults to "webrtc" + * Configures the scheme for addr matching to this transport. + * E.x.: webrtc:// + * + * @generated from field: string transport_type = 3; + */ + transportType = '' + + /** + * Quic contains the quic protocol options. + * + * The WebRTC transport always disables FEC and several other UDP-centric + * features which are unnecessary due to the "reliable" nature of WebRTC. + * + * @generated from field: transport.quic.Opts quic = 4; + */ + quic?: Opts + + /** + * WebRtc contains the WebRTC protocol options. + * + * @generated from field: webrtc.WebRtcConfig web_rtc = 5; + */ + webRtc?: WebRtcConfig + + /** + * Backoff is the backoff config for connecting to a PeerConnection. + * If unset, defaults to reasonable defaults. + * + * @generated from field: backoff.Backoff backoff = 6; + */ + backoff?: Backoff + + /** + * Dialers maps peer IDs to dialers. + * This allows mapping which peer ID should be dialed via this transport. + * + * @generated from field: map dialers = 7; + */ + dialers: { [key: string]: DialerOpts } = {} + + /** + * AllPeers tells the transport to attempt to negotiate a WebRTC session with + * any peer, even those not listed in the Dialers map. + * + * @generated from field: bool all_peers = 8; + */ + allPeers = false + + /** + * DisableListen disables listening for incoming Links. + * If set, we will only dial out, not accept incoming links. + * + * @generated from field: bool disable_listen = 9; + */ + disableListen = false + + /** + * BlockPeers is a list of peer ids that will not be contacted via this transport. + * + * @generated from field: repeated string block_peers = 10; + */ + blockPeers: string[] = [] + + /** + * Verbose enables very verbose logging. + * + * @generated from field: bool verbose = 11; + */ + verbose = false + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'webrtc.Config' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { + no: 1, + name: 'signaling_id', + kind: 'scalar', + T: 9 /* ScalarType.STRING */, + }, + { + no: 2, + name: 'transport_peer_id', + kind: 'scalar', + T: 9 /* ScalarType.STRING */, + }, + { + no: 3, + name: 'transport_type', + kind: 'scalar', + T: 9 /* ScalarType.STRING */, + }, + { no: 4, name: 'quic', kind: 'message', T: Opts }, + { no: 5, name: 'web_rtc', kind: 'message', T: WebRtcConfig }, + { no: 6, name: 'backoff', kind: 'message', T: Backoff }, + { + no: 7, + name: 'dialers', + kind: 'map', + K: 9 /* ScalarType.STRING */, + V: { kind: 'message', T: DialerOpts }, + }, + { no: 8, name: 'all_peers', kind: 'scalar', T: 8 /* ScalarType.BOOL */ }, + { + no: 9, + name: 'disable_listen', + kind: 'scalar', + T: 8 /* ScalarType.BOOL */, + }, + { + no: 10, + name: 'block_peers', + kind: 'scalar', + T: 9 /* ScalarType.STRING */, + repeated: true, + }, + { no: 11, name: 'verbose', kind: 'scalar', T: 8 /* ScalarType.BOOL */ }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): Config { + return new Config().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): Config { + return new Config().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): Config { + return new Config().fromJsonString(jsonString, options) + } + + static equals( + a: Config | PlainMessage | undefined, + b: Config | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(Config, a, b) + } +} + +/** + * WebRtcConfig configures the WebRTC PeerConnection. + * + * @generated from message webrtc.WebRtcConfig + */ +export class WebRtcConfig extends Message { + /** + * IceServers contains the list of ICE servers to use. + * + * @generated from field: repeated webrtc.IceServerConfig ice_servers = 1; + */ + iceServers: IceServerConfig[] = [] + + /** + * IceTransportPolicy defines the policy for permitted ICE candidates. + * Optional. + * + * @generated from field: webrtc.IceTransportPolicy ice_transport_policy = 2; + */ + iceTransportPolicy = IceTransportPolicy.IceTransportPolicy_ALL + + /** + * IceCandidatePoolSize defines the size of the prefetched ICE pool. + * Optional. + * + * @generated from field: uint32 ice_candidate_pool_size = 3; + */ + iceCandidatePoolSize = 0 + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'webrtc.WebRtcConfig' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { + no: 1, + name: 'ice_servers', + kind: 'message', + T: IceServerConfig, + repeated: true, + }, + { + no: 2, + name: 'ice_transport_policy', + kind: 'enum', + T: proto3.getEnumType(IceTransportPolicy), + }, + { + no: 3, + name: 'ice_candidate_pool_size', + kind: 'scalar', + T: 13 /* ScalarType.UINT32 */, + }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): WebRtcConfig { + return new WebRtcConfig().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): WebRtcConfig { + return new WebRtcConfig().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): WebRtcConfig { + return new WebRtcConfig().fromJsonString(jsonString, options) + } + + static equals( + a: WebRtcConfig | PlainMessage | undefined, + b: WebRtcConfig | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(WebRtcConfig, a, b) + } +} + +/** + * IceServer is a WebRTC ICE server config. + * + * @generated from message webrtc.IceServerConfig + */ +export class IceServerConfig extends Message { + /** + * Urls is the list of URLs for the ICE server. + * + * Format: stun:{url} or turn:{url} or turns:{url}?transport=tcp + * Examples: + * - stun:stun.l.google.com:19302 + * - stun:stun.stunprotocol.org:3478 + * - turns:google.de?transport=tcp + * + * @generated from field: repeated string urls = 1; + */ + urls: string[] = [] + + /** + * Username is the username for the ICE server. + * + * @generated from field: string username = 2; + */ + username = '' + + /** + * Credential contains the ice server credential, if any. + * + * @generated from oneof webrtc.IceServerConfig.credential + */ + credential: + | { + /** + * Password contains the ICE server password. + * + * @generated from field: string password = 3; + */ + value: string + case: 'password' + } + | { + /** + * Oauth contains an OAuth credential. + * + * @generated from field: webrtc.IceServerConfig.OauthCredential oauth = 4; + */ + value: IceServerConfig_OauthCredential + case: 'oauth' + } + | { case: undefined; value?: undefined } = { case: undefined } + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'webrtc.IceServerConfig' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { + no: 1, + name: 'urls', + kind: 'scalar', + T: 9 /* ScalarType.STRING */, + repeated: true, + }, + { no: 2, name: 'username', kind: 'scalar', T: 9 /* ScalarType.STRING */ }, + { + no: 3, + name: 'password', + kind: 'scalar', + T: 9 /* ScalarType.STRING */, + oneof: 'credential', + }, + { + no: 4, + name: 'oauth', + kind: 'message', + T: IceServerConfig_OauthCredential, + oneof: 'credential', + }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): IceServerConfig { + return new IceServerConfig().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): IceServerConfig { + return new IceServerConfig().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): IceServerConfig { + return new IceServerConfig().fromJsonString(jsonString, options) + } + + static equals( + a: IceServerConfig | PlainMessage | undefined, + b: IceServerConfig | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(IceServerConfig, a, b) + } +} + +/** + * OauthCredential is an OAuth credential information for the ICE server. + * + * @generated from message webrtc.IceServerConfig.OauthCredential + */ +export class IceServerConfig_OauthCredential extends Message { + /** + * MacKey is a base64-url format. + * + * @generated from field: string mac_key = 1; + */ + macKey = '' + + /** + * AccessToken is the access token in base64-encoded format. + * + * @generated from field: string access_token = 2; + */ + accessToken = '' + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'webrtc.IceServerConfig.OauthCredential' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: 'mac_key', kind: 'scalar', T: 9 /* ScalarType.STRING */ }, + { + no: 2, + name: 'access_token', + kind: 'scalar', + T: 9 /* ScalarType.STRING */, + }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): IceServerConfig_OauthCredential { + return new IceServerConfig_OauthCredential().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): IceServerConfig_OauthCredential { + return new IceServerConfig_OauthCredential().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): IceServerConfig_OauthCredential { + return new IceServerConfig_OauthCredential().fromJsonString( + jsonString, + options, + ) + } + + static equals( + a: + | IceServerConfig_OauthCredential + | PlainMessage + | undefined, + b: + | IceServerConfig_OauthCredential + | PlainMessage + | undefined, + ): boolean { + return proto3.util.equals(IceServerConfig_OauthCredential, a, b) + } +} + +/** + * WebRtcSignal is a WebRTC Signaling message sent via the Signaling channel. + * + * @generated from message webrtc.WebRtcSignal + */ +export class WebRtcSignal extends Message { + /** + * Body is the body of the message. + * + * @generated from oneof webrtc.WebRtcSignal.body + */ + body: + | { + /** + * RequestOffer requests a new offer from the offerer with the local session seqno. + * Incremented when negotiation is needed (something changes about the session). + * + * @generated from field: uint64 request_offer = 1; + */ + value: bigint + case: 'requestOffer' + } + | { + /** + * Sdp contains the sdp offer or answer. + * + * @generated from field: webrtc.WebRtcSdp sdp = 2; + */ + value: WebRtcSdp + case: 'sdp' + } + | { + /** + * Ice contains an ICE candidate. + * + * @generated from field: webrtc.WebRtcIce ice = 3; + */ + value: WebRtcIce + case: 'ice' + } + | { case: undefined; value?: undefined } = { case: undefined } + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'webrtc.WebRtcSignal' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { + no: 1, + name: 'request_offer', + kind: 'scalar', + T: 4 /* ScalarType.UINT64 */, + oneof: 'body', + }, + { no: 2, name: 'sdp', kind: 'message', T: WebRtcSdp, oneof: 'body' }, + { no: 3, name: 'ice', kind: 'message', T: WebRtcIce, oneof: 'body' }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): WebRtcSignal { + return new WebRtcSignal().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): WebRtcSignal { + return new WebRtcSignal().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): WebRtcSignal { + return new WebRtcSignal().fromJsonString(jsonString, options) + } + + static equals( + a: WebRtcSignal | PlainMessage | undefined, + b: WebRtcSignal | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(WebRtcSignal, a, b) + } +} + +/** + * WebRtcSdp contains the SDP offer or answer. + * + * @generated from message webrtc.WebRtcSdp + */ +export class WebRtcSdp extends Message { + /** + * TxSeqno is the sequence number of the transmitting peer. + * The receiver should update the local seqno to match. + * + * @generated from field: uint64 tx_seqno = 1; + */ + txSeqno = protoInt64.zero + + /** + * SdpType is the string encoded type of the sdp. + * Examples: "offer" "answer" + * + * @generated from field: string sdp_type = 2; + */ + sdpType = '' + + /** + * Sdp contains the WebRTC session description. + * + * @generated from field: string sdp = 3; + */ + sdp = '' + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'webrtc.WebRtcSdp' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: 'tx_seqno', kind: 'scalar', T: 4 /* ScalarType.UINT64 */ }, + { no: 2, name: 'sdp_type', kind: 'scalar', T: 9 /* ScalarType.STRING */ }, + { no: 3, name: 'sdp', kind: 'scalar', T: 9 /* ScalarType.STRING */ }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): WebRtcSdp { + return new WebRtcSdp().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): WebRtcSdp { + return new WebRtcSdp().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): WebRtcSdp { + return new WebRtcSdp().fromJsonString(jsonString, options) + } + + static equals( + a: WebRtcSdp | PlainMessage | undefined, + b: WebRtcSdp | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(WebRtcSdp, a, b) + } +} + +/** + * WebRtcIce contains an ICE candidate. + * + * @generated from message webrtc.WebRtcIce + */ +export class WebRtcIce extends Message { + /** + * Candidate contains the JSON-encoded ICE candidate. + * + * @generated from field: string candidate = 1; + */ + candidate = '' + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'webrtc.WebRtcIce' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { no: 1, name: 'candidate', kind: 'scalar', T: 9 /* ScalarType.STRING */ }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): WebRtcIce { + return new WebRtcIce().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): WebRtcIce { + return new WebRtcIce().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): WebRtcIce { + return new WebRtcIce().fromJsonString(jsonString, options) + } + + static equals( + a: WebRtcIce | PlainMessage | undefined, + b: WebRtcIce | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(WebRtcIce, a, b) + } +} diff --git a/transport/webrtc/webrtc_vtproto.pb.go b/transport/webrtc/webrtc_vtproto.pb.go deleted file mode 100644 index 9d050c2f..00000000 --- a/transport/webrtc/webrtc_vtproto.pb.go +++ /dev/null @@ -1,2714 +0,0 @@ -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// protoc-gen-go-vtproto version: v0.6.0 -// source: github.com/aperturerobotics/bifrost/transport/webrtc/webrtc.proto - -package webrtc - -import ( - fmt "fmt" - io "io" - - dialer "github.com/aperturerobotics/bifrost/transport/common/dialer" - quic "github.com/aperturerobotics/bifrost/transport/common/quic" - backoff "github.com/aperturerobotics/util/backoff" - protohelpers "github.com/planetscale/vtprotobuf/protohelpers" - proto "google.golang.org/protobuf/proto" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) -) - -func (m *Config) CloneVT() *Config { - if m == nil { - return (*Config)(nil) - } - r := new(Config) - r.SignalingId = m.SignalingId - r.TransportPeerId = m.TransportPeerId - r.TransportType = m.TransportType - r.WebRtc = m.WebRtc.CloneVT() - r.AllPeers = m.AllPeers - r.DisableListen = m.DisableListen - r.Verbose = m.Verbose - if rhs := m.Quic; rhs != nil { - if vtpb, ok := interface{}(rhs).(interface{ CloneVT() *quic.Opts }); ok { - r.Quic = vtpb.CloneVT() - } else { - r.Quic = proto.Clone(rhs).(*quic.Opts) - } - } - if rhs := m.Backoff; rhs != nil { - if vtpb, ok := interface{}(rhs).(interface{ CloneVT() *backoff.Backoff }); ok { - r.Backoff = vtpb.CloneVT() - } else { - r.Backoff = proto.Clone(rhs).(*backoff.Backoff) - } - } - if rhs := m.Dialers; rhs != nil { - tmpContainer := make(map[string]*dialer.DialerOpts, len(rhs)) - for k, v := range rhs { - if vtpb, ok := interface{}(v).(interface{ CloneVT() *dialer.DialerOpts }); ok { - tmpContainer[k] = vtpb.CloneVT() - } else { - tmpContainer[k] = proto.Clone(v).(*dialer.DialerOpts) - } - } - r.Dialers = tmpContainer - } - if rhs := m.BlockPeers; rhs != nil { - tmpContainer := make([]string, len(rhs)) - copy(tmpContainer, rhs) - r.BlockPeers = tmpContainer - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Config) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *WebRtcConfig) CloneVT() *WebRtcConfig { - if m == nil { - return (*WebRtcConfig)(nil) - } - r := new(WebRtcConfig) - r.IceTransportPolicy = m.IceTransportPolicy - r.IceCandidatePoolSize = m.IceCandidatePoolSize - if rhs := m.IceServers; rhs != nil { - tmpContainer := make([]*IceServerConfig, len(rhs)) - for k, v := range rhs { - tmpContainer[k] = v.CloneVT() - } - r.IceServers = tmpContainer - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *WebRtcConfig) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *IceServerConfig_OauthCredential) CloneVT() *IceServerConfig_OauthCredential { - if m == nil { - return (*IceServerConfig_OauthCredential)(nil) - } - r := new(IceServerConfig_OauthCredential) - r.MacKey = m.MacKey - r.AccessToken = m.AccessToken - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *IceServerConfig_OauthCredential) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *IceServerConfig) CloneVT() *IceServerConfig { - if m == nil { - return (*IceServerConfig)(nil) - } - r := new(IceServerConfig) - r.Username = m.Username - if rhs := m.Urls; rhs != nil { - tmpContainer := make([]string, len(rhs)) - copy(tmpContainer, rhs) - r.Urls = tmpContainer - } - if m.Credential != nil { - r.Credential = m.Credential.(interface { - CloneVT() isIceServerConfig_Credential - }).CloneVT() - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *IceServerConfig) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *IceServerConfig_Password) CloneVT() isIceServerConfig_Credential { - if m == nil { - return (*IceServerConfig_Password)(nil) - } - r := new(IceServerConfig_Password) - r.Password = m.Password - return r -} - -func (m *IceServerConfig_Oauth) CloneVT() isIceServerConfig_Credential { - if m == nil { - return (*IceServerConfig_Oauth)(nil) - } - r := new(IceServerConfig_Oauth) - r.Oauth = m.Oauth.CloneVT() - return r -} - -func (m *WebRtcSignal) CloneVT() *WebRtcSignal { - if m == nil { - return (*WebRtcSignal)(nil) - } - r := new(WebRtcSignal) - if m.Body != nil { - r.Body = m.Body.(interface{ CloneVT() isWebRtcSignal_Body }).CloneVT() - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *WebRtcSignal) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *WebRtcSignal_RequestOffer) CloneVT() isWebRtcSignal_Body { - if m == nil { - return (*WebRtcSignal_RequestOffer)(nil) - } - r := new(WebRtcSignal_RequestOffer) - r.RequestOffer = m.RequestOffer - return r -} - -func (m *WebRtcSignal_Sdp) CloneVT() isWebRtcSignal_Body { - if m == nil { - return (*WebRtcSignal_Sdp)(nil) - } - r := new(WebRtcSignal_Sdp) - r.Sdp = m.Sdp.CloneVT() - return r -} - -func (m *WebRtcSignal_Ice) CloneVT() isWebRtcSignal_Body { - if m == nil { - return (*WebRtcSignal_Ice)(nil) - } - r := new(WebRtcSignal_Ice) - r.Ice = m.Ice.CloneVT() - return r -} - -func (m *WebRtcSdp) CloneVT() *WebRtcSdp { - if m == nil { - return (*WebRtcSdp)(nil) - } - r := new(WebRtcSdp) - r.TxSeqno = m.TxSeqno - r.SdpType = m.SdpType - r.Sdp = m.Sdp - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *WebRtcSdp) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (m *WebRtcIce) CloneVT() *WebRtcIce { - if m == nil { - return (*WebRtcIce)(nil) - } - r := new(WebRtcIce) - r.Candidate = m.Candidate - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *WebRtcIce) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (this *Config) EqualVT(that *Config) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.SignalingId != that.SignalingId { - return false - } - if this.TransportPeerId != that.TransportPeerId { - return false - } - if this.TransportType != that.TransportType { - return false - } - if equal, ok := interface{}(this.Quic).(interface{ EqualVT(*quic.Opts) bool }); ok { - if !equal.EqualVT(that.Quic) { - return false - } - } else if !proto.Equal(this.Quic, that.Quic) { - return false - } - if !this.WebRtc.EqualVT(that.WebRtc) { - return false - } - if equal, ok := interface{}(this.Backoff).(interface{ EqualVT(*backoff.Backoff) bool }); ok { - if !equal.EqualVT(that.Backoff) { - return false - } - } else if !proto.Equal(this.Backoff, that.Backoff) { - return false - } - if len(this.Dialers) != len(that.Dialers) { - return false - } - for i, vx := range this.Dialers { - vy, ok := that.Dialers[i] - if !ok { - return false - } - if p, q := vx, vy; p != q { - if p == nil { - p = &dialer.DialerOpts{} - } - if q == nil { - q = &dialer.DialerOpts{} - } - if equal, ok := interface{}(p).(interface{ EqualVT(*dialer.DialerOpts) bool }); ok { - if !equal.EqualVT(q) { - return false - } - } else if !proto.Equal(p, q) { - return false - } - } - } - if this.AllPeers != that.AllPeers { - return false - } - if this.DisableListen != that.DisableListen { - return false - } - if len(this.BlockPeers) != len(that.BlockPeers) { - return false - } - for i, vx := range this.BlockPeers { - vy := that.BlockPeers[i] - if vx != vy { - return false - } - } - if this.Verbose != that.Verbose { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Config) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Config) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *WebRtcConfig) EqualVT(that *WebRtcConfig) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if len(this.IceServers) != len(that.IceServers) { - return false - } - for i, vx := range this.IceServers { - vy := that.IceServers[i] - if p, q := vx, vy; p != q { - if p == nil { - p = &IceServerConfig{} - } - if q == nil { - q = &IceServerConfig{} - } - if !p.EqualVT(q) { - return false - } - } - } - if this.IceTransportPolicy != that.IceTransportPolicy { - return false - } - if this.IceCandidatePoolSize != that.IceCandidatePoolSize { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *WebRtcConfig) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*WebRtcConfig) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *IceServerConfig_OauthCredential) EqualVT(that *IceServerConfig_OauthCredential) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.MacKey != that.MacKey { - return false - } - if this.AccessToken != that.AccessToken { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *IceServerConfig_OauthCredential) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*IceServerConfig_OauthCredential) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *IceServerConfig) EqualVT(that *IceServerConfig) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.Credential == nil && that.Credential != nil { - return false - } else if this.Credential != nil { - if that.Credential == nil { - return false - } - if !this.Credential.(interface { - EqualVT(isIceServerConfig_Credential) bool - }).EqualVT(that.Credential) { - return false - } - } - if len(this.Urls) != len(that.Urls) { - return false - } - for i, vx := range this.Urls { - vy := that.Urls[i] - if vx != vy { - return false - } - } - if this.Username != that.Username { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *IceServerConfig) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*IceServerConfig) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *IceServerConfig_Password) EqualVT(thatIface isIceServerConfig_Credential) bool { - that, ok := thatIface.(*IceServerConfig_Password) - if !ok { - return false - } - if this == that { - return true - } - if this == nil && that != nil || this != nil && that == nil { - return false - } - if this.Password != that.Password { - return false - } - return true -} - -func (this *IceServerConfig_Oauth) EqualVT(thatIface isIceServerConfig_Credential) bool { - that, ok := thatIface.(*IceServerConfig_Oauth) - if !ok { - return false - } - if this == that { - return true - } - if this == nil && that != nil || this != nil && that == nil { - return false - } - if p, q := this.Oauth, that.Oauth; p != q { - if p == nil { - p = &IceServerConfig_OauthCredential{} - } - if q == nil { - q = &IceServerConfig_OauthCredential{} - } - if !p.EqualVT(q) { - return false - } - } - return true -} - -func (this *WebRtcSignal) EqualVT(that *WebRtcSignal) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.Body == nil && that.Body != nil { - return false - } else if this.Body != nil { - if that.Body == nil { - return false - } - if !this.Body.(interface { - EqualVT(isWebRtcSignal_Body) bool - }).EqualVT(that.Body) { - return false - } - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *WebRtcSignal) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*WebRtcSignal) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *WebRtcSignal_RequestOffer) EqualVT(thatIface isWebRtcSignal_Body) bool { - that, ok := thatIface.(*WebRtcSignal_RequestOffer) - if !ok { - return false - } - if this == that { - return true - } - if this == nil && that != nil || this != nil && that == nil { - return false - } - if this.RequestOffer != that.RequestOffer { - return false - } - return true -} - -func (this *WebRtcSignal_Sdp) EqualVT(thatIface isWebRtcSignal_Body) bool { - that, ok := thatIface.(*WebRtcSignal_Sdp) - if !ok { - return false - } - if this == that { - return true - } - if this == nil && that != nil || this != nil && that == nil { - return false - } - if p, q := this.Sdp, that.Sdp; p != q { - if p == nil { - p = &WebRtcSdp{} - } - if q == nil { - q = &WebRtcSdp{} - } - if !p.EqualVT(q) { - return false - } - } - return true -} - -func (this *WebRtcSignal_Ice) EqualVT(thatIface isWebRtcSignal_Body) bool { - that, ok := thatIface.(*WebRtcSignal_Ice) - if !ok { - return false - } - if this == that { - return true - } - if this == nil && that != nil || this != nil && that == nil { - return false - } - if p, q := this.Ice, that.Ice; p != q { - if p == nil { - p = &WebRtcIce{} - } - if q == nil { - q = &WebRtcIce{} - } - if !p.EqualVT(q) { - return false - } - } - return true -} - -func (this *WebRtcSdp) EqualVT(that *WebRtcSdp) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.TxSeqno != that.TxSeqno { - return false - } - if this.SdpType != that.SdpType { - return false - } - if this.Sdp != that.Sdp { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *WebRtcSdp) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*WebRtcSdp) - if !ok { - return false - } - return this.EqualVT(that) -} -func (this *WebRtcIce) EqualVT(that *WebRtcIce) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.Candidate != that.Candidate { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *WebRtcIce) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*WebRtcIce) - if !ok { - return false - } - return this.EqualVT(that) -} -func (m *Config) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Config) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.Verbose { - i-- - if m.Verbose { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x58 - } - if len(m.BlockPeers) > 0 { - for iNdEx := len(m.BlockPeers) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.BlockPeers[iNdEx]) - copy(dAtA[i:], m.BlockPeers[iNdEx]) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.BlockPeers[iNdEx]))) - i-- - dAtA[i] = 0x52 - } - } - if m.DisableListen { - i-- - if m.DisableListen { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x48 - } - if m.AllPeers { - i-- - if m.AllPeers { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x40 - } - if len(m.Dialers) > 0 { - for k := range m.Dialers { - v := m.Dialers[k] - baseI := i - if vtmsg, ok := interface{}(v).(interface { - MarshalToSizedBufferVT([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(v) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0x12 - i -= len(k) - copy(dAtA[i:], k) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(k))) - i-- - dAtA[i] = 0xa - i = protohelpers.EncodeVarint(dAtA, i, uint64(baseI-i)) - i-- - dAtA[i] = 0x3a - } - } - if m.Backoff != nil { - if vtmsg, ok := interface{}(m.Backoff).(interface { - MarshalToSizedBufferVT([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.Backoff) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0x32 - } - if m.WebRtc != nil { - size, err := m.WebRtc.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x2a - } - if m.Quic != nil { - if vtmsg, ok := interface{}(m.Quic).(interface { - MarshalToSizedBufferVT([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.Quic) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0x22 - } - if len(m.TransportType) > 0 { - i -= len(m.TransportType) - copy(dAtA[i:], m.TransportType) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.TransportType))) - i-- - dAtA[i] = 0x1a - } - if len(m.TransportPeerId) > 0 { - i -= len(m.TransportPeerId) - copy(dAtA[i:], m.TransportPeerId) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.TransportPeerId))) - i-- - dAtA[i] = 0x12 - } - if len(m.SignalingId) > 0 { - i -= len(m.SignalingId) - copy(dAtA[i:], m.SignalingId) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.SignalingId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *WebRtcConfig) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *WebRtcConfig) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *WebRtcConfig) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.IceCandidatePoolSize != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.IceCandidatePoolSize)) - i-- - dAtA[i] = 0x18 - } - if m.IceTransportPolicy != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.IceTransportPolicy)) - i-- - dAtA[i] = 0x10 - } - if len(m.IceServers) > 0 { - for iNdEx := len(m.IceServers) - 1; iNdEx >= 0; iNdEx-- { - size, err := m.IceServers[iNdEx].MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *IceServerConfig_OauthCredential) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *IceServerConfig_OauthCredential) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *IceServerConfig_OauthCredential) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.AccessToken) > 0 { - i -= len(m.AccessToken) - copy(dAtA[i:], m.AccessToken) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.AccessToken))) - i-- - dAtA[i] = 0x12 - } - if len(m.MacKey) > 0 { - i -= len(m.MacKey) - copy(dAtA[i:], m.MacKey) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.MacKey))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *IceServerConfig) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *IceServerConfig) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *IceServerConfig) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if vtmsg, ok := m.Credential.(interface { - MarshalToSizedBufferVT([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - } - if len(m.Username) > 0 { - i -= len(m.Username) - copy(dAtA[i:], m.Username) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Username))) - i-- - dAtA[i] = 0x12 - } - if len(m.Urls) > 0 { - for iNdEx := len(m.Urls) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Urls[iNdEx]) - copy(dAtA[i:], m.Urls[iNdEx]) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Urls[iNdEx]))) - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *IceServerConfig_Password) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *IceServerConfig_Password) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - i := len(dAtA) - i -= len(m.Password) - copy(dAtA[i:], m.Password) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Password))) - i-- - dAtA[i] = 0x1a - return len(dAtA) - i, nil -} -func (m *IceServerConfig_Oauth) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *IceServerConfig_Oauth) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - i := len(dAtA) - if m.Oauth != nil { - size, err := m.Oauth.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x22 - } - return len(dAtA) - i, nil -} -func (m *WebRtcSignal) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *WebRtcSignal) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *WebRtcSignal) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if vtmsg, ok := m.Body.(interface { - MarshalToSizedBufferVT([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - } - return len(dAtA) - i, nil -} - -func (m *WebRtcSignal_RequestOffer) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *WebRtcSignal_RequestOffer) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - i := len(dAtA) - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.RequestOffer)) - i-- - dAtA[i] = 0x8 - return len(dAtA) - i, nil -} -func (m *WebRtcSignal_Sdp) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *WebRtcSignal_Sdp) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - i := len(dAtA) - if m.Sdp != nil { - size, err := m.Sdp.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x12 - } - return len(dAtA) - i, nil -} -func (m *WebRtcSignal_Ice) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *WebRtcSignal_Ice) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - i := len(dAtA) - if m.Ice != nil { - size, err := m.Ice.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - i-- - dAtA[i] = 0x1a - } - return len(dAtA) - i, nil -} -func (m *WebRtcSdp) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *WebRtcSdp) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *WebRtcSdp) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Sdp) > 0 { - i -= len(m.Sdp) - copy(dAtA[i:], m.Sdp) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Sdp))) - i-- - dAtA[i] = 0x1a - } - if len(m.SdpType) > 0 { - i -= len(m.SdpType) - copy(dAtA[i:], m.SdpType) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.SdpType))) - i-- - dAtA[i] = 0x12 - } - if m.TxSeqno != 0 { - i = protohelpers.EncodeVarint(dAtA, i, uint64(m.TxSeqno)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *WebRtcIce) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *WebRtcIce) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *WebRtcIce) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if len(m.Candidate) > 0 { - i -= len(m.Candidate) - copy(dAtA[i:], m.Candidate) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.Candidate))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Config) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.SignalingId) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - l = len(m.TransportPeerId) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - l = len(m.TransportType) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.Quic != nil { - if size, ok := interface{}(m.Quic).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.Quic) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.WebRtc != nil { - l = m.WebRtc.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.Backoff != nil { - if size, ok := interface{}(m.Backoff).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.Backoff) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if len(m.Dialers) > 0 { - for k, v := range m.Dialers { - _ = k - _ = v - l = 0 - if v != nil { - if size, ok := interface{}(v).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(v) - } - } - l += 1 + protohelpers.SizeOfVarint(uint64(l)) - mapEntrySize := 1 + len(k) + protohelpers.SizeOfVarint(uint64(len(k))) + l - n += mapEntrySize + 1 + protohelpers.SizeOfVarint(uint64(mapEntrySize)) - } - } - if m.AllPeers { - n += 2 - } - if m.DisableListen { - n += 2 - } - if len(m.BlockPeers) > 0 { - for _, s := range m.BlockPeers { - l = len(s) - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - } - if m.Verbose { - n += 2 - } - n += len(m.unknownFields) - return n -} - -func (m *WebRtcConfig) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.IceServers) > 0 { - for _, e := range m.IceServers { - l = e.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - } - if m.IceTransportPolicy != 0 { - n += 1 + protohelpers.SizeOfVarint(uint64(m.IceTransportPolicy)) - } - if m.IceCandidatePoolSize != 0 { - n += 1 + protohelpers.SizeOfVarint(uint64(m.IceCandidatePoolSize)) - } - n += len(m.unknownFields) - return n -} - -func (m *IceServerConfig_OauthCredential) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.MacKey) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - l = len(m.AccessToken) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *IceServerConfig) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Urls) > 0 { - for _, s := range m.Urls { - l = len(s) - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - } - l = len(m.Username) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if vtmsg, ok := m.Credential.(interface{ SizeVT() int }); ok { - n += vtmsg.SizeVT() - } - n += len(m.unknownFields) - return n -} - -func (m *IceServerConfig_Password) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Password) - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - return n -} -func (m *IceServerConfig_Oauth) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Oauth != nil { - l = m.Oauth.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - return n -} -func (m *WebRtcSignal) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if vtmsg, ok := m.Body.(interface{ SizeVT() int }); ok { - n += vtmsg.SizeVT() - } - n += len(m.unknownFields) - return n -} - -func (m *WebRtcSignal_RequestOffer) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - n += 1 + protohelpers.SizeOfVarint(uint64(m.RequestOffer)) - return n -} -func (m *WebRtcSignal_Sdp) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Sdp != nil { - l = m.Sdp.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - return n -} -func (m *WebRtcSignal_Ice) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Ice != nil { - l = m.Ice.SizeVT() - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - return n -} -func (m *WebRtcSdp) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.TxSeqno != 0 { - n += 1 + protohelpers.SizeOfVarint(uint64(m.TxSeqno)) - } - l = len(m.SdpType) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - l = len(m.Sdp) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *WebRtcIce) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Candidate) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - n += len(m.unknownFields) - return n -} - -func (m *Config) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Config: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Config: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SignalingId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SignalingId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TransportPeerId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TransportPeerId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TransportType", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TransportType = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Quic", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Quic == nil { - m.Quic = &quic.Opts{} - } - if unmarshal, ok := interface{}(m.Quic).(interface { - UnmarshalVT([]byte) error - }); ok { - if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - } else { - if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.Quic); err != nil { - return err - } - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field WebRtc", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.WebRtc == nil { - m.WebRtc = &WebRtcConfig{} - } - if err := m.WebRtc.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Backoff", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Backoff == nil { - m.Backoff = &backoff.Backoff{} - } - if unmarshal, ok := interface{}(m.Backoff).(interface { - UnmarshalVT([]byte) error - }); ok { - if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - } else { - if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.Backoff); err != nil { - return err - } - } - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Dialers", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Dialers == nil { - m.Dialers = make(map[string]*dialer.DialerOpts) - } - var mapkey string - var mapvalue *dialer.DialerOpts - for iNdEx < postIndex { - entryPreIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - if fieldNum == 1 { - var stringLenmapkey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapkey |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapkey := int(stringLenmapkey) - if intStringLenmapkey < 0 { - return protohelpers.ErrInvalidLength - } - postStringIndexmapkey := iNdEx + intStringLenmapkey - if postStringIndexmapkey < 0 { - return protohelpers.ErrInvalidLength - } - if postStringIndexmapkey > l { - return io.ErrUnexpectedEOF - } - mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) - iNdEx = postStringIndexmapkey - } else if fieldNum == 2 { - var mapmsglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - mapmsglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if mapmsglen < 0 { - return protohelpers.ErrInvalidLength - } - postmsgIndex := iNdEx + mapmsglen - if postmsgIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postmsgIndex > l { - return io.ErrUnexpectedEOF - } - mapvalue = &dialer.DialerOpts{} - if unmarshal, ok := interface{}(mapvalue).(interface { - UnmarshalVT([]byte) error - }); ok { - if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postmsgIndex]); err != nil { - return err - } - } else { - if err := proto.Unmarshal(dAtA[iNdEx:postmsgIndex], mapvalue); err != nil { - return err - } - } - iNdEx = postmsgIndex - } else { - iNdEx = entryPreIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > postIndex { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - m.Dialers[mapkey] = mapvalue - iNdEx = postIndex - case 8: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field AllPeers", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.AllPeers = bool(v != 0) - case 9: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field DisableListen", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.DisableListen = bool(v != 0) - case 10: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BlockPeers", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.BlockPeers = append(m.BlockPeers, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 11: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Verbose", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Verbose = bool(v != 0) - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *WebRtcConfig) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: WebRtcConfig: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: WebRtcConfig: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field IceServers", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.IceServers = append(m.IceServers, &IceServerConfig{}) - if err := m.IceServers[len(m.IceServers)-1].UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field IceTransportPolicy", wireType) - } - m.IceTransportPolicy = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.IceTransportPolicy |= IceTransportPolicy(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field IceCandidatePoolSize", wireType) - } - m.IceCandidatePoolSize = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.IceCandidatePoolSize |= uint32(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *IceServerConfig_OauthCredential) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: IceServerConfig_OauthCredential: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: IceServerConfig_OauthCredential: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MacKey", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.MacKey = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AccessToken", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.AccessToken = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *IceServerConfig) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: IceServerConfig: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: IceServerConfig: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Urls", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Urls = append(m.Urls, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Username", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Username = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Password", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Credential = &IceServerConfig_Password{Password: string(dAtA[iNdEx:postIndex])} - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Oauth", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if oneof, ok := m.Credential.(*IceServerConfig_Oauth); ok { - if err := oneof.Oauth.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - } else { - v := &IceServerConfig_OauthCredential{} - if err := v.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Credential = &IceServerConfig_Oauth{Oauth: v} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *WebRtcSignal) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: WebRtcSignal: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: WebRtcSignal: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field RequestOffer", wireType) - } - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Body = &WebRtcSignal_RequestOffer{RequestOffer: v} - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sdp", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if oneof, ok := m.Body.(*WebRtcSignal_Sdp); ok { - if err := oneof.Sdp.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - } else { - v := &WebRtcSdp{} - if err := v.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Body = &WebRtcSignal_Sdp{Sdp: v} - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Ice", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if oneof, ok := m.Body.(*WebRtcSignal_Ice); ok { - if err := oneof.Ice.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - } else { - v := &WebRtcIce{} - if err := v.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Body = &WebRtcSignal_Ice{Ice: v} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *WebRtcSdp) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: WebRtcSdp: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: WebRtcSdp: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TxSeqno", wireType) - } - m.TxSeqno = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TxSeqno |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SdpType", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SdpType = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sdp", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Sdp = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *WebRtcIce) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: WebRtcIce: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: WebRtcIce: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Candidate", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Candidate = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} diff --git a/transport/websocket/websocket.pb.go b/transport/websocket/websocket.pb.go index 0bb31e91..63a51de8 100644 --- a/transport/websocket/websocket.pb.go +++ b/transport/websocket/websocket.pb.go @@ -1,26 +1,17 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0-devel -// protoc v5.26.1 +// Code generated by protoc-gen-go-lite. DO NOT EDIT. +// protoc-gen-go-lite version: v0.4.5 // source: github.com/aperturerobotics/bifrost/transport/websocket/websocket.proto package websocket import ( - reflect "reflect" - sync "sync" + io "io" dialer "github.com/aperturerobotics/bifrost/transport/common/dialer" quic "github.com/aperturerobotics/bifrost/transport/common/quic" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) + protobuf_go_lite "github.com/aperturerobotics/protobuf-go-lite" + json "github.com/aperturerobotics/protobuf-go-lite/json" + errors "github.com/pkg/errors" ) // Config is the configuration for the Websocket transport. @@ -30,16 +21,13 @@ const ( // encryption to the peer that we handshake with on the other end, and to manage // stream congestion control, multiplexing, type Config struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - + unknownFields []byte // TransportPeerID sets the peer ID to attach the transport to. // If unset, attaches to any running peer with a private key. - TransportPeerId string `protobuf:"bytes,1,opt,name=transport_peer_id,json=transportPeerId,proto3" json:"transport_peer_id,omitempty"` + TransportPeerId string `protobuf:"bytes,1,opt,name=transport_peer_id,json=transportPeerId,proto3" json:"transportPeerId,omitempty"` // ListenAddr contains the address to listen on. // Has no effect in the browser. - ListenAddr string `protobuf:"bytes,2,opt,name=listen_addr,json=listenAddr,proto3" json:"listen_addr,omitempty"` + ListenAddr string `protobuf:"bytes,2,opt,name=listen_addr,json=listenAddr,proto3" json:"listenAddr,omitempty"` // Quic contains the quic protocol options. // // The WebSocket transport always disables FEC and several other UDP-centric @@ -49,45 +37,19 @@ type Config struct { Dialers map[string]*dialer.DialerOpts `protobuf:"bytes,4,rep,name=dialers,proto3" json:"dialers,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` // HttpPath is the http path to expose the websocket. // If unset, ignores the incoming request path. - HttpPath string `protobuf:"bytes,5,opt,name=http_path,json=httpPath,proto3" json:"http_path,omitempty"` + HttpPath string `protobuf:"bytes,5,opt,name=http_path,json=httpPath,proto3" json:"httpPath,omitempty"` // DisableServePeerId disables serving the peer id. // If this is unset the peer ID is available at http_path+"/peer" // If http_path is unset the peer ID is available at /peer - DisableServePeerId bool `protobuf:"varint,6,opt,name=disable_serve_peer_id,json=disableServePeerId,proto3" json:"disable_serve_peer_id,omitempty"` + DisableServePeerId bool `protobuf:"varint,6,opt,name=disable_serve_peer_id,json=disableServePeerId,proto3" json:"disableServePeerId,omitempty"` } func (x *Config) Reset() { *x = Config{} - if protoimpl.UnsafeEnabled { - mi := &file_github_com_aperturerobotics_bifrost_transport_websocket_websocket_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Config) String() string { - return protoimpl.X.MessageStringOf(x) } func (*Config) ProtoMessage() {} -func (x *Config) ProtoReflect() protoreflect.Message { - mi := &file_github_com_aperturerobotics_bifrost_transport_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 Config.ProtoReflect.Descriptor instead. -func (*Config) Descriptor() ([]byte, []int) { - return file_github_com_aperturerobotics_bifrost_transport_websocket_websocket_proto_rawDescGZIP(), []int{0} -} - func (x *Config) GetTransportPeerId() string { if x != nil { return x.TransportPeerId @@ -130,113 +92,737 @@ func (x *Config) GetDisableServePeerId() bool { return false } -var File_github_com_aperturerobotics_bifrost_transport_websocket_websocket_proto protoreflect.FileDescriptor - -var file_github_com_aperturerobotics_bifrost_transport_websocket_websocket_proto_rawDesc = []byte{ - 0x0a, 0x47, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, - 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x62, 0x69, - 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 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, 0x44, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, - 0x2f, 0x61, 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, - 0x73, 0x2f, 0x62, 0x69, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, - 0x6f, 0x72, 0x74, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x71, 0x75, 0x69, 0x63, 0x2f, - 0x71, 0x75, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x48, 0x67, 0x69, 0x74, 0x68, - 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x70, 0x65, 0x72, 0x74, 0x75, 0x72, 0x65, 0x72, - 0x6f, 0x62, 0x6f, 0x74, 0x69, 0x63, 0x73, 0x2f, 0x62, 0x69, 0x66, 0x72, 0x6f, 0x73, 0x74, 0x2f, - 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, - 0x2f, 0x64, 0x69, 0x61, 0x6c, 0x65, 0x72, 0x2f, 0x64, 0x69, 0x61, 0x6c, 0x65, 0x72, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xd9, 0x02, 0x0a, 0x06, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, - 0x2a, 0x0a, 0x11, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x5f, 0x70, 0x65, 0x65, - 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x74, 0x72, 0x61, 0x6e, - 0x73, 0x70, 0x6f, 0x72, 0x74, 0x50, 0x65, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x6c, - 0x69, 0x73, 0x74, 0x65, 0x6e, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0a, 0x6c, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x41, 0x64, 0x64, 0x72, 0x12, 0x28, 0x0a, 0x04, - 0x71, 0x75, 0x69, 0x63, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x74, 0x72, 0x61, - 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x71, 0x75, 0x69, 0x63, 0x2e, 0x4f, 0x70, 0x74, 0x73, - 0x52, 0x04, 0x71, 0x75, 0x69, 0x63, 0x12, 0x38, 0x0a, 0x07, 0x64, 0x69, 0x61, 0x6c, 0x65, 0x72, - 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x77, 0x65, 0x62, 0x73, 0x6f, 0x63, - 0x6b, 0x65, 0x74, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x44, 0x69, 0x61, 0x6c, 0x65, - 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x64, 0x69, 0x61, 0x6c, 0x65, 0x72, 0x73, - 0x12, 0x1b, 0x0a, 0x09, 0x68, 0x74, 0x74, 0x70, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x08, 0x68, 0x74, 0x74, 0x70, 0x50, 0x61, 0x74, 0x68, 0x12, 0x31, 0x0a, - 0x15, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x5f, 0x70, - 0x65, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x12, 0x64, 0x69, - 0x73, 0x61, 0x62, 0x6c, 0x65, 0x53, 0x65, 0x72, 0x76, 0x65, 0x50, 0x65, 0x65, 0x72, 0x49, 0x64, - 0x1a, 0x4e, 0x0a, 0x0c, 0x44, 0x69, 0x61, 0x6c, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, - 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, - 0x65, 0x79, 0x12, 0x28, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x12, 0x2e, 0x64, 0x69, 0x61, 0x6c, 0x65, 0x72, 0x2e, 0x44, 0x69, 0x61, 0x6c, 0x65, - 0x72, 0x4f, 0x70, 0x74, 0x73, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_github_com_aperturerobotics_bifrost_transport_websocket_websocket_proto_rawDescOnce sync.Once - file_github_com_aperturerobotics_bifrost_transport_websocket_websocket_proto_rawDescData = file_github_com_aperturerobotics_bifrost_transport_websocket_websocket_proto_rawDesc -) +type Config_DialersEntry struct { + unknownFields []byte + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Value *dialer.DialerOpts `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` +} + +func (x *Config_DialersEntry) Reset() { + *x = Config_DialersEntry{} +} + +func (*Config_DialersEntry) ProtoMessage() {} + +func (x *Config_DialersEntry) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +func (x *Config_DialersEntry) GetValue() *dialer.DialerOpts { + if x != nil { + return x.Value + } + return nil +} + +func (m *Config) CloneVT() *Config { + if m == nil { + return (*Config)(nil) + } + r := new(Config) + r.TransportPeerId = m.TransportPeerId + r.ListenAddr = m.ListenAddr + r.HttpPath = m.HttpPath + r.DisableServePeerId = m.DisableServePeerId + if rhs := m.Quic; rhs != nil { + r.Quic = rhs.CloneVT() + } + if rhs := m.Dialers; rhs != nil { + tmpContainer := make(map[string]*dialer.DialerOpts, len(rhs)) + for k, v := range rhs { + tmpContainer[k] = v.CloneVT() + } + r.Dialers = tmpContainer + } + if len(m.unknownFields) > 0 { + r.unknownFields = make([]byte, len(m.unknownFields)) + copy(r.unknownFields, m.unknownFields) + } + return r +} + +func (m *Config) CloneMessageVT() any { + return m.CloneVT() +} + +func (this *Config) EqualVT(that *Config) bool { + if this == that { + return true + } else if this == nil || that == nil { + return false + } + if this.TransportPeerId != that.TransportPeerId { + return false + } + if this.ListenAddr != that.ListenAddr { + return false + } + if !this.Quic.EqualVT(that.Quic) { + return false + } + if len(this.Dialers) != len(that.Dialers) { + return false + } + for i, vx := range this.Dialers { + vy, ok := that.Dialers[i] + if !ok { + return false + } + if p, q := vx, vy; p != q { + if p == nil { + p = &dialer.DialerOpts{} + } + if q == nil { + q = &dialer.DialerOpts{} + } + if !p.EqualVT(q) { + return false + } + } + } + if this.HttpPath != that.HttpPath { + return false + } + if this.DisableServePeerId != that.DisableServePeerId { + return false + } + return string(this.unknownFields) == string(that.unknownFields) +} + +func (this *Config) EqualMessageVT(thatMsg any) bool { + that, ok := thatMsg.(*Config) + if !ok { + return false + } + return this.EqualVT(that) +} + +// MarshalProtoJSON marshals the Config_DialersEntry message to JSON. +func (x *Config_DialersEntry) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return + } + s.WriteObjectStart() + var wroteField bool + if x.Key != "" || s.HasField("key") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("key") + s.WriteString(x.Key) + } + if x.Value != nil || s.HasField("value") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("value") + x.Value.MarshalProtoJSON(s.WithField("value")) + } + s.WriteObjectEnd() +} + +// MarshalJSON marshals the Config_DialersEntry to JSON. +func (x *Config_DialersEntry) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) +} -func file_github_com_aperturerobotics_bifrost_transport_websocket_websocket_proto_rawDescGZIP() []byte { - file_github_com_aperturerobotics_bifrost_transport_websocket_websocket_proto_rawDescOnce.Do(func() { - file_github_com_aperturerobotics_bifrost_transport_websocket_websocket_proto_rawDescData = protoimpl.X.CompressGZIP(file_github_com_aperturerobotics_bifrost_transport_websocket_websocket_proto_rawDescData) +// UnmarshalProtoJSON unmarshals the Config_DialersEntry message from JSON. +func (x *Config_DialersEntry) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { + return + } + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "key": + s.AddField("key") + x.Key = s.ReadString() + case "value": + if s.ReadNil() { + x.Value = nil + return + } + x.Value = &dialer.DialerOpts{} + x.Value.UnmarshalProtoJSON(s.WithField("value", true)) + } }) - return file_github_com_aperturerobotics_bifrost_transport_websocket_websocket_proto_rawDescData -} - -var file_github_com_aperturerobotics_bifrost_transport_websocket_websocket_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_github_com_aperturerobotics_bifrost_transport_websocket_websocket_proto_goTypes = []interface{}{ - (*Config)(nil), // 0: websocket.Config - nil, // 1: websocket.Config.DialersEntry - (*quic.Opts)(nil), // 2: transport.quic.Opts - (*dialer.DialerOpts)(nil), // 3: dialer.DialerOpts -} -var file_github_com_aperturerobotics_bifrost_transport_websocket_websocket_proto_depIdxs = []int32{ - 2, // 0: websocket.Config.quic:type_name -> transport.quic.Opts - 1, // 1: websocket.Config.dialers:type_name -> websocket.Config.DialersEntry - 3, // 2: websocket.Config.DialersEntry.value:type_name -> dialer.DialerOpts - 3, // [3:3] is the sub-list for method output_type - 3, // [3:3] is the sub-list for method input_type - 3, // [3:3] is the sub-list for extension type_name - 3, // [3:3] is the sub-list for extension extendee - 0, // [0:3] is the sub-list for field type_name -} - -func init() { file_github_com_aperturerobotics_bifrost_transport_websocket_websocket_proto_init() } -func file_github_com_aperturerobotics_bifrost_transport_websocket_websocket_proto_init() { - if File_github_com_aperturerobotics_bifrost_transport_websocket_websocket_proto != nil { +} + +// UnmarshalJSON unmarshals the Config_DialersEntry from JSON. +func (x *Config_DialersEntry) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +// MarshalProtoJSON marshals the Config message to JSON. +func (x *Config) MarshalProtoJSON(s *json.MarshalState) { + if x == nil { + s.WriteNil() + return + } + s.WriteObjectStart() + var wroteField bool + if x.TransportPeerId != "" || s.HasField("transportPeerId") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("transportPeerId") + s.WriteString(x.TransportPeerId) + } + if x.ListenAddr != "" || s.HasField("listenAddr") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("listenAddr") + s.WriteString(x.ListenAddr) + } + if x.Quic != nil || s.HasField("quic") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("quic") + x.Quic.MarshalProtoJSON(s.WithField("quic")) + } + if x.Dialers != nil || s.HasField("dialers") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("dialers") + s.WriteObjectStart() + var wroteElement bool + for k, v := range x.Dialers { + s.WriteMoreIf(&wroteElement) + s.WriteObjectStringField(k) + v.MarshalProtoJSON(s.WithField("dialers")) + } + s.WriteObjectEnd() + } + if x.HttpPath != "" || s.HasField("httpPath") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("httpPath") + s.WriteString(x.HttpPath) + } + if x.DisableServePeerId || s.HasField("disableServePeerId") { + s.WriteMoreIf(&wroteField) + s.WriteObjectField("disableServePeerId") + s.WriteBool(x.DisableServePeerId) + } + s.WriteObjectEnd() +} + +// MarshalJSON marshals the Config to JSON. +func (x *Config) MarshalJSON() ([]byte, error) { + return json.DefaultMarshalerConfig.Marshal(x) +} + +// UnmarshalProtoJSON unmarshals the Config message from JSON. +func (x *Config) UnmarshalProtoJSON(s *json.UnmarshalState) { + if s.ReadNil() { return } - if !protoimpl.UnsafeEnabled { - file_github_com_aperturerobotics_bifrost_transport_websocket_websocket_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Config); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil + s.ReadObject(func(key string) { + switch key { + default: + s.ReadAny() // ignore unknown field + case "transport_peer_id", "transportPeerId": + s.AddField("transport_peer_id") + x.TransportPeerId = s.ReadString() + case "listen_addr", "listenAddr": + s.AddField("listen_addr") + x.ListenAddr = s.ReadString() + case "quic": + if s.ReadNil() { + x.Quic = nil + return + } + x.Quic = &quic.Opts{} + x.Quic.UnmarshalProtoJSON(s.WithField("quic", true)) + case "dialers": + s.AddField("dialers") + if s.ReadNil() { + x.Dialers = nil + return + } + x.Dialers = make(map[string]*dialer.DialerOpts) + s.ReadStringMap(func(key string) { + var v dialer.DialerOpts + v.UnmarshalProtoJSON(s) + x.Dialers[key] = &v + }) + case "http_path", "httpPath": + s.AddField("http_path") + x.HttpPath = s.ReadString() + case "disable_serve_peer_id", "disableServePeerId": + s.AddField("disable_serve_peer_id") + x.DisableServePeerId = s.ReadBool() + } + }) +} + +// UnmarshalJSON unmarshals the Config from JSON. +func (x *Config) UnmarshalJSON(b []byte) error { + return json.DefaultUnmarshalerConfig.Unmarshal(b, x) +} + +func (m *Config) MarshalVT() (dAtA []byte, err error) { + if m == nil { + return nil, nil + } + size := m.SizeVT() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBufferVT(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Config) MarshalToVT(dAtA []byte) (int, error) { + size := m.SizeVT() + return m.MarshalToSizedBufferVT(dAtA[:size]) +} + +func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.unknownFields != nil { + i -= len(m.unknownFields) + copy(dAtA[i:], m.unknownFields) + } + if m.DisableServePeerId { + i-- + if m.DisableServePeerId { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x30 + } + if len(m.HttpPath) > 0 { + i -= len(m.HttpPath) + copy(dAtA[i:], m.HttpPath) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.HttpPath))) + i-- + dAtA[i] = 0x2a + } + if len(m.Dialers) > 0 { + for k := range m.Dialers { + v := m.Dialers[k] + baseI := i + size, err := v.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x12 + i -= len(k) + copy(dAtA[i:], k) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(k))) + i-- + dAtA[i] = 0xa + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0x22 + } + } + if m.Quic != nil { + size, err := m.Quic.MarshalToSizedBufferVT(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0x1a + } + if len(m.ListenAddr) > 0 { + i -= len(m.ListenAddr) + copy(dAtA[i:], m.ListenAddr) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.ListenAddr))) + i-- + dAtA[i] = 0x12 + } + if len(m.TransportPeerId) > 0 { + i -= len(m.TransportPeerId) + copy(dAtA[i:], m.TransportPeerId) + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.TransportPeerId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Config) SizeVT() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.TransportPeerId) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + l = len(m.ListenAddr) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + if m.Quic != nil { + l = m.Quic.SizeVT() + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + if len(m.Dialers) > 0 { + for k, v := range m.Dialers { + _ = k + _ = v + l = 0 + if v != nil { + l = v.SizeVT() + } + l += 1 + protobuf_go_lite.SizeOfVarint(uint64(l)) + mapEntrySize := 1 + len(k) + protobuf_go_lite.SizeOfVarint(uint64(len(k))) + l + n += mapEntrySize + 1 + protobuf_go_lite.SizeOfVarint(uint64(mapEntrySize)) + } + } + l = len(m.HttpPath) + if l > 0 { + n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l)) + } + if m.DisableServePeerId { + n += 2 + } + n += len(m.unknownFields) + return n +} + +func (m *Config) UnmarshalVT(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return errors.Errorf("proto: Config: wiretype end group for non-group") + } + if fieldNum <= 0 { + return errors.Errorf("proto: Config: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field TransportPeerId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TransportPeerId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field ListenAddr", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ListenAddr = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field Quic", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Quic == nil { + m.Quic = &quic.Opts{} + } + if err := m.Quic.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field Dialers", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Dialers == nil { + m.Dialers = make(map[string]*dialer.DialerOpts) + } + var mapkey string + var mapvalue *dialer.DialerOpts + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var mapmsglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapmsglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if mapmsglen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postmsgIndex := iNdEx + mapmsglen + if postmsgIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postmsgIndex > l { + return io.ErrUnexpectedEOF + } + mapvalue = &dialer.DialerOpts{} + if err := mapvalue.UnmarshalVT(dAtA[iNdEx:postmsgIndex]); err != nil { + return err + } + iNdEx = postmsgIndex + } else { + iNdEx = entryPreIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.Dialers[mapkey] = mapvalue + iNdEx = postIndex + case 5: + if wireType != 2 { + return errors.Errorf("proto: wrong wireType = %d for field HttpPath", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protobuf_go_lite.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.HttpPath = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 0 { + return errors.Errorf("proto: wrong wireType = %d for field DisableServePeerId", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protobuf_go_lite.ErrIntOverflow + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.DisableServePeerId = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protobuf_go_lite.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + iNdEx += skippy } } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_github_com_aperturerobotics_bifrost_transport_websocket_websocket_proto_rawDesc, - NumEnums: 0, - NumMessages: 2, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_github_com_aperturerobotics_bifrost_transport_websocket_websocket_proto_goTypes, - DependencyIndexes: file_github_com_aperturerobotics_bifrost_transport_websocket_websocket_proto_depIdxs, - MessageInfos: file_github_com_aperturerobotics_bifrost_transport_websocket_websocket_proto_msgTypes, - }.Build() - File_github_com_aperturerobotics_bifrost_transport_websocket_websocket_proto = out.File - file_github_com_aperturerobotics_bifrost_transport_websocket_websocket_proto_rawDesc = nil - file_github_com_aperturerobotics_bifrost_transport_websocket_websocket_proto_goTypes = nil - file_github_com_aperturerobotics_bifrost_transport_websocket_websocket_proto_depIdxs = nil + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil } diff --git a/transport/websocket/websocket.pb.ts b/transport/websocket/websocket.pb.ts deleted file mode 100644 index b34b5b7c..00000000 --- a/transport/websocket/websocket.pb.ts +++ /dev/null @@ -1,438 +0,0 @@ -/* eslint-disable */ -import Long from 'long' -import _m0 from 'protobufjs/minimal.js' -import { DialerOpts } from '../common/dialer/dialer.pb.js' -import { Opts } from '../common/quic/quic.pb.js' - -export const protobufPackage = 'websocket' - -/** - * Config is the configuration for the Websocket transport. - * - * Bifrost speaks Quic over the websocket. While this is not always necessary, - * especially when using wss transports, we still need to ensure end-to-end - * encryption to the peer that we handshake with on the other end, and to manage - * stream congestion control, multiplexing, - */ -export interface Config { - /** - * TransportPeerID sets the peer ID to attach the transport to. - * If unset, attaches to any running peer with a private key. - */ - transportPeerId: string - /** - * ListenAddr contains the address to listen on. - * Has no effect in the browser. - */ - listenAddr: string - /** - * Quic contains the quic protocol options. - * - * The WebSocket transport always disables FEC and several other UDP-centric - * features which are unnecessary due to the "reliable" nature of WebSockets. - */ - quic: Opts | undefined - /** Dialers maps peer IDs to dialers. */ - dialers: { [key: string]: DialerOpts } - /** - * HttpPath is the http path to expose the websocket. - * If unset, ignores the incoming request path. - */ - httpPath: string - /** - * DisableServePeerId disables serving the peer id. - * If this is unset the peer ID is available at http_path+"/peer" - * If http_path is unset the peer ID is available at /peer - */ - disableServePeerId: boolean -} - -export interface Config_DialersEntry { - key: string - value: DialerOpts | undefined -} - -function createBaseConfig(): Config { - return { - transportPeerId: '', - listenAddr: '', - quic: undefined, - dialers: {}, - httpPath: '', - disableServePeerId: false, - } -} - -export const Config = { - encode( - message: Config, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.transportPeerId !== '') { - writer.uint32(10).string(message.transportPeerId) - } - if (message.listenAddr !== '') { - writer.uint32(18).string(message.listenAddr) - } - if (message.quic !== undefined) { - Opts.encode(message.quic, writer.uint32(26).fork()).ldelim() - } - Object.entries(message.dialers).forEach(([key, value]) => { - Config_DialersEntry.encode( - { key: key as any, value }, - writer.uint32(34).fork(), - ).ldelim() - }) - if (message.httpPath !== '') { - writer.uint32(42).string(message.httpPath) - } - if (message.disableServePeerId !== false) { - writer.uint32(48).bool(message.disableServePeerId) - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Config { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseConfig() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break - } - - message.transportPeerId = reader.string() - continue - case 2: - if (tag !== 18) { - break - } - - message.listenAddr = reader.string() - continue - case 3: - if (tag !== 26) { - break - } - - message.quic = Opts.decode(reader, reader.uint32()) - continue - case 4: - if (tag !== 34) { - break - } - - const entry4 = Config_DialersEntry.decode(reader, reader.uint32()) - if (entry4.value !== undefined) { - message.dialers[entry4.key] = entry4.value - } - continue - case 5: - if (tag !== 42) { - break - } - - message.httpPath = reader.string() - continue - case 6: - if (tag !== 48) { - break - } - - message.disableServePeerId = reader.bool() - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: AsyncIterable | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config.encode(p).finish()] - } - } else { - yield* [Config.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config.decode(p)] - } - } else { - yield* [Config.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): Config { - return { - transportPeerId: isSet(object.transportPeerId) - ? globalThis.String(object.transportPeerId) - : '', - listenAddr: isSet(object.listenAddr) - ? globalThis.String(object.listenAddr) - : '', - quic: isSet(object.quic) ? Opts.fromJSON(object.quic) : undefined, - dialers: isObject(object.dialers) - ? Object.entries(object.dialers).reduce<{ [key: string]: DialerOpts }>( - (acc, [key, value]) => { - acc[key] = DialerOpts.fromJSON(value) - return acc - }, - {}, - ) - : {}, - httpPath: isSet(object.httpPath) - ? globalThis.String(object.httpPath) - : '', - disableServePeerId: isSet(object.disableServePeerId) - ? globalThis.Boolean(object.disableServePeerId) - : false, - } - }, - - toJSON(message: Config): unknown { - const obj: any = {} - if (message.transportPeerId !== '') { - obj.transportPeerId = message.transportPeerId - } - if (message.listenAddr !== '') { - obj.listenAddr = message.listenAddr - } - if (message.quic !== undefined) { - obj.quic = Opts.toJSON(message.quic) - } - if (message.dialers) { - const entries = Object.entries(message.dialers) - if (entries.length > 0) { - obj.dialers = {} - entries.forEach(([k, v]) => { - obj.dialers[k] = DialerOpts.toJSON(v) - }) - } - } - if (message.httpPath !== '') { - obj.httpPath = message.httpPath - } - if (message.disableServePeerId !== false) { - obj.disableServePeerId = message.disableServePeerId - } - return obj - }, - - create, I>>(base?: I): Config { - return Config.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>(object: I): Config { - const message = createBaseConfig() - message.transportPeerId = object.transportPeerId ?? '' - message.listenAddr = object.listenAddr ?? '' - message.quic = - object.quic !== undefined && object.quic !== null - ? Opts.fromPartial(object.quic) - : undefined - message.dialers = Object.entries(object.dialers ?? {}).reduce<{ - [key: string]: DialerOpts - }>((acc, [key, value]) => { - if (value !== undefined) { - acc[key] = DialerOpts.fromPartial(value) - } - return acc - }, {}) - message.httpPath = object.httpPath ?? '' - message.disableServePeerId = object.disableServePeerId ?? false - return message - }, -} - -function createBaseConfig_DialersEntry(): Config_DialersEntry { - return { key: '', value: undefined } -} - -export const Config_DialersEntry = { - encode( - message: Config_DialersEntry, - writer: _m0.Writer = _m0.Writer.create(), - ): _m0.Writer { - if (message.key !== '') { - writer.uint32(10).string(message.key) - } - if (message.value !== undefined) { - DialerOpts.encode(message.value, writer.uint32(18).fork()).ldelim() - } - return writer - }, - - decode(input: _m0.Reader | Uint8Array, length?: number): Config_DialersEntry { - const reader = - input instanceof _m0.Reader ? input : _m0.Reader.create(input) - let end = length === undefined ? reader.len : reader.pos + length - const message = createBaseConfig_DialersEntry() - while (reader.pos < end) { - const tag = reader.uint32() - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break - } - - message.key = reader.string() - continue - case 2: - if (tag !== 18) { - break - } - - message.value = DialerOpts.decode(reader, reader.uint32()) - continue - } - if ((tag & 7) === 4 || tag === 0) { - break - } - reader.skipType(tag & 7) - } - return message - }, - - // encodeTransform encodes a source of message objects. - // Transform - async *encodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config_DialersEntry.encode(p).finish()] - } - } else { - yield* [Config_DialersEntry.encode(pkt as any).finish()] - } - } - }, - - // decodeTransform decodes a source of encoded messages. - // Transform - async *decodeTransform( - source: - | AsyncIterable - | Iterable, - ): AsyncIterable { - for await (const pkt of source) { - if (globalThis.Array.isArray(pkt)) { - for (const p of pkt as any) { - yield* [Config_DialersEntry.decode(p)] - } - } else { - yield* [Config_DialersEntry.decode(pkt as any)] - } - } - }, - - fromJSON(object: any): Config_DialersEntry { - return { - key: isSet(object.key) ? globalThis.String(object.key) : '', - value: isSet(object.value) - ? DialerOpts.fromJSON(object.value) - : undefined, - } - }, - - toJSON(message: Config_DialersEntry): unknown { - const obj: any = {} - if (message.key !== '') { - obj.key = message.key - } - if (message.value !== undefined) { - obj.value = DialerOpts.toJSON(message.value) - } - return obj - }, - - create, I>>( - base?: I, - ): Config_DialersEntry { - return Config_DialersEntry.fromPartial(base ?? ({} as any)) - }, - fromPartial, I>>( - object: I, - ): Config_DialersEntry { - const message = createBaseConfig_DialersEntry() - message.key = object.key ?? '' - message.value = - object.value !== undefined && object.value !== null - ? DialerOpts.fromPartial(object.value) - : undefined - return message - }, -} - -type Builtin = - | Date - | Function - | Uint8Array - | string - | number - | boolean - | undefined - -export type DeepPartial = T extends Builtin - ? T - : T extends Long - ? string | number | Long - : T extends globalThis.Array - ? globalThis.Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends { $case: string } - ? { [K in keyof Omit]?: DeepPartial } & { - $case: T['$case'] - } - : T extends {} - ? { [K in keyof T]?: DeepPartial } - : Partial - -type KeysOfUnion = T extends T ? keyof T : never -export type Exact = P extends Builtin - ? P - : P & { [K in keyof P]: Exact } & { - [K in Exclude>]: never - } - -if (_m0.util.Long !== Long) { - _m0.util.Long = Long as any - _m0.configure() -} - -function isObject(value: any): boolean { - return typeof value === 'object' && value !== null -} - -function isSet(value: any): boolean { - return value !== null && value !== undefined -} diff --git a/transport/websocket/websocket_pb.ts b/transport/websocket/websocket_pb.ts new file mode 100644 index 00000000..b5284497 --- /dev/null +++ b/transport/websocket/websocket_pb.ts @@ -0,0 +1,142 @@ +// @generated by protoc-gen-es v1.8.0 with parameter "target=ts,ts_nocheck=false" +// @generated from file github.com/aperturerobotics/bifrost/transport/websocket/websocket.proto (package websocket, syntax proto3) +/* eslint-disable */ + +import type { + BinaryReadOptions, + FieldList, + JsonReadOptions, + JsonValue, + PartialMessage, + PlainMessage, +} from '@bufbuild/protobuf' +import { Message, proto3 } from '@bufbuild/protobuf' +import { Opts } from '../common/quic/quic_pb.js' +import { DialerOpts } from '../common/dialer/dialer_pb.js' + +/** + * Config is the configuration for the Websocket transport. + * + * Bifrost speaks Quic over the websocket. While this is not always necessary, + * especially when using wss transports, we still need to ensure end-to-end + * encryption to the peer that we handshake with on the other end, and to manage + * stream congestion control, multiplexing, + * + * @generated from message websocket.Config + */ +export class Config extends Message { + /** + * TransportPeerID sets the peer ID to attach the transport to. + * If unset, attaches to any running peer with a private key. + * + * @generated from field: string transport_peer_id = 1; + */ + transportPeerId = '' + + /** + * ListenAddr contains the address to listen on. + * Has no effect in the browser. + * + * @generated from field: string listen_addr = 2; + */ + listenAddr = '' + + /** + * Quic contains the quic protocol options. + * + * The WebSocket transport always disables FEC and several other UDP-centric + * features which are unnecessary due to the "reliable" nature of WebSockets. + * + * @generated from field: transport.quic.Opts quic = 3; + */ + quic?: Opts + + /** + * Dialers maps peer IDs to dialers. + * + * @generated from field: map dialers = 4; + */ + dialers: { [key: string]: DialerOpts } = {} + + /** + * HttpPath is the http path to expose the websocket. + * If unset, ignores the incoming request path. + * + * @generated from field: string http_path = 5; + */ + httpPath = '' + + /** + * DisableServePeerId disables serving the peer id. + * If this is unset the peer ID is available at http_path+"/peer" + * If http_path is unset the peer ID is available at /peer + * + * @generated from field: bool disable_serve_peer_id = 6; + */ + disableServePeerId = false + + constructor(data?: PartialMessage) { + super() + proto3.util.initPartial(data, this) + } + + static readonly runtime: typeof proto3 = proto3 + static readonly typeName = 'websocket.Config' + static readonly fields: FieldList = proto3.util.newFieldList(() => [ + { + no: 1, + name: 'transport_peer_id', + kind: 'scalar', + T: 9 /* ScalarType.STRING */, + }, + { + no: 2, + name: 'listen_addr', + kind: 'scalar', + T: 9 /* ScalarType.STRING */, + }, + { no: 3, name: 'quic', kind: 'message', T: Opts }, + { + no: 4, + name: 'dialers', + kind: 'map', + K: 9 /* ScalarType.STRING */, + V: { kind: 'message', T: DialerOpts }, + }, + { no: 5, name: 'http_path', kind: 'scalar', T: 9 /* ScalarType.STRING */ }, + { + no: 6, + name: 'disable_serve_peer_id', + kind: 'scalar', + T: 8 /* ScalarType.BOOL */, + }, + ]) + + static fromBinary( + bytes: Uint8Array, + options?: Partial, + ): Config { + return new Config().fromBinary(bytes, options) + } + + static fromJson( + jsonValue: JsonValue, + options?: Partial, + ): Config { + return new Config().fromJson(jsonValue, options) + } + + static fromJsonString( + jsonString: string, + options?: Partial, + ): Config { + return new Config().fromJsonString(jsonString, options) + } + + static equals( + a: Config | PlainMessage | undefined, + b: Config | PlainMessage | undefined, + ): boolean { + return proto3.util.equals(Config, a, b) + } +} diff --git a/transport/websocket/websocket_vtproto.pb.go b/transport/websocket/websocket_vtproto.pb.go deleted file mode 100644 index ddb1195a..00000000 --- a/transport/websocket/websocket_vtproto.pb.go +++ /dev/null @@ -1,643 +0,0 @@ -// Code generated by protoc-gen-go-vtproto. DO NOT EDIT. -// protoc-gen-go-vtproto version: v0.6.0 -// source: github.com/aperturerobotics/bifrost/transport/websocket/websocket.proto - -package websocket - -import ( - fmt "fmt" - io "io" - - dialer "github.com/aperturerobotics/bifrost/transport/common/dialer" - quic "github.com/aperturerobotics/bifrost/transport/common/quic" - protohelpers "github.com/planetscale/vtprotobuf/protohelpers" - proto "google.golang.org/protobuf/proto" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" -) - -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) -) - -func (m *Config) CloneVT() *Config { - if m == nil { - return (*Config)(nil) - } - r := new(Config) - r.TransportPeerId = m.TransportPeerId - r.ListenAddr = m.ListenAddr - r.HttpPath = m.HttpPath - r.DisableServePeerId = m.DisableServePeerId - if rhs := m.Quic; rhs != nil { - if vtpb, ok := interface{}(rhs).(interface{ CloneVT() *quic.Opts }); ok { - r.Quic = vtpb.CloneVT() - } else { - r.Quic = proto.Clone(rhs).(*quic.Opts) - } - } - if rhs := m.Dialers; rhs != nil { - tmpContainer := make(map[string]*dialer.DialerOpts, len(rhs)) - for k, v := range rhs { - if vtpb, ok := interface{}(v).(interface{ CloneVT() *dialer.DialerOpts }); ok { - tmpContainer[k] = vtpb.CloneVT() - } else { - tmpContainer[k] = proto.Clone(v).(*dialer.DialerOpts) - } - } - r.Dialers = tmpContainer - } - if len(m.unknownFields) > 0 { - r.unknownFields = make([]byte, len(m.unknownFields)) - copy(r.unknownFields, m.unknownFields) - } - return r -} - -func (m *Config) CloneMessageVT() proto.Message { - return m.CloneVT() -} - -func (this *Config) EqualVT(that *Config) bool { - if this == that { - return true - } else if this == nil || that == nil { - return false - } - if this.TransportPeerId != that.TransportPeerId { - return false - } - if this.ListenAddr != that.ListenAddr { - return false - } - if equal, ok := interface{}(this.Quic).(interface{ EqualVT(*quic.Opts) bool }); ok { - if !equal.EqualVT(that.Quic) { - return false - } - } else if !proto.Equal(this.Quic, that.Quic) { - return false - } - if len(this.Dialers) != len(that.Dialers) { - return false - } - for i, vx := range this.Dialers { - vy, ok := that.Dialers[i] - if !ok { - return false - } - if p, q := vx, vy; p != q { - if p == nil { - p = &dialer.DialerOpts{} - } - if q == nil { - q = &dialer.DialerOpts{} - } - if equal, ok := interface{}(p).(interface{ EqualVT(*dialer.DialerOpts) bool }); ok { - if !equal.EqualVT(q) { - return false - } - } else if !proto.Equal(p, q) { - return false - } - } - } - if this.HttpPath != that.HttpPath { - return false - } - if this.DisableServePeerId != that.DisableServePeerId { - return false - } - return string(this.unknownFields) == string(that.unknownFields) -} - -func (this *Config) EqualMessageVT(thatMsg proto.Message) bool { - that, ok := thatMsg.(*Config) - if !ok { - return false - } - return this.EqualVT(that) -} -func (m *Config) MarshalVT() (dAtA []byte, err error) { - if m == nil { - return nil, nil - } - size := m.SizeVT() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBufferVT(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Config) MarshalToVT(dAtA []byte) (int, error) { - size := m.SizeVT() - return m.MarshalToSizedBufferVT(dAtA[:size]) -} - -func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error) { - if m == nil { - return 0, nil - } - i := len(dAtA) - _ = i - var l int - _ = l - if m.unknownFields != nil { - i -= len(m.unknownFields) - copy(dAtA[i:], m.unknownFields) - } - if m.DisableServePeerId { - i-- - if m.DisableServePeerId { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x30 - } - if len(m.HttpPath) > 0 { - i -= len(m.HttpPath) - copy(dAtA[i:], m.HttpPath) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.HttpPath))) - i-- - dAtA[i] = 0x2a - } - if len(m.Dialers) > 0 { - for k := range m.Dialers { - v := m.Dialers[k] - baseI := i - if vtmsg, ok := interface{}(v).(interface { - MarshalToSizedBufferVT([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(v) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0x12 - i -= len(k) - copy(dAtA[i:], k) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(k))) - i-- - dAtA[i] = 0xa - i = protohelpers.EncodeVarint(dAtA, i, uint64(baseI-i)) - i-- - dAtA[i] = 0x22 - } - } - if m.Quic != nil { - if vtmsg, ok := interface{}(m.Quic).(interface { - MarshalToSizedBufferVT([]byte) (int, error) - }); ok { - size, err := vtmsg.MarshalToSizedBufferVT(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) - } else { - encoded, err := proto.Marshal(m.Quic) - if err != nil { - return 0, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) - } - i-- - dAtA[i] = 0x1a - } - if len(m.ListenAddr) > 0 { - i -= len(m.ListenAddr) - copy(dAtA[i:], m.ListenAddr) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.ListenAddr))) - i-- - dAtA[i] = 0x12 - } - if len(m.TransportPeerId) > 0 { - i -= len(m.TransportPeerId) - copy(dAtA[i:], m.TransportPeerId) - i = protohelpers.EncodeVarint(dAtA, i, uint64(len(m.TransportPeerId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Config) SizeVT() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.TransportPeerId) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - l = len(m.ListenAddr) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.Quic != nil { - if size, ok := interface{}(m.Quic).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(m.Quic) - } - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if len(m.Dialers) > 0 { - for k, v := range m.Dialers { - _ = k - _ = v - l = 0 - if v != nil { - if size, ok := interface{}(v).(interface { - SizeVT() int - }); ok { - l = size.SizeVT() - } else { - l = proto.Size(v) - } - } - l += 1 + protohelpers.SizeOfVarint(uint64(l)) - mapEntrySize := 1 + len(k) + protohelpers.SizeOfVarint(uint64(len(k))) + l - n += mapEntrySize + 1 + protohelpers.SizeOfVarint(uint64(mapEntrySize)) - } - } - l = len(m.HttpPath) - if l > 0 { - n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) - } - if m.DisableServePeerId { - n += 2 - } - n += len(m.unknownFields) - return n -} - -func (m *Config) UnmarshalVT(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Config: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Config: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TransportPeerId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TransportPeerId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListenAddr", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ListenAddr = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Quic", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Quic == nil { - m.Quic = &quic.Opts{} - } - if unmarshal, ok := interface{}(m.Quic).(interface { - UnmarshalVT([]byte) error - }); ok { - if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil { - return err - } - } else { - if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.Quic); err != nil { - return err - } - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Dialers", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Dialers == nil { - m.Dialers = make(map[string]*dialer.DialerOpts) - } - var mapkey string - var mapvalue *dialer.DialerOpts - for iNdEx < postIndex { - entryPreIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - if fieldNum == 1 { - var stringLenmapkey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapkey |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapkey := int(stringLenmapkey) - if intStringLenmapkey < 0 { - return protohelpers.ErrInvalidLength - } - postStringIndexmapkey := iNdEx + intStringLenmapkey - if postStringIndexmapkey < 0 { - return protohelpers.ErrInvalidLength - } - if postStringIndexmapkey > l { - return io.ErrUnexpectedEOF - } - mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) - iNdEx = postStringIndexmapkey - } else if fieldNum == 2 { - var mapmsglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - mapmsglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if mapmsglen < 0 { - return protohelpers.ErrInvalidLength - } - postmsgIndex := iNdEx + mapmsglen - if postmsgIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postmsgIndex > l { - return io.ErrUnexpectedEOF - } - mapvalue = &dialer.DialerOpts{} - if unmarshal, ok := interface{}(mapvalue).(interface { - UnmarshalVT([]byte) error - }); ok { - if err := unmarshal.UnmarshalVT(dAtA[iNdEx:postmsgIndex]); err != nil { - return err - } - } else { - if err := proto.Unmarshal(dAtA[iNdEx:postmsgIndex], mapvalue); err != nil { - return err - } - } - iNdEx = postmsgIndex - } else { - iNdEx = entryPreIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > postIndex { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - m.Dialers[mapkey] = mapvalue - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field HttpPath", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protohelpers.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protohelpers.ErrInvalidLength - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.HttpPath = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field DisableServePeerId", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protohelpers.ErrIntOverflow - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.DisableServePeerId = bool(v != 0) - default: - iNdEx = preIndex - skippy, err := protohelpers.Skip(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protohelpers.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} diff --git a/util/confparse/timestamp.go b/util/confparse/timestamp.go index c33512a3..98525fcd 100644 --- a/util/confparse/timestamp.go +++ b/util/confparse/timestamp.go @@ -4,29 +4,33 @@ import ( "strconv" "time" - "github.com/aperturerobotics/timestamp" + "github.com/aperturerobotics/protobuf-go-lite/types/known/timestamppb" ) // ParseTimestamp parses a timestamp string. // // The string can be either a unix time milliseconds or RFC3339 timestamp. // Returns nil, nil if empty. -func ParseTimestamp(timestampStr string) (*timestamp.Timestamp, error) { +func ParseTimestamp(timestampStr string) (*timestamppb.Timestamp, error) { if timestampStr == "" { return nil, nil } - ts := ×tamp.Timestamp{} + ts := ×tamppb.Timestamp{} jdat := []byte(strconv.Quote(timestampStr)) if err := ts.UnmarshalJSON(jdat); err != nil { - return nil, err + ts.Reset() + if err := ts.UnmarshalJSON([]byte(timestampStr)); err != nil { + return nil, err + } } return ts, nil } // MarshalTimestamp marshals a timestamp to a RFC3339 string. -func MarshalTimestamp(ts *timestamp.Timestamp) string { +// This format is also supported by proto3. +func MarshalTimestamp(ts *timestamppb.Timestamp) string { if ts == nil { return "" } - return ts.ToTime().Format(time.RFC3339) + return ts.AsTime().Format(time.RFC3339) } diff --git a/util/confparse/timestamp_test.go b/util/confparse/timestamp_test.go index 05195608..bc13833f 100644 --- a/util/confparse/timestamp_test.go +++ b/util/confparse/timestamp_test.go @@ -3,14 +3,14 @@ package confparse import ( "testing" - "github.com/aperturerobotics/timestamp" + "github.com/aperturerobotics/protobuf-go-lite/types/known/timestamppb" ) func TestParseTimestamp(t *testing.T) { tests := []struct { name string input string - expected *timestamp.Timestamp + expected *timestamppb.Timestamp expectError bool }{ { @@ -22,16 +22,16 @@ func TestParseTimestamp(t *testing.T) { { name: "ValidUnixMilliseconds", input: "1629048153000", - expected: ×tamp.Timestamp{ - TimeUnixMs: 1629048153000, + expected: ×tamppb.Timestamp{ + Seconds: 1629048153, }, expectError: false, }, { name: "ValidRFC3339", input: "2021-08-15T15:49:13Z", - expected: ×tamp.Timestamp{ - TimeUnixMs: 1629042553000, + expected: ×tamppb.Timestamp{ + Seconds: 1629042553, }, expectError: false, }, @@ -55,7 +55,7 @@ func TestParseTimestamp(t *testing.T) { t.Fatal(err.Error()) } } - if !tt.expected.Equals(actual) { + if !tt.expected.EqualVT(actual) { t.Fatalf("expected %q got %q", tt.expected, actual) } }) diff --git a/yarn.lock b/yarn.lock index 38752f57..e5ce5d87 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7,29 +7,20 @@ resolved "https://registry.yarnpkg.com/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz#bd9154aec9983f77b3a034ecaa015c2e4201f6cf" integrity sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA== -"@aperturerobotics/ts-common@0.9.1": - version "0.9.1" - resolved "https://registry.yarnpkg.com/@aperturerobotics/ts-common/-/ts-common-0.9.1.tgz#2799745db349ed4852b8d1841d544642ed2971b3" - integrity sha512-KpwZc8tCgXqKA+bVvSyl72wjyW419TTyi8qbBfcOJl8wxGyqFq4h9pZ6B22bleWT9qqFuwUyqnuieJmrjpg+uA== - dependencies: - "@typescript-eslint/eslint-plugin" "^7.3.1" - "@typescript-eslint/parser" "^7.3.1" +"@aperturerobotics/ts-common@0.11.0": + version "0.11.0" + resolved "https://registry.yarnpkg.com/@aperturerobotics/ts-common/-/ts-common-0.11.0.tgz#769b1489783b670c4eb617e34ad636b7c0d1c8b4" + integrity sha512-s1rMO5PfNxi/hDIIo96tw2NSk0r88Tj2EcOfsHHNtGRinBxfk/8ZeCXa8Hyq9RUqEqsgb6o0bjUhGzQt+8bBNg== + dependencies: + "@bufbuild/protobuf" "^1.8.0" + "@typescript-eslint/eslint-plugin" "^7.7.0" + "@typescript-eslint/parser" "^7.7.0" bufferutil "^4.0.7" - eslint "^9.0.0" + eslint "^9.1.0" eslint-config-prettier "^9.0.0" eslint-plugin-react-hooks "^4.6.0" eslint-plugin-unused-imports "^3.0.0" - long "^5.2.3" - starpc "^0.28.0" - utf-8-validate "^6.0.3" - -"@aperturerobotics/ts-proto-common-types@^0.3.0": - version "0.3.0" - resolved "https://registry.yarnpkg.com/@aperturerobotics/ts-proto-common-types/-/ts-proto-common-types-0.3.0.tgz#712bc9c6ad3ae4be7053e85209760fe4a1c1a748" - integrity sha512-XjPm1dkwL/FIptTEPhwifvpNwEMUdk359edStHnuYQRvlBwCDZ1dwPkX+jl1JZOnbcqQ7gPUvgelZvC9qLSFLQ== - dependencies: - long "^5.2.0" - protobufjs "^7.0.0" + starpc "^0.31.1" "@aptre/it-ws@^1.0.0": version "1.0.0" @@ -107,7 +98,7 @@ js-tokens "^4.0.0" picocolors "^1.0.0" -"@babel/parser@^7.23.0", "@babel/parser@^7.23.9", "@babel/parser@^7.24.0", "@babel/parser@^7.24.1": +"@babel/parser@^7.23.0", "@babel/parser@^7.24.0", "@babel/parser@^7.24.1": version "7.24.4" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.24.4.tgz#234487a110d89ad5a3ed4a8a566c36b9453e8c88" integrity sha512-zTvEBcghmeBma9QIGunWevvBAp4/Qu9Bdq+2k0Ot4fVMD6v3dsC9WOcRSKk7tRRyBM/53yKMJko9xOatGQAwSg== @@ -146,6 +137,28 @@ "@babel/helper-validator-identifier" "^7.22.20" to-fast-properties "^2.0.0" +"@bufbuild/protobuf@1.8.0", "@bufbuild/protobuf@^1.8.0": + version "1.8.0" + resolved "https://registry.yarnpkg.com/@bufbuild/protobuf/-/protobuf-1.8.0.tgz#1c8651ea34adb8019b483e09de02aeeb1cd57d79" + integrity sha512-qR9FwI8QKIveDnUYutvfzbC21UZJJryYrLuZGjeZ/VGz+vXelUkK+xgkOHsvPEdYEdxtgUUq4313N8QtOehJ1Q== + +"@bufbuild/protoc-gen-es@^1.8.0": + version "1.8.0" + resolved "https://registry.yarnpkg.com/@bufbuild/protoc-gen-es/-/protoc-gen-es-1.8.0.tgz#b16cca884ccba23f1401104ca002028635a2b169" + integrity sha512-jnvBKwHq3o/iOgfKxaxn5Za7ay4oAs8KWgoHiDc9Fsb0g+/d1z+mHlHvmevOiCPcVZsnH6V3LImOJvGStPONpA== + dependencies: + "@bufbuild/protobuf" "^1.8.0" + "@bufbuild/protoplugin" "1.8.0" + +"@bufbuild/protoplugin@1.8.0", "@bufbuild/protoplugin@^1.8.0": + version "1.8.0" + resolved "https://registry.yarnpkg.com/@bufbuild/protoplugin/-/protoplugin-1.8.0.tgz#0e60a79d195ad79d014c263ae9c57f64063d23a5" + integrity sha512-Pb89cTshW+I577qh27VvxGYvZEvQ3zJ8La1OfzPCKugP9d4A4P65WStkAY+aSCiDHk68m1/+mtBb6elfiLPuFg== + dependencies: + "@bufbuild/protobuf" "1.8.0" + "@typescript/vfs" "^1.4.0" + typescript "4.5.2" + "@chainsafe/is-ip@^2.0.1", "@chainsafe/is-ip@^2.0.2": version "2.0.2" resolved "https://registry.yarnpkg.com/@chainsafe/is-ip/-/is-ip-2.0.2.tgz#7311e7403f11d8c5cfa48111f56fcecaac37c9f6" @@ -198,15 +211,15 @@ minimatch "^3.1.2" strip-json-comments "^3.1.1" -"@eslint/js@9.0.0": - version "9.0.0" - resolved "https://registry.yarnpkg.com/@eslint/js/-/js-9.0.0.tgz#1a9e4b4c96d8c7886e0110ed310a0135144a1691" - integrity sha512-RThY/MnKrhubF6+s1JflwUjPEsnCEmYCWwqa/aRISKWNXGZ9epUwft4bUMM35SdKF9xvBrLydAM1RDHd1Z//ZQ== +"@eslint/js@9.1.1": + version "9.1.1" + resolved "https://registry.yarnpkg.com/@eslint/js/-/js-9.1.1.tgz#eb0f82461d12779bbafc1b5045cde3143d350a8a" + integrity sha512-5WoDz3Y19Bg2BnErkZTp0en+c/i9PvgFS7MBe1+m60HjFr0hrphlAGp4yzI7pxpt4xShln4ZyYp4neJm8hmOkQ== -"@humanwhocodes/config-array@^0.12.3": - version "0.12.3" - resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.12.3.tgz#a6216d90f81a30bedd1d4b5d799b47241f318072" - integrity sha512-jsNnTBlMWuTpDkeE3on7+dWJi0D6fdDfeANj/w7MpS8ztROCoLvIO2nG0CcFj+E4k8j4QrSTh4Oryi3i2G669g== +"@humanwhocodes/config-array@^0.13.0": + version "0.13.0" + resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.13.0.tgz#fb907624df3256d04b9aa2df50d7aa97ec648748" + integrity sha512-DZLEEqFWQFiyK6h5YIeynKx7JlvCYWL0cImfSRXZ9l4Sg2efkFGTuFf6vzXjK1cq6IYkU+Eg/JizXw+TD2vRNw== dependencies: "@humanwhocodes/object-schema" "^2.0.3" debug "^4.3.1" @@ -222,6 +235,11 @@ resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz#4a2868d75d6d6963e423bcf90b7fd1be343409d3" integrity sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA== +"@humanwhocodes/retry@^0.2.3": + version "0.2.3" + resolved "https://registry.yarnpkg.com/@humanwhocodes/retry/-/retry-0.2.3.tgz#c9aa036d1afa643f1250e83150f39efb3a15a631" + integrity sha512-X38nUbachlb01YMlvPFojKoiXq+LzZvuSce70KPMPdeM1Rj03k4dR7lDslhbqXn3Ang4EU3+EAmwEAsbrjHW3g== + "@jridgewell/gen-mapping@^0.3.5": version "0.3.5" resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz#dcce6aff74bdf6dad1a95802b69b04a2fcb1fb36" @@ -259,10 +277,10 @@ resolved "https://registry.yarnpkg.com/@leichtgewicht/ip-codec/-/ip-codec-2.0.5.tgz#4fc56c15c580b9adb7dc3c333a134e540b44bfb1" integrity sha512-Vo+PSpZG2/fmgmiNzYK9qWRh8h/CHrwD0mo1h1DzL4yzHNSfWYujGTYsWGreD000gcgmZ7K4Ys6Tx9TxtsKdDw== -"@libp2p/interface@^1.0.0", "@libp2p/interface@^1.1.3", "@libp2p/interface@^1.1.6": - version "1.1.6" - resolved "https://registry.yarnpkg.com/@libp2p/interface/-/interface-1.1.6.tgz#379e3201f776ca13482ea60d31c4c5d40d88f7de" - integrity sha512-CLz6TAZf+Mw1PCIU8pjMIct1uh3A1fIene2/t+E57Tw4uJLCBJE9CLed/Opxliy5RH0e32Aa6bi4QSXtkJTK7A== +"@libp2p/interface@^1.0.0", "@libp2p/interface@^1.1.3", "@libp2p/interface@^1.2.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@libp2p/interface/-/interface-1.2.0.tgz#3b5fdc5d96cffe17a8c88cc29ed78c70516b0a7f" + integrity sha512-ImnGNl3El/AukgaojACT8i9SNW1FOsrThcQU/qA3w5tEBR5p84Uwgzl/nxa4X5vGinItUJ9jLEJmtkQJENoiGQ== dependencies: "@multiformats/multiaddr" "^12.2.1" it-pushable "^3.2.3" @@ -271,25 +289,25 @@ progress-events "^1.0.0" uint8arraylist "^2.4.8" -"@libp2p/logger@^4.0.6", "@libp2p/logger@^4.0.9": - version "4.0.9" - resolved "https://registry.yarnpkg.com/@libp2p/logger/-/logger-4.0.9.tgz#30905a37f02d52488d990d8c2318c9aa8e5ea733" - integrity sha512-eGjFvMGA2FtNrnQuI6YwYY5jviA00lTMAKi8pF3eH0TCnEokSYJ9LxBLwZNgIzrWuwZwO+sf4SsY1YBEisFf5Q== +"@libp2p/logger@^4.0.10", "@libp2p/logger@^4.0.6": + version "4.0.10" + resolved "https://registry.yarnpkg.com/@libp2p/logger/-/logger-4.0.10.tgz#d59db10d74b20e78be37f8ec53c1139174c0afda" + integrity sha512-JiRfJHO/D9Jlh2rJ6STnONoeQevBAdAZaGUxrtvBf4RFfucldSFEMOtdkFO8xFGuiA90Q2kj4BE2douG6fB3Lw== dependencies: - "@libp2p/interface" "^1.1.6" + "@libp2p/interface" "^1.2.0" "@multiformats/multiaddr" "^12.2.1" debug "^4.3.4" interface-datastore "^8.2.11" multiformats "^13.1.0" "@libp2p/utils@^5.2.5": - version "5.2.8" - resolved "https://registry.yarnpkg.com/@libp2p/utils/-/utils-5.2.8.tgz#bc7b7064e36515ce12bce0eec584655b0530ee7b" - integrity sha512-gAATwKXh3UhRb6hQOhezT6uC8os6VRt4UkK8S2gQhcjTDaFW4cbfF0oQ3gkXpPJYi/rm8t9JCZmv1btbd5O+jA== + version "5.3.1" + resolved "https://registry.yarnpkg.com/@libp2p/utils/-/utils-5.3.1.tgz#1d3ff7e494f78503f33e1c8df4ad4a13209d594b" + integrity sha512-FdGzRU50PJLYSEOmVXqqtq27yjUVXkU4QNRZzMVuXF9L/sKgSC2oXwj0Satc9fHx5tG3MCX1ZOSAmYEIl2fu+w== dependencies: "@chainsafe/is-ip" "^2.0.2" - "@libp2p/interface" "^1.1.6" - "@libp2p/logger" "^4.0.9" + "@libp2p/interface" "^1.2.0" + "@libp2p/logger" "^4.0.10" "@multiformats/multiaddr" "^12.2.1" "@multiformats/multiaddr-matcher" "^1.2.0" delay "^6.0.0" @@ -359,59 +377,6 @@ "@nodelib/fs.scandir" "2.1.5" fastq "^1.6.0" -"@protobufjs/aspromise@^1.1.1", "@protobufjs/aspromise@^1.1.2": - version "1.1.2" - resolved "https://registry.yarnpkg.com/@protobufjs/aspromise/-/aspromise-1.1.2.tgz#9b8b0cc663d669a7d8f6f5d0893a14d348f30fbf" - integrity sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ== - -"@protobufjs/base64@^1.1.2": - version "1.1.2" - resolved "https://registry.yarnpkg.com/@protobufjs/base64/-/base64-1.1.2.tgz#4c85730e59b9a1f1f349047dbf24296034bb2735" - integrity sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg== - -"@protobufjs/codegen@^2.0.4": - version "2.0.4" - resolved "https://registry.yarnpkg.com/@protobufjs/codegen/-/codegen-2.0.4.tgz#7ef37f0d010fb028ad1ad59722e506d9262815cb" - integrity sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg== - -"@protobufjs/eventemitter@^1.1.0": - version "1.1.0" - resolved "https://registry.yarnpkg.com/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz#355cbc98bafad5978f9ed095f397621f1d066b70" - integrity sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q== - -"@protobufjs/fetch@^1.1.0": - version "1.1.0" - resolved "https://registry.yarnpkg.com/@protobufjs/fetch/-/fetch-1.1.0.tgz#ba99fb598614af65700c1619ff06d454b0d84c45" - integrity sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ== - dependencies: - "@protobufjs/aspromise" "^1.1.1" - "@protobufjs/inquire" "^1.1.0" - -"@protobufjs/float@^1.0.2": - version "1.0.2" - resolved "https://registry.yarnpkg.com/@protobufjs/float/-/float-1.0.2.tgz#5e9e1abdcb73fc0a7cb8b291df78c8cbd97b87d1" - integrity sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ== - -"@protobufjs/inquire@^1.1.0": - version "1.1.0" - resolved "https://registry.yarnpkg.com/@protobufjs/inquire/-/inquire-1.1.0.tgz#ff200e3e7cf2429e2dcafc1140828e8cc638f089" - integrity sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q== - -"@protobufjs/path@^1.1.2": - version "1.1.2" - resolved "https://registry.yarnpkg.com/@protobufjs/path/-/path-1.1.2.tgz#6cc2b20c5c9ad6ad0dccfd21ca7673d8d7fbf68d" - integrity sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA== - -"@protobufjs/pool@^1.1.0": - version "1.1.0" - resolved "https://registry.yarnpkg.com/@protobufjs/pool/-/pool-1.1.0.tgz#09fd15f2d6d3abfa9b65bc366506d6ad7846ff54" - integrity sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw== - -"@protobufjs/utf8@^1.1.0": - version "1.1.0" - resolved "https://registry.yarnpkg.com/@protobufjs/utf8/-/utf8-1.1.0.tgz#a777360b5b39a1a2e5106f8e858f2fd2d060c570" - integrity sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw== - "@types/dns-packet@^5.6.5": version "5.6.5" resolved "https://registry.yarnpkg.com/@types/dns-packet/-/dns-packet-5.6.5.tgz#49fc29a40f5d30227ed028fa1ee82601d3745e15" @@ -429,7 +394,7 @@ resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.5.tgz#1001cc5e6a3704b83c236027e77f2f58ea010f40" integrity sha512-Klz949h02Gz2uZCMGwDUSDS1YBlTdDDgbWHi+81l29tQALUtvz4rAYi5uoVhE5Lagoq6DeqAUlbrHvW/mXDgdQ== -"@types/node@*", "@types/node@>=13.7.0": +"@types/node@*": version "20.12.7" resolved "https://registry.yarnpkg.com/@types/node/-/node-20.12.7.tgz#04080362fa3dd6c5822061aa3124f5c152cff384" integrity sha512-wq0cICSkRLVaf3UGLMGItu/PtdY7oaXaI/RVU+xliKVOtRna3PRY57ZDfztpDL0n11vfymMUnXv8QwYCO7L1wg== @@ -453,16 +418,16 @@ dependencies: "@types/node" "*" -"@typescript-eslint/eslint-plugin@^7.3.1": - version "7.6.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.6.0.tgz#1f5df5cda490a0bcb6fbdd3382e19f1241024242" - integrity sha512-gKmTNwZnblUdnTIJu3e9kmeRRzV2j1a/LUO27KNNAnIC5zjy1aSvXSRp4rVNlmAoHlQ7HzX42NbKpcSr4jF80A== +"@typescript-eslint/eslint-plugin@^7.7.0": + version "7.7.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.7.0.tgz#bf34a02f221811505b8bf2f31060c8560c1bb0a3" + integrity sha512-GJWR0YnfrKnsRoluVO3PRb9r5aMZriiMMM/RHj5nnTrBy1/wIgk76XCtCKcnXGjpZQJQRFtGV9/0JJ6n30uwpQ== dependencies: "@eslint-community/regexpp" "^4.10.0" - "@typescript-eslint/scope-manager" "7.6.0" - "@typescript-eslint/type-utils" "7.6.0" - "@typescript-eslint/utils" "7.6.0" - "@typescript-eslint/visitor-keys" "7.6.0" + "@typescript-eslint/scope-manager" "7.7.0" + "@typescript-eslint/type-utils" "7.7.0" + "@typescript-eslint/utils" "7.7.0" + "@typescript-eslint/visitor-keys" "7.7.0" debug "^4.3.4" graphemer "^1.4.0" ignore "^5.3.1" @@ -470,47 +435,47 @@ semver "^7.6.0" ts-api-utils "^1.3.0" -"@typescript-eslint/parser@^7.3.1": - version "7.6.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-7.6.0.tgz#0aca5de3045d68b36e88903d15addaf13d040a95" - integrity sha512-usPMPHcwX3ZoPWnBnhhorc14NJw9J4HpSXQX4urF2TPKG0au0XhJoZyX62fmvdHONUkmyUe74Hzm1//XA+BoYg== +"@typescript-eslint/parser@^7.7.0": + version "7.7.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-7.7.0.tgz#6b1b3ce76c5de002c43af8ae933613b0f2b4bcc6" + integrity sha512-fNcDm3wSwVM8QYL4HKVBggdIPAy9Q41vcvC/GtDobw3c4ndVT3K6cqudUmjHPw8EAp4ufax0o58/xvWaP2FmTg== dependencies: - "@typescript-eslint/scope-manager" "7.6.0" - "@typescript-eslint/types" "7.6.0" - "@typescript-eslint/typescript-estree" "7.6.0" - "@typescript-eslint/visitor-keys" "7.6.0" + "@typescript-eslint/scope-manager" "7.7.0" + "@typescript-eslint/types" "7.7.0" + "@typescript-eslint/typescript-estree" "7.7.0" + "@typescript-eslint/visitor-keys" "7.7.0" debug "^4.3.4" -"@typescript-eslint/scope-manager@7.6.0": - version "7.6.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-7.6.0.tgz#1e9972f654210bd7500b31feadb61a233f5b5e9d" - integrity sha512-ngttyfExA5PsHSx0rdFgnADMYQi+Zkeiv4/ZxGYUWd0nLs63Ha0ksmp8VMxAIC0wtCFxMos7Lt3PszJssG/E6w== +"@typescript-eslint/scope-manager@7.7.0": + version "7.7.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-7.7.0.tgz#3f0db079b275bb8b0cb5be7613fb3130cfb5de77" + integrity sha512-/8INDn0YLInbe9Wt7dK4cXLDYp0fNHP5xKLHvZl3mOT5X17rK/YShXaiNmorl+/U4VKCVIjJnx4Ri5b0y+HClw== dependencies: - "@typescript-eslint/types" "7.6.0" - "@typescript-eslint/visitor-keys" "7.6.0" + "@typescript-eslint/types" "7.7.0" + "@typescript-eslint/visitor-keys" "7.7.0" -"@typescript-eslint/type-utils@7.6.0": - version "7.6.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-7.6.0.tgz#644f75075f379827d25fe0713e252ccd4e4a428c" - integrity sha512-NxAfqAPNLG6LTmy7uZgpK8KcuiS2NZD/HlThPXQRGwz6u7MDBWRVliEEl1Gj6U7++kVJTpehkhZzCJLMK66Scw== +"@typescript-eslint/type-utils@7.7.0": + version "7.7.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-7.7.0.tgz#36792ff4209a781b058de61631a48df17bdefbc5" + integrity sha512-bOp3ejoRYrhAlnT/bozNQi3nio9tIgv3U5C0mVDdZC7cpcQEDZXvq8inrHYghLVwuNABRqrMW5tzAv88Vy77Sg== dependencies: - "@typescript-eslint/typescript-estree" "7.6.0" - "@typescript-eslint/utils" "7.6.0" + "@typescript-eslint/typescript-estree" "7.7.0" + "@typescript-eslint/utils" "7.7.0" debug "^4.3.4" ts-api-utils "^1.3.0" -"@typescript-eslint/types@7.6.0": - version "7.6.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-7.6.0.tgz#53dba7c30c87e5f10a731054266dd905f1fbae38" - integrity sha512-h02rYQn8J+MureCvHVVzhl69/GAfQGPQZmOMjG1KfCl7o3HtMSlPaPUAPu6lLctXI5ySRGIYk94clD/AUMCUgQ== +"@typescript-eslint/types@7.7.0": + version "7.7.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-7.7.0.tgz#23af4d24bf9ce15d8d301236e3e3014143604f27" + integrity sha512-G01YPZ1Bd2hn+KPpIbrAhEWOn5lQBrjxkzHkWvP6NucMXFtfXoevK82hzQdpfuQYuhkvFDeQYbzXCjR1z9Z03w== -"@typescript-eslint/typescript-estree@7.6.0": - version "7.6.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-7.6.0.tgz#112a3775563799fd3f011890ac8322f80830ac17" - integrity sha512-+7Y/GP9VuYibecrCQWSKgl3GvUM5cILRttpWtnAu8GNL9j11e4tbuGZmZjJ8ejnKYyBRb2ddGQ3rEFCq3QjMJw== +"@typescript-eslint/typescript-estree@7.7.0": + version "7.7.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-7.7.0.tgz#b5dd6383b4c6a852d7b256a37af971e8982be97f" + integrity sha512-8p71HQPE6CbxIBy2kWHqM1KGrC07pk6RJn40n0DSc6bMOBBREZxSDJ+BmRzc8B5OdaMh1ty3mkuWRg4sCFiDQQ== dependencies: - "@typescript-eslint/types" "7.6.0" - "@typescript-eslint/visitor-keys" "7.6.0" + "@typescript-eslint/types" "7.7.0" + "@typescript-eslint/visitor-keys" "7.7.0" debug "^4.3.4" globby "^11.1.0" is-glob "^4.0.3" @@ -518,78 +483,80 @@ semver "^7.6.0" ts-api-utils "^1.3.0" -"@typescript-eslint/utils@7.6.0": - version "7.6.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-7.6.0.tgz#e400d782280b6f724c8a1204269d984c79202282" - integrity sha512-x54gaSsRRI+Nwz59TXpCsr6harB98qjXYzsRxGqvA5Ue3kQH+FxS7FYU81g/omn22ML2pZJkisy6Q+ElK8pBCA== +"@typescript-eslint/utils@7.7.0": + version "7.7.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-7.7.0.tgz#3d2b6606a60ac34f3c625facfb3b3ab7e126f58d" + integrity sha512-LKGAXMPQs8U/zMRFXDZOzmMKgFv3COlxUQ+2NMPhbqgVm6R1w+nU1i4836Pmxu9jZAuIeyySNrN/6Rc657ggig== dependencies: "@eslint-community/eslint-utils" "^4.4.0" "@types/json-schema" "^7.0.15" "@types/semver" "^7.5.8" - "@typescript-eslint/scope-manager" "7.6.0" - "@typescript-eslint/types" "7.6.0" - "@typescript-eslint/typescript-estree" "7.6.0" + "@typescript-eslint/scope-manager" "7.7.0" + "@typescript-eslint/types" "7.7.0" + "@typescript-eslint/typescript-estree" "7.7.0" semver "^7.6.0" -"@typescript-eslint/visitor-keys@7.6.0": - version "7.6.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-7.6.0.tgz#d1ce13145844379021e1f9bd102c1d78946f4e76" - integrity sha512-4eLB7t+LlNUmXzfOu1VAIAdkjbu5xNSerURS9X/S5TUKWFRpXRQZbmtPqgKmYx8bj3J0irtQXSiWAOY82v+cgw== +"@typescript-eslint/visitor-keys@7.7.0": + version "7.7.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-7.7.0.tgz#950148cf1ac11562a2d903fdf7acf76714a2dc9e" + integrity sha512-h0WHOj8MhdhY8YWkzIF30R379y0NqyOHExI9N9KCzvmu05EgG4FumeYa3ccfKUSphyWkWQE1ybVrgz/Pbam6YA== dependencies: - "@typescript-eslint/types" "7.6.0" + "@typescript-eslint/types" "7.7.0" eslint-visitor-keys "^3.4.3" -"@vue/compiler-core@3.4.21": - version "3.4.21" - resolved "https://registry.yarnpkg.com/@vue/compiler-core/-/compiler-core-3.4.21.tgz#868b7085378fc24e58c9aed14c8d62110a62be1a" - integrity sha512-MjXawxZf2SbZszLPYxaFCjxfibYrzr3eYbKxwpLR9EQN+oaziSu3qKVbwBERj1IFIB8OLUewxB5m/BFzi613og== +"@typescript/vfs@^1.4.0": + version "1.5.0" + resolved "https://registry.yarnpkg.com/@typescript/vfs/-/vfs-1.5.0.tgz#ed942922724f9ace8c07c80b006c47e5e3833218" + integrity sha512-AJS307bPgbsZZ9ggCT3wwpg3VbTKMFNHfaY/uF0ahSkYYrPF2dSSKDNIDIQAHm9qJqbLvCsSJH7yN4Vs/CsMMg== + dependencies: + debug "^4.1.1" + +"@vue/compiler-core@3.4.23": + version "3.4.23" + resolved "https://registry.yarnpkg.com/@vue/compiler-core/-/compiler-core-3.4.23.tgz#a08f5998e391ad75e602a66dd7255af9054df2f3" + integrity sha512-HAFmuVEwNqNdmk+w4VCQ2pkLk1Vw4XYiiyxEp3z/xvl14aLTUBw2OfVH3vBcx+FtGsynQLkkhK410Nah1N2yyQ== dependencies: - "@babel/parser" "^7.23.9" - "@vue/shared" "3.4.21" + "@babel/parser" "^7.24.1" + "@vue/shared" "3.4.23" entities "^4.5.0" estree-walker "^2.0.2" - source-map-js "^1.0.2" + source-map-js "^1.2.0" -"@vue/compiler-dom@3.4.21": - version "3.4.21" - resolved "https://registry.yarnpkg.com/@vue/compiler-dom/-/compiler-dom-3.4.21.tgz#0077c355e2008207283a5a87d510330d22546803" - integrity sha512-IZC6FKowtT1sl0CR5DpXSiEB5ayw75oT2bma1BEhV7RRR1+cfwLrxc2Z8Zq/RGFzJ8w5r9QtCOvTjQgdn0IKmA== +"@vue/compiler-dom@3.4.23": + version "3.4.23" + resolved "https://registry.yarnpkg.com/@vue/compiler-dom/-/compiler-dom-3.4.23.tgz#6fa622d1e5c8508551564c5dc5948e9cddf60867" + integrity sha512-t0b9WSTnCRrzsBGrDd1LNR5HGzYTr7LX3z6nNBG+KGvZLqrT0mY6NsMzOqlVMBKKXKVuusbbB5aOOFgTY+senw== dependencies: - "@vue/compiler-core" "3.4.21" - "@vue/shared" "3.4.21" + "@vue/compiler-core" "3.4.23" + "@vue/shared" "3.4.23" "@vue/compiler-sfc@^3.3.4": - version "3.4.21" - resolved "https://registry.yarnpkg.com/@vue/compiler-sfc/-/compiler-sfc-3.4.21.tgz#4af920dc31ab99e1ff5d152b5fe0ad12181145b2" - integrity sha512-me7epoTxYlY+2CUM7hy9PCDdpMPfIwrOvAXud2Upk10g4YLv9UBW7kL798TvMeDhPthkZ0CONNrK2GoeI1ODiQ== - dependencies: - "@babel/parser" "^7.23.9" - "@vue/compiler-core" "3.4.21" - "@vue/compiler-dom" "3.4.21" - "@vue/compiler-ssr" "3.4.21" - "@vue/shared" "3.4.21" + version "3.4.23" + resolved "https://registry.yarnpkg.com/@vue/compiler-sfc/-/compiler-sfc-3.4.23.tgz#7041517b9bbd1b304f0db33bfa424e9a899fda8d" + integrity sha512-fSDTKTfzaRX1kNAUiaj8JB4AokikzStWgHooMhaxyjZerw624L+IAP/fvI4ZwMpwIh8f08PVzEnu4rg8/Npssw== + dependencies: + "@babel/parser" "^7.24.1" + "@vue/compiler-core" "3.4.23" + "@vue/compiler-dom" "3.4.23" + "@vue/compiler-ssr" "3.4.23" + "@vue/shared" "3.4.23" estree-walker "^2.0.2" - magic-string "^0.30.7" - postcss "^8.4.35" - source-map-js "^1.0.2" + magic-string "^0.30.8" + postcss "^8.4.38" + source-map-js "^1.2.0" -"@vue/compiler-ssr@3.4.21": - version "3.4.21" - resolved "https://registry.yarnpkg.com/@vue/compiler-ssr/-/compiler-ssr-3.4.21.tgz#b84ae64fb9c265df21fc67f7624587673d324fef" - integrity sha512-M5+9nI2lPpAsgXOGQobnIueVqc9sisBFexh5yMIMRAPYLa7+5wEJs8iqOZc1WAa9WQbx9GR2twgznU8LTIiZ4Q== +"@vue/compiler-ssr@3.4.23": + version "3.4.23" + resolved "https://registry.yarnpkg.com/@vue/compiler-ssr/-/compiler-ssr-3.4.23.tgz#1ae4afe962a9e156b1a79eff909c37cd423dd4c2" + integrity sha512-hb6Uj2cYs+tfqz71Wj6h3E5t6OKvb4MVcM2Nl5i/z1nv1gjEhw+zYaNOV+Xwn+SSN/VZM0DgANw5TuJfxfezPg== dependencies: - "@vue/compiler-dom" "3.4.21" - "@vue/shared" "3.4.21" + "@vue/compiler-dom" "3.4.23" + "@vue/shared" "3.4.23" -"@vue/shared@3.4.21": - version "3.4.21" - resolved "https://registry.yarnpkg.com/@vue/shared/-/shared-3.4.21.tgz#de526a9059d0a599f0b429af7037cd0c3ed7d5a1" - integrity sha512-PuJe7vDIi6VYSinuEbUIQgMIRZGgM8e4R+G+/dQTk0X1NEdvgvvgv7m+rfmDH1gZzyA1OjjoWskvHlfRNfQf3g== - -"@yarnpkg/lockfile@^1.1.0": - version "1.1.0" - resolved "https://registry.yarnpkg.com/@yarnpkg/lockfile/-/lockfile-1.1.0.tgz#e77a97fbd345b76d83245edcd17d393b1b41fb31" - integrity sha512-GpSwvyXOcOOlV70vbnzjj4fW5xW/FdUF6nQEt1ENy7m4ZCczi1+/buVUPAqmGfqznsORNFzUMjctTIp8a9tuCQ== +"@vue/shared@3.4.23": + version "3.4.23" + resolved "https://registry.yarnpkg.com/@vue/shared/-/shared-3.4.23.tgz#e536a6dfd2f5f950d08c2e8ebcfe7e5329a851a1" + integrity sha512-wBQ0gvf+SMwsCQOyusNw/GoXPV47WGd1xB5A1Pgzy0sQ3Bi5r5xm3n+92y3gCnB3MWqnRDdvfkRGxhKtbBRNgg== acorn-jsx@^5.3.2: version "5.3.2" @@ -657,11 +624,6 @@ arrify@^2.0.1: resolved "https://registry.yarnpkg.com/arrify/-/arrify-2.0.1.tgz#c9655e9331e0abcd588d2a7cad7e9956f66701fa" integrity sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug== -at-least-node@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/at-least-node/-/at-least-node-1.0.0.tgz#602cd4b46e844ad4effc92a8011a3c46e0238dc2" - integrity sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg== - balanced-match@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" @@ -709,17 +671,6 @@ bufferutil@^4.0.7: dependencies: node-gyp-build "^4.3.0" -call-bind@^1.0.5: - version "1.0.7" - resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.7.tgz#06016599c40c56498c18769d2730be242b6fa3b9" - integrity sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w== - dependencies: - es-define-property "^1.0.0" - es-errors "^1.3.0" - function-bind "^1.1.2" - get-intrinsic "^1.2.4" - set-function-length "^1.2.1" - callsite@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/callsite/-/callsite-1.0.0.tgz#280398e5d664bd74038b6f0905153e6e8af1bc20" @@ -735,11 +686,6 @@ camelcase@^6.3.0: resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a" integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== -case-anything@^2.1.13: - version "2.1.13" - resolved "https://registry.yarnpkg.com/case-anything/-/case-anything-2.1.13.tgz#0cdc16278cb29a7fcdeb072400da3f342ba329e9" - integrity sha512-zlOQ80VrQ2Ue+ymH5OuM/DlDq64mEm+B9UTdHULv5osUMD6HalNTblf2b1u/m6QecjsnOkBpqVZ+XPwIVsy7Ng== - chalk@^2.4.2: version "2.4.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" @@ -749,7 +695,7 @@ chalk@^2.4.2: escape-string-regexp "^1.0.5" supports-color "^5.3.0" -chalk@^4.0.0, chalk@^4.1.2: +chalk@^4.0.0: version "4.1.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== @@ -757,11 +703,6 @@ chalk@^4.0.0, chalk@^4.1.2: ansi-styles "^4.1.0" supports-color "^7.1.0" -ci-info@^3.7.0: - version "3.9.0" - resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-3.9.0.tgz#4279a62028a7b1f262f3473fc9605f5e218c59b4" - integrity sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ== - cliui@^7.0.2: version "7.0.4" resolved "https://registry.yarnpkg.com/cliui/-/cliui-7.0.4.tgz#a0265ee655476fc807aea9df3df8df7783808b4f" @@ -811,7 +752,7 @@ cosmiconfig@^7.1.0: path-type "^4.0.0" yaml "^1.10.0" -cross-spawn@^7.0.2, cross-spawn@^7.0.3: +cross-spawn@^7.0.2: version "7.0.3" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== @@ -820,7 +761,7 @@ cross-spawn@^7.0.2, cross-spawn@^7.0.3: shebang-command "^2.0.0" which "^2.0.1" -debug@^4.3.1, debug@^4.3.2, debug@^4.3.4: +debug@^4.1.1, debug@^4.3.1, debug@^4.3.2, debug@^4.3.4: version "4.3.4" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== @@ -832,15 +773,6 @@ deep-is@^0.1.3: resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.4.tgz#a6f2dce612fadd2ef1f519b73551f17e85199831" integrity sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ== -define-data-property@^1.1.4: - version "1.1.4" - resolved "https://registry.yarnpkg.com/define-data-property/-/define-data-property-1.1.4.tgz#894dc141bb7d3060ae4366f6a0107e68fbe48c5e" - integrity sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A== - dependencies: - es-define-property "^1.0.0" - es-errors "^1.3.0" - gopd "^1.0.1" - delay@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/delay/-/delay-6.0.0.tgz#43749aefdf6cabd9e17b0d00bd3904525137e607" @@ -885,11 +817,6 @@ detect-file@^1.0.0: resolved "https://registry.yarnpkg.com/detect-file/-/detect-file-1.0.0.tgz#f0d66d03672a825cb1b73bdb3fe62310c8e552b7" integrity sha512-DtCOLG98P007x7wiiOmfI0fi3eIKyWiLTGJ2MDnVi/E04lWGbf+JzrRHMm0rgIIZJGtHpKpbVgLWHrv8xXpc3Q== -detect-libc@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-1.0.3.tgz#fa137c4bd698edf55cd5cd02ac559f91a4c4ba9b" - integrity sha512-pGjwhsmsp4kL2RTz08wcOlGN83otlqHeD/Z5T8GXZB+/YcpQ/dgo+lbU8ZsGxV0HIvqqxo9l7mqYwyYMD9bKDg== - dir-glob@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-3.0.1.tgz#56dbf73d992a4a93ba1584f4534063fd2e41717f" @@ -904,13 +831,6 @@ dns-packet@^5.6.1: dependencies: "@leichtgewicht/ip-codec" "^2.0.1" -dprint-node@^1.0.8: - version "1.0.8" - resolved "https://registry.yarnpkg.com/dprint-node/-/dprint-node-1.0.8.tgz#a02470722d8208a7d7eb3704328afda1d6758625" - integrity sha512-iVKnUtYfGrYcW1ZAlfR/F59cUVL8QIhWoBJoSjkkdua/dkWIgjZfiLMeTjiB06X0ZLkQ0M2C1VbUj/CxkIf1zg== - dependencies: - detect-libc "^1.0.3" - emoji-regex@^8.0.0: version "8.0.0" resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" @@ -928,18 +848,6 @@ error-ex@^1.3.1: dependencies: is-arrayish "^0.2.1" -es-define-property@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/es-define-property/-/es-define-property-1.0.0.tgz#c7faefbdff8b2696cf5f46921edfb77cc4ba3845" - integrity sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ== - dependencies: - get-intrinsic "^1.2.4" - -es-errors@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/es-errors/-/es-errors-1.3.0.tgz#05f75a25dab98e4fb1dcd5e1472c0546d5057c8f" - integrity sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw== - escalade@^3.1.1: version "3.1.2" resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.2.tgz#54076e9ab29ea5bf3d8f1ed62acffbb88272df27" @@ -995,17 +903,18 @@ eslint-visitor-keys@^4.0.0: resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-4.0.0.tgz#e3adc021aa038a2a8e0b2f8b0ce8f66b9483b1fb" integrity sha512-OtIRv/2GyiF6o/d8K7MYKKbXrOUBIK6SfkIRM4Z0dY3w+LiQ0vy3F57m0Z71bjbyeiWFiHJ8brqnmE6H6/jEuw== -eslint@^9.0.0: - version "9.0.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-9.0.0.tgz#6270548758e390343f78c8afd030566d86927d40" - integrity sha512-IMryZ5SudxzQvuod6rUdIUz29qFItWx281VhtFVc2Psy/ZhlCeD/5DT6lBIJ4H3G+iamGJoTln1v+QSuPw0p7Q== +eslint@^9.1.0: + version "9.1.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-9.1.0.tgz#262625f6b0921f7550f128a0098d05ecaad989c6" + integrity sha512-1TCBecGFQtItia2o39P7Z4BK1X7ByNPxAiWJvwiyTGcOwYnTiiASgMpNA6a+beu8cFPhEDWvPf6mIlYUJv6sgA== dependencies: "@eslint-community/eslint-utils" "^4.2.0" "@eslint-community/regexpp" "^4.6.1" "@eslint/eslintrc" "^3.0.2" - "@eslint/js" "9.0.0" - "@humanwhocodes/config-array" "^0.12.3" + "@eslint/js" "9.1.1" + "@humanwhocodes/config-array" "^0.13.0" "@humanwhocodes/module-importer" "^1.0.1" + "@humanwhocodes/retry" "^0.2.3" "@nodelib/fs.walk" "^1.2.8" ajv "^6.12.4" chalk "^4.0.0" @@ -1021,7 +930,6 @@ eslint@^9.0.0: file-entry-cache "^8.0.0" find-up "^5.0.0" glob-parent "^6.0.2" - graphemer "^1.4.0" ignore "^5.2.0" imurmurhash "^0.1.4" is-glob "^4.0.0" @@ -1150,13 +1058,6 @@ find-up@^5.0.0: locate-path "^6.0.0" path-exists "^4.0.0" -find-yarn-workspace-root@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/find-yarn-workspace-root/-/find-yarn-workspace-root-2.0.0.tgz#f47fb8d239c900eb78179aa81b66673eac88f7bd" - integrity sha512-1IMnbjt4KzsQfnhnzNd8wUEgXZ44IzZaZmnLYx7D5FZlaHt2gW20Cri8Q+E/t5tIj4+epTBub+2Zxu/vNILzqQ== - dependencies: - micromatch "^4.0.2" - findup-sync@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/findup-sync/-/findup-sync-5.0.0.tgz#54380ad965a7edca00cc8f63113559aadc541bd2" @@ -1180,21 +1081,6 @@ flatted@^3.2.9: resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.3.1.tgz#21db470729a6734d4997002f439cb308987f567a" integrity sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw== -fs-extra@^9.0.0: - version "9.1.0" - resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.1.0.tgz#5954460c764a8da2094ba3554bf839e6b9a7c86d" - integrity sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ== - dependencies: - at-least-node "^1.0.0" - graceful-fs "^4.2.0" - jsonfile "^6.0.1" - universalify "^2.0.0" - -fs.realpath@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" - integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw== - function-bind@^1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.2.tgz#2c02d864d97f3ea6c8830c464cbd11ab6eab7a1c" @@ -1205,17 +1091,6 @@ get-caller-file@^2.0.5: resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== -get-intrinsic@^1.1.3, get-intrinsic@^1.2.4: - version "1.2.4" - resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.2.4.tgz#e385f5a4b5227d449c3eabbad05494ef0abbeadd" - integrity sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ== - dependencies: - es-errors "^1.3.0" - function-bind "^1.1.2" - has-proto "^1.0.1" - has-symbols "^1.0.3" - hasown "^2.0.0" - get-iterator@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/get-iterator/-/get-iterator-2.0.1.tgz#a904829f61bace789e0d64bd1a504c511a015c3f" @@ -1235,18 +1110,6 @@ glob-parent@^6.0.2: dependencies: is-glob "^4.0.3" -glob@^7.1.3: - version "7.2.3" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b" - integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q== - dependencies: - fs.realpath "^1.0.0" - inflight "^1.0.4" - inherits "2" - minimatch "^3.1.1" - once "^1.3.0" - path-is-absolute "^1.0.0" - global-modules@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/global-modules/-/global-modules-1.0.0.tgz#6d770f0eb523ac78164d72b5e71a8877265cc3ea" @@ -1289,18 +1152,6 @@ globby@^11.1.0: merge2 "^1.4.1" slash "^3.0.0" -gopd@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.0.1.tgz#29ff76de69dac7489b7c0918a5788e56477c332c" - integrity sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA== - dependencies: - get-intrinsic "^1.1.3" - -graceful-fs@^4.1.11, graceful-fs@^4.1.6, graceful-fs@^4.2.0: - version "4.2.11" - resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" - integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== - graphemer@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/graphemer/-/graphemer-1.4.0.tgz#fb2f1d55e0e3a1849aeffc90c4fa0dd53a0e66c6" @@ -1316,23 +1167,6 @@ has-flag@^4.0.0: resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== -has-property-descriptors@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz#963ed7d071dc7bf5f084c5bfbe0d1b6222586854" - integrity sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg== - dependencies: - es-define-property "^1.0.0" - -has-proto@^1.0.1: - version "1.0.3" - resolved "https://registry.yarnpkg.com/has-proto/-/has-proto-1.0.3.tgz#b31ddfe9b0e6e9914536a6ab286426d0214f77fd" - integrity sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q== - -has-symbols@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.3.tgz#bb7b2c4349251dce87b125f7bdf874aa7c8b39f8" - integrity sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A== - hashlru@^2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/hashlru/-/hashlru-2.3.0.tgz#5dc15928b3f6961a2056416bb3a4910216fdfb51" @@ -1375,19 +1209,6 @@ imurmurhash@^0.1.4: resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" integrity sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA== -inflight@^1.0.4: - version "1.0.6" - resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" - integrity sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA== - dependencies: - once "^1.3.0" - wrappy "1" - -inherits@2: - version "2.0.4" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" - integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== - ini@^1.3.4: version "1.3.8" resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.8.tgz#a29da425b48806f34767a4efce397269af28432c" @@ -1418,11 +1239,6 @@ is-core-module@^2.12.0, is-core-module@^2.13.0: dependencies: hasown "^2.0.0" -is-docker@^2.0.0: - version "2.2.1" - resolved "https://registry.yarnpkg.com/is-docker/-/is-docker-2.2.1.tgz#33eeabe23cfe86f14bde4408a02c0cfb853acdaa" - integrity sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ== - is-extglob@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" @@ -1455,28 +1271,11 @@ is-path-inside@^3.0.3: resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-3.0.3.tgz#d231362e53a07ff2b0e0ea7fed049161ffd16283" integrity sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ== -is-promise@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-4.0.0.tgz#42ff9f84206c1991d26debf520dd5c01042dd2f3" - integrity sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ== - is-windows@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d" integrity sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA== -is-wsl@^2.1.1: - version "2.2.0" - resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-2.2.0.tgz#74a4c76e77ca9fd3f932f290c17ea326cd157271" - integrity sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww== - dependencies: - is-docker "^2.0.0" - -isarray@^2.0.5: - version "2.0.5" - resolved "https://registry.yarnpkg.com/isarray/-/isarray-2.0.5.tgz#8af1e4c1221244cc62459faf38940d4e644a5723" - integrity sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw== - isexe@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" @@ -1577,35 +1376,11 @@ json-stable-stringify-without-jsonify@^1.0.1: resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" integrity sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw== -json-stable-stringify@^1.0.2: - version "1.1.1" - resolved "https://registry.yarnpkg.com/json-stable-stringify/-/json-stable-stringify-1.1.1.tgz#52d4361b47d49168bcc4e564189a42e5a7439454" - integrity sha512-SU/971Kt5qVQfJpyDveVhQ/vya+5hvrjClFOcr8c0Fq5aODJjMwutrOfCU+eCnVD5gpx1Q3fEqkyom77zH1iIg== - dependencies: - call-bind "^1.0.5" - isarray "^2.0.5" - jsonify "^0.0.1" - object-keys "^1.1.1" - json5@^2.2.3: version "2.2.3" resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283" integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg== -jsonfile@^6.0.1: - version "6.1.0" - resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.1.0.tgz#bc55b2634793c679ec6403094eb13698a6ec0aae" - integrity sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ== - dependencies: - universalify "^2.0.0" - optionalDependencies: - graceful-fs "^4.1.6" - -jsonify@^0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/jsonify/-/jsonify-0.0.1.tgz#2aa3111dae3d34a0f151c63f3a45d995d9420978" - integrity sha512-2/Ki0GcmuqSrgFyelQq9M05y7PS0mEwuIzrf3f1fPqkVDVRvZrPZtVSMHxdgo8Aq0sxAOb/cr2aqqA3LeWHVPg== - keyv@^4.5.4: version "4.5.4" resolved "https://registry.yarnpkg.com/keyv/-/keyv-4.5.4.tgz#a879a99e29452f942439f2a405e3af8b31d4de93" @@ -1613,13 +1388,6 @@ keyv@^4.5.4: dependencies: json-buffer "3.0.1" -klaw-sync@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/klaw-sync/-/klaw-sync-6.0.0.tgz#1fd2cfd56ebb6250181114f0a581167099c2b28c" - integrity sha512-nIeuVSzdCCs6TDPTqI8w1Yre34sSq7AkZ4B3sfOBbI2CgVSB4Du4aLQijFU2+lhAFCwt9+42Hel6lQNIv6AntQ== - dependencies: - graceful-fs "^4.1.11" - levn@^0.4.1: version "0.4.1" resolved "https://registry.yarnpkg.com/levn/-/levn-0.4.1.tgz#ae4562c007473b932a6200d403268dd2fffc6ade" @@ -1650,11 +1418,6 @@ lodash@^4.17.21: resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== -long@^5.0.0, long@^5.2.0, long@^5.2.3: - version "5.2.3" - resolved "https://registry.yarnpkg.com/long/-/long-5.2.3.tgz#a3ba97f3877cf1d778eccbcb048525ebb77499e1" - integrity sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q== - lru-cache@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94" @@ -1662,10 +1425,10 @@ lru-cache@^6.0.0: dependencies: yallist "^4.0.0" -magic-string@^0.30.7: - version "0.30.9" - resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.30.9.tgz#8927ae21bfdd856310e07a1bc8dd5e73cb6c251d" - integrity sha512-S1+hd+dIrC8EZqKyT9DstTH/0Z+f76kmmvZnkfQVmOpDEF9iVgdYif3Q/pIWHmCoo59bQVGW0kVL3e2nl+9+Sw== +magic-string@^0.30.8: + version "0.30.10" + resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.30.10.tgz#123d9c41a0cb5640c892b041d4cfb3bd0aa4b39e" + integrity sha512-iIRwTIf0QKV3UAnYK4PU8uiEc4SRh5jX0mwpIwETPpHdhVM4f53RSwS/vXvN1JhGX+Cs7B8qIq3d6AH49O5fAQ== dependencies: "@jridgewell/sourcemap-codec" "^1.4.15" @@ -1679,7 +1442,7 @@ merge2@^1.3.0, merge2@^1.4.1: resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== -micromatch@^4.0.2, micromatch@^4.0.4: +micromatch@^4.0.4: version "4.0.5" resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.5.tgz#bc8999a7cbbf77cdc89f132f6e467051b49090c6" integrity sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA== @@ -1687,7 +1450,7 @@ micromatch@^4.0.2, micromatch@^4.0.4: braces "^3.0.2" picomatch "^2.3.1" -minimatch@^3.0.4, minimatch@^3.0.5, minimatch@^3.1.1, minimatch@^3.1.2: +minimatch@^3.0.4, minimatch@^3.0.5, minimatch@^3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== @@ -1708,11 +1471,6 @@ minimatch@^9.0.4: dependencies: brace-expansion "^2.0.1" -minimist@^1.2.6: - version "1.2.8" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c" - integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA== - ms@2.1.2: version "2.1.2" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" @@ -1754,26 +1512,6 @@ node-gyp-build@^4.3.0: resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.8.0.tgz#3fee9c1731df4581a3f9ead74664369ff00d26dd" integrity sha512-u6fs2AEUljNho3EYTJNBfImO5QTo/J/1Etd+NVdCj7qWKUSN/bSLkZwhDv7I+w/MSC6qJ4cknepkAYykDdK8og== -object-keys@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e" - integrity sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA== - -once@^1.3.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" - integrity sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w== - dependencies: - wrappy "1" - -open@^7.4.2: - version "7.4.2" - resolved "https://registry.yarnpkg.com/open/-/open-7.4.2.tgz#b8147e26dcf3e426316c730089fd71edd29c2321" - integrity sha512-MVHddDVweXZF3awtlAS+6pgKLlm/JgxZ90+/NBurBoQctVOOB/zDdVjcyPzQ+0laDGbsWgrRkflI65sQeOgT9Q== - dependencies: - is-docker "^2.0.0" - is-wsl "^2.1.1" - optionator@^0.9.3: version "0.9.3" resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.9.3.tgz#007397d44ed1872fdc6ed31360190f81814e2c64" @@ -1786,11 +1524,6 @@ optionator@^0.9.3: prelude-ls "^1.2.1" type-check "^0.4.0" -os-tmpdir@~1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" - integrity sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g== - p-defer@^4.0.0, p-defer@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/p-defer/-/p-defer-4.0.1.tgz#d12c6d41420785ed0d162dbd86b71ba490f7f99e" @@ -1845,37 +1578,11 @@ parse-passwd@^1.0.0: resolved "https://registry.yarnpkg.com/parse-passwd/-/parse-passwd-1.0.0.tgz#6d5b934a456993b23d37f40a382d6f1666a8e5c6" integrity sha512-1Y1A//QUXEZK7YKz+rD9WydcE1+EuPr6ZBgKecAB8tmoW6UFv0NREVJe1p+jRxtThkcbbKkfwIbWJe/IeE6m2Q== -patch-package@^8.0.0: - version "8.0.0" - resolved "https://registry.yarnpkg.com/patch-package/-/patch-package-8.0.0.tgz#d191e2f1b6e06a4624a0116bcb88edd6714ede61" - integrity sha512-da8BVIhzjtgScwDJ2TtKsfT5JFWz1hYoBl9rUQ1f38MC2HwnEIkK8VN3dKMKcP7P7bvvgzNDbfNHtx3MsQb5vA== - dependencies: - "@yarnpkg/lockfile" "^1.1.0" - chalk "^4.1.2" - ci-info "^3.7.0" - cross-spawn "^7.0.3" - find-yarn-workspace-root "^2.0.0" - fs-extra "^9.0.0" - json-stable-stringify "^1.0.2" - klaw-sync "^6.0.0" - minimist "^1.2.6" - open "^7.4.2" - rimraf "^2.6.3" - semver "^7.5.3" - slash "^2.0.0" - tmp "^0.0.33" - yaml "^2.2.2" - path-exists@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3" integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w== -path-is-absolute@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" - integrity sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg== - path-key@^3.1.0: version "3.1.1" resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" @@ -1908,7 +1615,7 @@ please-upgrade-node@^3.2.0: dependencies: semver-compare "^1.0.0" -postcss@^8.4.35: +postcss@^8.4.38: version "8.4.38" resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.38.tgz#b387d533baf2054288e337066d81c6bee9db9e0e" integrity sha512-Wglpdk03BSfXkHoQa3b/oulrotAkwrlLDRSOb9D0bN86FdRyE9lppSp33aHNPgBa0JKCoB+drFLZkQoRRYae5A== @@ -1932,24 +1639,6 @@ progress-events@^1.0.0: resolved "https://registry.yarnpkg.com/progress-events/-/progress-events-1.0.0.tgz#34f5e8fdb5dae3561837b22672d1e02277bb2109" integrity sha512-zIB6QDrSbPfRg+33FZalluFIowkbV5Xh1xSuetjG+rlC5he6u2dc6VQJ0TbMdlN3R1RHdpOqxEFMKTnQ+itUwA== -protobufjs@^7.0.0, protobufjs@^7.2.4, protobufjs@^7.2.6: - version "7.2.6" - resolved "https://registry.yarnpkg.com/protobufjs/-/protobufjs-7.2.6.tgz#4a0ccd79eb292717aacf07530a07e0ed20278215" - integrity sha512-dgJaEDDL6x8ASUZ1YqWciTRrdOuYNzoOf27oHNfdyvKqHr5i0FV7FSLU+aIeFjyFgVxrpTOtQUi0BLLBymZaBw== - dependencies: - "@protobufjs/aspromise" "^1.1.2" - "@protobufjs/base64" "^1.1.2" - "@protobufjs/codegen" "^2.0.4" - "@protobufjs/eventemitter" "^1.1.0" - "@protobufjs/fetch" "^1.1.0" - "@protobufjs/float" "^1.0.2" - "@protobufjs/inquire" "^1.1.0" - "@protobufjs/path" "^1.1.2" - "@protobufjs/pool" "^1.1.0" - "@protobufjs/utf8" "^1.1.0" - "@types/node" ">=13.7.0" - long "^5.0.0" - punycode@^2.1.0: version "2.3.1" resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.1.tgz#027422e2faec0b25e1549c3e1bd8309b9133b6e5" @@ -2019,13 +1708,6 @@ reusify@^1.0.4: resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76" integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw== -rimraf@^2.6.3: - version "2.7.1" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.7.1.tgz#35797f13a7fdadc566142c29d4f07ccad483e3ec" - integrity sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w== - dependencies: - glob "^7.1.3" - run-parallel@^1.1.9: version "1.2.0" resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.2.0.tgz#66d1368da7bdf921eb9d95bd1a9229e7f21a43ee" @@ -2038,25 +1720,13 @@ semver-compare@^1.0.0: resolved "https://registry.yarnpkg.com/semver-compare/-/semver-compare-1.0.0.tgz#0dee216a1c941ab37e9efb1788f6afc5ff5537fc" integrity sha512-YM3/ITh2MJ5MtzaM429anh+x2jiLVjqILF4m4oyQB18W7Ggea7BfqdH/wGMK7dDiMghv/6WG7znWMwUDzJiXow== -semver@^7.5.3, semver@^7.5.4, semver@^7.6.0: +semver@^7.5.4, semver@^7.6.0: version "7.6.0" resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.0.tgz#1a46a4db4bffcccd97b743b5005c8325f23d4e2d" integrity sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg== dependencies: lru-cache "^6.0.0" -set-function-length@^1.2.1: - version "1.2.2" - resolved "https://registry.yarnpkg.com/set-function-length/-/set-function-length-1.2.2.tgz#aac72314198eaed975cf77b2c3b6b880695e5449" - integrity sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg== - dependencies: - define-data-property "^1.1.4" - es-errors "^1.3.0" - function-bind "^1.1.2" - get-intrinsic "^1.2.4" - gopd "^1.0.1" - has-property-descriptors "^1.0.2" - shebang-command@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" @@ -2069,17 +1739,12 @@ shebang-regex@^3.0.0: resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== -slash@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/slash/-/slash-2.0.0.tgz#de552851a1759df3a8f206535442f5ec4ddeab44" - integrity sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A== - slash@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== -source-map-js@^1.0.2, source-map-js@^1.2.0: +source-map-js@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.2.0.tgz#16b809c162517b5b8c3e7dcd315a2a5c2612b2af" integrity sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg== @@ -2089,26 +1754,24 @@ sprintf-js@~1.0.2: resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" integrity sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g== -starpc@^0.28.0: - version "0.28.1" - resolved "https://registry.yarnpkg.com/starpc/-/starpc-0.28.1.tgz#60a4a58b18ecbbd42b483468df4aa2f9871e39d7" - integrity sha512-hBpMRK7XDhawrjruXOtZ+ch75fo4jV+fUcvcZngBb4j69zbUIHVLPWJQyVBaqlQOx/PJuUXT4q1Hykr28Pu2pQ== +starpc@^0.31.1, starpc@^0.31.2: + version "0.31.2" + resolved "https://registry.yarnpkg.com/starpc/-/starpc-0.31.2.tgz#47c57082dd3d9f815160658d39e98d2146f59de7" + integrity sha512-gX/XADJba90NYCj6WkU+uxdf2TFPI2TcHXdVrKeRHKxgg/UGs7aLP7e/fIvSnpKI+RenmpLU0SXgIpGQYkdZkA== dependencies: "@aptre/it-ws" "^1.0.0" + "@bufbuild/protobuf" "^1.8.0" + "@bufbuild/protoplugin" "^1.8.0" "@chainsafe/libp2p-yamux" "^6.0.2" "@libp2p/interface" "^1.1.3" "@libp2p/logger" "^4.0.6" event-iterator "^2.0.0" - is-promise "^4.0.0" isomorphic-ws "^5.0.0" it-first "^3.0.3" it-pipe "^3.0.1" it-pushable "^3.2.3" it-stream-types "^2.0.1" - long "^5.2.3" memoize-one "^6.0.0" - patch-package "^8.0.0" - protobufjs "^7.2.6" uint8arraylist "^2.4.7" ws "^8.15.1" @@ -2157,13 +1820,6 @@ text-table@^0.2.0: resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" integrity sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw== -tmp@^0.0.33: - version "0.0.33" - resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9" - integrity sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw== - dependencies: - os-tmpdir "~1.0.2" - to-fast-properties@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e" @@ -2181,31 +1837,6 @@ ts-api-utils@^1.3.0: resolved "https://registry.yarnpkg.com/ts-api-utils/-/ts-api-utils-1.3.0.tgz#4b490e27129f1e8e686b45cc4ab63714dc60eea1" integrity sha512-UQMIo7pb8WRomKR1/+MFVLTroIvDVtMX3K6OUir8ynLyzB8Jeriont2bTAtmNPa1ekAgN7YPDyf6V+ygrdU+eQ== -ts-poet@6.8.0, ts-poet@^6.7.0: - version "6.8.0" - resolved "https://registry.yarnpkg.com/ts-poet/-/ts-poet-6.8.0.tgz#fb7304165bf84c764b71d471e7ac9c152d4ca586" - integrity sha512-mjmr0JCUK1l3wyQyJFz6a2KF0iw8Mf5ADOIDEQTWWCsqpGEbJds/fOMA4BHlySc4RlQpGNFABo9JS5TNE9DD3w== - dependencies: - dprint-node "^1.0.8" - -ts-proto-descriptors@1.15.0: - version "1.15.0" - resolved "https://registry.yarnpkg.com/ts-proto-descriptors/-/ts-proto-descriptors-1.15.0.tgz#e859e3a2887da2d954c552524719b80bdb6ee355" - integrity sha512-TYyJ7+H+7Jsqawdv+mfsEpZPTIj9siDHS6EMCzG/z3b/PZiphsX+mWtqFfFVe5/N0Th6V3elK9lQqjnrgTOfrg== - dependencies: - long "^5.2.3" - protobufjs "^7.2.4" - -ts-proto@^1.171.0: - version "1.171.0" - resolved "https://registry.yarnpkg.com/ts-proto/-/ts-proto-1.171.0.tgz#679f9da0d3c9462b4814f422ef63e3f986936fd0" - integrity sha512-NMwiqCixlk6MZ3TAIpVQUuWwUktCXhoP+07V7D7Eo2IlEwulZucOGrU82toHhPL/QTd+oMBM2RDeQk9qs8+ZEQ== - dependencies: - case-anything "^2.1.13" - protobufjs "^7.2.4" - ts-poet "^6.7.0" - ts-proto-descriptors "1.15.0" - type-check@^0.4.0, type-check@~0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.4.0.tgz#07b8203bfa7056c0657050e3ccd2c37730bab8f1" @@ -2213,10 +1844,15 @@ type-check@^0.4.0, type-check@~0.4.0: dependencies: prelude-ls "^1.2.1" +typescript@4.5.2: + version "4.5.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.5.2.tgz#8ac1fba9f52256fdb06fb89e4122fa6a346c2998" + integrity sha512-5BlMof9H1yGt0P8/WF+wPNw6GfctgGjXp5hkblpyT+8rkASSmkUKMXrxR0Xg8ThVCi/JnHQiKXeBaEwCeQwMFw== + typescript@^5.4.4: - version "5.4.4" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.4.4.tgz#eb2471e7b0a5f1377523700a21669dce30c2d952" - integrity sha512-dGE2Vv8cpVvw28v8HCPqyb08EzbBURxDpuhJvTrusShUfGnhHBafDsLdS1EhhxyL6BJQE+2cT3dDPAv+MQ6oLw== + version "5.4.5" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.4.5.tgz#42ccef2c571fdbd0f6718b1d1f5e6e5ef006f611" + integrity sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ== uint8-varint@^2.0.1: version "2.0.4" @@ -2245,11 +1881,6 @@ undici-types@~5.26.4: resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617" integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA== -universalify@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/universalify/-/universalify-2.0.1.tgz#168efc2180964e6386d061e094df61afe239b18d" - integrity sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw== - uri-js@^4.2.2: version "4.4.1" resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e" @@ -2257,13 +1888,6 @@ uri-js@^4.2.2: dependencies: punycode "^2.1.0" -utf-8-validate@^6.0.3: - version "6.0.3" - resolved "https://registry.yarnpkg.com/utf-8-validate/-/utf-8-validate-6.0.3.tgz#7d8c936d854e86b24d1d655f138ee27d2636d777" - integrity sha512-uIuGf9TWQ/y+0Lp+KGZCMuJWc3N9BHA+l/UmHd/oUHwJJDeysyTRxNQVkbzsIWfGFbRe3OcgML/i0mvVRPOyDA== - dependencies: - node-gyp-build "^4.3.0" - which@^1.2.14: version "1.3.1" resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" @@ -2287,11 +1911,6 @@ wrap-ansi@^7.0.0: string-width "^4.1.0" strip-ansi "^6.0.0" -wrappy@1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" - integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== - ws@^8.15.1, ws@^8.4.0: version "8.16.0" resolved "https://registry.yarnpkg.com/ws/-/ws-8.16.0.tgz#d1cd774f36fbc07165066a60e40323eab6446fd4" @@ -2312,11 +1931,6 @@ yaml@^1.10.0: resolved "https://registry.yarnpkg.com/yaml/-/yaml-1.10.2.tgz#2301c5ffbf12b467de8da2333a459e29e7920e4b" integrity sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg== -yaml@^2.2.2: - version "2.4.1" - resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.4.1.tgz#2e57e0b5e995292c25c75d2658f0664765210eed" - integrity sha512-pIXzoImaqmfOrL7teGUBt/T7ZDnyeGBWyXQBvOVhLkWLN37GXv8NMLK406UY6dS51JfcQHsmcW5cJ441bHg6Lg== - yargs-parser@^20.2.2: version "20.2.9" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.9.tgz#2eb7dc3b0289718fc295f362753845c41a0c94ee"