Git Product home page Git Product logo

Comments (13)

jrhea avatar jrhea commented on June 25, 2024 3

@bigs @vyzo @raulk

tldr;
i was able to run the daemon from Java. do u mind providing some guidance (or an easy button) on how to test the daemon?

i created a .so and exported a start() and stop() to Java via C and JNI. I made a sample Java app to prove that I could run the daemon from Java. This is the output I get after calling start() from Java:

$ java p2pd
Control socket: /tmp/p2pd.sock
Peer ID: QmQXh4GVy1EYv79nfJEdkkzF8o6877UTqqg3eZHRyrvDpP
Peer Addrs:
/p2p-circuit
/ip4/127.0.0.1/tcp/64150
/ip4/192.168.1.129/tcp/64150
/ip6/::1/tcp/64151

Thanks,
Jonny

from go-libp2p-daemon.

bigs avatar bigs commented on June 25, 2024 1

from go-libp2p-daemon.

vyzo avatar vyzo commented on June 25, 2024 1

There are some example programs you can use as a starting point for testing in gerbil-libp2p/example.
There is also the go client which has a bunch of tests.

from go-libp2p-daemon.

raulk avatar raulk commented on June 25, 2024

So the idea would be to compile the daemon down to a shared library. This wouldn't be too efficient, because to my knowledge, the library will embed the Go runtime. Anybody knows if this would be possible with little effort?

Browsing -build-mode=c-shared examples, they look pretty flat and only import stdlib. Uncertain what the result would look like with the dependency tree we have.

Would it be so simple as keeping everything as-is, and creating exported entrypoints functions as suggested in the description?

from go-libp2p-daemon.

raulk avatar raulk commented on June 25, 2024

@bigs @vyzo @Stebalien – any clue here?

from go-libp2p-daemon.

Stebalien avatar Stebalien commented on June 25, 2024

Yeah, this actually looks like it might work.

from go-libp2p-daemon.

bigs avatar bigs commented on June 25, 2024

yep. as long as the exported interface is very simple (like the start/stop) i think it should work

from go-libp2p-daemon.

Stebalien avatar Stebalien commented on June 25, 2024

I assume we'd expose the API, right? That is, start, stop, newstream (returns a handle), close, read, write, reset, etc...

from go-libp2p-daemon.

cheatfate avatar cheatfate commented on June 25, 2024

@Stebalien, nope, the only API exposed is start(config) and stop.
start(config) starts opens control socket and start serving on like it currently does.
stop() stops all processing.
All other APIs are available through control socket.

from go-libp2p-daemon.

vyzo avatar vyzo commented on June 25, 2024

This sounds like a very reasonable. We should be able to export Start/Stop functions for embedding in the application.

from go-libp2p-daemon.

jrhea avatar jrhea commented on June 25, 2024

I like the idea of packaging this as an .so and have an immediate need for it. I am going to see if I have time to prove this idea out this week.

from go-libp2p-daemon.

bitnom avatar bitnom commented on June 25, 2024

Re-opening as reference and possible request for comment for same Nim repo issue: status-im/nim-libp2p#21

from go-libp2p-daemon.

aschmahmann avatar aschmahmann commented on June 25, 2024

Is this still a requested feature? It seems to me like a large amount of the functionality could be achieved by using go-libp2p as a shared library and not the daemon itself, or by just running the daemon and then writing a client api for a target language.

Feel free to reopen if this is still a requested feature.

from go-libp2p-daemon.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.