Skip to content

Commit

Permalink
ffi: update RelayConnectionStats
Browse files Browse the repository at this point in the history
  • Loading branch information
yukibtc committed Aug 25, 2023
1 parent bfecac7 commit 32bea21
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions bindings/nostr-sdk-ffi/src/nostr_sdk.udl
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,9 @@ interface Tag {
interface RelayConnectionStats {
u64 attempts();
u64 success();
u64 bytes_sent();
u64 bytes_received();
duration? latency();
u64 connected_at();
};

Expand Down
12 changes: 12 additions & 0 deletions bindings/nostr-sdk-ffi/src/relay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,18 @@ impl RelayConnectionStats {
pub fn connected_at(&self) -> u64 {
self.inner.connected_at().as_u64()
}

pub fn bytes_sent(&self) -> u64 {
self.inner.bytes_sent() as u64
}

pub fn bytes_received(&self) -> u64 {
self.inner.bytes_received() as u64
}

pub fn latency(&self) -> Option<Duration> {
self.inner.latency_blocking()
}
}

pub struct ActiveSubscription {
Expand Down

0 comments on commit 32bea21

Please sign in to comment.