tangled
alpha
login
or
join now
stream.place
/
streamplace
77
fork
atom
Live video on the AT Protocol
77
fork
atom
overview
issues
1
pulls
pipelines
iroh: update to previously-integrated version
Eli Mallon
7 months ago
b383ef72
8a80a31e
+155
-246
5 changed files
expand all
collapse all
unified
split
Cargo.lock
Makefile
pkg
iroh
generated
iroh_streamplace
iroh_streamplace.go
iroh_streamplace.h
rust
iroh-streamplace
Makefile
+16
-90
Cargo.lock
···
327
327
version = "1.10.1"
328
328
source = "registry+https://github.com/rust-lang/crates.io-index"
329
329
checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a"
330
330
-
dependencies = [
331
331
-
"serde",
332
332
-
]
333
330
334
331
[[package]]
335
332
name = "camino"
···
1466
1463
]
1467
1464
1468
1465
[[package]]
1466
1466
+
name = "imsg"
1467
1467
+
version = "0.1.0"
1468
1468
+
source = "git+https://github.com/n0-computer/imsg?branch=main#9165b1c6d6bc27ea324a01b1090fb7f269f05dc2"
1469
1469
+
dependencies = [
1470
1470
+
"anyhow",
1471
1471
+
"bytes",
1472
1472
+
"iroh",
1473
1473
+
"n0-future 0.2.0",
1474
1474
+
"thiserror 2.0.14",
1475
1475
+
"tokio",
1476
1476
+
"tokio-util",
1477
1477
+
"tracing",
1478
1478
+
]
1479
1479
+
1480
1480
+
[[package]]
1469
1481
name = "indexmap"
1470
1482
version = "2.10.0"
1471
1483
source = "registry+https://github.com/rust-lang/crates.io-index"
···
1752
1764
"anyhow",
1753
1765
"async-trait",
1754
1766
"bytes",
1767
1767
+
"imsg",
1755
1768
"iroh",
1756
1756
-
"irpc",
1757
1757
-
"irpc-iroh",
1758
1769
"n0-future 0.2.0",
1759
1759
-
"postcard",
1760
1760
-
"serde",
1761
1770
"snafu",
1762
1771
"tokio",
1763
1772
"tracing",
···
1767
1776
]
1768
1777
1769
1778
[[package]]
1770
1770
-
name = "irpc"
1771
1771
-
version = "0.7.0"
1772
1772
-
source = "registry+https://github.com/rust-lang/crates.io-index"
1773
1773
-
checksum = "a9f8f1d0987ea9da3d74698f921d0a817a214c83b2635a33ed4bc3efa4de1acd"
1774
1774
-
dependencies = [
1775
1775
-
"anyhow",
1776
1776
-
"futures-buffered",
1777
1777
-
"futures-util",
1778
1778
-
"iroh-quinn",
1779
1779
-
"irpc-derive",
1780
1780
-
"n0-future 0.1.3",
1781
1781
-
"postcard",
1782
1782
-
"rcgen",
1783
1783
-
"rustls",
1784
1784
-
"serde",
1785
1785
-
"smallvec",
1786
1786
-
"thiserror 2.0.14",
1787
1787
-
"tokio",
1788
1788
-
"tokio-util",
1789
1789
-
"tracing",
1790
1790
-
]
1791
1791
-
1792
1792
-
[[package]]
1793
1793
-
name = "irpc-derive"
1794
1794
-
version = "0.5.0"
1795
1795
-
source = "registry+https://github.com/rust-lang/crates.io-index"
1796
1796
-
checksum = "3e0b26b834d401a046dd9d47bc236517c746eddbb5d25ff3e1a6075bfa4eebdb"
1797
1797
-
dependencies = [
1798
1798
-
"proc-macro2",
1799
1799
-
"quote",
1800
1800
-
"syn 1.0.109",
1801
1801
-
]
1802
1802
-
1803
1803
-
[[package]]
1804
1804
-
name = "irpc-iroh"
1805
1805
-
version = "0.7.0"
1806
1806
-
source = "registry+https://github.com/rust-lang/crates.io-index"
1807
1807
-
checksum = "f5926531af491c6962db4d79f43ea219404cb800889922a728b1d3b92f887eda"
1808
1808
-
dependencies = [
1809
1809
-
"anyhow",
1810
1810
-
"getrandom 0.3.3",
1811
1811
-
"iroh",
1812
1812
-
"irpc",
1813
1813
-
"n0-future 0.1.3",
1814
1814
-
"postcard",
1815
1815
-
"serde",
1816
1816
-
"tokio",
1817
1817
-
"tracing",
1818
1818
-
]
1819
1819
-
1820
1820
-
[[package]]
1821
1779
name = "itoa"
1822
1780
version = "1.0.15"
1823
1781
source = "registry+https://github.com/rust-lang/crates.io-index"
···
2338
2296
checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"
2339
2297
2340
2298
[[package]]
2341
2341
-
name = "pem"
2342
2342
-
version = "3.0.5"
2343
2343
-
source = "registry+https://github.com/rust-lang/crates.io-index"
2344
2344
-
checksum = "38af38e8470ac9dee3ce1bae1af9c1671fffc44ddfd8bd1d0a3445bf349a8ef3"
2345
2345
-
dependencies = [
2346
2346
-
"base64",
2347
2347
-
"serde",
2348
2348
-
]
2349
2349
-
2350
2350
-
[[package]]
2351
2299
name = "pem-rfc7468"
2352
2300
version = "0.7.0"
2353
2301
source = "registry+https://github.com/rust-lang/crates.io-index"
···
2823
2771
checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38"
2824
2772
dependencies = [
2825
2773
"getrandom 0.3.3",
2826
2826
-
]
2827
2827
-
2828
2828
-
[[package]]
2829
2829
-
name = "rcgen"
2830
2830
-
version = "0.13.2"
2831
2831
-
source = "registry+https://github.com/rust-lang/crates.io-index"
2832
2832
-
checksum = "75e669e5202259b5314d1ea5397316ad400819437857b90861765f24c4cf80a2"
2833
2833
-
dependencies = [
2834
2834
-
"pem",
2835
2835
-
"ring",
2836
2836
-
"rustls-pki-types",
2837
2837
-
"time",
2838
2838
-
"yasna",
2839
2774
]
2840
2775
2841
2776
[[package]]
···
4591
4526
checksum = "d7d8a75eaf6557bb84a65ace8609883db44a29951042ada9b393151532e41fcb"
4592
4527
dependencies = [
4593
4528
"xml-rs",
4594
4594
-
]
4595
4595
-
4596
4596
-
[[package]]
4597
4597
-
name = "yasna"
4598
4598
-
version = "0.5.2"
4599
4599
-
source = "registry+https://github.com/rust-lang/crates.io-index"
4600
4600
-
checksum = "e17bb3549cc1321ae1296b9cdc2698e2b6cb1992adfa19a8c72e5b7a738f44cd"
4601
4601
-
dependencies = [
4602
4602
-
"time",
4603
4529
]
4604
4530
4605
4531
[[package]]
+4
Makefile
···
837
837
&& git add . \
838
838
&& git commit -m "Update streamplace $(VERSION)" \
839
839
&& git push
840
840
+
841
841
+
.PHONY: iroh-streamplace
842
842
+
iroh-streamplace:
843
843
+
uniffi-bindgen-go --out-dir pkg/iroh/generated --library ./target/debug/libiroh_streamplace.so
+121
-114
pkg/iroh/generated/iroh_streamplace/iroh_streamplace.go
···
353
353
checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t {
354
354
return C.uniffi_iroh_streamplace_checksum_method_datahandler_handle_data()
355
355
})
356
356
-
if checksum != 27893 {
356
356
+
if checksum != 61779 {
357
357
// If this happens try cleaning and rebuilding your project
358
358
panic("iroh_streamplace: uniffi_iroh_streamplace_checksum_method_datahandler_handle_data: UniFFI API checksum mismatch")
359
359
}
···
441
441
}
442
442
{
443
443
checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t {
444
444
-
return C.uniffi_iroh_streamplace_checksum_method_receiver_subscribe()
444
444
+
return C.uniffi_iroh_streamplace_checksum_method_sender_add_peer()
445
445
})
446
446
-
if checksum != 24145 {
447
447
-
// If this happens try cleaning and rebuilding your project
448
448
-
panic("iroh_streamplace: uniffi_iroh_streamplace_checksum_method_receiver_subscribe: UniFFI API checksum mismatch")
449
449
-
}
450
450
-
}
451
451
-
{
452
452
-
checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t {
453
453
-
return C.uniffi_iroh_streamplace_checksum_method_receiver_unsubscribe()
454
454
-
})
455
455
-
if checksum != 21760 {
446
446
+
if checksum != 34321 {
456
447
// If this happens try cleaning and rebuilding your project
457
457
-
panic("iroh_streamplace: uniffi_iroh_streamplace_checksum_method_receiver_unsubscribe: UniFFI API checksum mismatch")
448
448
+
panic("iroh_streamplace: uniffi_iroh_streamplace_checksum_method_sender_add_peer: UniFFI API checksum mismatch")
458
449
}
459
450
}
460
451
{
···
470
461
checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t {
471
462
return C.uniffi_iroh_streamplace_checksum_method_sender_send()
472
463
})
473
473
-
if checksum != 23930 {
464
464
+
if checksum != 24369 {
474
465
// If this happens try cleaning and rebuilding your project
475
466
panic("iroh_streamplace: uniffi_iroh_streamplace_checksum_method_sender_send: UniFFI API checksum mismatch")
476
467
}
···
720
711
}
721
712
722
713
type DataHandler interface {
723
723
-
HandleData(topic string, data []byte)
714
714
+
HandleData(peer *PublicKey, data []byte)
724
715
}
725
716
type DataHandlerImpl struct {
726
717
ffiObject FfiObject
727
718
}
728
719
729
729
-
func (_self *DataHandlerImpl) HandleData(topic string, data []byte) {
720
720
+
func (_self *DataHandlerImpl) HandleData(peer *PublicKey, data []byte) {
730
721
_pointer := _self.ffiObject.incrementPointer("DataHandler")
731
722
defer _self.ffiObject.decrementPointer()
732
723
uniffiRustCallAsync[struct{}](
···
739
730
// liftFn
740
731
func(_ struct{}) struct{} { return struct{}{} },
741
732
C.uniffi_iroh_streamplace_fn_method_datahandler_handle_data(
742
742
-
_pointer, FfiConverterStringINSTANCE.Lower(topic), FfiConverterBytesINSTANCE.Lower(data)),
733
733
+
_pointer, FfiConverterPublicKeyINSTANCE.Lower(peer), FfiConverterBytesINSTANCE.Lower(data)),
743
734
// pollFn
744
735
func(handle C.uint64_t, continuation C.UniffiRustFutureContinuationCallback, data C.uint64_t) {
745
736
C.ffi_iroh_streamplace_rust_future_poll_void(handle, continuation, data)
···
854
845
}
855
846
856
847
//export iroh_streamplace_cgo_dispatchCallbackInterfaceDataHandlerMethod0
857
857
-
func iroh_streamplace_cgo_dispatchCallbackInterfaceDataHandlerMethod0(uniffiHandle C.uint64_t, topic C.RustBuffer, data C.RustBuffer, uniffiFutureCallback C.UniffiForeignFutureCompleteVoid, uniffiCallbackData C.uint64_t, uniffiOutReturn *C.UniffiForeignFuture) {
848
848
+
func iroh_streamplace_cgo_dispatchCallbackInterfaceDataHandlerMethod0(uniffiHandle C.uint64_t, peer unsafe.Pointer, data C.RustBuffer, uniffiFutureCallback C.UniffiForeignFutureCompleteVoid, uniffiCallbackData C.uint64_t, uniffiOutReturn *C.UniffiForeignFuture) {
858
849
handle := uint64(uniffiHandle)
859
850
uniffiObj, ok := FfiConverterDataHandlerINSTANCE.handleMap.tryGet(handle)
860
851
if !ok {
···
886
877
}()
887
878
888
879
uniffiObj.HandleData(
889
889
-
FfiConverterStringINSTANCE.Lift(GoRustBuffer{
890
890
-
inner: topic,
891
891
-
}),
880
880
+
FfiConverterPublicKeyINSTANCE.Lift(peer),
892
881
FfiConverterBytesINSTANCE.Lift(GoRustBuffer{
893
882
inner: data,
894
883
}),
···
1282
1271
1283
1272
type ReceiverInterface interface {
1284
1273
NodeAddr() *NodeAddr
1285
1285
-
// Subscribe to the given topic on the remote.
1286
1286
-
Subscribe(remoteId *PublicKey, topic string) *Error
1287
1287
-
// Unsubscribe from this topic on the remote.
1288
1288
-
Unsubscribe(remoteId *PublicKey, topic string) *Error
1289
1274
}
1290
1275
type Receiver struct {
1291
1276
ffiObject FfiObject
···
1346
1331
1347
1332
return res
1348
1333
}
1349
1349
-
1350
1350
-
// Subscribe to the given topic on the remote.
1351
1351
-
func (_self *Receiver) Subscribe(remoteId *PublicKey, topic string) *Error {
1352
1352
-
_pointer := _self.ffiObject.incrementPointer("*Receiver")
1353
1353
-
defer _self.ffiObject.decrementPointer()
1354
1354
-
_, err := uniffiRustCallAsync[Error](
1355
1355
-
FfiConverterErrorINSTANCE,
1356
1356
-
// completeFn
1357
1357
-
func(handle C.uint64_t, status *C.RustCallStatus) struct{} {
1358
1358
-
C.ffi_iroh_streamplace_rust_future_complete_void(handle, status)
1359
1359
-
return struct{}{}
1360
1360
-
},
1361
1361
-
// liftFn
1362
1362
-
func(_ struct{}) struct{} { return struct{}{} },
1363
1363
-
C.uniffi_iroh_streamplace_fn_method_receiver_subscribe(
1364
1364
-
_pointer, FfiConverterPublicKeyINSTANCE.Lower(remoteId), FfiConverterStringINSTANCE.Lower(topic)),
1365
1365
-
// pollFn
1366
1366
-
func(handle C.uint64_t, continuation C.UniffiRustFutureContinuationCallback, data C.uint64_t) {
1367
1367
-
C.ffi_iroh_streamplace_rust_future_poll_void(handle, continuation, data)
1368
1368
-
},
1369
1369
-
// freeFn
1370
1370
-
func(handle C.uint64_t) {
1371
1371
-
C.ffi_iroh_streamplace_rust_future_free_void(handle)
1372
1372
-
},
1373
1373
-
)
1374
1374
-
1375
1375
-
return err
1376
1376
-
}
1377
1377
-
1378
1378
-
// Unsubscribe from this topic on the remote.
1379
1379
-
func (_self *Receiver) Unsubscribe(remoteId *PublicKey, topic string) *Error {
1380
1380
-
_pointer := _self.ffiObject.incrementPointer("*Receiver")
1381
1381
-
defer _self.ffiObject.decrementPointer()
1382
1382
-
_, err := uniffiRustCallAsync[Error](
1383
1383
-
FfiConverterErrorINSTANCE,
1384
1384
-
// completeFn
1385
1385
-
func(handle C.uint64_t, status *C.RustCallStatus) struct{} {
1386
1386
-
C.ffi_iroh_streamplace_rust_future_complete_void(handle, status)
1387
1387
-
return struct{}{}
1388
1388
-
},
1389
1389
-
// liftFn
1390
1390
-
func(_ struct{}) struct{} { return struct{}{} },
1391
1391
-
C.uniffi_iroh_streamplace_fn_method_receiver_unsubscribe(
1392
1392
-
_pointer, FfiConverterPublicKeyINSTANCE.Lower(remoteId), FfiConverterStringINSTANCE.Lower(topic)),
1393
1393
-
// pollFn
1394
1394
-
func(handle C.uint64_t, continuation C.UniffiRustFutureContinuationCallback, data C.uint64_t) {
1395
1395
-
C.ffi_iroh_streamplace_rust_future_poll_void(handle, continuation, data)
1396
1396
-
},
1397
1397
-
// freeFn
1398
1398
-
func(handle C.uint64_t) {
1399
1399
-
C.ffi_iroh_streamplace_rust_future_free_void(handle)
1400
1400
-
},
1401
1401
-
)
1402
1402
-
1403
1403
-
return err
1404
1404
-
}
1405
1334
func (object *Receiver) Destroy() {
1406
1335
runtime.SetFinalizer(object, nil)
1407
1336
object.ffiObject.destroy()
···
1452
1381
}
1453
1382
1454
1383
type SenderInterface interface {
1384
1384
+
AddPeer(addr *NodeAddr) *Error
1455
1385
NodeAddr() *NodeAddr
1456
1456
-
// Sends the given data to all subscribers that have subscribed to this `key`.
1457
1457
-
Send(key string, data []byte) *Error
1386
1386
+
Send(nodeId *PublicKey, data []byte) *Error
1458
1387
}
1459
1388
type Sender struct {
1460
1389
ffiObject FfiObject
···
1487
1416
return res, err
1488
1417
}
1489
1418
1419
1419
+
func (_self *Sender) AddPeer(addr *NodeAddr) *Error {
1420
1420
+
_pointer := _self.ffiObject.incrementPointer("*Sender")
1421
1421
+
defer _self.ffiObject.decrementPointer()
1422
1422
+
_, err := uniffiRustCallAsync[Error](
1423
1423
+
FfiConverterErrorINSTANCE,
1424
1424
+
// completeFn
1425
1425
+
func(handle C.uint64_t, status *C.RustCallStatus) struct{} {
1426
1426
+
C.ffi_iroh_streamplace_rust_future_complete_void(handle, status)
1427
1427
+
return struct{}{}
1428
1428
+
},
1429
1429
+
// liftFn
1430
1430
+
func(_ struct{}) struct{} { return struct{}{} },
1431
1431
+
C.uniffi_iroh_streamplace_fn_method_sender_add_peer(
1432
1432
+
_pointer, FfiConverterNodeAddrINSTANCE.Lower(addr)),
1433
1433
+
// pollFn
1434
1434
+
func(handle C.uint64_t, continuation C.UniffiRustFutureContinuationCallback, data C.uint64_t) {
1435
1435
+
C.ffi_iroh_streamplace_rust_future_poll_void(handle, continuation, data)
1436
1436
+
},
1437
1437
+
// freeFn
1438
1438
+
func(handle C.uint64_t) {
1439
1439
+
C.ffi_iroh_streamplace_rust_future_free_void(handle)
1440
1440
+
},
1441
1441
+
)
1442
1442
+
1443
1443
+
return err
1444
1444
+
}
1445
1445
+
1490
1446
func (_self *Sender) NodeAddr() *NodeAddr {
1491
1447
_pointer := _self.ffiObject.incrementPointer("*Sender")
1492
1448
defer _self.ffiObject.decrementPointer()
···
1516
1472
return res
1517
1473
}
1518
1474
1519
1519
-
// Sends the given data to all subscribers that have subscribed to this `key`.
1520
1520
-
func (_self *Sender) Send(key string, data []byte) *Error {
1475
1475
+
func (_self *Sender) Send(nodeId *PublicKey, data []byte) *Error {
1521
1476
_pointer := _self.ffiObject.incrementPointer("*Sender")
1522
1477
defer _self.ffiObject.decrementPointer()
1523
1478
_, err := uniffiRustCallAsync[Error](
···
1530
1485
// liftFn
1531
1486
func(_ struct{}) struct{} { return struct{}{} },
1532
1487
C.uniffi_iroh_streamplace_fn_method_sender_send(
1533
1533
-
_pointer, FfiConverterStringINSTANCE.Lower(key), FfiConverterBytesINSTANCE.Lower(data)),
1488
1488
+
_pointer, FfiConverterPublicKeyINSTANCE.Lower(nodeId), FfiConverterBytesINSTANCE.Lower(data)),
1534
1489
// pollFn
1535
1490
func(handle C.uint64_t, continuation C.UniffiRustFutureContinuationCallback, data C.uint64_t) {
1536
1491
C.ffi_iroh_streamplace_rust_future_poll_void(handle, continuation, data)
···
1620
1575
var ErrErrorInvalidUrl = fmt.Errorf("ErrorInvalidUrl")
1621
1576
var ErrErrorIrohConnect = fmt.Errorf("ErrorIrohConnect")
1622
1577
var ErrErrorInvalidNetworkAddress = fmt.Errorf("ErrorInvalidNetworkAddress")
1578
1578
+
var ErrErrorOpenStream = fmt.Errorf("ErrorOpenStream")
1579
1579
+
var ErrErrorSendMessage = fmt.Errorf("ErrorSendMessage")
1580
1580
+
var ErrErrorNewConnection = fmt.Errorf("ErrorNewConnection")
1623
1581
var ErrErrorMissingConnection = fmt.Errorf("ErrorMissingConnection")
1624
1582
var ErrErrorInvalidPublicKey = fmt.Errorf("ErrorInvalidPublicKey")
1625
1625
-
var ErrErrorIrpc = fmt.Errorf("ErrorIrpc")
1626
1583
1627
1584
// Variant structs
1628
1585
type ErrorIrohBind struct {
···
1701
1658
return target == ErrErrorInvalidNetworkAddress
1702
1659
}
1703
1660
1661
1661
+
type ErrorOpenStream struct {
1662
1662
+
message string
1663
1663
+
}
1664
1664
+
1665
1665
+
func NewErrorOpenStream() *Error {
1666
1666
+
return &Error{err: &ErrorOpenStream{}}
1667
1667
+
}
1668
1668
+
1669
1669
+
func (e ErrorOpenStream) destroy() {
1670
1670
+
}
1671
1671
+
1672
1672
+
func (err ErrorOpenStream) Error() string {
1673
1673
+
return fmt.Sprintf("OpenStream: %s", err.message)
1674
1674
+
}
1675
1675
+
1676
1676
+
func (self ErrorOpenStream) Is(target error) bool {
1677
1677
+
return target == ErrErrorOpenStream
1678
1678
+
}
1679
1679
+
1680
1680
+
type ErrorSendMessage struct {
1681
1681
+
message string
1682
1682
+
}
1683
1683
+
1684
1684
+
func NewErrorSendMessage() *Error {
1685
1685
+
return &Error{err: &ErrorSendMessage{}}
1686
1686
+
}
1687
1687
+
1688
1688
+
func (e ErrorSendMessage) destroy() {
1689
1689
+
}
1690
1690
+
1691
1691
+
func (err ErrorSendMessage) Error() string {
1692
1692
+
return fmt.Sprintf("SendMessage: %s", err.message)
1693
1693
+
}
1694
1694
+
1695
1695
+
func (self ErrorSendMessage) Is(target error) bool {
1696
1696
+
return target == ErrErrorSendMessage
1697
1697
+
}
1698
1698
+
1699
1699
+
type ErrorNewConnection struct {
1700
1700
+
message string
1701
1701
+
}
1702
1702
+
1703
1703
+
func NewErrorNewConnection() *Error {
1704
1704
+
return &Error{err: &ErrorNewConnection{}}
1705
1705
+
}
1706
1706
+
1707
1707
+
func (e ErrorNewConnection) destroy() {
1708
1708
+
}
1709
1709
+
1710
1710
+
func (err ErrorNewConnection) Error() string {
1711
1711
+
return fmt.Sprintf("NewConnection: %s", err.message)
1712
1712
+
}
1713
1713
+
1714
1714
+
func (self ErrorNewConnection) Is(target error) bool {
1715
1715
+
return target == ErrErrorNewConnection
1716
1716
+
}
1717
1717
+
1704
1718
type ErrorMissingConnection struct {
1705
1719
message string
1706
1720
}
···
1739
1753
return target == ErrErrorInvalidPublicKey
1740
1754
}
1741
1755
1742
1742
-
type ErrorIrpc struct {
1743
1743
-
message string
1744
1744
-
}
1745
1745
-
1746
1746
-
func NewErrorIrpc() *Error {
1747
1747
-
return &Error{err: &ErrorIrpc{}}
1748
1748
-
}
1749
1749
-
1750
1750
-
func (e ErrorIrpc) destroy() {
1751
1751
-
}
1752
1752
-
1753
1753
-
func (err ErrorIrpc) Error() string {
1754
1754
-
return fmt.Sprintf("Irpc: %s", err.message)
1755
1755
-
}
1756
1756
-
1757
1757
-
func (self ErrorIrpc) Is(target error) bool {
1758
1758
-
return target == ErrErrorIrpc
1759
1759
-
}
1760
1760
-
1761
1756
type FfiConverterError struct{}
1762
1757
1763
1758
var FfiConverterErrorINSTANCE = FfiConverterError{}
···
1784
1779
case 4:
1785
1780
return &Error{&ErrorInvalidNetworkAddress{message}}
1786
1781
case 5:
1782
1782
+
return &Error{&ErrorOpenStream{message}}
1783
1783
+
case 6:
1784
1784
+
return &Error{&ErrorSendMessage{message}}
1785
1785
+
case 7:
1786
1786
+
return &Error{&ErrorNewConnection{message}}
1787
1787
+
case 8:
1787
1788
return &Error{&ErrorMissingConnection{message}}
1788
1788
-
case 6:
1789
1789
+
case 9:
1789
1790
return &Error{&ErrorInvalidPublicKey{message}}
1790
1790
-
case 7:
1791
1791
-
return &Error{&ErrorIrpc{message}}
1792
1791
default:
1793
1792
panic(fmt.Sprintf("Unknown error code %d in FfiConverterError.Read()", errorID))
1794
1793
}
···
1805
1804
writeInt32(writer, 3)
1806
1805
case *ErrorInvalidNetworkAddress:
1807
1806
writeInt32(writer, 4)
1808
1808
-
case *ErrorMissingConnection:
1807
1807
+
case *ErrorOpenStream:
1809
1808
writeInt32(writer, 5)
1810
1810
-
case *ErrorInvalidPublicKey:
1809
1809
+
case *ErrorSendMessage:
1811
1810
writeInt32(writer, 6)
1812
1812
-
case *ErrorIrpc:
1811
1811
+
case *ErrorNewConnection:
1813
1812
writeInt32(writer, 7)
1813
1813
+
case *ErrorMissingConnection:
1814
1814
+
writeInt32(writer, 8)
1815
1815
+
case *ErrorInvalidPublicKey:
1816
1816
+
writeInt32(writer, 9)
1814
1817
default:
1815
1818
_ = variantValue
1816
1819
panic(fmt.Sprintf("invalid error value `%v` in FfiConverterError.Write", value))
···
1829
1832
variantValue.destroy()
1830
1833
case ErrorInvalidNetworkAddress:
1831
1834
variantValue.destroy()
1835
1835
+
case ErrorOpenStream:
1836
1836
+
variantValue.destroy()
1837
1837
+
case ErrorSendMessage:
1838
1838
+
variantValue.destroy()
1839
1839
+
case ErrorNewConnection:
1840
1840
+
variantValue.destroy()
1832
1841
case ErrorMissingConnection:
1833
1842
variantValue.destroy()
1834
1843
case ErrorInvalidPublicKey:
1835
1835
-
variantValue.destroy()
1836
1836
-
case ErrorIrpc:
1837
1844
variantValue.destroy()
1838
1845
default:
1839
1846
_ = variantValue
+14
-25
pkg/iroh/generated/iroh_streamplace/iroh_streamplace.h
···
380
380
#endif
381
381
#ifndef UNIFFI_FFIDEF_CALLBACK_INTERFACE_DATA_HANDLER_METHOD0
382
382
#define UNIFFI_FFIDEF_CALLBACK_INTERFACE_DATA_HANDLER_METHOD0
383
383
-
typedef void (*UniffiCallbackInterfaceDataHandlerMethod0)(uint64_t uniffi_handle, RustBuffer topic, RustBuffer data, UniffiForeignFutureCompleteVoid uniffi_future_callback, uint64_t uniffi_callback_data, UniffiForeignFuture* uniffi_out_return);
383
383
+
typedef void (*UniffiCallbackInterfaceDataHandlerMethod0)(uint64_t uniffi_handle, void* peer, RustBuffer data, UniffiForeignFutureCompleteVoid uniffi_future_callback, uint64_t uniffi_callback_data, UniffiForeignFuture* uniffi_out_return);
384
384
385
385
// Making function static works arround:
386
386
// https://github.com/golang/go/issues/11263
387
387
static void call_UniffiCallbackInterfaceDataHandlerMethod0(
388
388
-
UniffiCallbackInterfaceDataHandlerMethod0 cb, uint64_t uniffi_handle, RustBuffer topic, RustBuffer data, UniffiForeignFutureCompleteVoid uniffi_future_callback, uint64_t uniffi_callback_data, UniffiForeignFuture* uniffi_out_return)
388
388
+
UniffiCallbackInterfaceDataHandlerMethod0 cb, uint64_t uniffi_handle, void* peer, RustBuffer data, UniffiForeignFutureCompleteVoid uniffi_future_callback, uint64_t uniffi_callback_data, UniffiForeignFuture* uniffi_out_return)
389
389
{
390
390
-
return cb(uniffi_handle, topic, data, uniffi_future_callback, uniffi_callback_data, uniffi_out_return);
390
390
+
return cb(uniffi_handle, peer, data, uniffi_future_callback, uniffi_callback_data, uniffi_out_return);
391
391
}
392
392
393
393
···
417
417
#endif
418
418
#ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_DATAHANDLER_HANDLE_DATA
419
419
#define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_DATAHANDLER_HANDLE_DATA
420
420
-
uint64_t uniffi_iroh_streamplace_fn_method_datahandler_handle_data(void* ptr, RustBuffer topic, RustBuffer data
420
420
+
uint64_t uniffi_iroh_streamplace_fn_method_datahandler_handle_data(void* ptr, void* peer, RustBuffer data
421
421
);
422
422
#endif
423
423
#ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_CLONE_ENDPOINT
···
536
536
uint64_t uniffi_iroh_streamplace_fn_method_receiver_node_addr(void* ptr
537
537
);
538
538
#endif
539
539
-
#ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_RECEIVER_SUBSCRIBE
540
540
-
#define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_RECEIVER_SUBSCRIBE
541
541
-
uint64_t uniffi_iroh_streamplace_fn_method_receiver_subscribe(void* ptr, void* remote_id, RustBuffer topic
542
542
-
);
543
543
-
#endif
544
544
-
#ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_RECEIVER_UNSUBSCRIBE
545
545
-
#define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_RECEIVER_UNSUBSCRIBE
546
546
-
uint64_t uniffi_iroh_streamplace_fn_method_receiver_unsubscribe(void* ptr, void* remote_id, RustBuffer topic
547
547
-
);
548
548
-
#endif
549
539
#ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_CLONE_SENDER
550
540
#define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_CLONE_SENDER
551
541
void* uniffi_iroh_streamplace_fn_clone_sender(void* ptr, RustCallStatus *out_status
···
561
551
uint64_t uniffi_iroh_streamplace_fn_constructor_sender_new(void* endpoint
562
552
);
563
553
#endif
554
554
+
#ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_SENDER_ADD_PEER
555
555
+
#define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_SENDER_ADD_PEER
556
556
+
uint64_t uniffi_iroh_streamplace_fn_method_sender_add_peer(void* ptr, void* addr
557
557
+
);
558
558
+
#endif
564
559
#ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_SENDER_NODE_ADDR
565
560
#define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_SENDER_NODE_ADDR
566
561
uint64_t uniffi_iroh_streamplace_fn_method_sender_node_addr(void* ptr
···
568
563
#endif
569
564
#ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_SENDER_SEND
570
565
#define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_FN_METHOD_SENDER_SEND
571
571
-
uint64_t uniffi_iroh_streamplace_fn_method_sender_send(void* ptr, RustBuffer key, RustBuffer data
566
566
+
uint64_t uniffi_iroh_streamplace_fn_method_sender_send(void* ptr, void* node_id, RustBuffer data
572
567
);
573
568
#endif
574
569
#ifndef UNIFFI_FFIDEF_FFI_IROH_STREAMPLACE_RUSTBUFFER_ALLOC
···
911
906
912
907
);
913
908
#endif
914
914
-
#ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_RECEIVER_SUBSCRIBE
915
915
-
#define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_RECEIVER_SUBSCRIBE
916
916
-
uint16_t uniffi_iroh_streamplace_checksum_method_receiver_subscribe(void
917
917
-
918
918
-
);
919
919
-
#endif
920
920
-
#ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_RECEIVER_UNSUBSCRIBE
921
921
-
#define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_RECEIVER_UNSUBSCRIBE
922
922
-
uint16_t uniffi_iroh_streamplace_checksum_method_receiver_unsubscribe(void
909
909
+
#ifndef UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_SENDER_ADD_PEER
910
910
+
#define UNIFFI_FFIDEF_UNIFFI_IROH_STREAMPLACE_CHECKSUM_METHOD_SENDER_ADD_PEER
911
911
+
uint16_t uniffi_iroh_streamplace_checksum_method_sender_add_peer(void
923
912
924
913
);
925
914
#endif
···
978
967
);
979
968
#endif
980
969
981
981
-
void iroh_streamplace_cgo_dispatchCallbackInterfaceDataHandlerMethod0(uint64_t uniffi_handle, RustBuffer topic, RustBuffer data, UniffiForeignFutureCompleteVoid uniffi_future_callback, uint64_t uniffi_callback_data, UniffiForeignFuture* uniffi_out_return);
970
970
+
void iroh_streamplace_cgo_dispatchCallbackInterfaceDataHandlerMethod0(uint64_t uniffi_handle, void* peer, RustBuffer data, UniffiForeignFutureCompleteVoid uniffi_future_callback, uint64_t uniffi_callback_data, UniffiForeignFuture* uniffi_out_return);
982
971
void iroh_streamplace_cgo_dispatchCallbackInterfaceDataHandlerFree(uint64_t handle);
983
972
984
973
void iroh_streamplace_uniffiFutureContinuationCallback(uint64_t, int8_t);
-17
rust/iroh-streamplace/Makefile
···
1
1
-
.PHONY: all
2
2
-
all: rust go
3
3
-
4
4
-
.PHONY: rust
5
5
-
rust:
6
6
-
cargo install uniffi-bindgen-go --git https://github.com/NordSecurity/uniffi-bindgen-go --tag v0.3.0+v0.28.3
7
7
-
cargo build --release
8
8
-
9
9
-
.PHONY: go
10
10
-
go:
11
11
-
mkdir -p dist
12
12
-
uniffi-bindgen-go --out-dir ../../pkg/iroh/generated --library ./target/release/libiroh_streamplace.dylib
13
13
-
14
14
-
.PHONY: test
15
15
-
test:
16
16
-
cargo test
17
17
-
go test ./pkg/...