KadNode icon indicating copy to clipboard operation
KadNode copied to clipboard

KadNode as a library

Open chriamue opened this issue 6 years ago • 7 comments

Is it possible that this project serves a library to include in other projects. I really would like to use it for example in chat applications to resolve ip by public key as 'dns' .

chriamue avatar Aug 16 '17 13:08 chriamue

It is not possible yet, but I would love to do it and will give it a shoot very soon. The project has recently been rewritten and I currently prepare the new release (packaging, testing etc.).

mwarning avatar Aug 16 '17 16:08 mwarning

I've already created some cmake projects based on this cmake template (https://github.com/cginternals/cmake-init) which also has packaging for deb and rpm. Let me know if I can help anyhow.

chriamue avatar Aug 16 '17 16:08 chriamue

Thanks, but that would be too much of a change right now. Anyway, how do you like the library to operate?

  • kadnode, just as a library?
  • how should the API look like?

So far this is the first API method I came up with: int kadnode_lookup( const char query[], IP addr_array[], size_t addr_num );

How should settings be provided?

mwarning avatar Aug 16 '17 17:08 mwarning

Also important, how should the (non-blocking) event loop be integrated? Maybe the library should utilize its own thread.

mwarning avatar Aug 16 '17 18:08 mwarning

I plan to provide to config as strings, not as file. For my own I would run the event loop in my own thread, but for convenience the library should additionally have its own thread.

Here is an example how I would like to use it. https://github.com/hyphaproject/hypha/blob/namesystem/source/utils/source/namesystem.cpp

chriamue avatar Aug 17 '17 06:08 chriamue

I think it good practice to not do threading in the library. Some people want to use pthreads or other libs that might not be compatible. Your example looks about right. Might take a few days to implement something usable.

mwarning avatar Aug 18 '17 22:08 mwarning

Library support won't make it into 2.0.0. There is too much work to be done. It will be a testing release anyway.

mwarning avatar Sep 01 '17 20:09 mwarning