starpc 0.41.2 → 0.43.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/echo/echo.pb.h ADDED
@@ -0,0 +1,364 @@
1
+ //go:build deps_only && cgo
2
+
3
+ // Generated by the protocol buffer compiler. DO NOT EDIT!
4
+ // NO CHECKED-IN PROTOBUF GENCODE
5
+ // source: github.com/aperturerobotics/starpc/echo/echo.proto
6
+ // Protobuf C++ Version: 6.33.4
7
+
8
+ #ifndef github_2ecom_2faperturerobotics_2fstarpc_2fecho_2fecho_2eproto_2epb_2eh
9
+ #define github_2ecom_2faperturerobotics_2fstarpc_2fecho_2fecho_2eproto_2epb_2eh
10
+
11
+ #include <limits>
12
+ #include <string>
13
+ #include <type_traits>
14
+ #include <utility>
15
+
16
+ #include "google/protobuf/runtime_version.h"
17
+ #if PROTOBUF_VERSION != 6033004
18
+ #error "Protobuf C++ gencode is built with an incompatible version of"
19
+ #error "Protobuf C++ headers/runtime. See"
20
+ #error "https://protobuf.dev/support/cross-version-runtime-guarantee/#cpp"
21
+ #endif
22
+ #include "google/protobuf/io/coded_stream.h"
23
+ #include "google/protobuf/arena.h"
24
+ #include "google/protobuf/arenastring.h"
25
+ #include "google/protobuf/generated_message_tctable_decl.h"
26
+ #include "google/protobuf/generated_message_util.h"
27
+ #include "google/protobuf/metadata_lite.h"
28
+ #include "google/protobuf/generated_message_reflection.h"
29
+ #include "google/protobuf/message.h"
30
+ #include "google/protobuf/message_lite.h"
31
+ #include "google/protobuf/repeated_field.h" // IWYU pragma: export
32
+ #include "google/protobuf/extension_set.h" // IWYU pragma: export
33
+ #include "google/protobuf/unknown_field_set.h"
34
+ #include "../rpcstream/rpcstream.pb.h"
35
+ #include "google/protobuf/empty.pb.h"
36
+ // @@protoc_insertion_point(includes)
37
+
38
+ // Must be included last.
39
+ #include "google/protobuf/port_def.inc"
40
+
41
+ #define PROTOBUF_INTERNAL_EXPORT_github_2ecom_2faperturerobotics_2fstarpc_2fecho_2fecho_2eproto
42
+
43
+ namespace google {
44
+ namespace protobuf {
45
+ namespace internal {
46
+ template <typename T>
47
+ ::absl::string_view GetAnyMessageName();
48
+ } // namespace internal
49
+ } // namespace protobuf
50
+ } // namespace google
51
+
52
+ // Internal implementation detail -- do not use these members.
53
+ struct TableStruct_github_2ecom_2faperturerobotics_2fstarpc_2fecho_2fecho_2eproto {
54
+ static const ::uint32_t offsets[];
55
+ };
56
+ extern "C" {
57
+ extern const ::google::protobuf::internal::DescriptorTable descriptor_table_github_2ecom_2faperturerobotics_2fstarpc_2fecho_2fecho_2eproto;
58
+ } // extern "C"
59
+ namespace echo {
60
+ class EchoMsg;
61
+ struct EchoMsgDefaultTypeInternal;
62
+ extern EchoMsgDefaultTypeInternal _EchoMsg_default_instance_;
63
+ extern const ::google::protobuf::internal::ClassDataFull EchoMsg_class_data_;
64
+ } // namespace echo
65
+ namespace google {
66
+ namespace protobuf {
67
+ } // namespace protobuf
68
+ } // namespace google
69
+
70
+ namespace echo {
71
+
72
+ // ===================================================================
73
+
74
+
75
+ // -------------------------------------------------------------------
76
+
77
+ class EchoMsg final : public ::google::protobuf::Message
78
+ /* @@protoc_insertion_point(class_definition:echo.EchoMsg) */ {
79
+ public:
80
+ inline EchoMsg() : EchoMsg(nullptr) {}
81
+ ~EchoMsg() PROTOBUF_FINAL;
82
+
83
+ #if defined(PROTOBUF_CUSTOM_VTABLE)
84
+ void operator delete(EchoMsg* PROTOBUF_NONNULL msg, ::std::destroying_delete_t) {
85
+ SharedDtor(*msg);
86
+ ::google::protobuf::internal::SizedDelete(msg, sizeof(EchoMsg));
87
+ }
88
+ #endif
89
+
90
+ template <typename = void>
91
+ explicit PROTOBUF_CONSTEXPR EchoMsg(::google::protobuf::internal::ConstantInitialized);
92
+
93
+ inline EchoMsg(const EchoMsg& from) : EchoMsg(nullptr, from) {}
94
+ inline EchoMsg(EchoMsg&& from) noexcept
95
+ : EchoMsg(nullptr, ::std::move(from)) {}
96
+ inline EchoMsg& operator=(const EchoMsg& from) {
97
+ CopyFrom(from);
98
+ return *this;
99
+ }
100
+ inline EchoMsg& operator=(EchoMsg&& from) noexcept {
101
+ if (this == &from) return *this;
102
+ if (::google::protobuf::internal::CanMoveWithInternalSwap(GetArena(), from.GetArena())) {
103
+ InternalSwap(&from);
104
+ } else {
105
+ CopyFrom(from);
106
+ }
107
+ return *this;
108
+ }
109
+
110
+ inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const
111
+ ABSL_ATTRIBUTE_LIFETIME_BOUND {
112
+ return _internal_metadata_.unknown_fields<::google::protobuf::UnknownFieldSet>(::google::protobuf::UnknownFieldSet::default_instance);
113
+ }
114
+ inline ::google::protobuf::UnknownFieldSet* PROTOBUF_NONNULL mutable_unknown_fields()
115
+ ABSL_ATTRIBUTE_LIFETIME_BOUND {
116
+ return _internal_metadata_.mutable_unknown_fields<::google::protobuf::UnknownFieldSet>();
117
+ }
118
+
119
+ static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL descriptor() {
120
+ return GetDescriptor();
121
+ }
122
+ static const ::google::protobuf::Descriptor* PROTOBUF_NONNULL GetDescriptor() {
123
+ return default_instance().GetMetadata().descriptor;
124
+ }
125
+ static const ::google::protobuf::Reflection* PROTOBUF_NONNULL GetReflection() {
126
+ return default_instance().GetMetadata().reflection;
127
+ }
128
+ static const EchoMsg& default_instance() {
129
+ return *reinterpret_cast<const EchoMsg*>(
130
+ &_EchoMsg_default_instance_);
131
+ }
132
+ static constexpr int kIndexInFileMessages = 0;
133
+ friend void swap(EchoMsg& a, EchoMsg& b) { a.Swap(&b); }
134
+ inline void Swap(EchoMsg* PROTOBUF_NONNULL other) {
135
+ if (other == this) return;
136
+ if (::google::protobuf::internal::CanUseInternalSwap(GetArena(), other->GetArena())) {
137
+ InternalSwap(other);
138
+ } else {
139
+ ::google::protobuf::internal::GenericSwap(this, other);
140
+ }
141
+ }
142
+ void UnsafeArenaSwap(EchoMsg* PROTOBUF_NONNULL other) {
143
+ if (other == this) return;
144
+ ABSL_DCHECK(GetArena() == other->GetArena());
145
+ InternalSwap(other);
146
+ }
147
+
148
+ // implements Message ----------------------------------------------
149
+
150
+ EchoMsg* PROTOBUF_NONNULL New(::google::protobuf::Arena* PROTOBUF_NULLABLE arena = nullptr) const {
151
+ return ::google::protobuf::Message::DefaultConstruct<EchoMsg>(arena);
152
+ }
153
+ using ::google::protobuf::Message::CopyFrom;
154
+ void CopyFrom(const EchoMsg& from);
155
+ using ::google::protobuf::Message::MergeFrom;
156
+ void MergeFrom(const EchoMsg& from) { EchoMsg::MergeImpl(*this, from); }
157
+
158
+ private:
159
+ static void MergeImpl(::google::protobuf::MessageLite& to_msg,
160
+ const ::google::protobuf::MessageLite& from_msg);
161
+
162
+ public:
163
+ bool IsInitialized() const {
164
+ return true;
165
+ }
166
+ ABSL_ATTRIBUTE_REINITIALIZES void Clear() PROTOBUF_FINAL;
167
+ #if defined(PROTOBUF_CUSTOM_VTABLE)
168
+ private:
169
+ static ::size_t ByteSizeLong(const ::google::protobuf::MessageLite& msg);
170
+ static ::uint8_t* PROTOBUF_NONNULL _InternalSerialize(
171
+ const ::google::protobuf::MessageLite& msg, ::uint8_t* PROTOBUF_NONNULL target,
172
+ ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream);
173
+
174
+ public:
175
+ ::size_t ByteSizeLong() const { return ByteSizeLong(*this); }
176
+ ::uint8_t* PROTOBUF_NONNULL _InternalSerialize(
177
+ ::uint8_t* PROTOBUF_NONNULL target,
178
+ ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const {
179
+ return _InternalSerialize(*this, target, stream);
180
+ }
181
+ #else // PROTOBUF_CUSTOM_VTABLE
182
+ ::size_t ByteSizeLong() const final;
183
+ ::uint8_t* PROTOBUF_NONNULL _InternalSerialize(
184
+ ::uint8_t* PROTOBUF_NONNULL target,
185
+ ::google::protobuf::io::EpsCopyOutputStream* PROTOBUF_NONNULL stream) const final;
186
+ #endif // PROTOBUF_CUSTOM_VTABLE
187
+ int GetCachedSize() const { return _impl_._cached_size_.Get(); }
188
+
189
+ private:
190
+ void SharedCtor(::google::protobuf::Arena* PROTOBUF_NULLABLE arena);
191
+ static void SharedDtor(MessageLite& self);
192
+ void InternalSwap(EchoMsg* PROTOBUF_NONNULL other);
193
+ private:
194
+ template <typename T>
195
+ friend ::absl::string_view(::google::protobuf::internal::GetAnyMessageName)();
196
+ static ::absl::string_view FullMessageName() { return "echo.EchoMsg"; }
197
+
198
+ explicit EchoMsg(::google::protobuf::Arena* PROTOBUF_NULLABLE arena);
199
+ EchoMsg(::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const EchoMsg& from);
200
+ EchoMsg(
201
+ ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, EchoMsg&& from) noexcept
202
+ : EchoMsg(arena) {
203
+ *this = ::std::move(from);
204
+ }
205
+ const ::google::protobuf::internal::ClassData* PROTOBUF_NONNULL GetClassData() const PROTOBUF_FINAL;
206
+ static void* PROTOBUF_NONNULL PlacementNew_(
207
+ const void* PROTOBUF_NONNULL, void* PROTOBUF_NONNULL mem,
208
+ ::google::protobuf::Arena* PROTOBUF_NULLABLE arena);
209
+ static constexpr auto InternalNewImpl_();
210
+
211
+ public:
212
+ static constexpr auto InternalGenerateClassData_();
213
+
214
+ ::google::protobuf::Metadata GetMetadata() const;
215
+ // nested types ----------------------------------------------------
216
+
217
+ // accessors -------------------------------------------------------
218
+ enum : int {
219
+ kBodyFieldNumber = 1,
220
+ };
221
+ // string body = 1;
222
+ void clear_body() ;
223
+ const ::std::string& body() const;
224
+ template <typename Arg_ = const ::std::string&, typename... Args_>
225
+ void set_body(Arg_&& arg, Args_... args);
226
+ ::std::string* PROTOBUF_NONNULL mutable_body();
227
+ [[nodiscard]] ::std::string* PROTOBUF_NULLABLE release_body();
228
+ void set_allocated_body(::std::string* PROTOBUF_NULLABLE value);
229
+
230
+ private:
231
+ const ::std::string& _internal_body() const;
232
+ PROTOBUF_ALWAYS_INLINE void _internal_set_body(const ::std::string& value);
233
+ ::std::string* PROTOBUF_NONNULL _internal_mutable_body();
234
+
235
+ public:
236
+ // @@protoc_insertion_point(class_scope:echo.EchoMsg)
237
+ private:
238
+ class _Internal;
239
+ friend class ::google::protobuf::internal::TcParser;
240
+ static const ::google::protobuf::internal::TcParseTable<0, 1,
241
+ 0, 25,
242
+ 2>
243
+ _table_;
244
+
245
+ friend class ::google::protobuf::MessageLite;
246
+ friend class ::google::protobuf::Arena;
247
+ template <typename T>
248
+ friend class ::google::protobuf::Arena::InternalHelper;
249
+ using InternalArenaConstructable_ = void;
250
+ using DestructorSkippable_ = void;
251
+ struct Impl_ {
252
+ inline explicit constexpr Impl_(::google::protobuf::internal::ConstantInitialized) noexcept;
253
+ inline explicit Impl_(
254
+ ::google::protobuf::internal::InternalVisibility visibility,
255
+ ::google::protobuf::Arena* PROTOBUF_NULLABLE arena);
256
+ inline explicit Impl_(
257
+ ::google::protobuf::internal::InternalVisibility visibility,
258
+ ::google::protobuf::Arena* PROTOBUF_NULLABLE arena, const Impl_& from,
259
+ const EchoMsg& from_msg);
260
+ ::google::protobuf::internal::HasBits<1> _has_bits_;
261
+ ::google::protobuf::internal::CachedSize _cached_size_;
262
+ ::google::protobuf::internal::ArenaStringPtr body_;
263
+ PROTOBUF_TSAN_DECLARE_MEMBER
264
+ };
265
+ union { Impl_ _impl_; };
266
+ friend struct ::TableStruct_github_2ecom_2faperturerobotics_2fstarpc_2fecho_2fecho_2eproto;
267
+ };
268
+
269
+ extern const ::google::protobuf::internal::ClassDataFull EchoMsg_class_data_;
270
+
271
+ // ===================================================================
272
+
273
+
274
+
275
+
276
+ // ===================================================================
277
+
278
+
279
+ #ifdef __GNUC__
280
+ #pragma GCC diagnostic push
281
+ #pragma GCC diagnostic ignored "-Wstrict-aliasing"
282
+ #endif // __GNUC__
283
+ // -------------------------------------------------------------------
284
+
285
+ // EchoMsg
286
+
287
+ // string body = 1;
288
+ inline void EchoMsg::clear_body() {
289
+ ::google::protobuf::internal::TSanWrite(&_impl_);
290
+ _impl_.body_.ClearToEmpty();
291
+ ClearHasBit(_impl_._has_bits_[0],
292
+ 0x00000001U);
293
+ }
294
+ inline const ::std::string& EchoMsg::body() const
295
+ ABSL_ATTRIBUTE_LIFETIME_BOUND {
296
+ // @@protoc_insertion_point(field_get:echo.EchoMsg.body)
297
+ return _internal_body();
298
+ }
299
+ template <typename Arg_, typename... Args_>
300
+ PROTOBUF_ALWAYS_INLINE void EchoMsg::set_body(Arg_&& arg, Args_... args) {
301
+ ::google::protobuf::internal::TSanWrite(&_impl_);
302
+ SetHasBit(_impl_._has_bits_[0], 0x00000001U);
303
+ _impl_.body_.Set(static_cast<Arg_&&>(arg), args..., GetArena());
304
+ // @@protoc_insertion_point(field_set:echo.EchoMsg.body)
305
+ }
306
+ inline ::std::string* PROTOBUF_NONNULL EchoMsg::mutable_body()
307
+ ABSL_ATTRIBUTE_LIFETIME_BOUND {
308
+ SetHasBit(_impl_._has_bits_[0], 0x00000001U);
309
+ ::std::string* _s = _internal_mutable_body();
310
+ // @@protoc_insertion_point(field_mutable:echo.EchoMsg.body)
311
+ return _s;
312
+ }
313
+ inline const ::std::string& EchoMsg::_internal_body() const {
314
+ ::google::protobuf::internal::TSanRead(&_impl_);
315
+ return _impl_.body_.Get();
316
+ }
317
+ inline void EchoMsg::_internal_set_body(const ::std::string& value) {
318
+ ::google::protobuf::internal::TSanWrite(&_impl_);
319
+ _impl_.body_.Set(value, GetArena());
320
+ }
321
+ inline ::std::string* PROTOBUF_NONNULL EchoMsg::_internal_mutable_body() {
322
+ ::google::protobuf::internal::TSanWrite(&_impl_);
323
+ return _impl_.body_.Mutable( GetArena());
324
+ }
325
+ inline ::std::string* PROTOBUF_NULLABLE EchoMsg::release_body() {
326
+ ::google::protobuf::internal::TSanWrite(&_impl_);
327
+ // @@protoc_insertion_point(field_release:echo.EchoMsg.body)
328
+ if (!CheckHasBit(_impl_._has_bits_[0], 0x00000001U)) {
329
+ return nullptr;
330
+ }
331
+ ClearHasBit(_impl_._has_bits_[0], 0x00000001U);
332
+ auto* released = _impl_.body_.Release();
333
+ if (::google::protobuf::internal::DebugHardenForceCopyDefaultString()) {
334
+ _impl_.body_.Set("", GetArena());
335
+ }
336
+ return released;
337
+ }
338
+ inline void EchoMsg::set_allocated_body(::std::string* PROTOBUF_NULLABLE value) {
339
+ ::google::protobuf::internal::TSanWrite(&_impl_);
340
+ if (value != nullptr) {
341
+ SetHasBit(_impl_._has_bits_[0], 0x00000001U);
342
+ } else {
343
+ ClearHasBit(_impl_._has_bits_[0], 0x00000001U);
344
+ }
345
+ _impl_.body_.SetAllocated(value, GetArena());
346
+ if (::google::protobuf::internal::DebugHardenForceCopyDefaultString() && _impl_.body_.IsDefault()) {
347
+ _impl_.body_.Set("", GetArena());
348
+ }
349
+ // @@protoc_insertion_point(field_set_allocated:echo.EchoMsg.body)
350
+ }
351
+
352
+ #ifdef __GNUC__
353
+ #pragma GCC diagnostic pop
354
+ #endif // __GNUC__
355
+
356
+ // @@protoc_insertion_point(namespace_scope)
357
+ } // namespace echo
358
+
359
+
360
+ // @@protoc_insertion_point(global_scope)
361
+
362
+ #include "google/protobuf/port_undef.inc"
363
+
364
+ #endif // github_2ecom_2faperturerobotics_2fstarpc_2fecho_2fecho_2eproto_2epb_2eh
@@ -1,5 +1,5 @@
1
1
  // Code generated by protoc-gen-srpc. DO NOT EDIT.
2
- // protoc-gen-srpc version: v0.38.0
2
+ // protoc-gen-srpc version: v0.42.0
3
3
  // source: github.com/aperturerobotics/starpc/echo/echo.proto
4
4
 
5
5
  package echo
@@ -0,0 +1,3 @@
1
+ //! Generated code - do not edit.
2
+
3
+ include!(concat!(env!("OUT_DIR"), "/echo.rs"));
package/echo/main.rs ADDED
@@ -0,0 +1,162 @@
1
+ //! Echo service example demonstrating starpc usage.
2
+ //!
3
+ //! This example shows how to implement both client and server for a simple
4
+ //! echo service that supports unary, server streaming, client streaming,
5
+ //! and bidirectional streaming RPCs.
6
+
7
+ mod gen;
8
+
9
+ use std::sync::Arc;
10
+
11
+ use async_trait::async_trait;
12
+ use starpc::{Error, Mux, Result, Server, Stream, StreamExt};
13
+ use tokio::net::{TcpListener, TcpStream};
14
+
15
+ use gen::{EchoMsg, EchoerClient, EchoerClientImpl, EchoerHandler, EchoerServer};
16
+
17
+ /// Echo server implementation.
18
+ struct EchoServerImpl;
19
+
20
+ #[async_trait]
21
+ impl EchoerServer for EchoServerImpl {
22
+ async fn echo(&self, request: EchoMsg) -> Result<EchoMsg> {
23
+ println!("Server: received echo request: {:?}", request.body);
24
+ Ok(EchoMsg {
25
+ body: request.body,
26
+ })
27
+ }
28
+
29
+ async fn echo_server_stream(
30
+ &self,
31
+ request: EchoMsg,
32
+ stream: Box<dyn Stream>,
33
+ ) -> Result<()> {
34
+ println!(
35
+ "Server: received server stream request: {:?}",
36
+ request.body
37
+ );
38
+
39
+ // Send multiple responses.
40
+ for i in 0..5 {
41
+ let response = EchoMsg {
42
+ body: format!("{} - {}", request.body, i),
43
+ };
44
+ stream.msg_send(&response).await?;
45
+ }
46
+
47
+ Ok(())
48
+ }
49
+
50
+ async fn echo_client_stream(&self, stream: &dyn Stream) -> Result<EchoMsg> {
51
+ println!("Server: starting client stream");
52
+
53
+ let mut messages = Vec::new();
54
+
55
+ // Receive all messages from the client.
56
+ loop {
57
+ match stream.msg_recv::<EchoMsg>().await {
58
+ Ok(msg) => {
59
+ println!("Server: received message: {:?}", msg.body);
60
+ messages.push(msg.body);
61
+ }
62
+ Err(Error::StreamClosed) => break,
63
+ Err(e) => return Err(e),
64
+ }
65
+ }
66
+
67
+ // Return combined response (the handler will send it automatically).
68
+ let response = EchoMsg {
69
+ body: messages.join(", "),
70
+ };
71
+
72
+ Ok(response)
73
+ }
74
+
75
+ async fn echo_bidi_stream(&self, stream: Box<dyn Stream>) -> Result<()> {
76
+ println!("Server: starting bidi stream");
77
+
78
+ // Echo each message back.
79
+ loop {
80
+ match stream.msg_recv::<EchoMsg>().await {
81
+ Ok(msg) => {
82
+ println!("Server: echoing message: {:?}", msg.body);
83
+ stream.msg_send(&msg).await?;
84
+ }
85
+ Err(Error::StreamClosed) => break,
86
+ Err(e) => return Err(e),
87
+ }
88
+ }
89
+
90
+ Ok(())
91
+ }
92
+ }
93
+
94
+ #[tokio::main]
95
+ async fn main() -> Result<()> {
96
+ let addr = "127.0.0.1:8080";
97
+
98
+ // Spawn the server.
99
+ let server_handle = tokio::spawn(run_server(addr.to_string()));
100
+
101
+ // Wait for the server to start.
102
+ tokio::time::sleep(tokio::time::Duration::from_millis(100)).await;
103
+
104
+ // Run the client.
105
+ run_client(addr).await?;
106
+
107
+ // Stop the server.
108
+ server_handle.abort();
109
+
110
+ println!("Example completed successfully!");
111
+ Ok(())
112
+ }
113
+
114
+ async fn run_server(addr: String) -> Result<()> {
115
+ let listener = TcpListener::bind(&addr).await?;
116
+ println!("Server listening on {}", addr);
117
+
118
+ // Create the mux and register our handler.
119
+ let mux = Arc::new(Mux::new());
120
+ mux.register(Arc::new(EchoerHandler::new(EchoServerImpl)))?;
121
+
122
+ // Accept connections.
123
+ loop {
124
+ let (stream, peer_addr) = listener.accept().await?;
125
+ println!("Server: accepted connection from {}", peer_addr);
126
+
127
+ let server = Server::with_arc(mux.clone());
128
+ tokio::spawn(async move {
129
+ if let Err(e) = server.handle_stream(stream).await {
130
+ eprintln!("Server error: {}", e);
131
+ }
132
+ });
133
+ }
134
+ }
135
+
136
+ async fn run_client(addr: &str) -> Result<()> {
137
+ println!("\nClient: connecting to {}", addr);
138
+
139
+ // Connect to the server.
140
+ let stream = TcpStream::connect(addr).await?;
141
+
142
+ // Create a client.
143
+ let opener = starpc::client::transport::SingleStreamOpener::new(stream);
144
+ let client = starpc::SrpcClient::new(opener);
145
+ let echo_client = EchoerClientImpl::new(client);
146
+
147
+ // Test unary RPC.
148
+ println!("\n--- Unary RPC ---");
149
+ let request = EchoMsg {
150
+ body: "Hello, World!".to_string(),
151
+ };
152
+ let response = echo_client.echo(&request).await?;
153
+ println!("Client: received response: {:?}", response.body);
154
+ assert_eq!(response.body, request.body);
155
+
156
+ // Note: Additional streaming tests would require multiple connections
157
+ // since SingleStreamOpener only supports one stream at a time.
158
+ // For a full implementation, you would use yamux or similar multiplexing.
159
+
160
+ println!("\nClient: all tests passed!");
161
+ Ok(())
162
+ }
package/go.mod CHANGED
@@ -1,8 +1,6 @@
1
1
  module github.com/aperturerobotics/starpc
2
2
 
3
- go 1.24
4
-
5
- toolchain go1.24.6
3
+ go 1.25
6
4
 
7
5
  replace (
8
6
  // This fork uses go-protobuf-lite and adds post-quantum crypto support.
@@ -13,22 +11,29 @@ replace (
13
11
  )
14
12
 
15
13
  require (
16
- github.com/aperturerobotics/protobuf-go-lite v0.11.0 // latest
17
- github.com/aperturerobotics/util v1.31.4 // latest
14
+ github.com/aperturerobotics/common v0.26.11 // latest
15
+ github.com/aperturerobotics/protobuf-go-lite v0.12.0 // latest
16
+ github.com/aperturerobotics/util v1.32.0 // latest
18
17
  )
19
18
 
20
19
  require (
21
20
  github.com/coder/websocket v1.8.14 // latest
22
- github.com/libp2p/go-libp2p v0.46.0 // latest
21
+ github.com/libp2p/go-libp2p v0.47.0 // latest
22
+ github.com/libp2p/go-yamux/v4 v4.0.2 // latest
23
23
  github.com/pkg/errors v0.9.1 // latest
24
- github.com/sirupsen/logrus v1.9.3 // latest
24
+ github.com/sirupsen/logrus v1.9.4 // latest
25
25
  google.golang.org/protobuf v1.36.11 // latest
26
26
  )
27
27
 
28
- require github.com/libp2p/go-yamux/v4 v4.0.1
29
-
30
28
  require (
29
+ github.com/aperturerobotics/abseil-cpp v0.0.0-20260130220554-305ed0ea7006 // indirect
30
+ github.com/aperturerobotics/cli v1.1.0 // indirect
31
+ github.com/aperturerobotics/go-protoc-wasi v0.0.0-20260131050911-b5f94b044584 // indirect
31
32
  github.com/aperturerobotics/json-iterator-lite v1.0.1-0.20240713111131-be6bf89c3008 // indirect
33
+ github.com/aperturerobotics/protobuf v0.0.0-20260131033322-bd4a2148b9c4 // indirect
34
+ )
35
+
36
+ require (
32
37
  github.com/ipfs/go-cid v0.4.1 // indirect
33
38
  github.com/klauspost/cpuid/v2 v2.2.8 // indirect
34
39
  github.com/libp2p/go-buffer-pool v0.1.0 // indirect
@@ -42,8 +47,11 @@ require (
42
47
  github.com/multiformats/go-multistream v0.5.0 // indirect
43
48
  github.com/multiformats/go-varint v0.0.7 // indirect
44
49
  github.com/spaolacci/murmur3 v1.1.0 // indirect
50
+ github.com/tetratelabs/wazero v1.11.0 // indirect
51
+ github.com/xrash/smetrics v0.0.0-20250705151800-55b8f293f342 // indirect
45
52
  golang.org/x/crypto v0.37.0 // indirect
46
53
  golang.org/x/exp v0.0.0-20250305212735-054e65f0b394 // indirect
47
- golang.org/x/sys v0.34.0 // indirect
54
+ golang.org/x/mod v0.32.0 // indirect
55
+ golang.org/x/sys v0.38.0 // indirect
48
56
  lukechampine.com/blake3 v1.3.0 // indirect
49
57
  )
package/go.sum CHANGED
@@ -1,14 +1,23 @@
1
+ github.com/aperturerobotics/abseil-cpp v0.0.0-20260130220554-305ed0ea7006 h1:UvaY8ullxhGqCDQZl3Nj/mVjsKW6LHgyZcoZiTUQ1u4=
2
+ github.com/aperturerobotics/abseil-cpp v0.0.0-20260130220554-305ed0ea7006/go.mod h1:lNSJTKECIUFAnfeSqy01kXYTYe1BHubW7198jNX3nEw=
3
+ github.com/aperturerobotics/cli v1.1.0 h1:7a+YRC+EY3npAnTzhHV5gLCiw91KS0Ts3XwLILGOsT8=
4
+ github.com/aperturerobotics/cli v1.1.0/go.mod h1:M7BFP9wow5ytTzMyJQOOO991fGfsUqdTI7gGEsHfTQ8=
5
+ github.com/aperturerobotics/common v0.26.11 h1:pEcMztDoPxb5X36rL/BVW6wPeiX8jor+65dUj4nFl14=
6
+ github.com/aperturerobotics/common v0.26.11/go.mod h1:mSIaXBsZbPQP2Tw8CHl0CiAPCwq7QDsiFG3rVtof2ik=
1
7
  github.com/aperturerobotics/go-libp2p v0.37.1-0.20241111002741-5cfbb50b74e0 h1:tGwbeDoEeQCrUQL+ClUywldqvz9eRmhcVrGwGxz2xJg=
2
8
  github.com/aperturerobotics/go-libp2p v0.37.1-0.20241111002741-5cfbb50b74e0/go.mod h1:FJkAtQcP9XxqG1NNLNHKm+wLVIGSCQX2s6CEoD+w97g=
9
+ github.com/aperturerobotics/go-protoc-wasi v0.0.0-20260131050911-b5f94b044584 h1:ER8DYYL71cTg39uZ+Gi699tL/hZoscUWDOw4DbizqhI=
10
+ github.com/aperturerobotics/go-protoc-wasi v0.0.0-20260131050911-b5f94b044584/go.mod h1:vEq8i7EKb32+KXGtIEZjjhNns+BdsL2dUMw4uhy3578=
3
11
  github.com/aperturerobotics/json-iterator-lite v1.0.1-0.20240713111131-be6bf89c3008 h1:So9JeziaWKx2Fw8sK4AUN/szqKtJ0jEMhS6bU4sHbxs=
4
12
  github.com/aperturerobotics/json-iterator-lite v1.0.1-0.20240713111131-be6bf89c3008/go.mod h1:snaApCEDtrHHP6UWSLKiYNOZU9A5NyzccKenx9oZEzg=
5
- github.com/aperturerobotics/protobuf-go-lite v0.11.0 h1:IAaZISqrEpodqECYxk0yKWgROEbZtMhs7bErP+Zma9o=
6
- github.com/aperturerobotics/protobuf-go-lite v0.11.0/go.mod h1:c4kGy7Dkfz6B1m0t4QBIMQoNeQ7m+nYj3Qxxnlwhygo=
7
- github.com/aperturerobotics/util v1.31.4 h1:2F4j5CML/Hb4dQT1E1pjkZd3AdJhsAQiaRCR9pD/dwo=
8
- github.com/aperturerobotics/util v1.31.4/go.mod h1:qfeWUnkC60QpjxH4yocO6Q/No+J1E488yzuconPgF8c=
13
+ github.com/aperturerobotics/protobuf v0.0.0-20260131033322-bd4a2148b9c4 h1:hiNtIrSdy6EbxSVNYjyLJGAUD7j2wFNLqOMzetw2ddQ=
14
+ github.com/aperturerobotics/protobuf v0.0.0-20260131033322-bd4a2148b9c4/go.mod h1:tMgO7y6SJo/d9ZcvrpNqIQtdYT9de+QmYaHOZ4KnhOg=
15
+ github.com/aperturerobotics/protobuf-go-lite v0.12.0 h1:ZPPokQtm/NPhgGv+vYD9AhInvkrzQal6MDnqcYLWvlg=
16
+ github.com/aperturerobotics/protobuf-go-lite v0.12.0/go.mod h1:lGH3s5ArCTXKI4wJdlNpaybUtwSjfAG0vdWjxOfMcF8=
17
+ github.com/aperturerobotics/util v1.32.0 h1:6gIx5zt1/cOpyH5Wq+im3yNLnRncsfw9PupHNQsy8c0=
18
+ github.com/aperturerobotics/util v1.32.0/go.mod h1:Aufy+WeKncuhc1L2yEg+QxRhb8uVnGBprPyTubaDxLw=
9
19
  github.com/coder/websocket v1.8.14 h1:9L0p0iKiNOibykf283eHkKUHHrpG7f65OE3BhhO7v9g=
10
20
  github.com/coder/websocket v1.8.14/go.mod h1:NX3SzP+inril6yawo5CQXx8+fk145lPDC6pumgx0mVg=
11
- github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
12
21
  github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
13
22
  github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
14
23
  github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
@@ -21,8 +30,8 @@ github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6
21
30
  github.com/libp2p/go-buffer-pool v0.1.0/go.mod h1:N+vh8gMqimBzdKkSMVuydVDq+UV5QTWy5HSiZacSbPg=
22
31
  github.com/libp2p/go-libp2p-testing v0.12.0 h1:EPvBb4kKMWO29qP4mZGyhVzUyR25dvfUIK5WDu6iPUA=
23
32
  github.com/libp2p/go-libp2p-testing v0.12.0/go.mod h1:KcGDRXyN7sQCllucn1cOOS+Dmm7ujhfEyXQL5lvkcPg=
24
- github.com/libp2p/go-yamux/v4 v4.0.1 h1:FfDR4S1wj6Bw2Pqbc8Uz7pCxeRBPbwsBbEdfwiCypkQ=
25
- github.com/libp2p/go-yamux/v4 v4.0.1/go.mod h1:NWjl8ZTLOGlozrXSOZ/HlfG++39iKNnM5wwmtQP1YB4=
33
+ github.com/libp2p/go-yamux/v4 v4.0.2 h1:nrLh89LN/LEiqcFiqdKDRHjGstN300C1269K/EX0CPU=
34
+ github.com/libp2p/go-yamux/v4 v4.0.2/go.mod h1:C808cCRgOs1iBwY4S71T5oxgMxgLmqUw56qh4AeBW2o=
26
35
  github.com/minio/sha256-simd v1.0.1 h1:6kaan5IFmwTNynnKKpDHe6FWHohJOHhCPchzK49dzMM=
27
36
  github.com/minio/sha256-simd v1.0.1/go.mod h1:Pz6AKMiUdngCLpeTL/RJY1M9rUuPMYujV5xJjtbRSN8=
28
37
  github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o=
@@ -45,26 +54,27 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
45
54
  github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
46
55
  github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
47
56
  github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
48
- github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
49
- github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
57
+ github.com/sirupsen/logrus v1.9.4 h1:TsZE7l11zFCLZnZ+teH4Umoq5BhEIfIzfRDZ1Uzql2w=
58
+ github.com/sirupsen/logrus v1.9.4/go.mod h1:ftWc9WdOfJ0a92nsE2jF5u5ZwH8Bv2zdeOC42RjbV2g=
50
59
  github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI=
51
60
  github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
52
- github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
53
- github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
54
- github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
55
- github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
61
+ github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
62
+ github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
63
+ github.com/tetratelabs/wazero v1.11.0 h1:+gKemEuKCTevU4d7ZTzlsvgd1uaToIDtlQlmNbwqYhA=
64
+ github.com/tetratelabs/wazero v1.11.0/go.mod h1:eV28rsN8Q+xwjogd7f4/Pp4xFxO7uOGbLcD/LzB1wiU=
65
+ github.com/xrash/smetrics v0.0.0-20250705151800-55b8f293f342 h1:FnBeRrxr7OU4VvAzt5X7s6266i6cSVkkFPS0TuXWbIg=
66
+ github.com/xrash/smetrics v0.0.0-20250705151800-55b8f293f342/go.mod h1:Ohn+xnUBiLI6FVj/9LpzZWtj1/D6lUovWYBkxHVV3aM=
56
67
  golang.org/x/crypto v0.37.0 h1:kJNSjF/Xp7kU0iB2Z+9viTPMW4EqqsrywMXLJOOsXSE=
57
68
  golang.org/x/crypto v0.37.0/go.mod h1:vg+k43peMZ0pUMhYmVAWysMK35e6ioLh3wB8ZCAfbVc=
58
69
  golang.org/x/exp v0.0.0-20250305212735-054e65f0b394 h1:nDVHiLt8aIbd/VzvPWN6kSOPE7+F/fNFDSXLVYkE/Iw=
59
70
  golang.org/x/exp v0.0.0-20250305212735-054e65f0b394/go.mod h1:sIifuuw/Yco/y6yb6+bDNfyeQ/MdPUy/hKEMYQV17cM=
60
- golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
71
+ golang.org/x/mod v0.32.0 h1:9F4d3PHLljb6x//jOyokMv3eX+YDeepZSEo3mFJy93c=
72
+ golang.org/x/mod v0.32.0/go.mod h1:SgipZ/3h2Ci89DlEtEXWUk/HteuRin+HHhN+WbNhguU=
61
73
  golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
62
- golang.org/x/sys v0.34.0 h1:H5Y5sJ2L2JRdyv7ROF1he/lPdvFsd0mJHFw2ThKHxLA=
63
- golang.org/x/sys v0.34.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
74
+ golang.org/x/sys v0.38.0 h1:3yZWxaJjBmCWXqhN1qh02AkOnCQ1poK6oF+a7xWL6Gc=
75
+ golang.org/x/sys v0.38.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
64
76
  google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE=
65
77
  google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
66
- gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
67
- gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
68
78
  gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
69
79
  gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
70
80
  lukechampine.com/blake3 v1.3.0 h1:sJ3XhFINmHSrYCgl958hscfIa3bw8x4DqMP3u1YvoYE=