mirror of
https://gitlab.com/veilid/veilid.git
synced 2025-03-01 02:41:09 -05:00
add veilid_api logging to debug calls through the api
This commit is contained in:
parent
380ac1883f
commit
292664f3fe
@ -91,7 +91,7 @@ pub fn veilid_version() -> (u32, u32, u32) {
|
|||||||
#[cfg(target_os = "android")]
|
#[cfg(target_os = "android")]
|
||||||
pub use intf::android::veilid_core_setup_android;
|
pub use intf::android::veilid_core_setup_android;
|
||||||
|
|
||||||
pub static DEFAULT_LOG_IGNORE_LIST: [&str; 23] = [
|
pub static DEFAULT_LOG_IGNORE_LIST: [&str; 24] = [
|
||||||
"mio",
|
"mio",
|
||||||
"h2",
|
"h2",
|
||||||
"hyper",
|
"hyper",
|
||||||
@ -115,6 +115,7 @@ pub static DEFAULT_LOG_IGNORE_LIST: [&str; 23] = [
|
|||||||
"attohttpc",
|
"attohttpc",
|
||||||
"ws_stream_wasm",
|
"ws_stream_wasm",
|
||||||
"keyvaluedb_web",
|
"keyvaluedb_web",
|
||||||
|
"veilid_api",
|
||||||
];
|
];
|
||||||
|
|
||||||
use cfg_if::*;
|
use cfg_if::*;
|
||||||
|
@ -39,7 +39,7 @@ pub struct VeilidAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl VeilidAPI {
|
impl VeilidAPI {
|
||||||
#[instrument(skip_all)]
|
#[instrument(target = "veilid_api", level = "debug", skip_all)]
|
||||||
pub(crate) fn new(context: VeilidCoreContext) -> Self {
|
pub(crate) fn new(context: VeilidCoreContext) -> Self {
|
||||||
Self {
|
Self {
|
||||||
inner: Arc::new(Mutex::new(VeilidAPIInner {
|
inner: Arc::new(Mutex::new(VeilidAPIInner {
|
||||||
@ -49,7 +49,7 @@ impl VeilidAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Shut down Veilid and terminate the API
|
/// Shut down Veilid and terminate the API
|
||||||
#[instrument(skip_all)]
|
#[instrument(target = "veilid_api", level = "debug", skip_all)]
|
||||||
pub async fn shutdown(self) {
|
pub async fn shutdown(self) {
|
||||||
let context = { self.inner.lock().context.take() };
|
let context = { self.inner.lock().context.take() };
|
||||||
if let Some(context) = context {
|
if let Some(context) = context {
|
||||||
@ -168,6 +168,7 @@ impl VeilidAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Connect to the network
|
/// Connect to the network
|
||||||
|
#[instrument(target = "veilid_api", level = "debug", skip_all)]
|
||||||
pub async fn attach(&self) -> VeilidAPIResult<()> {
|
pub async fn attach(&self) -> VeilidAPIResult<()> {
|
||||||
let attachment_manager = self.attachment_manager()?;
|
let attachment_manager = self.attachment_manager()?;
|
||||||
if !attachment_manager.attach().await {
|
if !attachment_manager.attach().await {
|
||||||
@ -177,6 +178,7 @@ impl VeilidAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Disconnect from the network
|
/// Disconnect from the network
|
||||||
|
#[instrument(target = "veilid_api", level = "debug", skip_all)]
|
||||||
pub async fn detach(&self) -> VeilidAPIResult<()> {
|
pub async fn detach(&self) -> VeilidAPIResult<()> {
|
||||||
let attachment_manager = self.attachment_manager()?;
|
let attachment_manager = self.attachment_manager()?;
|
||||||
if !attachment_manager.detach().await {
|
if !attachment_manager.detach().await {
|
||||||
@ -189,6 +191,7 @@ impl VeilidAPI {
|
|||||||
// Routing Context
|
// Routing Context
|
||||||
|
|
||||||
/// Get a new `RoutingContext` object to use to send messages over the Veilid network.
|
/// Get a new `RoutingContext` object to use to send messages over the Veilid network.
|
||||||
|
#[instrument(target = "veilid_api", level = "debug", skip_all, err, ret)]
|
||||||
pub fn routing_context(&self) -> VeilidAPIResult<RoutingContext> {
|
pub fn routing_context(&self) -> VeilidAPIResult<RoutingContext> {
|
||||||
RoutingContext::try_new(self.clone())
|
RoutingContext::try_new(self.clone())
|
||||||
}
|
}
|
||||||
@ -200,6 +203,7 @@ impl VeilidAPI {
|
|||||||
/// `VLD0:XmnGyJrjMJBRC5ayJZRPXWTBspdX36-pbLb98H3UMeE` but if the prefix is left off
|
/// `VLD0:XmnGyJrjMJBRC5ayJZRPXWTBspdX36-pbLb98H3UMeE` but if the prefix is left off
|
||||||
/// `XmnGyJrjMJBRC5ayJZRPXWTBspdX36-pbLb98H3UMeE` will be parsed with the 'best' cryptosystem
|
/// `XmnGyJrjMJBRC5ayJZRPXWTBspdX36-pbLb98H3UMeE` will be parsed with the 'best' cryptosystem
|
||||||
/// available (at the time of this writing this is `VLD0`)
|
/// available (at the time of this writing this is `VLD0`)
|
||||||
|
#[instrument(target = "veilid_api", level = "debug", skip(self), fields(s=s.to_string()), ret, err)]
|
||||||
pub async fn parse_as_target<S: ToString>(&self, s: S) -> VeilidAPIResult<Target> {
|
pub async fn parse_as_target<S: ToString>(&self, s: S) -> VeilidAPIResult<Target> {
|
||||||
let s = s.to_string();
|
let s = s.to_string();
|
||||||
|
|
||||||
@ -231,6 +235,7 @@ impl VeilidAPI {
|
|||||||
///
|
///
|
||||||
/// Returns a route id and 'blob' that can be published over some means (DHT or otherwise) to be
|
/// Returns a route id and 'blob' that can be published over some means (DHT or otherwise) to be
|
||||||
/// imported by another Veilid node.
|
/// imported by another Veilid node.
|
||||||
|
//#[instrument(target = "veilid_api", level = "debug", skip(self), ret, err)]
|
||||||
pub async fn new_private_route(&self) -> VeilidAPIResult<(RouteId, Vec<u8>)> {
|
pub async fn new_private_route(&self) -> VeilidAPIResult<(RouteId, Vec<u8>)> {
|
||||||
self.new_custom_private_route(
|
self.new_custom_private_route(
|
||||||
&VALID_CRYPTO_KINDS,
|
&VALID_CRYPTO_KINDS,
|
||||||
@ -246,6 +251,7 @@ impl VeilidAPI {
|
|||||||
///
|
///
|
||||||
/// Returns a route id and 'blob' that can be published over some means (DHT or otherwise) to be
|
/// Returns a route id and 'blob' that can be published over some means (DHT or otherwise) to be
|
||||||
/// imported by another Veilid node.
|
/// imported by another Veilid node.
|
||||||
|
#[instrument(target = "veilid_api", level = "debug", skip(self), ret, err)]
|
||||||
pub async fn new_custom_private_route(
|
pub async fn new_custom_private_route(
|
||||||
&self,
|
&self,
|
||||||
crypto_kinds: &[CryptoKind],
|
crypto_kinds: &[CryptoKind],
|
||||||
@ -293,6 +299,7 @@ impl VeilidAPI {
|
|||||||
/// Import a private route blob as a remote private route.
|
/// Import a private route blob as a remote private route.
|
||||||
///
|
///
|
||||||
/// Returns a route id that can be used to send private messages to the node creating this route.
|
/// Returns a route id that can be used to send private messages to the node creating this route.
|
||||||
|
#[instrument(target = "veilid_api", level = "debug", skip(self), ret, err)]
|
||||||
pub fn import_remote_private_route(&self, blob: Vec<u8>) -> VeilidAPIResult<RouteId> {
|
pub fn import_remote_private_route(&self, blob: Vec<u8>) -> VeilidAPIResult<RouteId> {
|
||||||
let rss = self.routing_table()?.route_spec_store();
|
let rss = self.routing_table()?.route_spec_store();
|
||||||
rss.import_remote_private_route_blob(blob)
|
rss.import_remote_private_route_blob(blob)
|
||||||
@ -302,6 +309,7 @@ impl VeilidAPI {
|
|||||||
///
|
///
|
||||||
/// This will deactivate the route and free its resources and it can no longer be sent to
|
/// This will deactivate the route and free its resources and it can no longer be sent to
|
||||||
/// or received from.
|
/// or received from.
|
||||||
|
#[instrument(target = "veilid_api", level = "debug", skip(self), ret, err)]
|
||||||
pub fn release_private_route(&self, route_id: RouteId) -> VeilidAPIResult<()> {
|
pub fn release_private_route(&self, route_id: RouteId) -> VeilidAPIResult<()> {
|
||||||
let rss = self.routing_table()?.route_spec_store();
|
let rss = self.routing_table()?.route_spec_store();
|
||||||
if !rss.release_route(route_id) {
|
if !rss.release_route(route_id) {
|
||||||
@ -317,6 +325,7 @@ impl VeilidAPI {
|
|||||||
///
|
///
|
||||||
/// * `call_id` - specifies which call to reply to, and it comes from a [VeilidUpdate::AppCall], specifically the [VeilidAppCall::id()] value.
|
/// * `call_id` - specifies which call to reply to, and it comes from a [VeilidUpdate::AppCall], specifically the [VeilidAppCall::id()] value.
|
||||||
/// * `message` - is an answer blob to be returned by the remote node's [RoutingContext::app_call()] function, and may be up to 32768 bytes
|
/// * `message` - is an answer blob to be returned by the remote node's [RoutingContext::app_call()] function, and may be up to 32768 bytes
|
||||||
|
#[instrument(target = "veilid_api", level = "debug", skip(self), ret, err)]
|
||||||
pub async fn app_call_reply(
|
pub async fn app_call_reply(
|
||||||
&self,
|
&self,
|
||||||
call_id: OperationId,
|
call_id: OperationId,
|
||||||
@ -333,6 +342,7 @@ impl VeilidAPI {
|
|||||||
// Tunnel Building
|
// Tunnel Building
|
||||||
|
|
||||||
#[cfg(feature = "unstable-tunnels")]
|
#[cfg(feature = "unstable-tunnels")]
|
||||||
|
#[instrument(target = "veilid_api", level = "debug", skip(self), ret, err)]
|
||||||
pub async fn start_tunnel(
|
pub async fn start_tunnel(
|
||||||
&self,
|
&self,
|
||||||
_endpoint_mode: TunnelMode,
|
_endpoint_mode: TunnelMode,
|
||||||
@ -342,6 +352,7 @@ impl VeilidAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "unstable-tunnels")]
|
#[cfg(feature = "unstable-tunnels")]
|
||||||
|
#[instrument(target = "veilid_api", level = "debug", skip(self), ret, err)]
|
||||||
pub async fn complete_tunnel(
|
pub async fn complete_tunnel(
|
||||||
&self,
|
&self,
|
||||||
_endpoint_mode: TunnelMode,
|
_endpoint_mode: TunnelMode,
|
||||||
@ -352,6 +363,7 @@ impl VeilidAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "unstable-tunnels")]
|
#[cfg(feature = "unstable-tunnels")]
|
||||||
|
#[instrument(target = "veilid_api", level = "debug", skip(self), ret, err)]
|
||||||
pub async fn cancel_tunnel(&self, _tunnel_id: TunnelId) -> VeilidAPIResult<bool> {
|
pub async fn cancel_tunnel(&self, _tunnel_id: TunnelId) -> VeilidAPIResult<bool> {
|
||||||
panic!("unimplemented");
|
panic!("unimplemented");
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,15 @@ pub struct RoutingContext {
|
|||||||
unlocked_inner: Arc<RoutingContextUnlockedInner>,
|
unlocked_inner: Arc<RoutingContextUnlockedInner>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl fmt::Debug for RoutingContext {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
|
f.debug_struct("RoutingContext")
|
||||||
|
.field("ptr", &format!("{:p}", Arc::as_ptr(&self.unlocked_inner)))
|
||||||
|
.field("safety_selection", &self.unlocked_inner.safety_selection)
|
||||||
|
.finish()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl RoutingContext {
|
impl RoutingContext {
|
||||||
////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@ -63,6 +72,7 @@ impl RoutingContext {
|
|||||||
/// * Sequencing default is to prefer ordered before unordered message delivery
|
/// * Sequencing default is to prefer ordered before unordered message delivery
|
||||||
///
|
///
|
||||||
/// To customize the safety selection in use, use [RoutingContext::with_safety()].
|
/// To customize the safety selection in use, use [RoutingContext::with_safety()].
|
||||||
|
#[instrument(target = "veilid_api", level = "debug", ret, err)]
|
||||||
pub fn with_default_safety(self) -> VeilidAPIResult<Self> {
|
pub fn with_default_safety(self) -> VeilidAPIResult<Self> {
|
||||||
let config = self.api.config()?;
|
let config = self.api.config()?;
|
||||||
let c = config.get();
|
let c = config.get();
|
||||||
@ -76,6 +86,7 @@ impl RoutingContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Use a custom [SafetySelection]. Can be used to disable safety via [SafetySelection::Unsafe]
|
/// Use a custom [SafetySelection]. Can be used to disable safety via [SafetySelection::Unsafe]
|
||||||
|
#[instrument(target = "veilid_api", level = "debug", ret, err)]
|
||||||
pub fn with_safety(self, safety_selection: SafetySelection) -> VeilidAPIResult<Self> {
|
pub fn with_safety(self, safety_selection: SafetySelection) -> VeilidAPIResult<Self> {
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
api: self.api.clone(),
|
api: self.api.clone(),
|
||||||
@ -85,6 +96,7 @@ impl RoutingContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Use a specified [Sequencing] preference, with or without privacy
|
/// Use a specified [Sequencing] preference, with or without privacy
|
||||||
|
#[instrument(target = "veilid_api", level = "debug", ret)]
|
||||||
pub fn with_sequencing(self, sequencing: Sequencing) -> Self {
|
pub fn with_sequencing(self, sequencing: Sequencing) -> Self {
|
||||||
Self {
|
Self {
|
||||||
api: self.api.clone(),
|
api: self.api.clone(),
|
||||||
@ -120,6 +132,7 @@ impl RoutingContext {
|
|||||||
self.api.clone()
|
self.api.clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[instrument(target = "veilid_api", level = "debug", ret, err)]
|
||||||
async fn get_destination(&self, target: Target) -> VeilidAPIResult<rpc_processor::Destination> {
|
async fn get_destination(&self, target: Target) -> VeilidAPIResult<rpc_processor::Destination> {
|
||||||
let rpc_processor = self.api.rpc_processor()?;
|
let rpc_processor = self.api.rpc_processor()?;
|
||||||
rpc_processor
|
rpc_processor
|
||||||
@ -139,6 +152,7 @@ impl RoutingContext {
|
|||||||
/// * `message` - an arbitrary message blob of up to 32768 bytes
|
/// * `message` - an arbitrary message blob of up to 32768 bytes
|
||||||
///
|
///
|
||||||
/// Returns an answer blob of up to 32768 bytes
|
/// Returns an answer blob of up to 32768 bytes
|
||||||
|
#[instrument(target = "veilid_api", level = "debug", ret, err)]
|
||||||
pub async fn app_call(&self, target: Target, message: Vec<u8>) -> VeilidAPIResult<Vec<u8>> {
|
pub async fn app_call(&self, target: Target, message: Vec<u8>) -> VeilidAPIResult<Vec<u8>> {
|
||||||
let rpc_processor = self.api.rpc_processor()?;
|
let rpc_processor = self.api.rpc_processor()?;
|
||||||
|
|
||||||
@ -169,6 +183,7 @@ impl RoutingContext {
|
|||||||
///
|
///
|
||||||
/// * `target` - can be either a direct node id or a private route
|
/// * `target` - can be either a direct node id or a private route
|
||||||
/// * `message` - an arbitrary message blob of up to 32768 bytes
|
/// * `message` - an arbitrary message blob of up to 32768 bytes
|
||||||
|
#[instrument(target = "veilid_api", level = "debug", ret, err)]
|
||||||
pub async fn app_message(&self, target: Target, message: Vec<u8>) -> VeilidAPIResult<()> {
|
pub async fn app_message(&self, target: Target, message: Vec<u8>) -> VeilidAPIResult<()> {
|
||||||
let rpc_processor = self.api.rpc_processor()?;
|
let rpc_processor = self.api.rpc_processor()?;
|
||||||
|
|
||||||
@ -200,6 +215,7 @@ impl RoutingContext {
|
|||||||
/// The record is considered 'open' after the create operation succeeds.
|
/// The record is considered 'open' after the create operation succeeds.
|
||||||
///
|
///
|
||||||
/// Returns the newly allocated DHT record's key if successful.
|
/// Returns the newly allocated DHT record's key if successful.
|
||||||
|
#[instrument(target = "veilid_api", level = "debug", ret, err)]
|
||||||
pub async fn create_dht_record(
|
pub async fn create_dht_record(
|
||||||
&self,
|
&self,
|
||||||
schema: DHTSchema,
|
schema: DHTSchema,
|
||||||
@ -224,6 +240,7 @@ impl RoutingContext {
|
|||||||
/// safety selection.
|
/// safety selection.
|
||||||
///
|
///
|
||||||
/// Returns the DHT record descriptor for the opened record if successful
|
/// Returns the DHT record descriptor for the opened record if successful
|
||||||
|
#[instrument(target = "veilid_api", level = "debug", ret, err)]
|
||||||
pub async fn open_dht_record(
|
pub async fn open_dht_record(
|
||||||
&self,
|
&self,
|
||||||
key: TypedKey,
|
key: TypedKey,
|
||||||
@ -239,6 +256,7 @@ impl RoutingContext {
|
|||||||
/// Closes a DHT record at a specific key that was opened with create_dht_record or open_dht_record.
|
/// Closes a DHT record at a specific key that was opened with create_dht_record or open_dht_record.
|
||||||
///
|
///
|
||||||
/// Closing a record allows you to re-open it with a different routing context
|
/// Closing a record allows you to re-open it with a different routing context
|
||||||
|
#[instrument(target = "veilid_api", level = "debug", ret, err)]
|
||||||
pub async fn close_dht_record(&self, key: TypedKey) -> VeilidAPIResult<()> {
|
pub async fn close_dht_record(&self, key: TypedKey) -> VeilidAPIResult<()> {
|
||||||
Crypto::validate_crypto_kind(key.kind)?;
|
Crypto::validate_crypto_kind(key.kind)?;
|
||||||
let storage_manager = self.api.storage_manager()?;
|
let storage_manager = self.api.storage_manager()?;
|
||||||
@ -250,6 +268,7 @@ impl RoutingContext {
|
|||||||
/// If the record is opened, it must be closed before it is deleted.
|
/// If the record is opened, it must be closed before it is deleted.
|
||||||
/// Deleting a record does not delete it from the network, but will remove the storage of the record
|
/// Deleting a record does not delete it from the network, but will remove the storage of the record
|
||||||
/// locally, and will prevent its value from being refreshed on the network by this node.
|
/// locally, and will prevent its value from being refreshed on the network by this node.
|
||||||
|
#[instrument(target = "veilid_api", level = "debug", ret, err)]
|
||||||
pub async fn delete_dht_record(&self, key: TypedKey) -> VeilidAPIResult<()> {
|
pub async fn delete_dht_record(&self, key: TypedKey) -> VeilidAPIResult<()> {
|
||||||
Crypto::validate_crypto_kind(key.kind)?;
|
Crypto::validate_crypto_kind(key.kind)?;
|
||||||
let storage_manager = self.api.storage_manager()?;
|
let storage_manager = self.api.storage_manager()?;
|
||||||
@ -262,6 +281,7 @@ impl RoutingContext {
|
|||||||
///
|
///
|
||||||
/// Returns `None` if the value subkey has not yet been set
|
/// Returns `None` if the value subkey has not yet been set
|
||||||
/// Returns `Some(data)` if the value subkey has valid data
|
/// Returns `Some(data)` if the value subkey has valid data
|
||||||
|
#[instrument(target = "veilid_api", level = "debug", ret, err)]
|
||||||
pub async fn get_dht_value(
|
pub async fn get_dht_value(
|
||||||
&self,
|
&self,
|
||||||
key: TypedKey,
|
key: TypedKey,
|
||||||
@ -280,6 +300,7 @@ impl RoutingContext {
|
|||||||
///
|
///
|
||||||
/// Returns `None` if the value was successfully put
|
/// Returns `None` if the value was successfully put
|
||||||
/// Returns `Some(data)` if the value put was older than the one available on the network
|
/// Returns `Some(data)` if the value put was older than the one available on the network
|
||||||
|
#[instrument(target = "veilid_api", level = "debug", ret, err)]
|
||||||
pub async fn set_dht_value(
|
pub async fn set_dht_value(
|
||||||
&self,
|
&self,
|
||||||
key: TypedKey,
|
key: TypedKey,
|
||||||
@ -311,6 +332,7 @@ impl RoutingContext {
|
|||||||
/// * If a member (either the owner or a SMPL schema member) has opened the key for writing (even if no writing is performed) then the watch will be signed and guaranteed network.dht.member_watch_limit per writer
|
/// * If a member (either the owner or a SMPL schema member) has opened the key for writing (even if no writing is performed) then the watch will be signed and guaranteed network.dht.member_watch_limit per writer
|
||||||
///
|
///
|
||||||
/// Members can be specified via the SMPL schema and do not need to allocate writable subkeys in order to offer a member watch capability.
|
/// Members can be specified via the SMPL schema and do not need to allocate writable subkeys in order to offer a member watch capability.
|
||||||
|
#[instrument(target = "veilid_api", level = "debug", ret, err)]
|
||||||
pub async fn watch_dht_values(
|
pub async fn watch_dht_values(
|
||||||
&self,
|
&self,
|
||||||
key: TypedKey,
|
key: TypedKey,
|
||||||
@ -330,6 +352,7 @@ impl RoutingContext {
|
|||||||
/// This is a convenience function that cancels watching all subkeys in a range
|
/// This is a convenience function that cancels watching all subkeys in a range
|
||||||
/// Returns Ok(true) if there is any remaining watch for this record
|
/// Returns Ok(true) if there is any remaining watch for this record
|
||||||
/// Returns Ok(false) if the entire watch has been cancelled
|
/// Returns Ok(false) if the entire watch has been cancelled
|
||||||
|
#[instrument(target = "veilid_api", level = "debug", ret, err)]
|
||||||
pub async fn cancel_dht_watch(
|
pub async fn cancel_dht_watch(
|
||||||
&self,
|
&self,
|
||||||
key: TypedKey,
|
key: TypedKey,
|
||||||
@ -344,11 +367,13 @@ impl RoutingContext {
|
|||||||
/// Block Store
|
/// Block Store
|
||||||
|
|
||||||
#[cfg(feature = "unstable-blockstore")]
|
#[cfg(feature = "unstable-blockstore")]
|
||||||
|
#[instrument(target = "veilid_api", level = "debug", ret, err)]
|
||||||
pub async fn find_block(&self, _block_id: PublicKey) -> VeilidAPIResult<Vec<u8>> {
|
pub async fn find_block(&self, _block_id: PublicKey) -> VeilidAPIResult<Vec<u8>> {
|
||||||
panic!("unimplemented");
|
panic!("unimplemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "unstable-blockstore")]
|
#[cfg(feature = "unstable-blockstore")]
|
||||||
|
#[instrument(target = "veilid_api", level = "debug", ret, err)]
|
||||||
pub async fn supply_block(&self, _block_id: PublicKey) -> VeilidAPIResult<bool> {
|
pub async fn supply_block(&self, _block_id: PublicKey) -> VeilidAPIResult<bool> {
|
||||||
panic!("unimplemented");
|
panic!("unimplemented");
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ cfg_if::cfg_if! {
|
|||||||
use self::windows::PlatformSupportWindows as PlatformSupport;
|
use self::windows::PlatformSupportWindows as PlatformSupport;
|
||||||
} else if #[cfg(any(target_os = "macos", target_os = "ios"))] {
|
} else if #[cfg(any(target_os = "macos", target_os = "ios"))] {
|
||||||
use self::apple::PlatformSupportApple as PlatformSupport;
|
use self::apple::PlatformSupportApple as PlatformSupport;
|
||||||
} else if #[cfg(any(target_os = "openbsd"))] {
|
} else if #[cfg(target_os = "openbsd")] {
|
||||||
use self::openbsd::PlatformSupportOpenBSD as PlatformSupport;
|
use self::openbsd::PlatformSupportOpenBSD as PlatformSupport;
|
||||||
} else {
|
} else {
|
||||||
compile_error!("No network interfaces support for this platform!");
|
compile_error!("No network interfaces support for this platform!");
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
#![cfg(any(target_os = "openbsd"))]
|
#![cfg(target_os = "openbsd")]
|
||||||
#![allow(non_camel_case_types)]
|
#![allow(non_camel_case_types)]
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
use libc::{
|
use libc::{
|
||||||
close, freeifaddrs, getifaddrs, if_nametoindex, ifaddrs, ioctl, pid_t, sockaddr, sockaddr_in6, c_short,
|
c_short, close, freeifaddrs, getifaddrs, if_nametoindex, ifaddrs, ioctl, pid_t, sockaddr,
|
||||||
socket, sysctl, time_t, AF_INET6, CTL_NET, IFF_BROADCAST, IFF_LOOPBACK, IFF_POINTOPOINT,
|
sockaddr_in6, socket, sysctl, time_t, AF_INET6, CTL_NET, IFF_BROADCAST, IFF_LOOPBACK,
|
||||||
IFF_RUNNING, IFNAMSIZ, NET_RT_FLAGS, PF_ROUTE, SOCK_DGRAM,
|
IFF_POINTOPOINT, IFF_RUNNING, IFNAMSIZ, NET_RT_FLAGS, PF_ROUTE, SOCK_DGRAM,
|
||||||
};
|
};
|
||||||
use sockaddr_tools::SockAddr;
|
use sockaddr_tools::SockAddr;
|
||||||
use std::ffi::CStr;
|
use std::ffi::CStr;
|
||||||
@ -29,7 +29,6 @@ const RTA_DST: c_int = 1;
|
|||||||
const RTA_GATEWAY: c_int = 2;
|
const RTA_GATEWAY: c_int = 2;
|
||||||
const RTF_GATEWAY: c_int = 2;
|
const RTF_GATEWAY: c_int = 2;
|
||||||
|
|
||||||
|
|
||||||
macro_rules! set_name {
|
macro_rules! set_name {
|
||||||
($name_field:expr, $name_str:expr) => {{
|
($name_field:expr, $name_str:expr) => {{
|
||||||
let name_c = &::std::ffi::CString::new($name_str.to_owned()).map_err(|_| {
|
let name_c = &::std::ffi::CString::new($name_str.to_owned()).map_err(|_| {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user